![freecad gmsh .17 freecad gmsh .17](https://i.stack.imgur.com/dX3Vt.jpg)
![freecad gmsh .17 freecad gmsh .17](https://i1.wp.com/numerica.pt/wp-content/uploads/2017/10/PaperClip-Circular-section.jpg)
I am open to calling other script files from within my python file that are written in other languages. Similarly, I can double click on my Calculix Solver and get the "Mechanical Analysis" view, which allows me to select an analysis type, generate the. I would like to push that button in code. FreeCAD shows me the "FEM mesh by Gmsh" view, where I can select parameters and press a button to generate the mesh file. When I run my code, I get the fully setup analysis with constraints applied and material select. ObjectsFem.makeMeshGmsh(FreeCAD.ActiveDocument, 'FEMMeshGmsh')į = ObjectsFem.makeSolverCalculixCcxTools(FreeCAD.ActiveDocument)įemGui.getActiveAnalysis().addObject()įemGui.getActiveAnalysis().addObject(ObjectsFem.makeMaterialSolid(FreeCAD.ActiveDocument, 'SolidMaterial'))į()Īpp.activeDocument().addObject("Fem::ConstraintFixed","FemConstraintFixed")Īpp.activeDocument().FemConstraintFixed.Scale = 1Īpp.activeDocument().Analysis.addObject(App.activeDocument().FemConstraintFixed)įor amesh in App.activeDocument().Objects:Īparttoshow = ("_Mesh","")įor apart in App.activeDocument().Objects:Īpp. = 1Īpp. = Īpp.activeDocument().addObject("Fem::ConstraintForce","FemConstraintForce")Īpp.activeDocument().FemConstraintForce.Force = 1.0Īpp.activeDocument().FemConstraintForce.Reversed = FalseĪpp.activeDocument().FemConstraintForce.Scale = 1Īpp.activeDocument().Analysis.addObject(App.activeDocument().FemConstraintForce)Īpp. = 1Īpp. = NoneĪpp. = FalseĪpp. = 1Īpp. = ObjectsFem.makeAnalysis(FreeCAD.ActiveDocument, 'Analysis')įtActiveAnalysis() GeoList.append(Part.LineSegment(App.Vector(-10,-10,0),App.Vector(-10, 9,0)))Īpp.(geoList,False)ĬonList.append(Sketcher.Constraint('Coincident',0,2,1,1))ĬonList.append(Sketcher.Constraint('Coincident',1,2,2,1))ĬonList.append(Sketcher.Constraint('Coincident',2,2,3,1))ĬonList.append(Sketcher.Constraint('Coincident',3,2,0,1))ĬonList.append(Sketcher.Constraint('Horizontal',0))ĬonList.append(Sketcher.Constraint('Horizontal',2))ĬonList.append(Sketcher.Constraint('Vertical',1))ĬonList.append(Sketcher.Constraint('Vertical',3))Īpp.(conList)Īpp.activeDocument().Body.newObject("PartDesign::Pad","Pad")Īpp.activeDocument().Pad.Profile = App.activeDocument().SketchĪpp. = 200.000000Īpp.2 = 100.000000
![freecad gmsh .17 freecad gmsh .17](https://i2.wp.com/numerica.pt/wp-content/uploads/2017/08/FreeCAD_0_17_FEM_Results.jpg)
How do I now extend the script, so I can generate the mesh (using GMSH) and run the analysis with Calculix all in the same script?Įxec(open('/usr/share/freecad/Mod/Start/StartPage/LoadNew.py').read())Īpp.ActiveDocument=App.getDocument("Unnamed")Īpp.activeDocument().addObject('PartDesign::Body','Body')Īpp.activeDocument().Body.newObject('Sketcher::SketchObject','Sketch')Īpp.activeDocument().Sketch.Support = (App.activeDocument().XY_Plane, )Īpp.activeDocument().Sketch.MapMode = 'FlatFace' I created a macro (python script) in FreeCAD that generates a cantilever beam, creates an Analysis, selects a material, and applies constraints to the body.