def tube_shapewithgui(context): global tubebuilder, xalome, dialog activeStudy = context.study # Get the parameter values from a gui dialog box. If the dialog is # closed using the Ok button, then the data are requested from the # gui and used to create the shape of the tube. dialog.exec_() if dialog.wasOk(): radius, length, width = dialog.getData() shape = tubebuilder.createGeometry(activeStudy, radius, length, width) entry = xalome.addToStudy(activeStudy, shape, "Tube" ) xalome.displayShape(entry)
def acceptCallback(): """Action to be done when click on Ok""" global tubebuilder, xalome global dialogWithApply, activeStudy global previewShapeEntry, deletePreviewShape global DEFAULT_FOLDER_NAME,DEFAULT_SHAPE_NAME dialogWithApply.accept() if previewShapeEntry is not None: deletePreviewShape() radius, length, width = dialogWithApply.getData() shape = tubebuilder.createGeometry(activeStudy, radius, length, width) entry = xalome.addToStudy(activeStudy, shape, DEFAULT_SHAPE_NAME, DEFAULT_FOLDER_NAME) xalome.displayShape(entry)
def applyCallback(): """Action to be done when click on Apply""" global tubebuilder, xalome global dialogWithApply, activeStudy global previewShapeEntry, deletePreviewShape global PREVIEW_COLOR, DEFAULT_SHAPE_NAME, DEFAULT_FOLDER_NAME, PREVIEW_SHAPE_NAME # We first have to destroy the currently displayed preview shape. if previewShapeEntry is not None: deletePreviewShape() # Then we can create the new shape with the new parameter values radius, length, width = dialogWithApply.getData() shape = tubebuilder.createGeometry(activeStudy, radius, length, width) # We apply a specific color on the shape for the preview state shape.SetColor(PREVIEW_COLOR) previewShapeEntry = xalome.addToStudy(activeStudy, shape, PREVIEW_SHAPE_NAME, DEFAULT_FOLDER_NAME ) xalome.displayShape(previewShapeEntry)
def acceptCallback(): """Action called when click on Ok""" for i in range(len(LIST_SHAPE_NAME)): if LIST_SHAPE_NAME[i] == DEFAULT_SHAPE_NAME: dialogWithApply.accept() if previewShapeEntry[i] is not None: deletePreviewShape(LIST_SHAPE_NAME, activeStudy, previewShapeEntry, DEFAULT_SHAPE_NAME) PFONx, PFONy, PFONz, DTANx, DTANy, DTANz = dialogWithApply.getData( ) shape = fissbuilder.createGeometryHalfline(activeStudy, PFONx, PFONy, PFONz, DTANx, DTANy, DTANz) previewShapeEntry[i] = xalome.addToStudy( activeStudy, shape, DEFAULT_CRACK_TYPE + " : " + DEFAULT_SHAPE_NAME, DEFAULT_FOLDER_NAME) xalome.displayShape(previewShapeEntry[i]) LIST = [PFONx, PFONy, PFONz, DTANx, DTANy, DTANz]
def applyCallback(): """Action called when click on Apply""" for i in range(len(LIST_SHAPE_NAME)): if LIST_SHAPE_NAME[i] == DEFAULT_SHAPE_NAME: # We first have to destroy the currently displayed preview shape. if previewShapeEntry[i] is not None: deletePreviewShape(LIST_SHAPE_NAME, activeStudy, previewShapeEntry, DEFAULT_SHAPE_NAME) # Then we can create the new shape with the new parameter values PFONx, PFONy, PFONz, NORMx, NORMy, NORMz, DTANx, DTANy, DTANz = dialogWithApply.getData( ) shape = fissbuilder.createGeometryHalfplane( activeStudy, PFONx, PFONy, PFONz, NORMx, NORMy, NORMz, DTANx, DTANy, DTANz) # We apply a specific color on the shape for the preview state shape.SetColor(PREVIEW_COLOR) previewShapeEntry[i] = xalome.addToStudy(activeStudy, shape, PREVIEW_SHAPE_NAME, DEFAULT_FOLDER_NAME) xalome.displayShape(previewShapeEntry[i])
def acceptCallback(): """Action called when click on Ok""" for i in range(len(LIST_SHAPE_NAME)): if LIST_SHAPE_NAME[i] == DEFAULT_SHAPE_NAME: dialogWithApply.accept() if previewShapeEntry[i] is not None: deletePreviewShape(LIST_SHAPE_NAME, activeStudy, previewShapeEntry, DEFAULT_SHAPE_NAME) rmaj, rmin, centerx, centery, centerz, vectXx, vectXy, vectXz, vectYx, vectYy, vectYz = dialogWithApply.getData( ) shape = fissbuilder.createGeometryRectangle( activeStudy, rmaj, rmin, centerx, centery, centerz, vectXx, vectXy, vectXz, vectYx, vectYy, vectYz) previewShapeEntry[i] = xalome.addToStudy( activeStudy, shape, DEFAULT_CRACK_TYPE + " : " + DEFAULT_SHAPE_NAME, DEFAULT_FOLDER_NAME) xalome.displayShape(previewShapeEntry[i]) LIST = [ rmaj, rmin, centerx, centery, centerz, vectXx, vectXy, vectXz, vectYx, vectYy, vectYz ]
def applyCallback(): """Action called when click on Apply""" for i in range(len(LIST_SHAPE_NAME)): if LIST_SHAPE_NAME[i] == DEFAULT_SHAPE_NAME: # We first have to destroy the currently displayed preview shape. if previewShapeEntry[i] is not None: deletePreviewShape(LIST_SHAPE_NAME, activeStudy, previewShapeEntry, DEFAULT_SHAPE_NAME) # Then we can create the new shape with the new parameter values rmaj, rmin, centerx, centery, centerz, vectXx, vectXy, vectXz, vectYx, vectYy, vectYz = dialogWithApply.getData( ) shape = fissbuilder.createGeometryCylinder(activeStudy, rmaj, rmin, centerx, centery, centerz, vectXx, vectXy, vectXz, vectYx, vectYy, vectYz) # We apply a specific color on the shape for the preview state shape.SetColor(PREVIEW_COLOR) previewShapeEntry[i] = xalome.addToStudy(activeStudy, shape, PREVIEW_SHAPE_NAME, DEFAULT_FOLDER_NAME) xalome.displayShape(previewShapeEntry[i])