FEM FemMesh2Mesh/it: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
 
(38 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>


<div class="mw-translate-fuzzy">
{{GuiCommand/it|Name=FEM FemMesh2Mesh|Name/it=Mesh FEM in mesh|MenuLocation=FEM → Utilità → Converti mesh FEM in mesh||Workbenches=[[FEM Module/it|FEM]]|Shortcut=|SeeAlso=[[FEM_tutorial/it|Tutorial di FEM]]}}
{{Docnav/it|[[FEM_CreateNodesSet/it|Imposta i nodi]]|[[FEM_SolverCalculixCxxtools/it|Solutore Calculix CCX tools]]|[[FEM_Workbench/it|FEM]]|IconL=FEM_CreateNodesSet.png|IconC=Workbench_FEM.svg|IconR=FEM_Solver.png}}
</div>


<div class="mw-translate-fuzzy">
== Description ==
{{GuiCommand/it
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.
|Name=FEM_FemMesh2Mesh
|Name/it=Converti mesh FEM in mesh
|MenuLocation=Mesh → Converti mesh FEM in mesh
|Workbenches=[[FEM_Workbench/it|FEM]]
|Shortcut=
|SeeAlso=[[FEM_tutorial/it|Tutorial di FEM]]
}}
</div>


<span id="Description"></span>
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.
== Descrizione ==


<div class="mw-translate-fuzzy">
== How to use ==
Questo strumento converte in mesh le superfici degli elementi 3D di una mesh FEM selezionata. Sceglie le facce dell'elemento mesh FEM che sono uniche (non condivise da due elementi) e le usa per creare le facce di una mesh. Facoltativamente consente di creare una mesh deformata dall'azione delle forze definite. Ciò avviene aggiungendo lo spostamento dei risultati FEM ai nodi della maglia.
# Select a FEM mesh object (optionally select additionally the FEM results)
</div>
# Press the {{KEY|[[Image:FEM_FemMesh2Mesh.png|24px]]FEM mesh to mesh}} button

<span id="Usage"></span>
==Utilizzo==

<div class="mw-translate-fuzzy">
# Selezionare un oggetto mesh FEM (opzionalmente selezionare anche i risultati FEM)
# Premere il pulsante {{KEY|[[Image:FEM_FemMesh2Mesh.png|24px]]FEM mesh to mesh}}
</div>


== 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 = App.ActiveDocument.getObject("Box_Mesh").FemMesh
import FreeCAD as App
result = App.ActiveDocument.getObject("CalculiX_static_results")
import FemMesh2Mesh
out_mesh = FemMesh2Mesh.femmesh_2_mesh(femmesh, 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)


<div class="mw-translate-fuzzy">
selection = FreeCADGui.Selection.getSelection()
{{Docnav/it|[[FEM_CreateNodesSet/it|Imposta i nodi]]|[[FEM_SolverCalculixCxxtools/it|Solutore Calculix CCX tools]]|[[FEM_Workbench/it|FEM]]|IconL=FEM_CreateNodesSet.png|IconC=Workbench_FEM.svg|IconR=FEM_Solver.png}}
input_mesh = App.ActiveDocument.getObject(selection[0].Name).FemMesh
</div>
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)


{{FEM Tools navi{{#translation:}}}}
obj = Mesh.Mesh(output_mesh)
{{Userdocnavi{{#translation:}}}}
Mesh.show(obj)
}}


{{clear}}
<languages/>

Latest revision as of 14:40, 12 October 2023

Converti mesh FEM in mesh

Posizione nel menu
Mesh → Converti mesh FEM in mesh
Ambiente
FEM
Avvio veloce
Nessuno
Introdotto nella versione
-
Vedere anche
Tutorial di FEM

Descrizione

Questo strumento converte in mesh le superfici degli elementi 3D di una mesh FEM selezionata. Sceglie le facce dell'elemento mesh FEM che sono uniche (non condivise da due elementi) e le usa per creare le facce di una mesh. Facoltativamente consente di creare una mesh deformata dall'azione delle forze definite. Ciò avviene aggiungendo lo spostamento dei risultati FEM ai nodi della maglia.

Utilizzo

  1. Selezionare un oggetto mesh FEM (opzionalmente selezionare anche i risultati FEM)
  2. Premere il pulsante FEM mesh to mesh

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))