|Part → Create shape from mesh...|
|Introduced in version|
|ConvertToSolid, RefineShape, PointsFromMesh|
- Select the mesh object in the tree view.
- Go to the menu, Part → Create shape from mesh.
- A popup-menu will ask for the tolerance for sewing shape; the default value is
- A shape from the mesh object is created as a separate new object.
Analyzing and repairing of the mesh, if needed, should be done manually before launching Mesh Workbench.. Appropriate tools for this task are available in the
- Edit STL Files In FreeCAD video by AllVisuals4U.
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()