def runCart(self, cart_mesh): cart_mesh.error = False QApplication.setOverrideCursor(Qt.WaitCursor) try: cmd = CfdTools.makeRunCommand('./Allmesh', self.meshCaseDir, source_env=False) FreeCAD.Console.PrintMessage("Executing: " + ' '.join(cmd) + "\n") env = QtCore.QProcessEnvironment.systemEnvironment() env_vars = CfdTools.getRunEnvironment() for key in env_vars: env.insert(key, env_vars[key]) self.mesh_process.setProcessEnvironment(env) self.mesh_process.start(cmd[0], cmd[1:]) if self.mesh_process.waitForStarted(): self.form.pb_run_mesh.setEnabled(False) # Prevent user running a second instance self.form.pb_stop_mesh.setEnabled(True) self.form.pb_paraview.setEnabled(False) else: self.console_log("Error starting meshing process", "#FF0000") cart_mesh.error = True finally: QApplication.restoreOverrideCursor()
def lineDirectionChanged(self, value): selection = value.split(':') # See if entered face actually exists and is planar try: selected_object = self.obj.Document.getObject(selection[0]) if hasattr(selected_object, "Shape"): elt = selected_object.Shape.getElement(selection[1]) if elt.ShapeType == 'Face' and CfdTools.is_planar(elt): self.BoundarySettings['DirectionFace'] = value return except SystemError: pass FreeCAD.Console.PrintMessage(value + " is not a valid, planar face\n")
def Activated(self): FreeCAD.ActiveDocument.openTransaction("Create CFD mesh") analysis_obj = CfdTools.getActiveAnalysis() if analysis_obj: meshObj = CfdTools.getMesh(analysis_obj) if not meshObj: sel = FreeCADGui.Selection.getSelection() if len(sel) == 1: if sel[0].isDerivedFrom("Part::Feature"): mesh_obj_name = sel[0].Name + "_Mesh" FreeCADGui.doCommand("") FreeCADGui.addModule("CfdMesh") FreeCADGui.doCommand("CfdMesh.makeCfdMesh('" + mesh_obj_name + "')") FreeCADGui.doCommand("App.ActiveDocument.ActiveObject.Part = App.ActiveDocument." + sel[0].Name) if CfdTools.getActiveAnalysis(): FreeCADGui.addModule("CfdTools") FreeCADGui.doCommand( "CfdTools.getActiveAnalysis().addObject(App.ActiveDocument.ActiveObject)") FreeCADGui.ActiveDocument.setEdit(FreeCAD.ActiveDocument.ActiveObject.Name) else: print("ERROR: You cannot have more than one mesh object") FreeCADGui.Selection.clearSelection()
def Activated(self): FreeCAD.Console.PrintMessage("Set fluid properties \n") FreeCAD.ActiveDocument.openTransaction("Set CfdFluidMaterialProperty") FreeCADGui.addModule("FemGui") FreeCADGui.addModule("CfdFluidMaterial") editing_existing = False analysis_object = FemGui.getActiveAnalysis() if analysis_object is None: CfdTools.cfdError("No analysis object found") return False physics_model, phys_model_present = CfdTools.getPhysicsModel(analysis_object) if not phys_model_present or physics_model.Phase == 'Single': members = analysis_object.Group for i in members: if i.Name.startswith('FluidProperties'): FreeCADGui.doCommand("Gui.activeDocument().setEdit('"+i.Name+"')") editing_existing = True if not editing_existing: FreeCADGui.doCommand( "FemGui.getActiveAnalysis().addObject(CfdFluidMaterial.makeCfdFluidMaterial('FluidProperties'))") FreeCADGui.ActiveDocument.setEdit(FreeCAD.ActiveDocument.ActiveObject.Name)
def get_solver_cmd(self, case_dir): self.initResiduals() self.print_next_error_lines = 0 self.print_next_error_file = False self.residualPlot = ResidualPlot() # Environment is sourced in run script, so no need to include in run command cmd = CfdTools.makeRunCommand('./Allrun', case_dir, source_env=False) FreeCAD.Console.PrintMessage("Solver run command: " + ' '.join(cmd) + "\n") return cmd
def threadFinished(self, status): if self.thread.task == DEPENDENCY_CHECK: QApplication.restoreOverrideCursor() elif self.thread.task == DOWNLOAD_GNUPLOTPY: self.consoleMessage("Attempting to install Gnuplot-py package:") if platform.system() == 'Windows': python_exe = os.path.join(FreeCAD.getHomePath(), 'bin', 'python.exe') else: python_exe = 'python' cmd = [python_exe, '-u', 'setup.py', 'install'] working_dir = os.path.join(tempfile.gettempdir(), GNUPLOTPY_FILE_BASE) self.install_process = CfdConsoleProcess.CfdConsoleProcess( finishedHook=self.installFinished) print("Running {} in {}".format(' '.join(cmd), working_dir)) self.install_process.start(cmd, working_dir=working_dir) if not self.install_process.waitForStarted(): self.consoleMessage("Unable to run command " + ' '.join(cmd), '#FF0000') elif self.thread.task == DOWNLOAD_CFMESH: if status: self.consoleMessage("Download completed") user_dir = self.thread.user_dir self.consoleMessage( "Building cfMesh. Lengthy process - please wait...") if CfdFoamTools.getFoamRuntime() == "BlueCFD": script_name = "buildCfMeshOnBlueCFD.sh" self.consoleMessage("Log file: {}\\log.{}".format( user_dir, script_name)) shutil.copy( os.path.join(CfdTools.getModulePath(), 'data', script_name), os.path.join(user_dir, script_name)) self.install_process = CfdFoamTools.startFoamApplication( "./" + script_name, "$WM_PROJECT_USER_DIR", self.installFinished) else: self.consoleMessage("Log file: {}/{}/log.Allwmake".format( user_dir, CFMESH_FILE_BASE)) self.install_process = CfdFoamTools.startFoamApplication( "./Allwmake", "$WM_PROJECT_USER_DIR/" + CFMESH_FILE_BASE, self.installFinished) else: self.consoleMessage("Download unsuccessful")
def __init__(self, cart_mesh_obj, analysis=None): self.mesh_obj = cart_mesh_obj if analysis: self.analysis = analysis # group meshing turned on else: self.analysis = CfdTools.getParentAnalysisObject(self.mesh_obj) self.part_obj = self.mesh_obj.Part # Part to mesh self.scale = 0.001 # Scale mm to m # Default to 2 % of bounding box characteristic length self.clmax = Units.Quantity(self.mesh_obj.CharacteristicLengthMax).Value if self.clmax == 0.0: shape = self.part_obj.Shape cl_bound_box = math.sqrt(shape.BoundBox.XLength**2 + shape.BoundBox.YLength**2 + shape.BoundBox.ZLength**2) self.clmax = 0.02*cl_bound_box # Always in internal format, i.e. mm # Only used by gmsh - what purpose? self.clmin = 0.0 self.dimension = self.mesh_obj.ElementDimension shape_face_names = [] for (i, f) in enumerate(self.part_obj.Shape.Faces): face_name = ("face{}".format(i)) shape_face_names.append(face_name) self.mesh_obj.ShapeFaceNames = shape_face_names self.cf_settings = {} self.snappy_settings = {} self.gmsh_settings = {} self.two_d_settings = {} self.error = False output_path = CfdTools.getOutputPath(self.analysis) self.get_file_paths(output_path)
def __init__(self, solver_runner_obj): ui_path = os.path.join(os.path.dirname(__file__), "TaskPanelCfdSolverControl.ui") self.form = FreeCADGui.PySideUic.loadUi(ui_path) self.analysis_object = CfdTools.getActiveAnalysis() self.solver_runner = solver_runner_obj self.solver_object = solver_runner_obj.solver # update UI self.console_message = '' self.solver_run_process = CfdConsoleProcess( finishedHook=self.solverFinished, stdoutHook=self.gotOutputLines, stderrHook=self.gotErrorLines) self.Timer = QtCore.QTimer() self.Timer.setInterval(1000) self.Timer.timeout.connect(self.updateText) self.form.terminateSolver.clicked.connect(self.killSolverProcess) self.form.terminateSolver.setEnabled(False) self.open_paraview = QtCore.QProcess() self.working_dir = CfdTools.getOutputPath(self.analysis_object) self.updateUI() # Connect Signals and Slots self.form.pb_write_inp.clicked.connect(self.write_input_file_handler) self.form.pb_edit_inp.clicked.connect(self.editSolverInputFile) self.form.pb_run_solver.clicked.connect(self.runSolverProcess) self.form.pb_paraview.clicked.connect(self.openParaview) self.Start = time.time() self.Timer.start()
def GetResources(self): icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "porous.png") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_PorousZone", "Porous zone"), 'Accel': "", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_PorousZone", "Select and create a porous zone") }
def GetResources(self): icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "physics.png") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_PhysicsModel", "Select models"), 'Accel': "", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_PhysicsModel", "Select the physics model") }
def GetResources(self): icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "meshRegion.png") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshRegion", "Mesh refinement"), 'Accel': "M, R", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshRegion", "Creates a mesh refinement") }
def setEdit(self, vobj, mode): analysis_object = CfdTools.getParentAnalysisObject(self.Object) if analysis_object is None: FreeCAD.Console.PrintError("Boundary must have a parent analysis object") return False # hide all meshes for o in FreeCAD.ActiveDocument.Objects: if o.isDerivedFrom("Fem::FemMeshObject"): o.ViewObject.hide() # show task panel taskd = _TaskPanelCfdFluidBoundary(self.Object) taskd.obj = vobj.Object FreeCADGui.Control.showDialog(taskd) return True
def openParaview(self): self.Start = time.time() QApplication.setOverrideCursor(Qt.WaitCursor) paraview_cmd = "paraview" # If using blueCFD, use paraview supplied if CfdTools.getFoamRuntime() == 'BlueCFD': paraview_cmd = '{}\\..\\AddOns\\ParaView\\bin\\paraview.exe'.format( CfdTools.getFoamDir()) # Otherwise, the command 'paraview' must be in the path. Possibly make path user-settable. # Test to see if it exists, as the exception thrown is cryptic on Windows if it doesn't import distutils.spawn if distutils.spawn.find_executable(paraview_cmd) is None: raise IOError("Paraview executable " + paraview_cmd + " not found in path.") self.paraviewScriptName = os.path.join(self.meshCaseDir, 'pvScriptMesh.py') arg = '--script={}'.format(self.paraviewScriptName) self.console_log("Running " + paraview_cmd + " " + arg) self.open_paraview.start(paraview_cmd, [arg]) QApplication.restoreOverrideCursor()
def GetResources(self): icon_path = os.path.join(CfdTools.getModulePath(), "Resources", "icons", "cfd-foam-boundary.svg") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_FluidBoundary", "fluid boundary"), 'Accel': "C, F", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_FluidBoundary", "Creates boundary condition for CFD") }
def GetResources(self): icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "boundary.png") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_FluidBoundary", "Fluid boundary"), 'Accel': "C, W", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_FluidBoundary", "Creates a CFD fluid boundary") }
def select_without_widget(self): filters = u"IDES mesh (*.unv);;Med mesh(*.med);;VTK mesh (*.vtk *.vtu)" #;;GMSH mesh (*.msh) not supported, converted to unv or vtk mesh_file = QFileDialog.getOpenFileName(None, u"Open mesh files", u"./", filters) mesh_file = mesh_file[0] # why return a tuple of filename and selected filter sel = FreeCADGui.Selection.getSelection() if (len(sel) == 1) and (sel[0].isDerivedFrom("Part::Feature")): # using existing part_feature, no need to import geometry, but get obj as link geo_obj = sel[0] CfdTools.importGeometryAndMesh(geo_obj, mesh_file) # Todo: macro recording is yet support, get geo_obj else: filters = u"BREP (*.brep *.brp);;STEP (*.step *.stp);;IGES (*.iges *.igs);; FcStd (*.fcstd)" geo_file = QFileDialog.getOpenFileName(None, u"Open geometry files", u"./", filters) geo_file = geo_file[ 0] # can be None? link mesh_obj.Part later manually by user FreeCADGui.doCommand( "CfdTools.importGeometryAndMesh(u'{}', u'{}')".format( geo_file, mesh_file))
def __init__(self, analysis=None, solver=None): super(CfdRunnable, self).__init__() if analysis and isinstance(analysis.Proxy, CfdAnalysis._CfdAnalysis): self.analysis = analysis else: if FreeCAD.GuiUp: self.analysis = CfdTools.getActiveAnalysis() self.solver = None if solver: self.solver = solver else: if analysis: self.solver = CfdTools.getSolver(self.analysis) if not self.solver: FreeCAD.Console.printMessage( "Solver object is missing from Analysis Object") if self.analysis: self.results_present = False self.result_object = None else: raise Exception('No active analysis found')
def edit_case(self): """ Open case folder externally in file browser. """ case_path = os.path.abspath( os.path.join(CfdTools.getOutputPath(self.analysis), self.solver.InputCaseName)) FreeCAD.Console.PrintMessage( "Please edit the case input files externally at: {}\n".format( case_path)) if platform.system() == 'MacOS': self.edit_process = subprocess.Popen(['open', '--', case_path]) elif platform.system() == 'Linux': self.edit_process = subprocess.Popen(['xdg-open', case_path]) elif platform.system() == 'Windows': self.edit_process = subprocess.Popen(['explorer', case_path])
def addSelection(self, doc_name, obj_name, sub, selectedPoint=None): """ Add the selected sub-element (face) of the part to the Reference list. Prevent selection in other document. """ if FreeCADGui.activeDocument().Document.Name != self.obj.Document.Name: return selected_object = FreeCAD.getDocument(doc_name).getObject(obj_name) # On double click on a vertex of a solid sub is None and obj is the solid tempList = list(self.obj.References) print('Selection: ' + selected_object.Shape.ShapeType + ' ' + selected_object.Name + ':' + sub + " @ " + str(selectedPoint)) if hasattr(selected_object, "Shape") and sub: elt = selected_object.Shape.getElement(sub) if elt.ShapeType == 'Face': selection = (selected_object.Name, sub) if self.selecting_references: if selection not in self.obj.References: tempList.append(selection) # If the user hasn't picked anything for direction the selected face is used as default. if self.form.lineDirection.text( ) == "" and CfdTools.is_planar(elt): self.form.lineDirection.setText(selection[0] + ':' + selection[1]) else: FreeCAD.Console.PrintMessage( selection[0] + ':' + selection[1] + ' already in reference list\n') if self.selecting_direction: if CfdTools.is_planar(elt): self.form.lineDirection.setText(selection[0] + ':' + selection[1]) self.selecting_direction = False else: FreeCAD.Console.PrintMessage('Face must be planar\n') self.obj.References = list(tempList) self.rebuild_list_references() self.update_selectionbuttons_ui()
def __init__(self, cart_mesh_obj): self.mesh_obj = cart_mesh_obj self.analysis = CfdTools.getParentAnalysisObject(self.mesh_obj) self.part_obj = self.mesh_obj.Part # Part to mesh self.scale = 0.001 # Scale mm to m # Default to 2 % of bounding box characteristic length self.clmax = Units.Quantity( self.mesh_obj.CharacteristicLengthMax).Value if self.clmax <= 0.0: shape = self.part_obj.Shape cl_bound_box = math.sqrt(shape.BoundBox.XLength**2 + shape.BoundBox.YLength**2 + shape.BoundBox.ZLength**2) self.clmax = 0.02 * cl_bound_box # Always in internal format, i.e. mm # Only used by gmsh - what purpose? self.clmin = 0.0 self.dimension = self.mesh_obj.ElementDimension self.cf_settings = {} self.snappy_settings = {} self.gmsh_settings = {} self.two_d_settings = {} self.error = False output_path = CfdTools.getOutputPath(self.analysis) self.getFilePaths(output_path) # 2D array of list of faces (index into shape) in each patch, indexed by [bc_id+1][meshregion_id+1] self.patch_faces = [] # 2D array of names of each patch, indexed by [bc_id+1][meshregion_id+1] self.patch_names = []
def createInletBoundary(self): self.inlet_boundary = CfdFluidBoundary.makeCfdFluidBoundary('inlet') bc_set = self.inlet_boundary.BoundarySettings bc_set['BoundaryType'] = 'inlet' bc_set['BoundarySubtype'] = 'uniformVelocity' bc_set['Ux'] = 1 bc_set['Uy'] = 0 bc_set['Uz'] = 0 # Test addSelection and rebuild_list_references doc = FreeCAD.getDocument(self.__class__.__doc_name) obj = doc.getObject('inlet') vobj = obj.ViewObject import _TaskPanelCfdFluidBoundary physics_model, is_present = CfdTools.getPhysicsModel(self.analysis) material_objs = CfdTools.getMaterials(self.analysis) taskd = _TaskPanelCfdFluidBoundary.TaskPanelCfdFluidBoundary( obj, physics_model, material_objs) taskd.obj = vobj.Object taskd.selecting_references = True taskd.faceSelector.addSelection( doc.Name, doc.getObject(self.__class__.__part_name).Name, 'Face1') taskd.accept()
def write_mesh(self): """ This is FreeCAD specific code, convert from UNV to OpenFoam """ caseFolder = self.solver_obj.WorkingDir + os.path.sep + self.solver_obj.InputCaseName if self.mesh_obj.Proxy.Type == u"FemMeshGmsh": # Gmsh has already write boundary mesh for FemConstraint derived class using_unv_format = True if using_unv_format: foamMeshFile = caseFolder + os.path.sep + self.solver_obj.InputCaseName + u".unv" else: # GMSH format ascii foamMeshFile = caseFolder + os.path.sep + self.solver_obj.InputCaseName + u".msh" if using_unv_format: self.mesh_generated = CfdTools.write_unv_mesh(self.mesh_obj, self.bc_group, foamMeshFile, is_gmsh=True) # however, the generated boundary patch name for OpenFOAM has suffix: '_Faces' for 3D. # FreecAD (internal standard length) mm by default; while in CFD, it is metre, so mesh needs scaling # unit_shema == 1, may mean Metre-kg-second # cfd result import, will also involve mesh scaling, it is done in c++ Fem/VTKTools.cpp if self.unit_shema == 0: scale = 0.001 else: scale = 1 else: # feature not yet merged into Fem master 2017-10-21 self.mesh_generated = CfdTools.export_gmsh_mesh( self.mesh_obj, foamMeshFile) scale = 1 # importGmshMesh.export already set the output mesh scale to metre else: FreeCAD.Console.PrintError( "Only Gmsh is supported for OpenFOAM mesh") return False #self.mesh_generated = CfdTools.write_unv_mesh(self.mesh_obj, self.bc_group, unvMeshFile self.builder.setupMesh(foamMeshFile, scale)
def initialiseUponReload(self): self.meshConverted = self.obj.Converter2D["TwoDMeshCreated"] self.frontFaceName = self.obj.Converter2D["FrontFace"] self.backFaceName = self.obj.Converter2D["BackFace"] if self.frontFaceName: try: indexFront = self.listOfBoundaryLabels.index( self.frontFaceName) indexBack = self.listOfBoundaryLabels.index(self.backFaceName) self.form.comboBoxFront.setCurrentIndex(indexFront) self.form.comboBoxBack.setCurrentIndex(indexBack) except ValueError: CfdTools.cfdError("NOTE: Either the bounary with the name " + str(self.frontFaceName) + " or " + str(self.backFaceName) + " no longer exists.") if self.meshConverted: self.form.conversionStatusText.setText( "Mesh has already been converted.") self.form.conversionStatusText.setStyleSheet('color: green') self.form.paraviewButton.setEnabled(True) else: self.form.conversionStatusText.setText("Not yet converted.") self.form.conversionStatusText.setStyleSheet('color: red')
def downloadHisa(self): self.signals.status.emit("Downloading HiSA, please wait...") self.user_dir = CfdTools.runFoamCommand( "echo $WM_PROJECT_USER_DIR").rstrip().split('\n')[-1] self.user_dir = CfdTools.reverseTranslatePath(self.user_dir) try: if hasattr(ssl, 'create_default_context'): context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) else: context = None # Download (filename, header) = self.downloadFile(self.hisa_url, reporthook=self.downloadStatus, context=context) except Exception as ex: raise Exception("Error downloading HiSA: {}".format(str(ex))) self.signals.status.emit("Extracting HiSA...") CfdTools.runFoamCommand( '{{ mkdir -p "$WM_PROJECT_USER_DIR" && cd "$WM_PROJECT_USER_DIR" && ( rm -r {}; unzip -o "{}"; ); }}' .format(HISA_FILE_BASE, CfdTools.translatePath(filename)))
def downloadHisa(self): filename = self.download(self.hisa_url, HISA_FILE_EXT, "HiSA") self.user_dir = CfdTools.runFoamCommand( "echo $WM_PROJECT_USER_DIR").rstrip().split('\n')[-1] # We can't reverse-translate the path for docker since it sits inside the container. Just report it as such. if CfdTools.getFoamRuntime() != 'WindowsDocker': self.user_dir = CfdTools.reverseTranslatePath(self.user_dir) self.signals.status.emit("Extracting HiSA...") if CfdTools.getFoamRuntime() == 'WindowsDocker': from zipfile import ZipFile with ZipFile(filename, 'r') as zip: with tempfile.TemporaryDirectory() as tempdir: zip.extractall(path=tempdir) CfdTools.runFoamCommand( '{{ mkdir -p "$WM_PROJECT_USER_DIR" && cp -r "{}" "$WM_PROJECT_USER_DIR/"; }}' .format( CfdTools.translatePath( os.path.join(tempdir, HISA_FILE_BASE)))) else: CfdTools.runFoamCommand( '{{ mkdir -p "$WM_PROJECT_USER_DIR" && cd "$WM_PROJECT_USER_DIR" && ( rm -r {}; unzip -o "{}"; ); }}' .format(HISA_FILE_BASE, CfdTools.translatePath(filename)))
def downloadCfMesh(self): self.signals.status.emit("Downloading cfMesh, please wait...") self.user_dir = CfdTools.runFoamCommand( "echo $WM_PROJECT_USER_DIR").rstrip().split('\n')[-1] self.user_dir = CfdTools.reverseTranslatePath(self.user_dir) try: import urllib # Work around for certificate issues import ssl urllib._urlopener = urllib.FancyURLopener( context=ssl._create_unverified_context()) # Download (filename, header) = urllib.urlretrieve(self.cfmesh_url, reporthook=self.downloadStatus) except Exception as ex: raise Exception("Error downloading cfMesh: {}".format(str(ex))) self.signals.status.emit("Extracting cfMesh...") CfdTools.runFoamCommand( '{{ mkdir -p "$WM_PROJECT_USER_DIR" && cd "$WM_PROJECT_USER_DIR" && unzip -o "{}"; }}' .format(CfdTools.translatePath(filename)))
def __init__(self): super(_CommandCfdMeshGmshFromShape, self).__init__() icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "mesh_g.png") self.resources = { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshGmshFromShape", "Tetrahedral meshing using GMSH"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshGmshFromShape", "Create a tetrahedral mesh using GMSH") } self.is_active = 'with_part_feature'
def __init__(self): super(_CommandCfdMeshFromShape, self).__init__() icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "mesh.png") self.resources = { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_MeshFromShape", "CFD mesh"), 'ToolTip': QtCore.QT_TRANSLATE_NOOP( "Cfd_MeshFromShape", "Create a mesh using cfMesh, snappyHexMesh or gmsh") } self.is_active = 'with_part_feature'
def __init__(self): super(_CommandMeshRegion, self).__init__() icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "meshRegion.png") self.resources = { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MeshRegion", "Mesh region"), 'Accel': "M, R", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MeshRegion", "Creates a mesh region") } self.is_active = 'with_femmesh'
def GetResources(self): icon_path = os.path.join(CfdTools.get_module_path(), "Gui", "Resources", "icons", "solver.png") return { 'Pixmap': icon_path, 'MenuText': QtCore.QT_TRANSLATE_NOOP("Cfd_SolverControl", "Solver job control"), 'Accel': "S, C", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Cfd_SolverControl", "Edit properties and run solver") }