Assembly: Use cpp getGlobalPlacement python binding rather than reimplementing it.

This commit is contained in:
PaddleStroke
2024-09-30 10:51:12 +02:00
committed by Chris Hennes
parent 306183ce26
commit 69fd894017

View File

@@ -260,32 +260,13 @@ def getGlobalPlacement(ref, targetObj=None):
if targetObj is None: # If no targetObj is given, we consider it's the getObject(ref)
targetObj = getObject(ref)
if targetObj is None:
return App.Placement()
if targetObj is None:
return App.Placement()
rootObj = ref[0]
names = ref[1][0].split(".")
subName = ref[1][0]
doc = rootObj.Document
plc = rootObj.Placement
for objName in names:
obj = doc.getObject(objName)
if not obj:
continue
plc = plc * obj.Placement
if obj == targetObj:
return plc
if isLink(obj):
linked_obj = obj.getLinkedObject()
doc = linked_obj.Document # in case its an external link.
# If targetObj has not been found there's a problem
return App.Placement()
return App.GeoFeature.getGlobalPlacementOf(targetObj, rootObj, subName)
def isThereOneRootAssembly():