FEM FemMesh2Mesh/ru: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>

{{Docnav
|[[FEM_MeshGroup|FEM mesh group]]
|[[FEM_SolverCalculixCxxtools|Solver CalculiX Standard]]
|[[FEM_Workbench|FEM]]
|IconL=FEM_MeshGroup.svg
|IconR=FEM_SolverCalculixCxxtools.svg
|IconC=Workbench_FEM.svg
}}


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
{{GuiCommand/ru
{{GuiCommand/ru|Name=FEM FemMesh2Mesh|Name/ru=FEM FemMesh2Mesh|MenuLocation=FEM → Utilities → FEM mesh to mesh||Workbenches=[[Fem Workbench/ru|FEM]]|Shortcut=|SeeAlso=[[FEM_tutorial/ru|FEM tutorial]]}}
|Name=FEM FemMesh2Mesh
|Name/ru=FEM FemMesh2Mesh
|MenuLocation=Mesh → FEM mesh to mesh
|Workbenches=[[FEM Workbench/ru|FEM]]
|Shortcut=
|SeeAlso=[[FEM_tutorial/ru|FEM tutorial]]
}}
</div>
</div>


== 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 that are unique (not shared by two elements) and uses them to create faces of a mesh. Optionally, it can be used to save a deformed mesh. This is done by adding the displacement of the FEM results to the mesh nodes (the scale of the displacement can be set using Python).


==Usage==
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.


# Select a FEM mesh object.
== How to use ==
# Optionally also select the FEM results.

# There are several ways to invoke the command:
# Select a FEM mesh object (optionally select additionally the FEM results)
# Press the {{KEY|[[Image:FEM_FemMesh2Mesh.png|24px]]FEM mesh to mesh}} button
#* Press the {{Button|[[Image:FEM_FemMesh2Mesh.svg|16px]] [[FEM_FemMesh2Mesh|FEM mesh to mesh]]}} button.
#* Select the {{MenuCommand|Mesh → [[Image:FEM_FemMesh2Mesh.svg|16px]] FEM mesh to mesh}} option from the menu.


== Scripting ==
== Scripting ==

Example:
'''Note''': The parameter ''scale'' was {{Version|0.21}}. For older versions of FreeCAD omit it from your code.
* Load FreeCAD's 3D FEM example from the Start Workbench and run the following code

The cantilever example:

{{Code|code=
{{Code|code=
from os.path import join
femmesh_obj = App.ActiveDocument.getObject("Result_mesh").FemMesh
import FreeCAD as App
result = App.ActiveDocument.getObject("CalculiX_static_results")
import femmesh.femmesh2mesh
out_mesh = femmesh.femmesh2mesh.femmesh_2_mesh(femmesh_obj, result)
import Mesh
import Mesh
from femmesh import femmesh2mesh

path = join(App.getResourceDir(), "examples", "FemCalculixCantilever3D.FCStd")
doc = App.openDocument(path)
fem_mesh = doc.Box_Mesh.FemMesh
result = doc.CCX_Results
scale = 1 # displacement scale factor
out_mesh = femmesh2mesh.femmesh_2_mesh(fem_mesh, result, scale)
Mesh.show(Mesh.Mesh(out_mesh))
Mesh.show(Mesh.Mesh(out_mesh))
}}
}}
== Converting 2D elements ==
Select a mesh and run the following python script
{{Code|code=
import 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)


{{Docnav
selection = FreeCADGui.Selection.getSelection()
|[[FEM_MeshGroup|FEM mesh group]]
input_mesh = App.ActiveDocument.getObject(selection[0].Name).FemMesh
|[[FEM_SolverCalculixCxxtools|Solver CalculiX Standard]]
output_mesh = []
|[[FEM_Workbench|FEM]]
for element in input_mesh.Faces:
|IconL=FEM_MeshGroup.svg
element_nodes = input_mesh.getElementNodes(element)
|IconR=FEM_SolverCalculixCxxtools.svg
if len(element_nodes) in [3, 6]: # tria3 or tria6 (ignoring mid-nodes)
|IconC=Workbench_FEM.svg
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)
}}
}}


{{FEM Tools navi{{#translation:}}}}

{{Userdocnavi{{#translation:}}}}
{{clear}}

Latest revision as of 10:14, 2 March 2024

Other languages:

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 that are unique (not shared by two elements) and uses them to create faces of a mesh. Optionally, it can be used to save a deformed mesh. This is done by adding the displacement of the FEM results to the mesh nodes (the scale of the displacement can be set using Python).

Usage

  1. Select a FEM mesh object.
  2. Optionally also select the FEM results.
  3. 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 0.21. For older versions of FreeCAD omit it from your code.

The cantilever example:

from os.path import join
import FreeCAD as App
import Mesh
from femmesh import femmesh2mesh

path = join(App.getResourceDir(), "examples", "FemCalculixCantilever3D.FCStd")
doc = App.openDocument(path)
fem_mesh = doc.Box_Mesh.FemMesh
result = doc.CCX_Results
scale = 1  # displacement scale factor
out_mesh = femmesh2mesh.femmesh_2_mesh(fem_mesh, result, scale)
Mesh.show(Mesh.Mesh(out_mesh))