Reference

Warning

The module is still in alpha version and the API may change a lot before release.

submodules

Tip

Most of the submodule functions and classes are present in the madcad root module, so unless you write a library you won’t need to import them explicitly.

solvers

solve(constraints, fixed=(), *args, **kwargs)

short hand to use the class Problem

solvekin(joints, fixed=(), precision=0.0001, maxiter=None, damping=1)

solver for kinematic joint constraints.

Unlike solve, the present solver is dedicated to kinematic usage (and far more efficient and precise). It doesn’t rely on variables as defined by solve, but instead use Solids as constraints.

volume boolean operators

difference(a, b) madcad.mesh.Mesh

return a mesh for the volume of a less the common volume with b It is a boolean with selector (False, True)

union(a, b) madcad.mesh.Mesh

return a mesh for the union of the volumes. It is a boolean with selector (False,False)

intersection(a, b) madcad.mesh.Mesh

return a mesh for the common volume. It is a boolean with selector (True, True)

generation functions

extrusion(trans, line, alignment=0)

create a surface by extruding the given outline by a transformation

:param : line: a line (Web or Wire) or a surface (Mesh) to extrude :param : trans: any transformation object accepted by mathutils.transform :param : alignment: when > 0 the line is extruded both sides (the transformation is linearly interpoled)

revolution(angle, axis, profile, resolution=None)

create a revolution surface by extruding the given outline steps is the number of steps between the start and the end of the extrusion

tube(outline, path, end=True, section=True)

create a tube surface by extrusing the outline along the path if section is True, there is a correction of the segments to keep the section undeformed by the curve

blending functions

junction(*args, center=None, tangents='normal', weight=1.0, match='length', resolution=None)

join several outlines with a blended surface

tangents:

‘straight’ no interpolation, straight lines ‘normal’ interpolated surface starts normal to the interfaces ‘tangent’ interpolated surface starts tangent to the interfaces

weight:

factor applied on the tangents before passing to interpol2 or intri_smooth the resulting tangent is computed in point a as weight * distance(a,b) * normalize(tangent[a])

match:

‘length’ share the outline between 2 matched points to assign the same length to both sides ‘corner’ split the curve to share around a corner

center:

position of the center of the junction node used to determine connexion between interfaces can be usefull for particularly weird and ambiguous interfaces

Note

match method ‘corner’ is not yet implemented

blendpair(*interfaces, match='length', tangents='tangent', weight=1.0, resolution=None) madcad.mesh.Mesh

blend between a pair of interfaces

match:

‘length’, ‘closest’ refer to match_* in this module

see junction for the other parameters.

blendloop(interface, center=None, tangents='tangent', weight=1.0, resolution=None) madcad.mesh.Mesh

blend inside a loop interface

see junction for the parameters.

cut 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

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

standard parts

pyadcad contains a collection of functions to generate some of the most standard parts. checkout module module standard and module gear