Example #1
0
 def __init__(self, analysis_obj):
     self.analysis_obj = analysis_obj
     self.solver_obj = CfdTools.getSolver(analysis_obj)
     self.physics_model, isPresent = CfdTools.getPhysicsModel(analysis_obj)
     self.mesh_obj = CfdTools.getMesh(analysis_obj)
     self.material_objs = CfdTools.getMaterials(analysis_obj)
     self.bc_group = CfdTools.getCfdBoundaryGroup(analysis_obj)
     self.initial_conditions, isPresent = CfdTools.getInitialConditions(analysis_obj)
     self.porousZone_objs = CfdTools.getPorousZoneObjects(analysis_obj)
     self.initialisationZone_objs = CfdTools.getInitialisationZoneObjects(analysis_obj)
     self.zone_objs = CfdTools.getZoneObjects(analysis_obj)
     self.conversion2D_obj,self.conversionObjPresent = CfdTools.get2DConversionObject(analysis_obj)
     self.mesh_generated = False
    def Activated(self):
        FreeCAD.Console.PrintMessage("Convert 3D mesh into a 2D mesh \n")
        FreeCADGui.addModule("FemGui")
        FreeCADGui.addModule("CfdConverterTo2D")
        analysis_obj = FemGui.getActiveAnalysis()
        obj,isPresent = CfdTools.get2DConversionObject(analysis_obj)

        if not(isPresent):
            sel = FreeCADGui.Selection.getSelection()
            if len(sel) == 1:
                sobj = sel[0]
                if len(sel) == 1 \
                        and hasattr(sobj, "Proxy") \
                        and (sobj.Proxy.Type == "Fem::FemMeshGmsh" or sobj.Proxy.Type == "CfdMeshCart"):
                    FreeCADGui.doCommand("FemGui.getActiveAnalysis().addObject(CfdConverterTo2D.makeCfdConvertTo2D())")
                    FreeCADGui.ActiveDocument.setEdit(FreeCAD.ActiveDocument.ActiveObject.Name)
        else:
            FreeCADGui.ActiveDocument.setEdit(obj.Name)

        FreeCADGui.Selection.clearSelection()