I have written some code, for the FEM WB, that enables the user to erase elements from the display. The majority of the code is written in c++ with some processing in python. The code is based on "Mesh->Nodes Set" in FreeCAD version 20, the source of which I downloaded in May, 2022.
The first picture shows the full mesh, which is based on the "Fem.FCStd" example, and the second shows a cross-section.
The attachments are:
1 - a different FCStd file which contains examples of the output of this new function, as described below
2 - my version of "femmesh2mesh.py"
This function can be used:
- to look at the internal mesh to check on the mesh density
- to look at parts of the model that are obscured by other parts
- to look at the variation of results through the thickness
Open "erase.FCStd". Because of file attachment size limitations, this FCStd file is not the same as the one shown in the first 2 attachments. In the "Labels and Attributes" list, we have:
FEMMeshGmsh - the original finite element mesh, FEM
ResultMesh - the latest "ResultMesh"
ResultPipeLine - based on the original "ResultMesh"
ResultPipeLine001 - based on the latest "ResultMesh"
ElementsSet001 - a list of kept element numbers in "NewFemMesh", used internally
NewFemMesh - the new FEM, with elements erased from "FEMMeshGmsh"
ElementsSet001 - a list of kept element numbers in "NewResultMesh", used internally
StartResultMesh - a copy of the original "ResultMesh"
NewResultMesh - the new "ResultMesh", with elements erased from "StartResultMesh", a copy of this is now the new "ResultMesh"
Mesh - the Mesh of the "StartResultMesh" FEM
Mesh2Fem - the FEM mesh from "Mesh"
ElementsSet002 - a list of kept element numbers in "NewResultMesh001", used internally
NewFemMesh001 - the new FEM, with elements erased from "Mesh2Fem"
"Mesh2Fem" has been created with an additional function I have added to "femmesh2mesh.py", which now generates an FEM from the mesh that the code originally generated.
To change the "ResultMesh", use:
Code: Select all
name = "StartResultMesh" c = FreeCADGui.ActiveDocument.getObject(name) FreeCAD.ActiveDocument.ResultMesh.FemMesh = c.Object.FemMesh Gui.ActiveDocument.getObject('ResultMesh').BackfaceCulling = False
Does this look like a useful addition to FreeCAD?
If it is, then how do I go about incorporating it?