diff --git a/src/Mod/Assembly/App/AssemblyLink.cpp b/src/Mod/Assembly/App/AssemblyLink.cpp index 3a8d6530cd..6fa032466d 100644 --- a/src/Mod/Assembly/App/AssemblyLink.cpp +++ b/src/Mod/Assembly/App/AssemblyLink.cpp @@ -207,6 +207,7 @@ void AssemblyLink::synchronizeComponents() auto* subAsmLink = freecad_cast(obj2); auto* link2 = dynamic_cast(obj2); + if (subAsmLink) { linkedObj = subAsmLink->getLinkedObject2(false); // not recursive } @@ -214,7 +215,7 @@ void AssemblyLink::synchronizeComponents() linkedObj = link2->getLinkedObject(false); // not recursive } else { - // We consider only Links and AssemblyLinks in the AssemblyLink. + // We consider only Links and AssemblyLinks continue; } @@ -228,8 +229,10 @@ void AssemblyLink::synchronizeComponents() // Add a link or a AssemblyLink to it in the AssemblyLink. if (obj->isDerivedFrom()) { auto* asmLink = static_cast(obj); - auto* subAsmLink = new AssemblyLink(); - doc->addObject(subAsmLink, obj->getNameInDocument()); + + App::DocumentObject* newObj = + doc->addObject("Assembly::AssemblyLink", obj->getNameInDocument()); + auto* subAsmLink = static_cast(newObj); subAsmLink->LinkedObject.setValue(obj); subAsmLink->Rigid.setValue(asmLink->Rigid.getValue()); subAsmLink->Label.setValue(obj->Label.getValue()); diff --git a/src/Mod/Assembly/App/AssemblyLink.h b/src/Mod/Assembly/App/AssemblyLink.h index 5bbcfefa40..370a78acb4 100644 --- a/src/Mod/Assembly/App/AssemblyLink.h +++ b/src/Mod/Assembly/App/AssemblyLink.h @@ -68,6 +68,9 @@ public: bool isRigid(); + /** + * Update all of the components and joints from the Assembly + */ void updateContents(); void synchronizeComponents();