TPMS, strut, and face lattices#

TPMS lattices#

Every TPMS builder returns a pyvcad.MappedImplicitLattice (or a pyvcad.MappedStructureCollection for a multi-map collection) in either "sheet" or "solid" mode.

pyvcad_metamaterials.tpms(cell_map, kind, mode='sheet', wall_thickness=1.0, level=0.0)[source]#

Evaluate a standard or custom periodic implicit unit cell in a CellMap.

The unit cell repeats once per map cell, so the cell size comes from cell_map. The cell’s scalar field is converted to an approximate signed distance in world millimetres through the map Jacobian, so wall thickness and level stay physical lengths on stretched or curved maps.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • kind (str | pv.ImplicitUnitCell) – A name from TPMS_NAMES ("gyroid", "schwarz_p", …) or a custom pv.ImplicitUnitCell.

  • mode (str) – "sheet" (default) builds a wall of wall_thickness centred on the mid-surface. "solid" fills one side of the mid-surface, offset by level.

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only in "sheet" mode.

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0. The solid is where the signed distance to the mid-surface is below level, so a positive value grows it. Used only in "solid" mode.

Controls accept a number, a pv.FloatAttribute field sampled at each point (plain x, y, z are in mm; cell_map.logical_position and friends give cell coordinates), or a Python function f(x, y, z, d) that is compiled with numba.cfunc.

Returns:

a pv.MappedImplicitLattice for one map, or a pv.MappedStructureCollection when cell_map is a pv.CellMapCollection holding more than one map.

Return type:

pv.Node

Raises:

TypeError – If kind is neither a name nor a pv.ImplicitUnitCell.

Example

>>> node = mm.tpms(cell_map, "schwarz_p", wall_thickness=1.0)
pyvcad_metamaterials.TPMS_NAMES#

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Names accepted by tpms(): fischer_koch_s, frd, gyroid, iwp, lidinoid, neovius, schwarz_d, schwarz_p, split_p.

