示例#1
0
    def update(self):
        self.MeshObject = None
        self.result_object = CfdTools.getResultObject(
        )  # return the first one, or the currently selected result object
        # Disable temperature radio button if it does not exist in results
        if len(self.result_object.Temperature) == 1:
            self.form.rb_temperature.setEnabled(0)
        #
        for i in FemGui.getActiveAnalysis().Member:
            if i.isDerivedFrom("Fem::FemMeshObject"):
                self.MeshObject = i
                break

        self.suitable_results = False
        if self.result_object:
            if (self.MeshObject.FemMesh.NodeCount == len(
                    self.result_object.NodeNumbers)):
                self.suitable_results = True
            else:
                if not self.MeshObject.FemMesh.VolumeCount:
                    FreeCAD.Console.PrintError(
                        'Only 3D FEM or CFD Meshes are supported!\n')
                else:
                    FreeCAD.Console.PrintError(
                        'Result node numbers are not equal to FEM Mesh NodeCount!\n'
                    )
示例#2
0
    def update(self):
        self.result_object = CfdTools.getResultObject()  # return the first one, or the currently selected result object
        self.suitable_results = False
        if self.result_object:
            # todo: enable widget only if variable floatlist is not empty
            if len(self.result_object.Temperature) == 1:  # default value for FloatList is : [0]
                self.form.rb_temperature.setEnabled(0)
            if len(self.result_object.TurbulenceEnergy) == 1:  # default value for FloatList is : [0]
                self.form.rb_turbulence_energy.setEnabled(0)
            
            if self.result_object.Mesh:
                self.MeshObject = self.result_object.Mesh
            else:
                FreeCAD.Console.PrintError('no Mesh object found in ResultObject {}'.format(self.result_object.Name))
                """
                # the first mesh object found is the mesh before writing case and solving
                for i in FemGui.getActiveAnalysis().Group:
                    if i.isDerivedFrom("Fem::FemMeshObject"):
                        self.MeshObject = i
                        break
                """

            if (self.MeshObject.FemMesh.NodeCount == len(self.result_object.NodeNumbers)):
                self.suitable_results = True
            else:
                if not self.MeshObject.FemMesh.VolumeCount:
                    FreeCAD.Console.PrintError('Only 3D FEM or CFD Meshes are supported!\n')
                else:
                    FreeCAD.Console.PrintError('Result node numbers are not equal to FEM Mesh NodeCount!\n')
        else:
            FreeCAD.Console.PrintError('None returned by CfdTools.getResultObject() in update()')
示例#3
0
    def Activated(self):
        self.result_object = CfdTools.getResultObject()

        if not self.result_object:
            QtGui.QMessageBox.critical(None, "Missing prerequisite",
                                       "No result found in active Analysis")
            return

        self.hide_parts_constraints_show_meshes()

        import _TaskPanelCfdResult
        taskd = _TaskPanelCfdResult._TaskPanelCfdResult()
        FreeCADGui.Control.showDialog(taskd)