Ejemplo n.º 1
0
    def Activated(self):
        FreeCAD.ActiveDocument.openTransaction("Create CFD Analysis")
        FreeCADGui.addModule("FemGui")
        FreeCADGui.addModule("CfdObjects")
        FreeCADGui.doCommand("CfdObjects.makeCfdAnalysis('CfdAnalysis')")
        FreeCADGui.doCommand(
            "FemGui.setActiveAnalysis(App.activeDocument().ActiveObject)")

        import CfdTools
        CfdTools.createSolver()  # using FreeCADGui.doCommand style

        FreeCADGui.addModule("CfdObjects")
        FreeCADGui.doCommand(
            "FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [CfdObjects.makeCfdFluidMaterial('FluidMaterial')]"
        )

        sel = FreeCADGui.Selection.getSelection()
        if (len(sel) == 1):
            if (sel[0].isDerivedFrom("Fem::FemMeshObject")):
                FreeCADGui.doCommand(
                    "FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument()."
                    + sel[0].Name + "]")
            if (sel[0].isDerivedFrom("Part::Feature")):
                CfdTools.createMesh(sel)  #code shared with mesh command
        FreeCADGui.Selection.clearSelection()
 def Activated(self):
     sel = FreeCADGui.Selection.getSelection()
     if (len(sel) == 1):
         if (sel[0].isDerivedFrom("Part::Feature")):
             import CfdTools
             CfdTools.createMesh(sel)
     FreeCADGui.Selection.clearSelection()
Ejemplo n.º 3
0
 def Activated(self):
     import CfdTools
     CfdTools.createAnalysis()
     sel = FreeCADGui.Selection.getSelection()
     if (len(sel) == 1):
         if(sel[0].isDerivedFrom("Fem::FemMeshObject")):
             FreeCADGui.doCommand("FemGui.getActiveAnalysis().addObject(App.activeDocument()." + sel[0].Name + ")")
         if(sel[0].isDerivedFrom("Part::Feature")):
             CfdTools.createMesh(sel)  #code shared with mesh command
     FreeCADGui.Selection.clearSelection()