Part ShapeFromMesh: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:7-->
<!--T:7-->
{{Docnav
{{Docnav
|[[Part BoxSelection|Part BoxSelection]]
|[[Part_BoxSelection|BoxSelection]]
|[[Part PointsFromMesh|PointsFromMesh]]
|[[Part_PointsFromMesh|PointsFromMesh]]
|[[Part_Module|Part]]
|[[Part_Workbench|Part]]
|IconL=Part_BoxSelection.svg
|IconL=Part_BoxSelection.svg
|IconC=Workbench_Part.svg
|IconR=Part_PointsFromMesh.svg
|IconR=Part_PointsFromMesh.svg
|IconC=Workbench_Part.svg
}}
}}


Line 15: Line 16:
|Name=Part ShapeFromMesh‏‎
|Name=Part ShapeFromMesh‏‎
|MenuLocation=Part → Create shape from mesh...
|MenuLocation=Part → Create shape from mesh...
|Workbenches=[[Part Workbench|Part]]
|Workbenches=[[Part_Workbench|Part]]
|SeeAlso=[[Part_MakeSolid|ConvertToSolid]], [[Part RefineShape|RefineShape]], [[Part_PointsFromMesh|PointsFromMesh]]
|SeeAlso=[[Part_MakeSolid|Part ConvertToSolid]], [[Part_RefineShape|Part RefineShape]], [[Part_PointsFromMesh|Part PointsFromMesh]]
}}
}}


Line 30: Line 31:


<!--T:4-->
<!--T:4-->
# Analyzing and repairing the mesh object, if needed, should be done before launching this command. Appropriate tools for this task are available in the [[File:Workbench_Mesh.svg|16px]] [[Mesh_Workbench|Mesh Workbench]].
# Select the mesh object in the [[tree_view|tree view]].
# Select the mesh object.
# Go to the menu, {{MenuCommand|Part → [[File:Part_ShapeFromMesh.svg|16px]] Create shape from mesh}}.
# Select the {{MenuCommand|Part → [[File:Part_ShapeFromMesh.svg|16px]] Create shape from mesh}} option from the menu.
# A popup-menu will ask for the tolerance for sewing shape; the default value is {{Value|0.1}}.
# A [[Shape|shape]] from the mesh object is created as a separate new object.
# The {{MenuCommand|Shape from mesh}} dialog opens.
# Optionally check the {{MenuCommand|Sew shape}} checkbox and specify a tolerance:

#* This option is usually not needed. It is meant for mesh objects that are not watertight and have small gaps between edges.
<!--T:5-->
#* If the option is selected a compound of shells, instead of a compound of faces, is created.
Analyzing and repairing of the mesh, if needed, should be done manually before launching {{Button|[[File:Part_ShapeFromMesh.svg|16px]] [[Part_ShapeFromMesh|ShapeFromMesh]]}}. Appropriate tools for this task are available in the [[File:Workbench_Mesh.svg|24px]] [[Mesh_Workbench|Mesh Workbench]].
#* The sewing operation may be computationally demanding.

# Press the {{Button|OK}} button.
<!--T:16-->
# A [[Shape|shape]] is created as a separate new object.
After creation of a [[Shape|Shape]], it may be useful to use {{Button|[[Part_ConvertToSolid|Convert to solid]]}} (necessary for [[Part_Boolean|boolean operations]]) and {{Button|[[File:Part_RefineShape.svg|16px]] [[Part_RefineShape|Refine shape]]}}.
# Optionally turn this object into a solid with [[File:Part_MakeSolid.svg|16px]] [[Part_MakeSolid|Part MakeSolid]].
# Optionally use [[File:Part_RefineShape.svg|16px]] [[Part_RefineShape|Part RefineShape]] on the final object.


== Links == <!--T:17-->
== Links == <!--T:17-->
Line 73: Line 76:
}}
}}
<translate>
<translate>



<!--T:8-->
<!--T:8-->
{{Docnav
{{Docnav
|[[Part BoxSelection|Part BoxSelection]]
|[[Part_BoxSelection|BoxSelection]]
|[[Part PointsFromMesh|PointsFromMesh]]
|[[Part_PointsFromMesh|PointsFromMesh]]
|[[Part_Module|Part]]
|[[Part_Workbench|Part]]
|IconL=Part_BoxSelection.svg
|IconL=Part_BoxSelection.svg
|IconC=Workbench_Part.svg
|IconR=Part_PointsFromMesh.svg
|IconR=Part_PointsFromMesh.svg
|IconC=Workbench_Part.svg
}}
}}



Latest revision as of 12:44, 30 January 2024

Part ShapeFromMesh‏‎

Menu location
Part → Create shape from mesh...
Workbenches
Part
Default shortcut
None
Introduced in version
-
See also
Part ConvertToSolid, Part RefineShape, Part PointsFromMesh

Introduction

The Part ShapeFromMesh command creates a shape from a mesh object. Mesh objects have limited editing capabilities in FreeCAD, converting them to shapes will allow their use with many more boolean and modification tools.

The inverse operation is Mesh FromPartShape from the Mesh Workbench.

Usage

  1. Analyzing and repairing the mesh object, if needed, should be done before launching this command. Appropriate tools for this task are available in the Mesh Workbench.
  2. Select the mesh object.
  3. Select the Part → Create shape from mesh option from the menu.
  4. The Shape from mesh dialog opens.
  5. Optionally check the Sew shape checkbox and specify a tolerance:
    • This option is usually not needed. It is meant for mesh objects that are not watertight and have small gaps between edges.
    • If the option is selected a compound of shells, instead of a compound of faces, is created.
    • The sewing operation may be computationally demanding.
  6. Press the OK button.
  7. A shape is created as a separate new object.
  8. Optionally turn this object into a solid with Part MakeSolid.
  9. Optionally use Part RefineShape on the final object.

Links

Scripting

Creating a Shape from a Mesh can be done by using the makeShapeFromMesh method from a Part TopoShape; you need to specify the source mesh and tolerance, and assign the result to a new Part Feature object.

Notice that the mesh must be recalculated before it is converted to a Shape, otherwise there won't be topology information, and the conversion won't be successful.

import FreeCAD as App
import Part

doc = App.newDocument()
mesh = doc.addObject("Mesh::Cube", "Mesh")
mesh.recompute()

solid = doc.addObject("Part::Feature", "Shape")
shape = Part.Shape()
shape.makeShapeFromMesh(mesh.Mesh.Topology, 0.1)

solid.Shape = shape
solid.Placement.Base = App.Vector(15, 0, 0)
solid.purgeTouched()
doc.recompute()