Mesh FromPartShape: Difference between revisions

From FreeCAD Documentation
No edit summary
(Button text.)
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<languages/>

{{Page in progress}}

<translate>
<translate>


<!--T:1-->
<!--T:1-->
{{Docnav
{{Docnav
|[[Mesh_Export|Mesh Export]]
|[[Mesh_Export|Export]]
|[[Mesh_RemeshGmsh|Mesh RemeshGmsh]]
|[[Mesh_RemeshGmsh|RemeshGmsh]]
|[[Mesh_Workbench|Mesh]]
|[[Mesh_Workbench|Mesh]]
|IconL=Mesh_Export.svg
|IconL=Mesh_Export.svg
|IconR=
|IconR=Mesh_RemeshGmsh.svg
|IconC=Workbench_Mesh.svg
|IconC=Workbench_Mesh.svg
}}
}}
Line 25: Line 22:


<!--T:3-->
<!--T:3-->
The '''Mesh FromPartShape''' command creates a non-parametric mesh object, a [[Mesh_Feature|Mesh Feature]], from a shape object.
The '''Mesh_FromPartShape''' command creates non-parametric [[mesh|mesh]] objects ([[Mesh_Feature|Mesh Features]]) from [[shape|shape]] objects ([[Part_Feature|Part Features]]).

<!--T:40-->
The inverse operation is [[Part_ShapeFromMesh|Part ShapeFromMesh]] from the [[File:Workbench_Part.svg|24px]] [[Part_Workbench|Part Workbench]].


