Avoid using getSubObject() to obtain shape
This commit is contained in:
parent
9e34ecd1c0
commit
0acaa5e9c3
|
@ -626,8 +626,7 @@ class AsmElement(AsmBase):
|
|||
if not subs[1]:
|
||||
return False # no mapped element name
|
||||
|
||||
shape = linked.getSubObject(subs[0])
|
||||
if not utils.getElement(shape, subs[1]):
|
||||
if not utils.getElement(linked, subname):
|
||||
return True
|
||||
|
||||
def fix(self):
|
||||
|
@ -642,7 +641,7 @@ class AsmElement(AsmBase):
|
|||
if not subs[1]:
|
||||
raise RuntimeError('No mapped sub-element found')
|
||||
|
||||
shape = linked.getSubObject(subs[0])
|
||||
shape = Part.getShape(linked,subs[0])
|
||||
if utils.getElement(shape, subs[1]):
|
||||
return
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ def isLine(param):
|
|||
return isinstance(param,(Part.Line,Part.LineSegment))
|
||||
|
||||
def deduceSelectedElement(obj,subname):
|
||||
shape = obj.getSubObject(subname)
|
||||
shape = getElementShape(obj, subname)
|
||||
if not shape:
|
||||
return
|
||||
count = shape.countElement('Face')
|
||||
|
@ -207,6 +207,14 @@ def isElement(obj):
|
|||
|
||||
def getElement(shape, element):
|
||||
res = None
|
||||
if not isinstance(shape, Part.Shape):
|
||||
try:
|
||||
res = getElementShape(shape, element)
|
||||
if res and not res.isNull():
|
||||
return res
|
||||
except Exception:
|
||||
return
|
||||
|
||||
try:
|
||||
res = shape.getElement(element, True)
|
||||
except TypeError:
|
||||
|
|
Loading…
Reference in New Issue
Block a user