diff --git a/src/Mod/Assembly/UtilsAssembly.py b/src/Mod/Assembly/UtilsAssembly.py index ca26472864..68eddfffbc 100644 --- a/src/Mod/Assembly/UtilsAssembly.py +++ b/src/Mod/Assembly/UtilsAssembly.py @@ -1004,6 +1004,22 @@ def findPlacement(ref, ignoreVertex=False): return App.Placement(App.Vector(), App.Rotation(0.5, 0.5, 0.5, 0.5)) if obj.Role == "Z_Axis": return App.Placement(App.Vector(), App.Rotation(-0.5, 0.5, -0.5, 0.5)) + + # PartDesign datum planes (including ZTools datums like ZPlane_Mid, ZPlane_Offset) + if obj.isDerivedFrom("PartDesign::Plane"): + if hasattr(obj, "Shape") and obj.Shape.Faces: + face = obj.Shape.Faces[0] + surface = face.Surface + plc = App.Placement() + plc.Base = face.CenterOfGravity + if hasattr(surface, "Rotation") and surface.Rotation is not None: + plc.Rotation = App.Rotation(surface.Rotation) + return obj.Placement.inverse() * plc + + # PartDesign datum points + if obj.isDerivedFrom("PartDesign::Point"): + return obj.Placement + return App.Placement() plc = App.Placement()