diff --git a/src/Mod/Assembly/App/AssemblyLink.cpp b/src/Mod/Assembly/App/AssemblyLink.cpp index 52607d3180..7df49b12e7 100644 --- a/src/Mod/Assembly/App/AssemblyLink.cpp +++ b/src/Mod/Assembly/App/AssemblyLink.cpp @@ -159,7 +159,6 @@ void AssemblyLink::onChanged(const App::Property* prop) propPlc->setValue(movePlc); } } - return; } App::Part::onChanged(prop); @@ -175,7 +174,6 @@ void AssemblyLink::updateContents() else { synchronizeJoints(); } - purgeTouched(); } @@ -220,7 +218,6 @@ void AssemblyLink::synchronizeComponents() continue; } - if (linkedObj == obj) { found = true; link = obj2; @@ -272,24 +269,6 @@ void AssemblyLink::synchronizeComponents() if (objLinkMap.find(link) != objLinkMap.end()) { doc->removeObject(link->getNameInDocument()); } - - /*if (!link->isDerivedFrom() && !link->isDerivedFrom()) { - // AssemblyLink should contain only Links or assembly links. - continue; - } - - auto* linkedObj = link->getLinkedObject(false); // not recursive - - bool found = false; - for (auto* obj2 : assemblyGroup) { - if (obj2 == linkedObj) { - found = true; - break; - } - } - if (!found) { - doc->removeObject(link->getNameInDocument()); - }*/ } } @@ -567,7 +546,6 @@ bool AssemblyLink::isRigid() if (!prop) { return true; } - return prop->getValue(); } @@ -578,6 +556,5 @@ std::vector AssemblyLink::getJoints() if (!jointGroup) { return {}; } - return jointGroup->getJoints(); } diff --git a/src/Mod/Assembly/App/AssemblyObject.cpp b/src/Mod/Assembly/App/AssemblyObject.cpp index a7164bad36..910101a8bf 100644 --- a/src/Mod/Assembly/App/AssemblyObject.cpp +++ b/src/Mod/Assembly/App/AssemblyObject.cpp @@ -158,7 +158,6 @@ int AssemblyObject::solve(bool enableRedo, bool updateJCS) } try { - // mbdAssembly->runPreDrag(); // solve() is causing some issues with limits. mbdAssembly->runKINEMATIC(); } catch (const std::exception& e) { @@ -198,7 +197,6 @@ int AssemblyObject::generateSimulation(App::DocumentObject* sim) create_mbdSimulationParameters(sim); - try { mbdAssembly->runKINEMATIC(); } @@ -384,7 +382,6 @@ bool AssemblyObject::validateNewPlacements() // TODO: We could do further tests // For example check if the joints connectors are correctly aligned. - return true; } @@ -593,7 +590,6 @@ App::DocumentObject* AssemblyObject::getJointOfPartConnectingToGround(App::Docum return joint; } } - return nullptr; } @@ -753,7 +749,6 @@ std::vector AssemblyObject::getJointsOfPart(App::DocumentO jointsOf.push_back(joint); } } - return jointsOf; } @@ -1804,7 +1799,6 @@ AssemblyObject::MbDPartData AssemblyObject::getMbDData(App::DocumentObject* part addConnectedFixedParts(part, addConnectedFixedParts); } - return data; } @@ -1813,7 +1807,6 @@ std::shared_ptr AssemblyObject::getMbDPart(App::DocumentObject* part) if (!part) { return nullptr; } - return getMbDData(part).part; } @@ -1831,7 +1824,6 @@ AssemblyObject::makeMbdPart(std::string& name, Base::Placement plc, double mass) Base::Vector3d pos = plc.getPosition(); mbdPart->setPosition3D(pos.x, pos.y, pos.z); - // Base::Console().Warning("MbD Part placement : (%f, %f, %f)\n", pos.x, pos.y, pos.z); // TODO : replace with quaternion to simplify Base::Rotation rot = plc.getRotation(); diff --git a/src/Mod/Assembly/App/AssemblyObject.h b/src/Mod/Assembly/App/AssemblyObject.h index b8ea59049c..61ceaff796 100644 --- a/src/Mod/Assembly/App/AssemblyObject.h +++ b/src/Mod/Assembly/App/AssemblyObject.h @@ -200,12 +200,8 @@ private: std::vector> previousPositions; bool bundleFixed; - // void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property - // *prop) override; }; -// using AssemblyObjectPython = App::FeaturePythonT; - } // namespace Assembly diff --git a/src/Mod/Assembly/App/AssemblyUtils.cpp b/src/Mod/Assembly/App/AssemblyUtils.cpp index f48eb4dbd7..f665b25613 100644 --- a/src/Mod/Assembly/App/AssemblyUtils.cpp +++ b/src/Mod/Assembly/App/AssemblyUtils.cpp @@ -37,9 +37,8 @@ #include #include #include -// #include #include -// #include + #include #include #include @@ -695,7 +694,6 @@ App::DocumentObject* getMovingPartFromRef(const AssemblyObject* assemblyObject, return obj; } - return nullptr; } @@ -715,7 +713,6 @@ App::DocumentObject* getMovingPartFromRef(const AssemblyObject* assemblyObject, if (subs.empty()) { return nullptr; } - return getMovingPartFromRef(assemblyObject, obj, subs[0]); } @@ -731,102 +728,5 @@ App::DocumentObject* getMovingPartFromRef(const AssemblyObject* assemblyObject, return getMovingPartFromRef(assemblyObject, prop); } -/* -Base::Placement getPlacementFromProp(App::DocumentObject* obj, const char* propName) -{ - Base::Placement plc = Base::Placement(); - auto* propPlacement = dynamic_cast(obj->getPropertyByName(propName)); - if (propPlacement) { - plc = propPlacement->getValue(); - } - return plc; -} - -// Currently unused -Base::Placement* getTargetPlacementRelativeTo( - App::DocumentObject* targetObj, App::DocumentObject* part, App::DocumentObject* container, - bool inContainerBranch, bool ignorePlacement = false) -{ - inContainerBranch = inContainerBranch || (!ignorePlacement && part == container); - - Base::Console().Warning("sub --------------\n"); - if (targetObj == part && inContainerBranch && !ignorePlacement) { - Base::Console().Warning("found0\n"); - return &getPlacementFromProp(targetObj, "Placement"); - } - - if (auto group = dynamic_cast(part)) { - for (auto& obj : group->getOutList()) { - auto foundPlacement = getTargetPlacementRelativeTo( - targetObj, obj, container, inContainerBranch, ignorePlacement - ); - if (foundPlacement != nullptr) { - return foundPlacement; - } - } - } - else if (auto assembly = dynamic_cast(part)) { - Base::Console().Warning("h3\n"); - for (auto& obj : assembly->getOutList()) { - auto foundPlacement = getTargetPlacementRelativeTo( - targetObj, obj, container, inContainerBranch - ); - if (foundPlacement == nullptr) { - continue; - } - - if (!ignorePlacement) { - *foundPlacement = getPlacementFromProp(part, "Placement") * *foundPlacement; - } - - Base::Console().Warning("found\n"); - return foundPlacement; - } - } - else if (auto link = dynamic_cast(part)) { - Base::Console().Warning("h4\n"); - auto linked_obj = link->getLinkedObject(); - - if (dynamic_cast(linked_obj) || dynamic_cast(linked_obj)) { - for (auto& obj : linked_obj->getOutList()) { - auto foundPlacement = getTargetPlacementRelativeTo( - targetObj, obj, container, inContainerBranch - ); - if (foundPlacement == nullptr) { - continue; - } - - *foundPlacement = getPlacementFromProp(link, "Placement") * *foundPlacement; - return foundPlacement; - } - } - - auto foundPlacement = getTargetPlacementRelativeTo( - targetObj, linked_obj, container, inContainerBranch, true - ); - - if (foundPlacement != nullptr && !ignorePlacement) { - *foundPlacement = getPlacementFromProp(link, "Placement") * *foundPlacement; - } - - Base::Console().Warning("found2\n"); - return foundPlacement; - } - - return nullptr; -} - -Base::Placement getGlobalPlacement(App::DocumentObject* targetObj, App::DocumentObject* container = -nullptr) { bool inContainerBranch = container == nullptr; auto rootObjects = -App::GetApplication().getActiveDocument()->getRootObjects(); for (auto& part : rootObjects) { auto -foundPlacement = getTargetPlacementRelativeTo(targetObj, part, container, inContainerBranch); if -(foundPlacement != nullptr) { Base::Placement plc(foundPlacement->toMatrix()); return plc; - } - } - - return Base::Placement(); -} -*/ - } // namespace Assembly diff --git a/src/Mod/Assembly/App/AssemblyUtils.h b/src/Mod/Assembly/App/AssemblyUtils.h index b04145d26b..6fe1e22912 100644 --- a/src/Mod/Assembly/App/AssemblyUtils.h +++ b/src/Mod/Assembly/App/AssemblyUtils.h @@ -25,7 +25,6 @@ #ifndef ASSEMBLY_AssemblyUtils_H #define ASSEMBLY_AssemblyUtils_H - #include #include