Part ShapeFromMesh: Difference between revisions
(Removed excessive space.) |
(Module to Workbench renaming.) |
||
(30 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
<languages/> |
||
<translate> |
<translate> |
||
<!--T:7--> |
<!--T:7--> |
||
{{Docnav |
|||
{{Docnav|[[Part ExportCAD|Export CAD]]|[[Part ConvertToSolid|Convert to solid]]|[[Part_Module|Part]]|IconL=Part ExportCAD.png|IconC=Workbench_Part.svg|IconR=Part_ConvertToSolid.png}} |
|||
|[[Part_BoxSelection|BoxSelection]] |
|||
|[[Part_PointsFromMesh|PointsFromMesh]] |
|||
|[[Part_Workbench|Part]] |
|||
|IconL=Part_BoxSelection.svg |
|||
|IconR=Part_PointsFromMesh.svg |
|||
|IconC=Workbench_Part.svg |
|||
}} |
|||
<!--T:2--> |
<!--T:2--> |
||
{{GuiCommand |
|||
{{GuiCommand|Name=Part ShapeFromMesh|MenuLocation=Part → Create shape from mesh...|Workbenches=[[Part Workbench|Part]]|SeeAlso=[[Part ConvertToSolid]], [[Part RefineShape]]}} |
|||
|Name=Part ShapeFromMesh |
|||
|MenuLocation=Part → Create shape from mesh... |
|||
|Workbenches=[[Part_Workbench|Part]] |
|||
|SeeAlso=[[Part_MakeSolid|Part ConvertToSolid]], [[Part_RefineShape|Part RefineShape]], [[Part_PointsFromMesh|Part PointsFromMesh]] |
|||
}} |
|||
==Introduction== <!--T: |
==Introduction== <!--T:14--> |
||
⚫ | |||
<!--T:3--> |
|||
⚫ | The {{Button|[[Image:Part_ShapeFromMesh.svg|16px]] [[Part_ShapeFromMesh|Part ShapeFromMesh]]}} command creates a shape from a [[Mesh|mesh object]]. Mesh objects have limited editing capabilities in FreeCAD, converting them to [[Shape|shapes]] will allow their use with many more boolean and modification tools. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
<!--T:21--> |
|||
The inverse operation is {{Button|[[File:Mesh_FromPartShape.svg|16px]] [[Mesh_FromPartShape|Mesh FromPartShape]]}} from the [[File:Workbench_Mesh.svg|24px]] [[Mesh_Workbench|Mesh Workbench]]. |
|||
There will be no analyzing or validating of the mesh object. |
|||
<br /> |
|||
Analyzing and repairing of the mesh (if needed) should be done manually before conversion. |
|||
<br /> |
|||
Appropriate tools are available in the [[Mesh Workbench]]. |
|||
== |
==Usage== <!--T:15--> |
||
⚫ | |||
<!--T: |
<!--T:4--> |
||
⚫ | |||
{{Docnav|[[Part ExportCAD|Export CAD]]|[[Part ConvertToSolid|Convert to solid]]|[[Part_Module|Part]]|IconL=Part ExportCAD.png|IconC=Workbench_Part.svg|IconR=Part_ConvertToSolid.png}} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
<!--T: |
<!--T:5--> |
||
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]]. |
|||
⚫ | |||
<!--T: |
<!--T:16--> |
||
⚫ | |||
⚫ | |||
== Links == <!--T:17--> |
|||
<!--T:18--> |
|||
* [https://www.youtube.com/watch?v=5lwENZeNiNg&feature=youtu.be Edit STL Files In FreeCAD] video by AllVisuals4U. |
|||
==Scripting== <!--T:13--> |
|||
<!--T:19--> |
|||
Creating a [[Shape|Shape]] from a [[Mesh|Mesh]] can be done by using the {{incode|makeShapeFromMesh}} method from a [[Part_TopoShape|Part TopoShape]]; you need to specify the source mesh and tolerance, and assign the result to a new [[Part_Feature|Part Feature]] object. |
|||
<!--T:20--> |
|||
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. |
|||
</translate> |
|||
{{Code|code= |
|||
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() |
|||
}} |
|||
<translate> |
|||
<!--T:8--> |
|||
{{Docnav |
|||
|[[Part_BoxSelection|BoxSelection]] |
|||
|[[Part_PointsFromMesh|PointsFromMesh]] |
|||
|[[Part_Workbench|Part]] |
|||
|IconL=Part_BoxSelection.svg |
|||
|IconR=Part_PointsFromMesh.svg |
|||
|IconC=Workbench_Part.svg |
|||
}} |
|||
</translate> |
</translate> |
||
⚫ | |||
⚫ | |||
{{clear}} |
{{clear}} |
Revision as of 12:58, 25 August 2021
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
- 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
0.1
. - 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 ShapeFromMesh. Appropriate tools for this task are available in the Mesh Workbench.
After creation of a Shape, it may be useful to use Convert to solid (necessary for boolean operations) and Refine shape.
Links
- Edit STL Files In FreeCAD video by AllVisuals4U.
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()
- Primitives: Box, Cylinder, Sphere, Cone, Torus, Tube, Create primitives, Shape builder
- Creation and modification: Extrude, Revolve, Mirror, Fillet, Chamfer, Make face from wires, Ruled Surface, Loft, Sweep, Section, Cross sections, 3D Offset, 2D Offset, Thickness, Projection on surface, Attachment
- Boolean: Make compound, Explode Compound, Compound Filter, Boolean, Cut, Fuse, Common, Connect, Embed, Cutout, Boolean fragments, Slice apart, Slice, XOR
- Measure: Measure Linear, Measure Angular, Measure Refresh, Clear All, Toggle All, Toggle 3D, Toggle Delta
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Start, Surface, TechDraw, Test Framework, Web
- Hubs: User hub, Power users hub, Developer hub