Mesh FromPartShape: Difference between revisions

From FreeCAD Documentation
m (syntax fixes)
m ((Vertical Docnav)(Vertical GuiCommand))
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>
<!--T:18-->
<!--T:1-->
{{Docnav
{{Docnav|[[Mesh Export|Export Mesh]]|[[Mesh CurvaturePlot|Curvature Plot]]|[[Mesh_Workbench|Mesh]]|IconL=Mesh_ExportMesh.png|IconC=Workbench_Mesh.svg|IconR=Mesh_CurvaturePlot.png}}
|[[Mesh Export|Export Mesh]]
|[[Mesh CurvaturePlot|Curvature Plot]]
|[[Mesh_Workbench|Mesh]]
|IconL=Mesh_ExportMesh.png
|IconC=Workbench_Mesh.svg
|IconR=Mesh_CurvaturePlot.png
}}


<!--T:2-->
<!--T:2-->
{{GuiCommand
{{GuiCommand|Name=Mesh MeshFromShape‏‎|MenuLocation=Meshes → Create Mesh from Shape|Workbenches=[[Mesh Workbench|Mesh]]|SeeAlso=}}
|Name=Mesh MeshFromShape‏‎
|MenuLocation=Meshes → Create Mesh from Shape
|Workbenches=[[Mesh Workbench|Mesh]]
|SeeAlso=
}}


==Introduction== <!--T:3-->
==Introduction== <!--T:3-->
This command creates a mesh from a shape object.
This command creates a mesh from a shape object.


==Use== <!--T:4-->
==Usage== <!--T:4-->
# Select the shape object.
# Choose {{KEY| Meshes}} → {{KEY|[[Image:Mesh_Mesh_from_Shape.svg|32px]] Create Mesh from shape...}} from the top menu.
# A menu will ask for the mesher to use and the appropriate values for the mesher
<br />
Just selecting {{KEY| Meshes}} → {{KEY|[[Image:Mesh_Mesh_from_Shape.svg|32px]] Create Mesh from shape...}} will give you an additional menu to choose your shape to mesh


===Standard Mesher===<!--T:13-->
<!--T:5-->
There are two methods:
# Either select the shape object, then choose {{KEY|Meshes}} → {{KEY|[[Image:Mesh_Mesh_from_Shape.svg|32px]] Create Mesh from shape...}} from the top menu.
# Just selecting {{KEY| Meshes}} → {{KEY|[[Image:Mesh_Mesh_from_Shape.svg|32px]] Create Mesh from shape...}} will give you an additional menu to choose your shape to mesh.


<!--T:7-->
<!--T:6-->
In both cases you get a menu that asks for the mesher program to use and its settings.<br/>
[[Image:Mesh_Mesher_Standard.jpg]]
The settings you make there will be stored and used as default for the next time you create a mesh from a shape. {{Version|0.19}}.

==Mesher program== <!--T:7-->


<!--T:8-->
<!--T:8-->
You can choose one of these 3 mesher programs:

===Standard Mesher=== <!--T:9-->

<!--T:10-->
[[Image:Mesh_Mesher_Standard.jpg]]

