From 2d06d7d7d4072842cb65977b76524c55dc2b0eb0 Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Fri, 16 Feb 2024 18:01:24 +0100 Subject: [PATCH] Assembly: Disable pre-solve for distance joints. --- src/Mod/Assembly/JointObject.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Mod/Assembly/JointObject.py b/src/Mod/Assembly/JointObject.py index 92c998f632..c48e77b966 100644 --- a/src/Mod/Assembly/JointObject.py +++ b/src/Mod/Assembly/JointObject.py @@ -276,7 +276,7 @@ class Joint: """Do something when a property has changed""" # App.Console.PrintMessage("Change property: " + str(prop) + "\n") - if prop == "Rotation" or prop == "Offset" or prop == "Distance": + if prop == "Rotation" or prop == "Offset": # during loading the onchanged may be triggered before full init. if hasattr(joint, "Vertex1"): # so we check Vertex1 self.updateJCSPlacements(joint) @@ -297,6 +297,11 @@ class Joint: else: self.updateJCSPlacements(joint) + if prop == "Distance": + # during loading the onchanged may be triggered before full init. + if hasattr(joint, "Vertex1"): # so we check Vertex1 + solveIfAllowed(self.getAssembly(joint)) + def execute(self, fp): """Do something when doing a recomputation, this method is mandatory""" # App.Console.PrintMessage("Recompute Python Box feature\n") @@ -343,13 +348,15 @@ class Joint: joint.Placement2 = self.findPlacement( joint, joint.Object2, joint.Part2, joint.Element2, joint.Vertex2, True ) - self.preSolve( - joint, - current_selection[0]["object"], - joint.Part1, - current_selection[1]["object"], - joint.Part2, - ) + if joint.JointType != "Distance": + self.preSolve( + joint, + current_selection[0]["object"], + joint.Part1, + current_selection[1]["object"], + joint.Part2, + ) + if isAssembly: solveIfAllowed(assembly, True) else: