Arch MeshToShape: Difference between revisions

From FreeCAD Documentation
m ([[ | ]](Vertical Docnav))
(Undo revision 1124009 by David69 (talk)This is not correct.)
Tag: Undo
 
(20 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:11-->
<!--T:11-->
{{docnav
{{Docnav
|[[Arch_SplitMesh|Split Mesh]]
|[[Arch_SplitMesh|SplitMesh]]
|[[Arch_SelectNonSolidMeshes|Select non-solid meshes]]
|[[Arch_SelectNonSolidMeshes|SelectNonSolidMeshes]]
|[[Arch_Module|Arch]]
|[[Arch_Workbench|Arch]]
|IconL=Arch_SplitMesh.svg
|IconL=Arch_SplitMesh.svg
|IconR=Arch_SelectNonSolidMeshes.svg
|IconC=Workbench_Arch.svg
|IconC=Workbench_Arch.svg
|IconR=Arch_SelectNonSolidMeshes.png
}}
}}


Line 15: Line 16:
|Name=Arch MeshToShape
|Name=Arch MeshToShape
|MenuLocation=Arch → Utilities → Mesh to Shape
|MenuLocation=Arch → Utilities → Mesh to Shape
|Workbenches=[[Arch Module|Arch]]
|Workbenches=[[Arch_Workbench|Arch]]
|SeeAlso=[[Arch SplitMesh|Arch SplitMesh]], [[Arch RemoveShape|Arch RemoveShape]]
|SeeAlso=[[Arch_SplitMesh|Arch SplitMesh]], [[Arch_RemoveShape|Arch RemoveShape]]
}}
}}


Line 22: Line 23:


<!--T:3-->
<!--T:3-->
[[Arch_MeshToShape|Arch MeshToShape]] converts a selected [[Mesh|Mesh]] ([[Mesh_Feature|Mesh Feature]]) object into a [[Shape|Shape]] ([[Part_Feature|Part Feature]]) object.
This tool converts a selected [[Mesh Module|Mesh]] object into a [[Part Module|Shape]] object. Note that this tool is optimized for objects with flat faces (no curves). The corresponding tool from the {{KEY|[[Image:Workbench_Part.svg|16px]] [[Part Workbench]]}} might be more suited for objects that contain curved surfaces.


==How to use== <!--T:4-->
<!--T:17-->
This tool is optimized for objects with flat faces (no curves). The corresponding tool {{Button|[[File:Part_ShapeFromMesh.svg|16px]] [[Part_ShapeFromMesh|Part ShapeFromMesh]]}} from the [[Image:Workbench_Part.svg|16px]] [[Part_Workbench|Part Workbench]] might be more suited for objects that contain curved surfaces.

==Usage== <!--T:4-->


<!--T:5-->
<!--T:5-->
# Select a mesh object.
# Select a mesh object.
# Press the {{Button|[[Image:Arch MeshToShape.svg|16px]] [[Arch MeshToShape|Mesh to Shape]]}} entry in {{MenuCommand|Arch → Utilities → Mesh to Shape}}.
# Press the {{Button|[[Image:Arch MeshToShape.svg|16px]] [[Arch_MeshToShape|Mesh to Shape]]}} entry in {{MenuCommand|Arch → Utilities → Mesh to Shape}}.


==Scripting== <!--T:6-->
==Properties== <!--T:15-->

{{Emphasis|See also:}} [[Arch API|Arch API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
==Limitations== <!--T:16-->

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

<!--T:6-->
{{Emphasis|See also:}} [[Arch_API|Arch API]] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].


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


<!--T:8-->
<!--T:8-->
* Turns the given {{incode|obj}}, a mesh, into a shape, joining coplanar facets.
The above code snippet converts the given {{incode|obj}} (a mesh), into a shape, joining coplanar facets.
* If {{incode|mark}} is {{incode|True}}, non-solid objects will be marked in red.
* If {{incode|mark}} is {{incode|True}}, non-solid objects will be marked in red.
* If {{incode|fast}} is {{incode|True}} it uses a faster algorithm by building a shell from the facets then removing splitter.
* If {{incode|fast}} is {{incode|True}}, it uses a faster algorithm by building a shell from the facets then removing splitter.
* {{incode|tol}} is the tolerance used when converting mesh segments to wires.
* {{incode|tol}} is the tolerance used when converting mesh segments to wires.
* If {{incode|flat}} is {{incode|True}} it will force the wires to be perfectly planar, to be sure they can be turned into faces, but this might leave gaps in the final shell.
* If {{incode|flat}} is {{incode|True}}, it will force the wires to be perfectly planar to be sure they can be converted into faces, but this might leave gaps in the final shell.
* If {{incode|cut}} is {{incode|True}} holes in faces are made by subtraction.
* If {{incode|cut}} is {{incode|True}}, holes in faces are made by subtraction.
</translate>


<!--T:18-->
Example:
</translate>
{{Code|code=
{{Code|code=
import Arch, Mesh, BuildRegularGeoms
import Arch, Mesh, BuildRegularGeoms
Line 62: Line 74:
}}
}}
<translate>
<translate>



<!--T:12-->
<!--T:12-->
{{docnav
{{Docnav
|[[Arch_SplitMesh|Split Mesh]]
|[[Arch_SplitMesh|SplitMesh]]
|[[Arch_SelectNonSolidMeshes|Select non-solid meshes]]
|[[Arch_SelectNonSolidMeshes|SelectNonSolidMeshes]]
|[[Arch_Module|Arch]]|IconL=Arch_SplitMesh.svg
|[[Arch_Workbench|Arch]]
|IconL=Arch_SplitMesh.svg
|IconR=Arch_SelectNonSolidMeshes.svg
|IconC=Workbench_Arch.svg
|IconC=Workbench_Arch.svg
|IconR=Arch_SelectNonSolidMeshes.png
}}
}}


<!--T:13-->
{{Arch Tools navi}}

<!--T:14-->
{{Userdocnavi}}
</translate>
</translate>
{{Arch Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 13:47, 3 April 2022

Arch MeshToShape

Menu location
Arch → Utilities → Mesh to Shape
Workbenches
Arch
Default shortcut
None
Introduced in version
-
See also
Arch SplitMesh, Arch RemoveShape

Description

Arch MeshToShape converts a selected Mesh (Mesh Feature) object into a Shape (Part Feature) object.

This tool is optimized for objects with flat faces (no curves). The corresponding tool Part ShapeFromMesh from the Part Workbench might be more suited for objects that contain curved surfaces.

Usage

  1. Select a mesh object.
  2. Press the Mesh to Shape entry in Arch → Utilities → Mesh to Shape.

Properties

Limitations

Scripting

See also: Arch API and FreeCAD Scripting Basics.

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

new_obj = meshToShape(obj, mark=True, fast=True, tol=0.001, flat=False, cut=True)

The above code snippet converts the given obj (a mesh), into a shape, joining coplanar facets.

  • If mark is True, non-solid objects will be marked in red.
  • If fast is True, it uses a faster algorithm by building a shell from the facets then removing splitter.
  • tol is the tolerance used when converting mesh segments to wires.
  • If flat is True, it will force the wires to be perfectly planar to be sure they can be converted into faces, but this might leave gaps in the final shell.
  • If cut is True, holes in faces are made by subtraction.

Example:

import Arch, Mesh, BuildRegularGeoms

Box = FreeCAD.ActiveDocument.addObject("Mesh::Cube", "Cube")
Box.Length = 1000
Box.Width = 2000
Box.Height = 1000
FreeCAD.ActiveDocument.recompute()

new_obj = Arch.meshToShape(Box)