<!--T:11-->
You can change these settings:
You can change these settings:
* {{MenuCommand|Surface deviation}}: Maximal [https://www.opencascade.com/doc/occt-7.1.0/overview/html/occt_user_guides__modeling_algos.html#occt_modalg_11_2 linear deflection] of a mesh section from the surface of the object
* {{MenuCommand|Surface deviation}}: Maximal [https://www.opencascade.com/doc/occt-7.3.0/overview/html/occt_user_guides__modeling_algos.html#occt_modalg_11_2 linear deflection] of a mesh section from the surface of the object
* {{MenuCommand|Angular deviation}}: Maximal [https://www.opencascade.com/doc/occt-7.1.0/overview/html/occt_user_guides__modeling_algos.html#occt_modalg_11_2 angular deflection] of a mesh section to the next section
* {{MenuCommand|Angular deviation}}: Maximal [https://www.opencascade.com/doc/occt-7.3.0/overview/html/occt_user_guides__modeling_algos.html#occt_modalg_11_2 angular deflection] from one mesh section to the next section
* {{MenuCommand|Relative surface deviation}}: If checked, the maximal linear deviation of a mesh segment will be the specified {{MenuCommand|Surface deviation}} multiplied by the length of the current mesh segment (edge)
* {{MenuCommand|Relative surface deviation}}: If checked, the maximal linear deviation of a mesh segment will be the specified {{MenuCommand|Surface deviation}} multiplied by the length of the current mesh segment (edge)
* {{MenuCommand|Apply face colors to mesh}}: If checked, the mesh will get the face colors of the object
* {{MenuCommand|Apply face colors to mesh}}: If checked, the mesh will get the face colors of the object
* {{MenuCommand|Define segments by face colors}}: If checked, mesh segments will be grouped according to the color of the object faces. These groups will be exported for mesh output formats supporting this feature (e.g. the format [https://en.wikipedia.org/wiki/Wavefront_.obj_file OBJ]).
* {{MenuCommand|Define segments by face colors}}: If checked, mesh segments will be grouped according to the color of the object faces. These groups will be exported for mesh output formats supporting this feature (e.g. the format [https://en.wikipedia.org/wiki/Wavefront_.obj_file OBJ]).


===Mefisto Mesher===<!--T:14-->
===Mefisto Mesher=== <!--T:12-->


<!--T:9-->
<!--T:13-->
[[Image:Mesh_Mesher_Mefisto.jpg]]
[[Image:Mesh_Mesher_Mefisto.jpg]]


<!--T:10-->
<!--T:14-->
The only setting is:
The only setting is:
*{{MenuCommand|Maximum edge length}}: If this number is smaller the mesh becomes finer. The smallest value is 0.
*{{MenuCommand|Maximum edge length}}: If this number is smaller the mesh becomes finer. The smallest value is 0.


===Netgen Mesher===<!--T:15-->
===Netgen Mesher=== <!--T:15-->


<!--T:11-->
<!--T:16-->
[[Image:Mesh_Mesher_Netgen.jpg]]
[[Image:Mesh_Mesher_Netgen.jpg]]


<!--T:12-->
<!--T:17-->
You can choose between mesh being:
You can choose between mesh {{MenuCommand|Fineness }} being:
*{{MenuCommand|Very coarse}}
*{{MenuCommand|Very coarse}}
*{{MenuCommand|Coarse}}
*{{MenuCommand|Coarse}}
Line 51: Line 72:
*{{MenuCommand|Fine}}
*{{MenuCommand|Fine}}
*{{MenuCommand|Very fine}}
*{{MenuCommand|Very fine}}
*{{MenuCommand|User defined}}
*{{MenuCommand|User defined}}<br />For Mesh being "user defined" you can set these values:<br />{{MenuCommand|Mesh size grading}}: If this parameter is smaller, mesh becomes finer. A value in the range of 0.1-1.<br />{{MenuCommand|Element per edge}}: If this parameter is larger, mesh becomes finer. A value in the range of 0.2-10.<br />{{MenuCommand|Element per curvature radius}}: If this parameter is larger, mesh becomes finer. A value in the range of 0.2-10.
:For this you can set these values:
:{{MenuCommand|Mesh size grading}}: If this parameter is smaller, the mesh becomes finer. A value in the range of 0.1-1.
:{{MenuCommand|Element per edge}}: If this parameter is larger, the mesh becomes finer. A value in the range of 0.2-10.
:{{MenuCommand|Element per curvature radius}}: If this parameter is larger, the mesh becomes finer. A value in the range of 0.2-10.


<!--T:18-->
For every main option you can also choose:
*{{MenuCommand|Optimize surface}}: Whether optimization of surface shape will be done.
For every {{MenuCommand|Fineness}} you can also choose:
*{{MenuCommand|Second order elements}}: Whether second order elments will be generated.
*{{MenuCommand|Optimize surface}}: Whether an optimization of surface shape will be done.
*{{MenuCommand|Quad dominant}}: Whether meshes will be arranged like hexahedral.
*{{MenuCommand|Second order elements}}: Whether second order elements will be generated.
*{{MenuCommand|Quad dominated}}: Whether meshes will be arranged preferably using [https://en.wikipedia.org/wiki/Types_of_mesh#Two-dimensional quadrilateral faces].


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

<!--T:20-->
This tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:


<!--T:16-->
This tool can be used in [[macros]] and from the [[Python]] console by using the following function:
</translate>
</translate>
{{Code|code=
{{Code|code=
Line 68: Line 95:
<translate>
<translate>


<!--T:17-->
<!--T:21-->
Example:
Example:

</translate>
</translate>
{{Code|code=
{{Code|code=
Line 87: Line 115:
<translate>
<translate>


==Notes== <!--T:6-->
==Notes== <!--T:22-->
* Tutorial: [[Export_to_STL_or_OBJ|Export_to_STL_or_OBJ]]
* Tutorial: [[Export_to_STL_or_OBJ|Export_to_STL_or_OBJ]]


<!--T:19-->
<!--T:23-->
{{Docnav
{{Docnav|[[Mesh Export|Export Mesh]]|[[Mesh CurvaturePlot|Curvature Plot]]|[[Mesh_Workbench|Mesh]]|IconL=Mesh_ExportMesh.png|IconC=Workbench_Mesh.svg|IconR=Mesh_CurvaturePlot.png}}
|[[Mesh Export|Export Mesh]]
|[[Mesh CurvaturePlot|Curvature Plot]]
|[[Mesh_Workbench|Mesh]]
|IconL=Mesh_ExportMesh.png
|IconC=Workbench_Mesh.svg
|IconR=Mesh_CurvaturePlot.png
}}


<!--T:20-->
<!--T:24-->
{{Mesh Tools navi}}
{{Mesh Tools navi}}


<!--T:21-->
<!--T:25-->
{{Userdocnavi}}
{{Userdocnavi}}



Revision as of 09:55, 30 October 2019

Mesh MeshFromShape‏‎

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

Introduction

This command creates a mesh from a shape object.

Usage

There are two methods:

  1. Either select the shape object, then choose Meshes Create Mesh from shape... from the top menu.
  2. Just selecting Meshes Create Mesh from shape... will give you an additional menu to choose your shape to mesh.

In both cases you get a menu that asks for the mesher program to use and its settings.
The settings you make there will be stored and used as default for the next time you create a mesh from a shape. introduced in version 0.19.

Mesher program

You can choose one of these 3 mesher programs:

Standard Mesher

You can change these settings:

  • Surface deviation: Maximal linear deflection of a mesh section from the surface of the object
  • Angular deviation: Maximal angular deflection from one mesh section to the next section
  • Relative surface deviation: If checked, the maximal 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 color of the object faces. These groups will be exported for mesh output formats supporting this feature (e.g. the format OBJ).

Mefisto Mesher

The only setting is:

  • Maximum edge length: If this number is smaller the mesh becomes finer. The smallest value is 0.

Netgen Mesher

You can choose between mesh Fineness being:

  • Very coarse
  • Coarse
  • Moderate
  • Fine
  • Very fine
  • User defined
For this you can set these values:
Mesh size grading: If this parameter is smaller, the mesh becomes finer. A value in the range of 0.1-1.
Element per edge: If this parameter is larger, the mesh becomes finer. A value in the range of 0.2-10.
Element per curvature radius: If this parameter is larger, the mesh becomes finer. A value in the range of 0.2-10.

For every Fineness you can also choose:

  • Optimize surface: Whether an optimization of surface shape will be done.
  • Second order elements: Whether second order elements will be generated.
  • Quad dominated: Whether meshes will be arranged preferably using quadrilateral faces.

Scripting

This tool can be used in macros and from the Python console by using the following function:

MeshPart.meshFromShape(Shape=Shape, MaxLength=520)

Example:

import FreeCAD, Draft, Arch, Mesh, MeshPart

Line = Draft.makeWire([FreeCAD.Vector(0, 0, 0),FreeCAD.Vector(2000, 2000, 0)])
Wall = Arch.makeWall(Line, width=150, height=3000)
FreeCAD.ActiveDocument.recompute()

Shape = Wall.Shape.copy(False)
Shape.Placement = Wall.getGlobalPlacement()

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

Notes