Assembly: Add support to origin components Fixes #12446
This commit is contained in:
committed by
Yorik van Havre
parent
e37d15f081
commit
622821906f
@@ -385,6 +385,21 @@ def getElementName(full_name):
|
||||
if parts[-1] in {"X", "Y", "Z", "Point", "Line", "Plane"}:
|
||||
return ""
|
||||
|
||||
# Case of origin objects
|
||||
if parts[-1] == "":
|
||||
if "X_Axis" in parts[-2]:
|
||||
return "X_Axis"
|
||||
if "Y_Axis" in parts[-2]:
|
||||
return "Y_Axis"
|
||||
if "Z_Axis" in parts[-2]:
|
||||
return "Z_Axis"
|
||||
if "XY_Plane" in parts[-2]:
|
||||
return "XY_Plane"
|
||||
if "XZ_Plane" in parts[-2]:
|
||||
return "XZ_Plane"
|
||||
if "YZ_Plane" in parts[-2]:
|
||||
return "YZ_Plane"
|
||||
|
||||
return parts[-1]
|
||||
|
||||
|
||||
@@ -844,6 +859,14 @@ def findPlacement(obj, part, elt, vtx, ignoreVertex=False):
|
||||
if not obj or not part:
|
||||
return App.Placement()
|
||||
|
||||
# case of origin objects.
|
||||
if elt == "X_Axis" or elt == "YZ_Plane":
|
||||
return App.Placement(App.Vector(), App.Rotation(App.Vector(0, 1, 0), -90))
|
||||
if elt == "Y_Axis" or elt == "XZ_Plane":
|
||||
return App.Placement(App.Vector(), App.Rotation(App.Vector(1, 0, 0), 90))
|
||||
if elt == "Z_Axis" or elt == "XY_Plane":
|
||||
return App.Placement()
|
||||
|
||||
if not elt or not vtx:
|
||||
# case of whole parts such as PartDesign::Body or PartDesign::CordinateSystem/Point/Line/Plane.
|
||||
return App.Placement()
|
||||
|
||||
Reference in New Issue
Block a user