aDeadGroupEntry = "dead" + str(anIndex) + "_" + aGroup.GetEntry()
aDeadGroup.SetEntry(aDeadGroupEntry)
aDeadGroup.SetSelectionType(aGroup.GetSelectionType())
- aDeadGroup.SetSelection(aGroup.GetSelection())
+ aDeadGroup.SetSelection(aGroup.GetSelectionOld())
if isinstance(aGroup, SHAPERSTUDY_ORB._objref_SHAPER_Field): # additional field data
aDeadGroup.SetValuesType(aGroup.GetValuesType())
aDeadGroup.SetSteps(aGroup.GetSteps())
SHAPERSTUDY_GenericObject.__init__(self)
self.seltype = None
self.selection = []
+ self.selectionTick = -2 # tick of the main shape when the current selection is set
+ self.selectionOld = [] # keep selection for breaking link
self.SO = None
self.data = None
self.entry = ""
"""
Sets what is returned in the GEOM_IGroupOperations::GetObjects
"""
- #self.data = None # nullify the cashed shape when selection is changed
- #print("Set selection for the group " + str(self.entry) + " = " + str(theSelection))
- self.selection = theSelection
+ aTick = -2
+ if self.SO:
+ aMainShape = self.GetMainShape()
+ if aMainShape:
+ aTick = aMainShape.GetTick()
+ if aTick != self.selectionTick or aTick == -2: # the last condition is for load: restore old and new
+ self.selectionOld = self.selection
+ self.selection = theSelection
+ self.selectionTick = aTick
+ #print("Set selection " + self.entry + " old = " + str(self.selectionOld) + " new = " + str(self.selection) + " tick = " + str(aTick))
+ else:
+ self.selection = theSelection
+ #print("Set selection " + self.entry + " tick = " + str(aTick))
+ pass
def GetSelection(self):
"""
"""
return self.selection
+ def GetSelectionOld(self):
+ """
+ Returns the previously selected sub-shapes indices
+ """
+ print("get selection OLD " + self.entry + " old = " + str(self.selectionOld) + " new = " + str(self.selection))
+ return self.selectionOld
+
def IsMainShape( self ):
"""
Returns True if this object is not a sub-shape of another object.
SHAPERSTUDY_GenericObject.__init__(self)
self.seltype = None
self.selection = []
+ self.selectionTick = -2 # tick of the main shape when the current selection is set
+ self.selectionOld = [] # keep selection for breaking link
self.SO = None
self.data = None
self.entry = None