BaseFeature: add dereferencing to getPlacementsList

This commit is contained in:
DeepSOIC 2018-09-07 01:18:02 +03:00
parent e4c342f5ba
commit f7bbd41b2c

View File

@ -510,7 +510,7 @@ def makeMoveFromTo(plmFrom, plmTo):
from one placement to another placement''' from one placement to another placement'''
return plmTo.multiply(plmFrom.inverse()) return plmTo.multiply(plmFrom.inverse())
def getPlacementsList(documentObject, context = None, suppressWarning = False): def getPlacementsList(documentObject, context = None, suppressWarning = False, dereferenced = False, torefplm = App.Placement()):
'''getPlacementsList(documentObject, context = None): extract list of placements '''getPlacementsList(documentObject, context = None): extract list of placements
from an array object. Context is an object to report as context, when displaying from an array object. Context is an object to report as context, when displaying
a warning if the documentObject happens to be a non-lattice.''' a warning if the documentObject happens to be a non-lattice.'''
@ -518,7 +518,14 @@ def getPlacementsList(documentObject, context = None, suppressWarning = False):
if not suppressWarning: if not suppressWarning:
lattice2Executer.warning(context, documentObject.Name + " is not a placement or an array of placements. Results may be unexpected.") lattice2Executer.warning(context, documentObject.Name + " is not a placement or an array of placements. Results may be unexpected.")
leaves = LCE.AllLeaves(documentObject.Shape) leaves = LCE.AllLeaves(documentObject.Shape)
return [leaf.Placement for leaf in leaves] if not dereferenced:
return [leaf.Placement for leaf in leaves]
else:
# goal: refplm * derefplm == it
# return = torefplm * derefplm
# => return = torefplm * refplm.inverse * it
operator = torefplm.multiply(getReferencePlm(documentObject).inverse())
return [operator.multiply(leaf.Placement) for leaf in leaves]
def getReferencePlm(feature): def getReferencePlm(feature):
"""Obtains reference placement, in container's CS (includes feature.Placement).""" """Obtains reference placement, in container's CS (includes feature.Placement)."""