From f7bbd41b2ca06287cdc8bbecf77ce3e3fe935ced Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Fri, 7 Sep 2018 01:18:02 +0300 Subject: [PATCH] BaseFeature: add dereferencing to getPlacementsList --- lattice2BaseFeature.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lattice2BaseFeature.py b/lattice2BaseFeature.py index be1202c..212fcdc 100644 --- a/lattice2BaseFeature.py +++ b/lattice2BaseFeature.py @@ -510,7 +510,7 @@ def makeMoveFromTo(plmFrom, plmTo): from one placement to another placement''' 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 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.''' @@ -518,7 +518,14 @@ def getPlacementsList(documentObject, context = None, suppressWarning = False): if not suppressWarning: lattice2Executer.warning(context, documentObject.Name + " is not a placement or an array of placements. Results may be unexpected.") 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): """Obtains reference placement, in container's CS (includes feature.Placement)."""