pyvcad_metamaterials.gyroid(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped gyroid TPMS lattice.

Schoen gyroid surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "gyroid", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.gyroid(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.schwarz_p(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped Schwarz P TPMS lattice.

Schwarz Primitive surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "schwarz_p", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.schwarz_p(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.schwarz_d(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped Schwarz D TPMS lattice.

Schwarz Diamond surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "schwarz_d", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.schwarz_d(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.neovius(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped Neovius TPMS lattice.

Neovius surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "neovius", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.neovius(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.iwp(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped I-WP TPMS lattice.

Schoen I-WP surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "iwp", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.iwp(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.lidinoid(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped lidinoid TPMS lattice.

Lidinoid surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "lidinoid", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.lidinoid(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.split_p(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped split P TPMS lattice.

Split P surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "split_p", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.split_p(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.fischer_koch_s(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped Fischer-Koch S TPMS lattice.

Fischer-Koch S surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "fischer_koch_s", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.fischer_koch_s(cell_map, wall_thickness=1.2)
pyvcad_metamaterials.frd(cell_map, wall_thickness=1.0, mode='sheet', level=0.0)[source]#

Build a mapped F-RD TPMS lattice.

Schoen F-RD surface (nodal approximation).

The surface repeats once per map cell. Equivalent to tpms(cell_map, "frd", mode=mode, wall_thickness=wall_thickness, level=level); see tpms() for details.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • wall_thickness (float | pv.FloatAttribute | callable) – Total sheet wall thickness in mm, default 1.0. Must stay positive. Used only when mode="sheet".

  • mode (str) – "sheet" (default) or "solid".

  • level (float | pv.FloatAttribute | callable) – Solid level offset in mm, default 0.0; a positive value grows the solid. Used only when mode="solid".

Returns:

a pv.MappedImplicitLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.frd(cell_map, wall_thickness=1.2)

Strut (graph) lattices#

Every strut builder returns a pyvcad.MappedGraphLattice (or a pyvcad.MappedStructureCollection for a multi-map collection).

pyvcad_metamaterials.graph_lattice(cell_map, unit_cell, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Tile a standard or custom graph (strut) cell through a CellMap.

One copy of the cell fills each map cell. Struts are curved to follow the map, and every radius is a physical length in millimetres.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • unit_cell (str | pv.GraphUnitCell | list) – A name from LATTICE_NAMES ("bcc", "octet", …), a pv.GraphUnitCell with vertices in [0, 1], or a list of edges ((x0, y0, z0), (x1, y1, z1)) in normalized cell coordinates spanning [-0.5, 0.5].

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere added at every unit-cell vertex. None (default) adds no joint spheres.

  • curve_tolerance (float) – Largest chord error in mm allowed when a strut is subdivided to follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Radius in mm of the smooth blend that fillets the nodes where distinct struts and joints meet, default 0.0 (sharp). A field needs pv.ScalarParameter bounds. Struts shared by neighbouring cells count once, so they never bulge.

Controls accept a number, a pv.FloatAttribute field sampled at each point (plain x, y, z are in mm), or a Python function f(x, y, z, d) that is compiled with numba.cfunc.

Returns:

a pv.MappedGraphLattice for one map, or a pv.MappedStructureCollection when cell_map is a pv.CellMapCollection holding more than one map.

Return type:

pv.Node

Example

>>> node = mm.graph_lattice(cell_map, "bcc", beam_radius=1.0)
pyvcad_metamaterials.LATTICE_NAMES#

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Names accepted by graph_lattice(): bcc, column, columns, cubic, diamond, fcc, fluorite, hex_prism_central_axis, hex_prism_diamond, hex_prism_edge, hex_prism_laves, hex_prism_vertex_centroid, isotruss, kelvin, oct_vertex_centroid, octet, reentrant_3d, reentrant_hex_prism, rhombic_dodecahedron, rotated_square_prism_edge, rotated_triangular_prism_edge, tet_oct_vertex_centroid, triangular_prism_edge, truncated_cube, weaire_phelan.

pyvcad_metamaterials.cubic(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped simple cubic strut lattice.

The twelve edges of the cube.

Equivalent to graph_lattice(cell_map, "cubic", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.cubic(cell_map, beam_radius=0.7)
pyvcad_metamaterials.bcc(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped body-centred cubic (BCC) strut lattice.

The four body diagonals through the cell centre.

Equivalent to graph_lattice(cell_map, "bcc", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.bcc(cell_map, beam_radius=0.7)
pyvcad_metamaterials.fcc(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped face-centred cubic (FCC) strut lattice.

The twelve face diagonals.

Equivalent to graph_lattice(cell_map, "fcc", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.fcc(cell_map, beam_radius=0.7)
pyvcad_metamaterials.kelvin(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped Kelvin strut lattice.

The edges of a truncated octahedron (Kelvin cell).

Equivalent to graph_lattice(cell_map, "kelvin", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.kelvin(cell_map, beam_radius=0.7)
pyvcad_metamaterials.octet(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped octet truss strut lattice.

Face-centre to corner struts plus the octahedron joining the six face centres.

Equivalent to graph_lattice(cell_map, "octet", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.octet(cell_map, beam_radius=0.7)
pyvcad_metamaterials.diamond(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped diamond strut lattice.

Tetrahedral bonds of the diamond cubic structure.

Equivalent to graph_lattice(cell_map, "diamond", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.diamond(cell_map, beam_radius=0.7)
pyvcad_metamaterials.isotruss(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped Isotruss strut lattice.

Cube edges, centre-to-corner and centre-to-face struts (SC + BCC + SCC topology).

Equivalent to graph_lattice(cell_map, "isotruss", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.isotruss(cell_map, beam_radius=0.7)
pyvcad_metamaterials.fluorite(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped fluorite strut lattice.

Fluorite crystal net: face-centred sites joined to the eight tetrahedral sites.

Equivalent to graph_lattice(cell_map, "fluorite", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.fluorite(cell_map, beam_radius=0.7)
pyvcad_metamaterials.hex_prism_edge(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)[source]#

Build a mapped hexagonal prism strut lattice.

Edge network of a regular hexagonal prism extruded along W. Use hex_prism_reference_aspect_ratio() as the U/V cell pitch ratio to keep the hexagons regular.

Equivalent to graph_lattice(cell_map, "hex_prism_edge", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.hex_prism_edge(cell_map, beam_radius=0.7)
pyvcad_metamaterials.reentrant_hex_prism(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, angle_degrees=-30.0, rib_ratio=2.0, member_blend_radius=0.0)[source]#

Build a mapped re-entrant (auxetic) hexagonal prism strut lattice.

An extruded re-entrant honeycomb graph, regenerated from angle_degrees and rib_ratio and tiled through cell_map with graph_lattice(). To keep the intended geometry, give the map the U/V pitch ratio from reentrant_hex_prism_reference_aspect_ratio() with the same two parameters.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • angle_degrees (float) – Inclined-member angle in degrees, strictly between -90 and 0, default -30.

  • rib_ratio (float) – Vertical-to-inclined member length ratio, positive, default 2.0.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Raises:

ValueError – If angle_degrees or rib_ratio is out of range.

Example

>>> node = mm.reentrant_hex_prism(cell_map, beam_radius=0.5, angle_degrees=-20.0)
pyvcad_metamaterials.rhombic_dodecahedron(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped rhombic-dodecahedron foam strut lattice.

The Voronoi edges of FCC sites: rhombic dodecahedra filling space.

Equivalent to graph_lattice(cell_map, "rhombic_dodecahedron", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.rhombic_dodecahedron(cell_map, beam_radius=0.7)
pyvcad_metamaterials.weaire_phelan(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped Weaire-Phelan foam strut lattice.

The Voronoi edges of the A15 sites: two pentagonal dodecahedra and six tetrakaidecahedra per cell, four struts at every node.

Equivalent to graph_lattice(cell_map, "weaire_phelan", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.weaire_phelan(cell_map, beam_radius=0.7)
pyvcad_metamaterials.truncated_cube(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped truncated-cube strut lattice.

The edges of the truncated cubic honeycomb (truncated cubes and octahedra); every strut lies in a cell face plane.

Equivalent to graph_lattice(cell_map, "truncated_cube", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.truncated_cube(cell_map, beam_radius=0.7)
pyvcad_metamaterials.column(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped column strut lattice.

One W column per cell, tied at its ends to the cell corners by X struts in the faces.

Equivalent to graph_lattice(cell_map, "column", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.column(cell_map, beam_radius=0.7)
pyvcad_metamaterials.columns(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped two-column strut lattice.

Two W columns per cell at the centres of the cell’s U and V edges, tied by a half-pitch square grid in every layer.

Equivalent to graph_lattice(cell_map, "columns", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.columns(cell_map, beam_radius=0.7)
pyvcad_metamaterials.reentrant_3d(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, angle_degrees=-30.0, rib_ratio=2.0, member_blend_radius=0.0)[source]#

Build a mapped three-dimensional re-entrant (auxetic) strut lattice.

Two orthogonal families of the planar re-entrant pattern of reentrant_hex_prism(), turned so the re-entrant direction is W, share their W ribs; compression along W pulls the cells in along both U and V. Give the map the U:V:W proportions from reference_cell_size() with the same two parameters to keep the requested angle.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • angle_degrees (float) – Inclined-member angle in degrees, strictly between -90 and 0, default -30.

  • rib_ratio (float) – W-rib to inclined member length ratio, positive, default 2.0.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Raises:

ValueError – If angle_degrees or rib_ratio is out of range.

Example

>>> u, v, w = mm.reference_cell_size("reentrant_3d")
>>> node = mm.reentrant_3d(cell_map, beam_radius=0.4, angle_degrees=-25.0)
pyvcad_metamaterials.triangular_prism_edge(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped triangular-prism (strut triangular honeycomb) strut lattice.

Edges of triangular prisms extruded along W, one edge family along U. Keep U:V = 1:sqrt(3) for equilateral triangles.

Equivalent to graph_lattice(cell_map, "triangular_prism_edge", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.triangular_prism_edge(cell_map, beam_radius=0.7)
pyvcad_metamaterials.rotated_triangular_prism_edge(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped rotated triangular-prism strut lattice.

Triangular prisms turned 90 degrees, one edge family along V (U:V = sqrt(3):1).

Equivalent to graph_lattice(cell_map, "rotated_triangular_prism_edge", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.rotated_triangular_prism_edge(cell_map, beam_radius=0.7)
pyvcad_metamaterials.rotated_square_prism_edge(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped rotated square-prism strut lattice.

Square prisms turned 45 degrees about W: X struts in every layer and W struts at the cell’s vertical edges and centre.

Equivalent to graph_lattice(cell_map, "rotated_square_prism_edge", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.rotated_square_prism_edge(cell_map, beam_radius=0.7)
pyvcad_metamaterials.hex_prism_vertex_centroid(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped hexagonal-prism vertex-centroid strut lattice.

Each hexagonal prism’s centre joined to its twelve corners.

Equivalent to graph_lattice(cell_map, "hex_prism_vertex_centroid", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.hex_prism_vertex_centroid(cell_map, beam_radius=0.7)
pyvcad_metamaterials.hex_prism_central_axis(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped hexagonal-prism central-axis strut lattice.

Hexagonal-prism edges plus a W column through every prism, its ends joined to the cap corners by spokes.

Equivalent to graph_lattice(cell_map, "hex_prism_central_axis", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.hex_prism_central_axis(cell_map, beam_radius=0.7)
pyvcad_metamaterials.hex_prism_diamond(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped hexagonal diamond strut lattice.

Tetrahedral bonds of hexagonal diamond (lonsdaleite): puckered hexagons in every layer joined by W bonds, on the corners of the hexagons of hex_prism_edge.

Equivalent to graph_lattice(cell_map, "hex_prism_diamond", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.hex_prism_diamond(cell_map, beam_radius=0.7)
pyvcad_metamaterials.hex_prism_laves(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped hexagonal Laves-phase strut lattice.

Bonds between the smaller atoms of the C14 Laves phase: corner- and face-sharing tetrahedra (kagome layers joined through triangles).

Equivalent to graph_lattice(cell_map, "hex_prism_laves", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.hex_prism_laves(cell_map, beam_radius=0.7)
pyvcad_metamaterials.tet_oct_vertex_centroid(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped tetrahedral-octahedral vertex-centroid strut lattice.

Each tetrahedron’s and octahedron’s centre in the tet-oct honeycomb joined to its corners.

Equivalent to graph_lattice(cell_map, "tet_oct_vertex_centroid", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.tet_oct_vertex_centroid(cell_map, beam_radius=0.7)
pyvcad_metamaterials.oct_vertex_centroid(cell_map, beam_radius=0.8, node_radius=None, curve_tolerance=0.05, member_blend_radius=0.0)#

Build a mapped octahedral face vertex-centroid strut lattice.

The face centres of the tet-oct honeycomb’s octahedra joined to their three corners.

Equivalent to graph_lattice(cell_map, "oct_vertex_centroid", beam_radius, node_radius, curve_tolerance, member_blend_radius); see graph_lattice().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells, e.g. from rectangular_cell_map().

  • beam_radius (float | pv.FloatAttribute | callable) – Strut radius in mm, default 0.8. Must stay positive.

  • node_radius (float | pv.FloatAttribute | callable | None) – Radius in mm of a sphere at every unit-cell vertex; None (default) adds none.

  • curve_tolerance (float) – Largest chord error in mm when struts follow a curved map, default 0.05.

  • member_blend_radius (float | pv.FloatAttribute | pv.ScalarParameter | callable) – Smooth-blend radius in mm that fillets the nodes, default 0.0.

Returns:

a pv.MappedGraphLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.oct_vertex_centroid(cell_map, beam_radius=0.7)
pyvcad_metamaterials.reference_cell_size(name, angle_degrees=-30.0, rib_ratio=2.0)[source]#

Return the U:V:W cell proportions that keep a catalog cell’s intended shape.

Give a map cells with these proportions (any common scale) to get regular hexagons and triangles, ideal bond angles, or the requested re-entrant angle. Cells without a preferred shape return (1, 1, 1); for extruded prism and honeycomb cells the W value is a free choice.

Parameters:
  • name (str) – A graph cell name from LATTICE_NAMES or a face cell name from FACE_LATTICE_NAMES.

  • angle_degrees (float) – For reentrant_hex_prism, reentrant_3d and reentrant_honeycomb: the inclined-member angle, default -30.

  • rib_ratio (float) – For the same cells: the rib ratio, default 2.0.

Returns:

Relative U, V, W pitches.

Return type:

tuple[float, float, float]

Example

>>> u, v, w = mm.reference_cell_size("hex_prism_diamond")
>>> pitch = 8.0 / v   # 8 mm along V
>>> cell_map = mm.rectangular_cell_map(bounds, cell_size=(u * pitch, v * pitch, w * pitch))
pyvcad_metamaterials.hex_prism_reference_aspect_ratio()[source]#

Return the U/V cell pitch ratio for regular hexagons, 2 / sqrt(3).

Use it to size the map cells for hex_prism_edge(), e.g. a U pitch of ratio * v_pitch.

Returns:

U pitch divided by V pitch.

Return type:

float

pyvcad_metamaterials.reentrant_hex_prism_reference_aspect_ratio(angle_degrees=-30.0, rib_ratio=2.0)[source]#

Return the U/V cell pitch ratio preserving a re-entrant geometry.

Pass the same values given to reentrant_hex_prism().

Parameters:
  • angle_degrees (float) – Inclined-member angle in degrees, strictly between -90 and 0, default -30.

  • rib_ratio (float) – Vertical-to-inclined member length ratio, positive, default 2.0.

Returns:

U pitch divided by V pitch.

Return type:

float

Raises:

ValueError – If either parameter is out of range.

Face (plate and wall) lattices#

Face builders return a pyvcad.MappedFaceLattice (or a pyvcad.MappedStructureCollection for a multi-map collection) whose center surfaces are thickened into walls.

pyvcad_metamaterials.face_lattice(cell_map, unit_cell, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Tile a standard, static, or native parametric face cell through a CellMap.

Each face of the cell is a mid-surface that is mapped through the cell map and thickened into a wall.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • unit_cell (str | pv.FaceUnitCell) – A name from FACE_LATTICE_NAMES, or a pv.FaceUnitCell such as one from a *_cell builder or PeriodicTessellation.face_cell().

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Raises:
  • ValueError – If unit_cell is an unknown name.

  • TypeError – If unit_cell is neither a name nor a pv.FaceUnitCell.

Example

>>> node = mm.face_lattice(cell_map, "hexagonal_honeycomb", wall_thickness=0.6)
pyvcad_metamaterials.FACE_LATTICE_NAMES#

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Names accepted by face_lattice() and face_unit_cell(): plate, simple_cubic_plate, body_centered_cubic_plate, face_centered_cubic_plate, cubic_octet_plate, hexagonal_honeycomb, reentrant_honeycomb, square_honeycomb, rotated_square_honeycomb, triangular_honeycomb, rotated_triangular_honeycomb.

Plate lattices#

pyvcad_metamaterials.plate_lattice(cell_map, wall_thickness=1.0, eccentricity=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Build the period-two folded plate lattice with legacy eccentricity semantics.

The cell is a pv.PlateUnitCell: plates that fold between neighbouring cells, so the pattern repeats every two cells.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • eccentricity (float | pv.FloatAttribute | callable) – Fold eccentricity, sampled at the logical cell centres. 1.0 (default) is flat; values must be positive.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.plate_lattice(cell_map, wall_thickness=0.6, eccentricity=1.5)
pyvcad_metamaterials.simple_cubic_plate(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Build a mapped simple cubic (three orthogonal {100} families) plate lattice.

Equivalent to face_lattice(cell_map, "simple_cubic_plate", wall_thickness, surface_mode, surface_tolerance); see face_lattice() and simple_cubic_plate_cell().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.simple_cubic_plate(cell_map, wall_thickness=0.6)
pyvcad_metamaterials.body_centered_cubic_plate(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Build a mapped body-centred cubic (six {110} families) plate lattice.

Equivalent to face_lattice(cell_map, "body_centered_cubic_plate", wall_thickness, surface_mode, surface_tolerance); see face_lattice() and body_centered_cubic_plate_cell().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.body_centered_cubic_plate(cell_map, wall_thickness=0.6)
pyvcad_metamaterials.face_centered_cubic_plate(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Build a mapped face-centred cubic (four {111} families, octet) plate lattice.

Equivalent to face_lattice(cell_map, "face_centered_cubic_plate", wall_thickness, surface_mode, surface_tolerance); see face_lattice() and face_centered_cubic_plate_cell().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.face_centered_cubic_plate(cell_map, wall_thickness=0.6)
pyvcad_metamaterials.octet_plate(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Alias for face_centered_cubic_plate().

pyvcad_metamaterials.cubic_octet_plate(cell_map, cubic_wall_thickness=1.0, octet_wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Build the SC+FCC plate hybrid with independent family thicknesses.

The union of simple_cubic_plate() and face_centered_cubic_plate() on the same cell map. Use face_lattice() with "cubic_octet_plate" for one thickness field.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • cubic_wall_thickness (float | pv.FloatAttribute | callable) – Thickness of the {100} plates in mm, default 1.0.

  • octet_wall_thickness (float | pv.FloatAttribute | callable) – Thickness of the {111} plates in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

The union of the two plate lattices.

Return type:

pv.Union

Example

>>> node = mm.cubic_octet_plate(cell_map, cubic_wall_thickness=0.5, octet_wall_thickness=0.4)

Honeycombs#

Wall cells extruded along W.

pyvcad_metamaterials.hexagonal_honeycomb(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Build a mapped regular hexagonal honeycomb wall lattice.

Equivalent to face_lattice(cell_map, "hexagonal_honeycomb", wall_thickness, surface_mode, surface_tolerance); see face_lattice() and hexagonal_honeycomb_cell().

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.hexagonal_honeycomb(cell_map, wall_thickness=0.6)
pyvcad_metamaterials.reentrant_honeycomb(cell_map, wall_thickness=1.0, angle_degrees=-30.0, rib_ratio=2.0, surface_mode='bilinear', surface_tolerance=0.05)[source]#

Build a mapped re-entrant (auxetic) honeycomb wall lattice.

Equivalent to face_lattice(cell_map, reentrant_honeycomb_cell(angle_degrees, rib_ratio), ...); see face_lattice(). Use reentrant_hex_prism_reference_aspect_ratio() for the U:V pitch that keeps the requested angle.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • angle_degrees (float) – Angle of the inclined ribs, strictly between -90 and 0, default -30.0.

  • rib_ratio (float) – Positive ratio h/l of the vertical rib length to the inclined rib length, default 2.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Raises:

ValueError – If angle_degrees or rib_ratio is out of range.

Example

>>> node = mm.reentrant_honeycomb(cell_map, wall_thickness=0.6, angle_degrees=-20.0)
pyvcad_metamaterials.square_honeycomb(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)#

Build a mapped square honeycomb wall lattice.

Equivalent to face_lattice(cell_map, "square_honeycomb", wall_thickness, surface_mode, surface_tolerance); see face_lattice(). Use the U:V:W proportions from reference_cell_size() for regular cells.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.square_honeycomb(cell_map, wall_thickness=0.6)
pyvcad_metamaterials.rotated_square_honeycomb(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)#

Build a mapped square honeycomb turned 45 degrees about W wall lattice.

Equivalent to face_lattice(cell_map, "rotated_square_honeycomb", wall_thickness, surface_mode, surface_tolerance); see face_lattice(). Use the U:V:W proportions from reference_cell_size() for regular cells.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.rotated_square_honeycomb(cell_map, wall_thickness=0.6)
pyvcad_metamaterials.triangular_honeycomb(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)#

Build a mapped triangular honeycomb wall lattice.

Equivalent to face_lattice(cell_map, "triangular_honeycomb", wall_thickness, surface_mode, surface_tolerance); see face_lattice(). Use the U:V:W proportions from reference_cell_size() for regular cells.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.triangular_honeycomb(cell_map, wall_thickness=0.6)
pyvcad_metamaterials.rotated_triangular_honeycomb(cell_map, wall_thickness=1.0, surface_mode='bilinear', surface_tolerance=0.05)#

Build a mapped triangular honeycomb turned 90 degrees wall lattice.

Equivalent to face_lattice(cell_map, "rotated_triangular_honeycomb", wall_thickness, surface_mode, surface_tolerance); see face_lattice(). Use the U:V:W proportions from reference_cell_size() for regular cells.

Parameters:
  • cell_map (pv.CellMap | pv.CellMapCollection) – Map that places the cells.

  • wall_thickness (float | pv.FloatAttribute | callable) – Wall thickness in mm, default 1.0.

  • surface_mode (str) – "bilinear" (default) or "triangulated" wall surfaces.

  • surface_tolerance (float) – Largest surface error in mm on curved maps, default 0.05.

Returns:

a pv.MappedFaceLattice, or a pv.MappedStructureCollection for a multi-map pv.CellMapCollection.

Return type:

pv.Node

Example

>>> node = mm.rotated_triangular_honeycomb(cell_map, wall_thickness=0.6)

Face unit cells#

Each builder returns a pyvcad.FaceUnitCell for face_lattice(), for example to inspect the cell or to tag faces before tiling.

pyvcad_metamaterials.face_unit_cell(name)[source]#

Return a standard static face cell by name.

Parameters:

name (str) – One of FACE_LATTICE_NAMES. "plate" returns a flat pv.PlateUnitCell (eccentricity 1.0); the other names call the matching *_cell builder with its defaults.

Returns:

The unit cell, ready for face_lattice().

Return type:

pv.FaceUnitCell

Raises:

ValueError – If the name is unknown.

pyvcad_metamaterials.simple_cubic_plate_cell()[source]#

Return the three orthogonal {100} plate families.

pyvcad_metamaterials.body_centered_cubic_plate_cell()[source]#

Return the six {110} plate families associated with a BCC crystal.

pyvcad_metamaterials.face_centered_cubic_plate_cell()[source]#

Return the four {111} plate families, also called an octet plate cell.

pyvcad_metamaterials.cubic_octet_plate_cell()[source]#

Return the combined simple-cubic and face-centered-cubic plate cell.

pyvcad_metamaterials.hexagonal_honeycomb_cell()[source]#

Return an extruded regular-hexagonal wall cell.

pyvcad_metamaterials.reentrant_honeycomb_cell(angle_degrees=-30.0, rib_ratio=2.0)[source]#

Return an extruded re-entrant wall cell.

rib_ratio is h/l. The physical U/V pitch ratio required to preserve the requested angle is returned by reentrant_hex_prism_reference_aspect_ratio.

pyvcad_metamaterials.square_honeycomb_cell()[source]#

Return square honeycomb walls: the side faces of tessellation("cube").

Walls stand on the U and V cell faces and run along W (the cubic plate cell without its W-normal plates).

pyvcad_metamaterials.rotated_square_honeycomb_cell()[source]#

Return square honeycomb walls turned 45 degrees about W: walls along both cell diagonals in plan.

pyvcad_metamaterials.triangular_honeycomb_cell()[source]#

Return triangular honeycomb walls with one wall family along U.

Keep the U:V pitch at 1:sqrt(3) (reference_cell_size) for equilateral triangles.

pyvcad_metamaterials.rotated_triangular_honeycomb_cell()[source]#

Return triangular honeycomb walls with one wall family along V (U:V = sqrt(3):1).

Building graph cells from seeds and tessellations#

These builders return the same edge lists as the catalog cells (origin-centred, spanning [-0.5, 0.5]), so their results go straight into graph_lattice(); PeriodicTessellation.face_cell() returns a pyvcad.FaceUnitCell for face_lattice(). See Custom unit cells for a walkthrough.

pyvcad_metamaterials.periodic_voronoi(seeds, cell_size=(1.0, 1.0, 1.0))[source]#

Return the Voronoi tessellation of a periodic seed set (A1 builder).

Any set of seeds inside one cell, repeated along U, V and W, divides space into Voronoi cells: the region closer to each seed than to any other. Their edges are a strut network that tiles without seams, so periodic_voronoi(seeds).edges() is a graph unit cell for graph_lattice(). Regular seeds give the classic foams; random seeds give a random foam that still tiles, so it can follow a curved CellMap.

Seeds (fractional coordinates)

Voronoi cells

(0.5, 0.5, 0.5)

cubes: the "cubic" cell

BCC: corner + centre

truncated octahedra: the "kelvin" cell

FCC: corner + face centres

rhombic dodecahedra: "rhombic_dodecahedron"

A15 (eight sites)

the Weaire-Phelan foam: "weaire_phelan"

The tessellation’s cell centres are the seeds, so .edges("dual") joins seeds whose Voronoi cells share a face (the periodic Delaunay graph, where it is unique). For the bond network of a crystal use periodic_bonds(), which joins seeds by distance.

Parameters:
  • seeds (array-like) – (n, 3) distinct seed positions in fractional cell coordinates; they are wrapped into [0, 1).

  • cell_size (float | tuple) – U, V, W proportions of the physical cell. Distances are measured in this metric, so a non-cubic cell gives the right Voronoi cells when the map has the same proportions. Default (1, 1, 1).

Returns:

One Voronoi polyhedron per seed.

Return type:

PeriodicTessellation

Raises:

ValueError – If a seed is not finite or two seeds coincide.

Example

>>> fcc = [(0, 0, 0), (0.5, 0.5, 0), (0.5, 0, 0.5), (0, 0.5, 0.5)]
>>> edges = mm.periodic_voronoi(fcc).edges()      # rhombic dodecahedra
>>> node = mm.graph_lattice(cell_map, edges, beam_radius=0.5)
pyvcad_metamaterials.periodic_bonds(sites, max_length, cell_size=(1.0, 1.0, 1.0), min_length=0.0)[source]#

Return the graph cell that joins every two periodic sites closer than max_length.

This is the bond network of a crystal: give its sites in one cell and the bond length. It needs no tessellation, so it also works where many sites are equally far apart (the Voronoi faces of such neighbours can shrink to an edge or a point).

Parameters:
  • sites (array-like) – (n, 3) distinct site positions in fractional cell coordinates; they are wrapped into [0, 1).

  • max_length (float) – Longest bond, in cell_size units.

  • cell_size (float | tuple) – U, V, W proportions of the physical cell, default (1, 1, 1).

  • min_length (float) – Shortest bond kept, default 0.

Returns:

Origin-centred edges, as PeriodicTessellation.edges() returns them.

Return type:

list

Example

>>> fcc = [(0, 0, 0), (0.5, 0.5, 0), (0.5, 0, 0.5), (0, 0.5, 0.5)]
>>> holes = [(x + 0.25, y + 0.25, z + 0.25) for x, y, z in fcc]
>>> diamond = mm.periodic_bonds(fcc + holes, max_length=0.44)
pyvcad_metamaterials.tessellation(name, **parameters)[source]#

Return a built-in periodic tessellation by name.

Name

Cells (prism caps tagged "cap", walls "side")

"cube"

one cube (a square prism along W)

"hexagonal_prism"

four regular hexagonal prisms in the rectangular supercell of "hex_prism_edge" (U:V = 2:sqrt(3))

"reentrant_hexagonal_prism"

the re-entrant version; takes angle_degrees and rib_ratio like reentrant_hex_prism()

"triangular_prism"

four triangular prisms, one edge family along U (U:V = 1:sqrt(3))

"rotated_triangular_prism"

the same turned 90 degrees, edges along V (U:V = sqrt(3):1)

"rotated_square_prism"

two square prisms turned 45 degrees about W

"tet_oct"

the tetrahedral-octahedral honeycomb on FCC sites: eight regular tetrahedra (kind "tet") and four octahedra (kind "oct")

"truncated_cube"

a truncated cube and an octahedron (kinds "truncated_cube" and "oct")

Parameters:
  • name (str) – A name from TESSELLATION_NAMES.

  • **parameters – Shape parameters of a parametric tessellation.

Returns:

The tessellation, with its design cell_size.

Return type:

PeriodicTessellation

Example

>>> walls = mm.tessellation("hexagonal_prism").face_cell(face_tags="side")
pyvcad_metamaterials.TESSELLATION_NAMES#

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Names accepted by tessellation(): cube, hexagonal_prism, reentrant_hexagonal_prism, triangular_prism, rotated_triangular_prism, rotated_square_prism, tet_oct, truncated_cube.

pyvcad_metamaterials.GRAPH_RULES#

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Rules accepted by PeriodicTessellation.edges(): edges, cell_vertex_centroid, facet_vertex_centroid, dual, central_axes.

class pyvcad_metamaterials.PeriodicTessellation(cells, cell_size=(1.0, 1.0, 1.0))[source]#

Space-filling cells that repeat with period one along U, V and W.

Hold one representative of each periodic class of cells, in normalized cell coordinates. The cells must fill space face to face once repeated. edges() turns them into a graph unit cell with any of the GRAPH_RULES, and face_cell() turns their faces into walls.

Parameters:
  • cells (list[Polyhedron]) – One cell per periodic class.

  • cell_size (float | tuple) – The U, V, W proportions of the physical cell the tessellation was designed for, default (1, 1, 1). max_length is measured in these units. Give the map cells the same proportions to keep the intended shape.

Example

>>> tess = mm.tessellation("tet_oct")
>>> edges = tess.edges("cell_vertex_centroid", kinds="tet")   # the fluorite net
>>> node = mm.graph_lattice(cell_map, edges, beam_radius=0.5)
edges(rules='edges', kinds=None, face_tags=None, max_length=None)[source]#

Return the graph unit cell that rules make from the cells.

Struts are repeated periodically and clipped to the cell, every strut is split where another strut ends on it, and duplicates are removed. Struts on the cell’s faces are kept on both opposite faces, like the other catalog cells; a mapped lattice counts the copies that neighbouring cells share as one strut.

Parameters:
  • rules (str | list[str]) – One of GRAPH_RULES, or several for their union. Default "edges".

  • kinds (str | list[str] | None) – Only use cells of these kinds. None uses all.

  • face_tags (str | list | None) – Only use faces with these tags. "edges" then takes the edges of those faces, and "cell_vertex_centroid" their vertices.

  • max_length (float | None) – Drop struts longer than this, measured in cell_size units before clipping.

Returns:

Edges ((x0, y0, z0), (x1, y1, z1)) in origin-centred coordinates spanning [-0.5, 0.5], sorted.

Return type:

list

Example

>>> bcc = mm.tessellation("cube").edges("cell_vertex_centroid")
face_cell(kinds=None, face_tags=None)[source]#

Return the cells’ faces as walls: a pv.FaceUnitCell for face_lattice().

Each shared face is used once. Faces are repeated periodically and clipped to the cell, and polygons with more than four corners are triangulated. Every piece of one source face gets that face’s index as its face tag, and faces with the same plane direction share an orientation tag.

Parameters:
  • kinds (str | list[str] | None) – Only use faces of cells of these kinds.

  • face_tags (str | list | None) – Only use faces with these tags, for example "side" for a prism honeycomb’s walls.

Returns:

The wall cell, vertices in [0, 1].

Return type:

pv.FaceUnitCell

Example

>>> walls = mm.tessellation("triangular_prism").face_cell(face_tags="side")
>>> node = mm.face_lattice(cell_map, walls, wall_thickness=0.6)
class pyvcad_metamaterials.Polyhedron(vertices, faces=None, kind=None, face_tags=None, center=None)[source]#

One cell of a tessellation: vertices, polygonal faces, a centre and optional tags.

Parameters:
  • vertices (array-like) – (n, 3) vertex positions. In a PeriodicTessellation they are normalized cell coordinates (one repeat spans [0, 1] on each axis, and a cell may stick out of it).

  • faces (list[list[int]] | None) – Faces as vertex-index polygons in boundary order. None (default) uses the convex hull of vertices, with coplanar triangles merged into one polygon; vertices that are not hull corners are dropped.

  • kind (str | None) – Cell type, for selecting cells with kinds=....

  • face_tags (list | None) – One tag per face, for selecting faces with face_tags=....

  • center (array-like | None) – The cell centre used by the centroid, dual and axis rules. Defaults to the average of the vertices.

Example

>>> cube = mm.Polyhedron([(x, y, z) for x in (0, 1) for y in (0, 1) for z in (0, 1)])
>>> len(cube.faces)
6
classmethod prism(polygon, bottom=0.0, top=1.0, kind=None)[source]#

Return the prism over a 2D polygon, extruded along W.

The two caps are tagged "cap" and the side walls "side", so rules and face cells can use them separately (for example a honeycomb’s walls are its "side" faces).

Parameters:
  • polygon (array-like) – (n, 2) U, V corners in boundary order. It may be concave.

  • bottom (float) – W of the bottom cap, default 0.

  • top (float) – W of the top cap, default 1.

  • kind (str | None) – Cell type.

Returns:

The prism.

Return type:

Polyhedron

Example

>>> square = mm.Polyhedron.prism([(0, 0), (1, 0), (1, 1), (0, 1)])

Lattices from meshes#

pyvcad_metamaterials.mesh_lattice(mesh, rules='edges', beam_radius=0.5, node_radius=None, min_length=0.0)[source]#

Build a beam lattice from the cells of a volume or surface mesh.

The tessellation rules of GRAPH_RULES run on the mesh cells: "edges" keeps every mesh edge, "cell_vertex_centroid" joins each cell’s centre to its corners, "facet_vertex_centroid" joins each face’s centre to its corners, "dual" joins the centres of cells that share a face (on a triangle surface, a strut across every interior edge), and "central_axes" joins each cell’s centre to its face centres. Struts that neighbouring cells share are kept once. A list of rules gives their union.

Struts are centred on the mesh, so they bulge out of the part by their radius where they run along its surface; intersect the result with the part to trim them.

Parameters:
  • mesh (pv.TetrahedralMesh | pv.HexahedralMesh | pv.SurfaceMesh | tuple) – The cells. A (vertices, cells) tuple takes an (n, 3) array and cells of 3 (triangle), 4 (tetrahedron) or 8 (hexahedron, VTK order) vertex indices.

  • rules (str | list[str]) – One or more of GRAPH_RULES, default "edges".

  • beam_radius (float | array-like | pv.FloatAttribute | callable) – Strut radius in mm: a number, one value per mesh vertex (cell and face centres take the mean of their vertices), or a field sampled at both ends of every strut.

  • node_radius (float | array-like | pv.FloatAttribute | callable | None) – Radius in mm of a ball at every lattice vertex, given the same ways; None (default) adds none.

  • min_length (float) – Struts shorter than this (mm) are dropped, default 0.

Returns:

The lattice (new geometry; its distance is exact outside the struts and a bound inside, like any union of struts).

Return type:

pv.BeamLattice

Example

>>> settings = pv.TetrahedralMeshFixedSettings()
>>> settings.cell_size = 6.0
>>> tets = pv.TetrahedralMesh.from_tree(pv.Sphere(pv.Vec3(0, 0, 0), 20.0), settings)
>>> lattice = mm.mesh_lattice(tets, "edges", beam_radius=0.6)