Example #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()
Example #2
0
 def Activated(self):
     import CfdTools
     CfdTools.createSolver()