Assembly: Remove bad joints : joints between a part and itself. Fixes #12752

This commit is contained in:
PaddleStroke
2024-03-13 14:48:59 +01:00
committed by Yorik van Havre
parent 788e9f4667
commit 56051b83bc

View File

@@ -419,8 +419,11 @@ std::vector<App::DocumentObject*> AssemblyObject::getJoints(bool updateJCS, bool
continue;
}
if (!getLinkObjFromProp(joint, "Part1") || !getLinkObjFromProp(joint, "Part2")) {
auto* part1 = getLinkObjFromProp(joint, "Part1");
auto* part2 = getLinkObjFromProp(joint, "Part2");
if (!part1 || !part2 || part1->getFullName() == part2->getFullName()) {
// Remove incomplete joints. Left-over when the user delets a part.
// Remove incoherent joints (self-pointing joints)
if (delBadJoints) {
getDocument()->removeObject(joint->getNameInDocument());
}