==Usage== <!--T:4-->
==Usage== <!--T:4-->
Line 32: Line 32:
# Optionally select one or more objects.
# Optionally select one or more objects.
# There are several ways to invoke the command:
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Mesh_FromPartShape.svg|16px]] [[Mesh_FromPartShape|Mesh FromPartShape]]}} button.
#* Press the {{Button|[[Image:Mesh_FromPartShape.svg|16px]] [[Mesh_FromPartShape|Create mesh from shape...]]}} button.
#* Select the {{MenuCommand|Meshes → [[Image:Mesh_FromPartShape.svg|16px]] Create mesh from shape...}} option from the menu.
#* Select the {{MenuCommand|Meshes → [[Image:Mesh_FromPartShape.svg|16px]] Create mesh from shape...}} option from the menu.
# The Tessellation task panel opens.
# The {{MenuCommand|Tessellation}} task panel opens.
# While the task panel is open you can create a new selection or change an existing selection.
# While the task panel is open you can create a new selection or change an existing selection.
# Select the tab for the mesher you wish to use.
# Select the tab for the mesher you wish to use.
Line 70: Line 70:
** {{MenuCommand|Very fine}}
** {{MenuCommand|Very fine}}
** {{MenuCommand|User defined}}: for this option the following settings can be specified:
** {{MenuCommand|User defined}}: for this option the following settings can be specified:
*** {{MenuCommand|Mesh size grading}}: a smaller value results in a finer mesh. The value should be in the {{Value|0.1}} - {{Value|1.0}} range.
*** {{MenuCommand|Mesh size grading}}: a smaller value results in a finer mesh. The value must be in the {{Value|0.1}} - {{Value|1.0}} range.
*** {{MenuCommand|Element per edge}}: a larger value results in a finer mesh. The value should be in the {{Value|0.2}} - {{Value|10.0}} range.
*** {{MenuCommand|Element per edge}}: a larger value results in a finer mesh. The value must be in the {{Value|0.2}} - {{Value|10.0}} range.
*** {{MenuCommand|Element per curvature radius}}: a larger value results in a finer mesh. The value should be in the {{Value|0.2}} - {{Value|10}} range.
*** {{MenuCommand|Element per curvature radius}}: a larger value results in a finer mesh. The value must be in the {{Value|0.2}} - {{Value|10}} range.
*{{MenuCommand|Optimize surface}}: if checked, the surface shape will be optimized.
*{{MenuCommand|Optimize surface}}: if checked, the surface shape will be optimized.
*{{MenuCommand|Second order elements}}: if checked, second order elements will be generated resulting in a finer mesh.
*{{MenuCommand|Second order elements}}: if checked, second order elements will be generated resulting in a finer mesh.
*{{MenuCommand|Quad dominated}}: if checked, the mesh will preferably use [https://en.wikipedia.org/wiki/Types_of_mesh#Two-dimensional quadrilateral faces].
*{{MenuCommand|Quad dominated}}: if checked, the mesh will preferably use [https://en.wikipedia.org/wiki/Types_of_mesh#Two-dimensional quadrilateral faces].


===Gmsh mesher===
===Gmsh mesher=== <!--T:27-->


<!--T:29-->
For Linux users: the external [https://gmsh.info/ gmsh] module is required.
For Linux users: the external [https://gmsh.info/ Gmsh] module is required.


<!--T:30-->
* {{MenuCommand|Meshing}}: select a meshing option:
* {{MenuCommand|Meshing}}: select a meshing option:
** {{MenuCommand|Automatic}}
** {{MenuCommand|Automatic}}
Line 89: Line 91:
** {{MenuCommand|Frontal Quad}}
** {{MenuCommand|Frontal Quad}}
** {{MenuCommand|Parallelograms}}
** {{MenuCommand|Parallelograms}}
* {{MenuCommand|Max. element size}}: a smaller value results in a finer mesh.
* {{MenuCommand|Max. element size}}: a smaller value results in a finer mesh. Specify {{Value|0}} to have this size automatically determined.
* {{MenuCommand|Min. element size}}: a smaller value results in a finer mesh. The value should be smaller than the {{MenuCommand|Max. element size}}.
* {{MenuCommand|Min. element size}}: a smaller value results in a finer mesh. The value should be smaller than the {{MenuCommand|Max. element size}}. Specify {{Value|0}} to have this size automatically determined.
* {{MenuCommand|Angle}}: seems to be unsupported at this time.
* {{MenuCommand|Angle}}: seems to be unsupported at this time.
* {{MenuCommand|Path}}: the gmsh.exe path.
* {{MenuCommand|Path}}: press the {{Button|...}} button and browse to the {{FileName|gmsh.exe}} path.
* If the meshing process takes too long you can press the {{Button|Kill}} button to abort it.
* Press the {{Button|Clear}} button to remove the information in the text area. <!--Because the task panel closes the Clear button cannot be used with this command. But the same task panel is used for the Mesh_RemeshGmsh command-->


==Notes== <!--T:22-->
==Notes== <!--T:22-->


<!--T:31-->
* This command is not restricted to objects created with the [[Part_Module|Part workbench]]. It can create a mesh from any object that has a shape including objects created with the [[PartDesign_Workbench|PartDesign workbench]].
* This command is not restricted to objects created with the [[Part_Workbench|Part workbench]]. It can create a mesh from any object that has a shape including objects created with the [[PartDesign_Workbench|PartDesign workbench]].
* The [[Std_Export|Std Export]] command can export shape objects directly to a mesh format.
* The [[Std_Export|Std Export]] command can export shape objects directly to a mesh format.
* See also: [[Export_to_STL_or_OBJ|Export to STL or OBJ]] tutorial.
* See also: [[Export_to_STL_or_OBJ|Export to STL or OBJ]] tutorial.


==Preferences==
==Preferences== <!--T:32-->


===Standard mesher===
===Standard mesher=== <!--T:33-->


<!--T:34-->
* The {{MenuCommand|Surface deviation}} is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → LinearDeflection}}.
* The {{MenuCommand|Angular deviation}} is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → AngularDeflection}}.
* The {{MenuCommand|Surface deviation}} setting is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → LinearDeflection}}.
* The {{MenuCommand|Relative surface deviation}} is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → RelativeLinearDeflection}}.
* The {{MenuCommand|Angular deviation}} setting is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → AngularDeflection}}.
* The {{MenuCommand|Relative surface deviation}} setting is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → RelativeLinearDeflection}}.


===Gmsh mesher===
===Gmsh mesher=== <!--T:35-->


<!--T:36-->
* The {{MenuCommand|Path}} is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → gmshExe}}.
* The {{MenuCommand|Path}} is stored: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → gmshExe}}.


==Properties==
==Properties== <!--T:37-->


<!--T:38-->
See [[Mesh_Feature|Mesh Feature]].
See: [[Mesh_Feature|Mesh Feature]].


==Scripting== <!--T:19-->
==Scripting== <!--T:19-->


<!--T:39-->
{{Emphasis|See also:}} [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].
See also: [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].


<!--T:20-->
<!--T:20-->
Line 135: Line 144:
}}
}}
<translate>
<translate>



<!--T:23-->
<!--T:23-->
{{Docnav
{{Docnav
|[[Mesh_Export|Mesh Export]]
|[[Mesh_Export|Export]]
|[[Mesh_RemeshGmsh|Mesh RemeshGmsh]]
|[[Mesh_RemeshGmsh|RemeshGmsh]]
|[[Mesh_Workbench|Mesh]]
|[[Mesh_Workbench|Mesh]]
|IconL=Mesh_Export.svg
|IconL=Mesh_Export.svg
|IconR=
|IconR=Mesh_RemeshGmsh.svg
|IconC=Workbench_Mesh.svg
|IconC=Workbench_Mesh.svg
}}
}}

