Assembly: Solver message taskbox. UI setup, App not implemented yet. (#23420)

* Assembly: Solver message taskbox. UI setup, App not implemented yet.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update TaskAssemblyMessages.cpp

* Update ViewProviderAssembly.cpp

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
PaddleStroke
2025-09-01 23:29:06 +02:00
committed by GitHub
parent 24a6d59ca8
commit e40e01b039
9 changed files with 408 additions and 2 deletions

View File

@@ -102,8 +102,17 @@ PROPERTY_SOURCE(Assembly::AssemblyObject, App::Part)
AssemblyObject::AssemblyObject()
: mbdAssembly(std::make_shared<ASMTAssembly>())
, bundleFixed(false)
, lastDoF(0)
, lastHasConflict(false)
, lastHasRedundancies(false)
, lastHasPartialRedundancies(false)
, lastHasMalformedConstraints(false)
, lastSolverStatus(0)
{
mbdAssembly->externalSystem->freecadAssemblyObject = this;
lastDoF = numberOfComponents() * 6;
signalSolverUpdate();
}
AssemblyObject::~AssemblyObject() = default;
@@ -131,6 +140,8 @@ App::DocumentObjectExecReturn* AssemblyObject::execute()
int AssemblyObject::solve(bool enableRedo, bool updateJCS)
{
lastDoF = numberOfComponents() * 6;
ensureIdentityPlacements();
mbdAssembly = makeMbdAssembly();
@@ -169,6 +180,8 @@ int AssemblyObject::solve(bool enableRedo, bool updateJCS)
redrawJointPlacements(joints);
signalSolverUpdate();
return 0;
}
@@ -1972,3 +1985,52 @@ void AssemblyObject::ensureIdentityPlacements()
}
}
}
int AssemblyObject::numberOfComponents() const
{
int count = 0;
const std::vector<App::DocumentObject*> objects = Group.getValues();
for (auto* obj : objects) {
if (!obj) {
continue;
}
if (obj->isLinkGroup()) {
auto* link = static_cast<const App::Link*>(obj);
count += link->ElementCount.getValue();
continue;
}
if (obj->isDerivedFrom(Assembly::AssemblyLink::getClassTypeId())) {
auto* subAssembly = static_cast<const AssemblyLink*>(obj);
count += subAssembly->numberOfComponents();
continue;
}
// Resolve standard App::Links to their target object
if (obj->isDerivedFrom(App::Link::getClassTypeId())) {
obj = static_cast<const App::Link*>(obj)->getLinkedObject();
if (!obj) {
continue;
}
}
if (!obj->isDerivedFrom(App::GeoFeature::getClassTypeId())) {
continue;
}
if (obj->isDerivedFrom(App::LocalCoordinateSystem::getClassTypeId())) {
continue;
}
count++;
}
return count;
}
bool AssemblyObject::isEmpty() const
{
return numberOfComponents() == 0;
}