microgen.shape.strut_lattice subpackage

Abstract Lattice (microgen.shape.strut_lattice.abstract_lattice)

class microgen.shape.strut_lattice.abstract_lattice.AbstractLattice(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: Shape

Abstract Class to create strut-based lattice.

property base_vertices: ndarray[tuple[Any, ...], dtype[float64]]

coordinates of the vertices for a structure centered at the origin and enclosed in a size 1 cubic rve

Type:

Property

property cad_shape: CadShape
generate_cad(**_: KwargsGenerateType) CadShape

Generate a CAD shape.

The default implementation builds an OCCT tessellated BREP from the implicit-field VTK mesh, via microgen.cad.mesh_to_shape() (single TopoDS_Face carrying a Poly_Triangulation). Subclasses override this with native primitive construction.

Requires the optional [cad] install extra (cadquery-ocp-novtk).

Parameters:
  • bounds(xmin, xmax, ymin, ymax, zmin, zmax)

  • resolution – number of grid points per axis

Returns:

microgen.cad.CadShape wrapping an OCCT TopoDS_Shell

generate_surface_mesh(**_: KwargsGenerateType) pv.PolyData

Return a surface mesh of the lattice (for visualisation).

Today this delegates to mesh_for_fem() with default parameters (size=0.02, order=1, periodic=True), which runs CAD → STEP → gmsh → pyvista. When the F-rep implicit-lattice work lands, this method will switch to F-rep marching cubes (no CAD/gmsh required) and mesh_for_fem() will remain as the explicit FEM-meshing path.

Users who need to control mesh size / element order / periodicity should call mesh_for_fem() directly.

mesh_for_fem(size: float = 0.02, order: int = 1, *, periodic: bool = True) PolyData

Build a periodic / non-periodic FEM tet mesh and return its surface.

Path: cad_shape → STEP → gmsh (microgen.mesh_periodic() or microgen.mesh()) → pv.readextract_surface(). Requires the [cad] extra and gmsh.

Cached per (size, order, periodic) tuple on the instance, so repeated calls with the same parameters are O(1).

Parameters:
  • size – target element size (gmsh)

  • order – element order (gmsh)

  • periodic – enforce periodicity via mesh_periodic()

Returns:

surface pv.PolyData extracted from the tet mesh

property strut_heights: list[float]

Return the list of strut lengths.

If a single value is given, it is converted to a list.

property strut_number: int
property strut_vertex_pairs: ndarray[tuple[Any, ...], dtype[int64]]

pairs of vertex indices forming a strut

Type:

Property

property volume: float
property vtk_shape: pv.PolyData

Return a surface mesh of the lattice (for visualisation).

Today this delegates to mesh_for_fem() with default parameters (size=0.02, order=1, periodic=True), which runs CAD → STEP → gmsh → pyvista. When the F-rep implicit-lattice work lands, this method will switch to F-rep marching cubes (no CAD/gmsh required) and mesh_for_fem() will remain as the explicit FEM-meshing path.

Users who need to control mesh size / element order / periodicity should call mesh_for_fem() directly.

Body Centered Cubic (microgen.shape.strut_lattice.body_centered_cubic)

class microgen.shape.strut_lattice.body_centered_cubic.BodyCenteredCubic(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit body-centered cubic lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_1_1.png

Cubic (microgen.shape.strut_lattice.cubic)

class microgen.shape.strut_lattice.cubic.Cubic(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit cubic lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_3_1.png

Cuboctahedron (microgen.shape.strut_lattice.cuboctahedron)

class microgen.shape.strut_lattice.cuboctahedron.Cuboctahedron(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit cuboctahedron lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_5_1.png

Custom Lattice (microgen.shape.strut_lattice.custom_lattice)

class microgen.shape.strut_lattice.custom_lattice.CustomLattice(base_vertices: npt.NDArray[np.float64], strut_vertex_pairs: npt.NDArray[np.int64], strut_radius: float | None = None, strut_heights: float | list[float] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None)

Bases: AbstractLattice

Class to create a custom lattice.

Uses user-defined base vertices and strut vertex pairs.

Diamond (microgen.shape.strut_lattice.diamond)

class microgen.shape.strut_lattice.diamond.Diamond(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit diamond lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_7_1.png

Face Centered Cubic (microgen.shape.strut_lattice.face_centered_cubic)

class microgen.shape.strut_lattice.face_centered_cubic.FaceCenteredCubic(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit face-centered cubic lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_9_1.png

Octahedron (microgen.shape.strut_lattice.octahedron)

class microgen.shape.strut_lattice.octahedron.Octahedron(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit octahedron lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_11_1.png

Octet-truss (microgen.shape.strut_lattice.octet_truss)

class microgen.shape.strut_lattice.octet_truss.OctetTruss(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit octet-truss lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_13_1.png

Rhombic Cuboctahedron (microgen.shape.strut_lattice.rhombic_cuboctahedron)

class microgen.shape.strut_lattice.rhombic_cuboctahedron.RhombicCuboctahedron(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit rhombic cuboctahedron lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_15_1.png

Rhombic Dodecahedron (microgen.shape.strut_lattice.rhombic_dodecahedron)

class microgen.shape.strut_lattice.rhombic_dodecahedron.RhombicDodecahedron(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit rhombic dodecahedron lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_17_1.png

Truncated Cube (microgen.shape.strut_lattice.truncated_cube)

class microgen.shape.strut_lattice.truncated_cube.TruncatedCube(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit truncated cubic lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_19_1.png

Truncated Cuboctahedron (microgen.shape.strut_lattice.truncated_cuboctahedron)

class microgen.shape.strut_lattice.truncated_cuboctahedron.TruncatedCuboctahedron(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit truncated cuboctahedron lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_21_1.png

Truncated Octahedron (microgen.shape.strut_lattice.truncated_octahedron)

class microgen.shape.strut_lattice.truncated_octahedron.TruncatedOctahedron(strut_radius: float | None = None, strut_heights: float | list[float] | None = None, base_vertices: npt.NDArray[np.float64] | None = None, strut_vertex_pairs: npt.NDArray[np.int64] | None = None, cell_size: float = 1.0, strut_joints: bool = False, density: float | None = None, **kwargs: Vector3DType | Rotation)

Bases: AbstractLattice

Class to create a unit truncated octahedron lattice.

Built from a given cell size and density or strut radius.

_images/microgen.shape.strut_lattice_23_1.png