FEM FemMesh2Mesh/ru: Difference between revisions
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 23: | Line 23: | ||
== Description == |
== Description == |
||
This tool converts surfaces of 3D elements of a selected FEM mesh to mesh. Internally it picks FEM mesh element faces which are unique (not shared by two elements) and uses them to create faces of a mesh. Optionally it allows to create a deformed mesh caused by the action of the defined forces. This is done by adding the displacement of the FEM results to the mesh nodes. |
This tool converts surfaces of 3D elements of a selected FEM mesh to mesh, or converts 2D FEM mesh to mesh. Internally it picks FEM mesh element faces which are unique (not shared by two elements) and uses them to create faces of a mesh. Optionally it allows to create a deformed mesh caused by the action of the defined forces. This is done by adding the displacement of the FEM results to the mesh nodes (scale of the displacement can be set by python). |
||
Two dimensional elements from the FEM mesh are not taken into account. If you need to convert them, you can use a python script below. |
|||
==Usage== |
==Usage== |
||
Line 37: | Line 35: | ||
== Scripting == |
== Scripting == |
||
'''Note''': The parameter ''scale'' was {{Version|1.0}}. For older versions of FreeCAD omit it in your code. |
|||
Example: Load FreeCAD's 3D FEM example from the Start Workbench and run the following code |
|||
When you just require the displacement scale factor, check your mesh object name and the scale factor in the following code: |
|||
{{Code|code= |
{{Code|code= |
||
femmesh_obj = App.ActiveDocument.getObject("Result_mesh").FemMesh |
|||
result = App.ActiveDocument.getObject("CalculiX_static_results") |
|||
import femmesh.femmesh2mesh |
import femmesh.femmesh2mesh |
||
mesh_obj = FEMMeshGmsh # the name of your mesh object |
|||
⚫ | |||
scale = 5 # displacement scale factor |
|||
out_mesh = femmesh.femmesh2mesh.femmesh_2_mesh(FreeCAD.ActiveDocument.mesh_obj.FemMesh, FreeCAD.ActiveDocument.CCX_Results, scale) |
|||
import Mesh |
import Mesh |
||
Mesh.show(Mesh.Mesh(out_mesh)) |
Mesh.show(Mesh.Mesh(out_mesh)) |
||
}} |
}} |
||
The cantilever example: |
|||
== Converting 2D elements == |
|||
Select a mesh and run the following Python script: |
|||
{{Code|code= |
{{Code|code= |
||
from os.path import join |
|||
the_file = join(FreeCAD.getResourceDir(), "examples", "FemCalculixCantilever3D.FCStd") |
|||
fc_file = FreeCAD.openDocument(the_file) |
|||
fem_mesh = fc_file.getObject("Box_Mesh").FemMesh # do not remove the _ |
|||
result = fc_file.getObject("CCX_Results") |
|||
scale = 1 # displacement scale factor |
|||
from femmesh import femmesh2mesh |
|||
⚫ | |||
import Mesh |
import Mesh |
||
Mesh.show(Mesh.Mesh(out_mesh)) |
|||
def extend_by_triangle(i, j, k): |
|||
triangle = [input_mesh.getNodeById(element_nodes[i]), |
|||
input_mesh.getNodeById(element_nodes[j]), |
|||
input_mesh.getNodeById(element_nodes[k])] |
|||
return output_mesh.extend(triangle) |
|||
selection = FreeCADGui.Selection.getSelection() |
|||
input_mesh = App.ActiveDocument.getObject(selection[0].Name).FemMesh |
|||
output_mesh = [] |
|||
for element in input_mesh.Faces: |
|||
element_nodes = input_mesh.getElementNodes(element) |
|||
if len(element_nodes) in [3, 6]: # tria3 or tria6 (ignoring mid-nodes) |
|||
extend_by_triangle(0, 1, 2) |
|||
elif len(element_nodes) in [4, 8]: # quad4 or quad8 (ignoring mid-nodes) |
|||
extend_by_triangle(0, 1, 2) |
|||
extend_by_triangle(2, 3, 0) |
|||
obj = Mesh.Mesh(output_mesh) |
|||
Mesh.show(obj) |
|||
}} |
}} |
||
Revision as of 09:08, 9 November 2022
FEM FemMesh2Mesh |
Системное название |
---|
FEM FemMesh2Mesh |
Расположение в меню |
Mesh → FEM mesh to mesh |
Верстаки |
FEM |
Быстрые клавиши |
Нет |
Представлено в версии |
- |
См. также |
FEM tutorial |
Description
This tool converts surfaces of 3D elements of a selected FEM mesh to mesh, or converts 2D FEM mesh to mesh. Internally it picks FEM mesh element faces which are unique (not shared by two elements) and uses them to create faces of a mesh. Optionally it allows to create a deformed mesh caused by the action of the defined forces. This is done by adding the displacement of the FEM results to the mesh nodes (scale of the displacement can be set by python).
Usage
- Select a FEM mesh object.
- Optionally also select the FEM results.
- There are several ways to invoke the command:
- Press the FEM mesh to mesh button.
- Select the Mesh → FEM mesh to mesh option from the menu.
Scripting
Note: The parameter scale was introduced in version 1.0. For older versions of FreeCAD omit it in your code.
When you just require the displacement scale factor, check your mesh object name and the scale factor in the following code:
import femmesh.femmesh2mesh
mesh_obj = FEMMeshGmsh # the name of your mesh object
scale = 5 # displacement scale factor
out_mesh = femmesh.femmesh2mesh.femmesh_2_mesh(FreeCAD.ActiveDocument.mesh_obj.FemMesh, FreeCAD.ActiveDocument.CCX_Results, scale)
import Mesh
Mesh.show(Mesh.Mesh(out_mesh))
The cantilever example:
from os.path import join
the_file = join(FreeCAD.getResourceDir(), "examples", "FemCalculixCantilever3D.FCStd")
fc_file = FreeCAD.openDocument(the_file)
fem_mesh = fc_file.getObject("Box_Mesh").FemMesh # do not remove the _
result = fc_file.getObject("CCX_Results")
scale = 1 # displacement scale factor
from femmesh import femmesh2mesh
out_mesh = femmesh2mesh.femmesh_2_mesh(fem_mesh, result, scale)
import Mesh
Mesh.show(Mesh.Mesh(out_mesh))
FEM
- Materials: Solid, Fluid, Nonlinear mechanical, Reinforced (concrete); Material editor
- Element geometry: Beam (1D), Beam rotation (1D), Shell (2D), Fluid flow (1D)
Constraints
- Electromagnetic: Electrostatic potential, Current density, Magnetization
- Geometrical: Plane rotation, Section print, Transform
- Mechanical: Fixed, Displacement, Contact, Tie, Spring, Force, Pressure, Centrif, Self weight
- Thermal: Initial temperature, Heat flux, Temperature, Body heat source
- Overwrite Constants: Constant vacuum permittivity
- Solve: CalculiX Standard, Elmer, Mystran, Z88; Equations: Deformation, Elasticity, Electrostatic, Electricforce, Magnetodynamic, Magnetodynamic 2D, Flow, Flux, Heat; Solver: Solver control, Solver run
- Results: Purge, Show; Postprocessing: Apply changes, Pipeline from result, Warp filter, Scalar clip filter, Function cut filter, Region clip filter, Contours filter, Line clip filter, Stress linearization plot, Data at point clip filter, Filter function plane, Filter function sphere, Filter function cylinder, Filter function box
- Additional: Preferences; FEM Install, FEM Mesh, FEM Solver, FEM CalculiX, FEM Concrete; FEM Element Types
Документация пользователя
- Начинающим
- Установка: Загрузка, Windows, Linux, Mac, Дополнительных компонентов, Docker, AppImage, Ubuntu Snap
- Базовая: О FreeCAD, Интерфейс, Навигация мыши, Методы выделения, Имя объекта, Настройки, Верстаки, Структура документа, Свойства, Помоги FreeCAD, Пожертвования
- Помощь: Учебники, Видео учебники
- Верстаки: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework