def duplicateVisualizer(self, objKey): # get the typ of the object typeNr = self.__objects[objKey].type # copy only 2d and 3d parts if not typeNr in [ VIS_STREAMLINE, VIS_MOVING_POINTS, VIS_PATHLINES, VIS_ISOPLANE, VIS_VECTORFIELD, VIS_PLANE, VIS_VECTOR ]: return # get the parent of the object parent = self.getParentOfObject(objKey) # get the name of the object name = self.getParamsOfObject(objKey).name # copy the params newParams = CopyParams(self.getParamsOfObject(objKey)) # create new name with copy at the end newName = name + '(Copy)' i = 2 while newName in self.__copyNames: newName = name + '(Copy ' + str(i) + ')' i = i + 1 # set the new params newParams.name = newName # send duplicate message request = theGuiMsgHandler().requestDuplicateObject( objKey, newName, typeNr, None, parent, newParams) theGuiMsgHandler().waitforAnswer(request)
def duplicatePart(self, objKey, rotX, rotY, rotZ, rotAngle, transX, transY, transZ): # get the typ of the object typeNr = self.__objects[objKey].type # copy only 2d and 3d parts if not typeNr in [TYPE_2D_PART, TYPE_3D_PART]: return # get the parent of the object # parent means 2d_group odr 3d_group parent = self.getParentOfObject(objKey) while not (self.__objects[parent].type == TYPE_2D_GROUP or self.__objects[parent].type == TYPE_3D_GROUP): parent = self.getParentOfObject(parent) # get the name of the object name = self.getParamsOfObject(objKey).name # copy the params newParams = CopyParams(self.getParamsOfObject(objKey)) # create new name with copy at the end newName = name + '(Copy)' i = 2 while newName in self.__copyNames: newName = name + '(Copy ' + str(i) + ')' i = i + 1 # set the new params newParams.name = newName newParams.rotX = rotX newParams.rotY = rotY newParams.rotZ = rotZ newParams.rotAngle = rotAngle if hasattr(newParams, 'transX'): newParams.transX = newParams.transX + transX newParams.transY = newParams.transY + transY newParams.transZ = newParams.transZ + transZ else: newParams.transX = transX newParams.transY = transY newParams.transZ = transZ # send duplicate message request = theGuiMsgHandler().requestDuplicateObject( objKey, newName, typeNr, None, parent, newParams) theGuiMsgHandler().waitforAnswer(request)
def duplicatePart(self, objKey, rotX, rotY, rotZ, rotAngle, transX, transY, transZ): # get the typ of the object typeNr = self.__objects[objKey].type # copy only 2d and 3d parts if not typeNr in [TYPE_2D_PART, TYPE_3D_PART]: return # get the parent of the object # parent means 2d_group odr 3d_group parent = self.getParentOfObject(objKey) while not (self.__objects[parent].type == TYPE_2D_GROUP or self.__objects[parent].type == TYPE_3D_GROUP): parent = self.getParentOfObject(parent) # get the name of the object name = self.getParamsOfObject(objKey).name # copy the params newParams = CopyParams(self.getParamsOfObject(objKey)) # create new name with copy at the end newName = name + '(Copy)' i = 2 while newName in self.__copyNames: newName = name+'(Copy '+str(i)+')' i = i+1 # set the new params newParams.name = newName newParams.rotX = rotX newParams.rotY = rotY newParams.rotZ = rotZ newParams.rotAngle = rotAngle if hasattr(newParams, 'transX'): newParams.transX = newParams.transX + transX newParams.transY = newParams.transY + transY newParams.transZ = newParams.transZ + transZ else: newParams.transX = transX newParams.transY = transY newParams.transZ = transZ # send duplicate message request = theGuiMsgHandler().requestDuplicateObject( objKey, newName, typeNr, None, parent, newParams) theGuiMsgHandler().waitforAnswer(request)
def duplicateVisualizer(self, objKey): # get the typ of the object typeNr = self.__objects[objKey].type # copy only 2d and 3d parts if not typeNr in [VIS_STREAMLINE, VIS_MOVING_POINTS, VIS_PATHLINES, VIS_ISOPLANE, VIS_VECTORFIELD, VIS_PLANE, VIS_VECTOR]: return # get the parent of the object parent = self.getParentOfObject(objKey) # get the name of the object name = self.getParamsOfObject(objKey).name # copy the params newParams = CopyParams(self.getParamsOfObject(objKey)) # create new name with copy at the end newName = name + '(Copy)' i = 2 while newName in self.__copyNames: newName = name+'(Copy '+str(i)+')' i = i+1 # set the new params newParams.name = newName # send duplicate message request = theGuiMsgHandler().requestDuplicateObject( objKey, newName, typeNr, None, parent, newParams) theGuiMsgHandler().waitforAnswer(request)