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.

Transformations

iterable of mat4, one each section

Link

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)

../_images/generation-extrusion.png
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

../_images/generation-revolution.png
saddle(web1, web2)

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

../_images/generation-saddle.png
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

../_images/generation-tube.png

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

../_images/generation-square.png
brick(*args, **kwargs) madcad.mesh.Mesh

a simple brick with rectangular sides

constructors

  • brick(Box)

  • brick(min, max)

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

../_images/generation-brick.png
icosahedron(center, radius) madcad.mesh.Mesh

a simple icosahedron (see https://en.wikipedia.org/wiki/Icosahedron)

../_images/generation-icosahedron.png
icosphere(center, radius, resolution=None) madcad.mesh.Mesh

a simple icosphere with an arbitrary resolution (see https://en.wikipedia.org/wiki/Geodesic_polyhedron).

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

../_images/generation-icosphere.png
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)

../_images/generation-uvsphere.png
regon(axis, radius, n, alignment=None) madcad.mesh.Wire

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

../_images/generation-regon.png

offseting

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

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

Method

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

Method

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

../_images/generation-inflate.png
thicken(surf, thickness, alignment=0, method='face') madcad.mesh.Mesh

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

Thickness

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

Alignment

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.

Method

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

../_images/generation-thicken.png

others

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.

../_images/generation-flatsurface.png
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.

Pattern

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

N

the number of repetitions

Trans

is the transformation between each duplicate