Fix regressions of #16726
This commit is contained in:
committed by
Chris Hennes
parent
6c8c263297
commit
9b407eed07
@@ -183,6 +183,40 @@ def isBodySubObject(typeId):
|
||||
)
|
||||
|
||||
|
||||
def fixBodyExtraFeatureInSub(doc_name, sub_name):
|
||||
# If the sub_name that comes in has extra features in it, remove them.
|
||||
# For example :
|
||||
# "Part.Body.Pad.Edge2" -> "Part.Body.Edge2"
|
||||
# "Part.Body.Pad.Sketch." -> "Part.Body.Sketch."
|
||||
# "Body.Pad.Sketch." -> "Body.sketch."
|
||||
doc = App.getDocument(doc_name)
|
||||
names = sub_name.split(".")
|
||||
elt = names.pop() # remove element
|
||||
|
||||
bodyPassed = False
|
||||
new_sub_name = ""
|
||||
for obj_name in names:
|
||||
obj = doc.getObject(obj_name)
|
||||
if obj is None:
|
||||
return sub_name
|
||||
|
||||
if bodyPassed and obj.isDerivedFrom("PartDesign::Feature"):
|
||||
continue # we skip this name!
|
||||
|
||||
if isLink(obj):
|
||||
obj = obj.getLinkedObject()
|
||||
doc = obj.Document
|
||||
|
||||
if obj.TypeId == "PartDesign::Body":
|
||||
bodyPassed = True
|
||||
|
||||
new_sub_name = new_sub_name + obj_name + "."
|
||||
|
||||
new_sub_name = new_sub_name + elt # Put back the element name
|
||||
|
||||
return new_sub_name
|
||||
|
||||
|
||||
# Deprecated. Kept for migrationScript.
|
||||
def getObjectInPart(objName, part):
|
||||
if part is None:
|
||||
|
||||
Reference in New Issue
Block a user