cut - functions for cutting meshes at edges or points, like chamfer

This module provides the chamfer and bevel functions, and the associated tools.

multicut, chamfer, and bevel are built in the same cutting algorithm. It cuts the mesh faces by propagation from the given edges. The cutting planes are determined by an offset vector from the original primitive (point or edge).

Most of the time you don’t need to set the offset yourself. It can be automatically calculated by several methods, depending on the shape you want to get. Those methods are called cutters and are executed using planeoffsets.

end-user functions

chamfer(mesh, indices, cutter)
chamfer(mesh: madcad.mesh.Mesh, edges, cutter)
chamfer(web: madcad.mesh.Web, points, cutter)
chamfer(wire: madcad.mesh.Wire, points, cutter)

chamfer a Mesh/Web/Wire around the given edges/points, using the given cutter

This is a chamfer on edges around a cube corner

../_images/chamfer.png
bevel(mesh, indices, cutter)
bevel(mesh: madcad.mesh.Mesh, edges, cutter, resolution=None)
bevel(obj: madcad.mesh.Web, points, cutter, resolution=None)
bevel(wire: madcad.mesh.Wire, points, cutter, resolution=None)

bevel a Mesh/Web/Wire around the given edges/points, using the given cutter

This is a bevel on edges around a cube corner

../_images/bevel.png
multicut(mesh, indices, cutter)
multicut(mesh: madcad.mesh.Mesh, edges, cutter, conn=None, prec=None, removal=None)
multicut(web: madcad.mesh.Web, points, cutter, conn=None, prec=None, removal=None)
multicut(wire: madcad.mesh.Wire, points, cutter)

cut a Mesh/Web/Wire around the given edges/points, using the given cutter

This is the result on edges around a cube corner

../_images/multicut.png

cutters (cut methods)

../_images/cutter.svg
cutter_width(width, fn1, fn2)

plane offset for a cut based on the width of the bevel

cutter_distance(depth, fn1, fn2)

plane offset for a cut based on the distance along the side faces

Warning

this cut method can be unstable at the moment

cutter_depth(dist, fn1, fn2)

plane offset for a cut based on the distance to the cutted edge

cutter_radius(depth, fn1, fn2)

plane offset for a cut based on the angle between faces

helpers

mesh_cut(mesh, start, cutplane, stops, conn, prec, removal, cutghost=True)

propagation cut for an edge

Start

the edge or point to start propagation from

Cutplane

the plane cutting the faces. Its normal must be oriented toward the propagation area.

Stops

the planes stopping the propagation. Their normal must be oriented toward the propagation area.

Removal

the set in wich the function will put the indices of faces inside

Cutghost

whether the function should propagate on faces already marked for removal (previously or during the propagation)

web_cut(web, start, cutplane, conn, prec, removal)

propagation cut for a point

Start

the edge or point to start propagation from

Cutplane

the plane cutting the faces. Its normal must be oriented toward the propagation area.

planeoffsets(mesh, edges, cutter)

compute the offsets for cutting planes using the given method cutter is a tuple or a function

  • function(fn1,fn2) -> offset

    fn1, fn2 are the adjacents face normals offset is the distance from segment to plane times the normal to the plane

  • (‘method’, distance)

    the method is the string name of the method (a function named ‘cutter’+method existing in this module) distance depends on the method and is the numeric parameter of the method

tangentjunction(points, match, normals, div)

create a surface joining the given couples of points, tangent to the two sides normals is a dict {point: normal}

tangentcorner(pts, lp, normals, div)

create a rounded surface tangent to the loop given normals is a dict {point: normal}

tangentend(points, edge, normals, div)

join a tangent surface resulting of tangentcorner or tangentjunction to a straight edge e normals is the same dict as for tangentcorner and tangentjunction