|
|
| Menu location |
|---|
| Meshes → Cutting → Trim |
| Workbenches |
| Mesh |
| Default shortcut |
| None |
| Introduced in version |
| - |
| See also |
| Mesh PolyCut, Mesh TrimByPlane |
The Mesh PolyTrim command trims faces and parts of faces from mesh objects.
See also: FreeCAD Scripting Basics.
To trim a mesh with a polygon use its trim method.
import FreeCAD as App
import Mesh
# Create a non-parametric box-shaped mesh:
msh = App.ActiveDocument.addObject("Mesh::Feature", "Mesh")
msh.Mesh = Mesh.createBox(30, 40, 50)
msh.ViewObject.DisplayMode = "Flat Lines"
# Define some points:
p1 = App.Vector(0, 0, 0)
p2 = App.Vector(60, 0, 0)
p3 = App.Vector(60, 60, 0)
# We need to work on a copy of the msh.Mesh object:
new_msh = msh.Mesh.copy()
# Trim that copy:
new_msh.trim([p1, p2, p3], 0) # 2nd argument: 0=inner, 1=outer.
# Update msh.Mesh:
msh.Mesh = new_msh