Latest revision as of 16:26, 25 November 2023

Mesh FromPartShape

Menu location
Meshes → Create mesh from shape...
Workbenches
Mesh
Default shortcut
None
Introduced in version
-
See also
None

Description

The Mesh_FromPartShape command creates non-parametric mesh objects (Mesh Features) from shape objects (Part Features).

The inverse operation is Part ShapeFromMesh from the Part Workbench.

Usage

  1. Optionally select one or more objects.
  2. There are several ways to invoke the command:
  3. The Tessellation task panel opens.
  4. While the task panel is open you can create a new selection or change an existing selection.
  5. Select the tab for the mesher you wish to use.
  6. Specify the required settings. See Meshers.
  7. Press the OK button to close the task panel and finish the command.

Meshers

These are the available meshers and their settings:

Standard mesher

  • Surface deviation: the maximum linear deviation of a mesh section from the surface of the object.
  • Angular deviation: the maximum angular deviation from one mesh section to the next. This setting is used when meshing curved surfaces.
  • Relative surface deviation: if checked, the maximum linear deviation of a mesh segment will be the specified Surface deviation multiplied by the length of the current mesh segment (edge).
  • Apply face colors to mesh: if checked, the mesh will get the face colors of the object.
  • Define segments by face colors: if checked, mesh segments will be grouped according to the colors of the object's faces. These groups will be exported for mesh output formats supporting this feature (the OBJ format for example).

Mefisto mesher

  • Maximum edge length: the maximum edge length of the mesh. A smaller value results in a finer mesh. Specifying 0, or unchecking the checkbox, results in a very coarse mesh.
    • If you press the Estimate button the mesher will enter an estimated value for the Maximum edge length. This value is not very reliable if multiple objects have been selected.

Netgen mesher

  • Fineness: select an options for the finesse of the mesh:
    • Very coarse
    • Coarse
    • Moderate
    • Fine
    • Very fine
    • User defined: for this option the following settings can be specified:
      • Mesh size grading: a smaller value results in a finer mesh. The value must be in the 0.1 - 1.0 range.
      • Element per edge: a larger value results in a finer mesh. The value must be in the 0.2 - 10.0 range.
      • Element per curvature radius: a larger value results in a finer mesh. The value must be in the 0.2 - 10 range.
  • Optimize surface: if checked, the surface shape will be optimized.
  • Second order elements: if checked, second order elements will be generated resulting in a finer mesh.
  • Quad dominated: if checked, the mesh will preferably use quadrilateral faces.

Gmsh mesher

For Linux users: the external Gmsh module is required.

  • Meshing: select a meshing option:
    • Automatic
    • Adaptive
    • Delaunay
    • Frontal
    • BAMG
    • Frontal Quad
    • Parallelograms
  • Max. element size: a smaller value results in a finer mesh. Specify 0 to have this size automatically determined.
  • Min. element size: a smaller value results in a finer mesh. The value should be smaller than the Max. element size. Specify 0 to have this size automatically determined.
  • Angle: seems to be unsupported at this time.
  • Path: press the ... button and browse to the gmsh.exe path.
  • If the meshing process takes too long you can press the Kill button to abort it.
  • Press the Clear button to remove the information in the text area.

Notes

Preferences

Standard mesher

  • The Surface deviation setting is stored: Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → LinearDeflection.
  • The Angular deviation setting is stored: Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → AngularDeflection.
  • The Relative surface deviation setting is stored: Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → Standard → RelativeLinearDeflection.

Gmsh mesher

  • The Path is stored: Tools → Edit parameters... → BaseApp → Preferences → Mod → Mesh → Meshing → gmshExe.

Properties

See: Mesh Feature.

Scripting

See also: FreeCAD Scripting Basics.

To create a mesh object from a shape object use the meshFromShape method of the MeshPart module. This method has several signatures. The signature determines the mesher that will be used. The example below uses the Mefisto mesher signature.

import FreeCAD, Part, Mesh, MeshPart

cyl = FreeCAD.ActiveDocument.addObject("Part::Cylinder","Cylinder")
FreeCAD.ActiveDocument.recompute()

msh = FreeCAD.ActiveDocument.addObject("Mesh::Feature", "Mesh")
msh.Mesh = MeshPart.meshFromShape(Shape=cyl.Shape, MaxLength=1)
msh.ViewObject.DisplayMode = "Flat Lines"