generation - functions to generate mesh surfaces from lines or meshes

based on extrusion/transformation of a Web

extrans(section, transformations, links) madcad.mesh.Mesh

create a surface by extruding and transforming the given outline.


iterable of mat4, one each section


iterable of tuples (a,b,t) with: (a,b) the sections to link (indices of values returned by transformation). t the group number of that link, to combine with the section groups

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

saddle(web1, web2)

create a surface by extruding outine1 translating each instance to the next point of outline2

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


generation of common meshes

square(axis, width: float) madcad.mesh.Mesh

return a simple square with the given normal axis and square width. Useful to quickly create a cutplane

brick(*args, **kwargs) madcad.mesh.Mesh

a simple brick with rectangular sides


  • brick(Box)

  • brick(min, max)

  • brick(center=vec3(0), width=vec3(-inf))

icosahedron(center, radius) madcad.mesh.Mesh

a simple icosahedron (see

icosphere(center, radius, resolution=None) madcad.mesh.Mesh

a simple icosphere with an arbitrary resolution (see

Points are obtained from a subdivided icosahedron and reprojected on the desired radius.

uvsphere(center, radius, alignment=dvec3(0, 0, 1), resolution=None) madcad.mesh.Mesh

a simple uvsphere (simple sphere obtained with a revolution of an arc)

regon(axis, radius, n, alignment=None) madcad.mesh.Wire

create a regular n-gon Wire, the same way we create a Circle



inflateoffsets(surf, distance, method='face') [vec3]

displacements vectors for points of a surface we want to inflate.


determines if the distance is from the old to the new faces, edges or points possible values: 'face', 'edge', 'point'

inflate(surf, distance, method='face') madcad.mesh.Mesh

move all points of the surface to make a new one at a certain distance of the last one


determines if the distance is from the old to the new faces, edges or points

thicken(surf, thickness, alignment=0, method='face') madcad.mesh.Mesh

thicken a surface by extruding it, points displacements are made along normal.


determines the distance between the two surfaces (can be negative to go the opposite direction to the normal).


specifies which side is the given surface: 0 is for the first, 1 for the second side, 0.5 thicken all apart the given surface.


determines if the thickness is from the old to the new faces, edges or points



flatsurface(outline, normal=None) madcad.mesh.Mesh

generates a surface for a flat outline using the prefered triangulation method .

if normal is specified, it must be the normal vector to the plane, and will be used to orient the face.

icosurface(pts, ptangents, resolution=None) madcad.mesh.Mesh

generate a surface ICO (a subdivided triangle) with its points interpolated using interpol2tri.

  • If normals are given instead of point tangents (for ptangents), the surface will fit a sphere.

  • Else ptangents must be a list of couples (2 edge tangents each point).

subdivide(mesh, div=1) madcad.mesh.Mesh

subdivide all faces by the number of cuts

repeat(pattern, n, trans)

create a mesh duplicating n times the given pattern, each time applying the given transform.


can either be a Mesh, Web or Wire the return type will depend on the input type


the number of repetitions


is the transformation between each duplicate