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:
ShapeAbstract 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()(singleTopoDS_Facecarrying aPoly_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.CadShapewrapping an OCCTTopoDS_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) andmesh_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()ormicrogen.mesh()) →pv.read→extract_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.PolyDataextracted 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) andmesh_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:
AbstractLatticeClass to create a unit body-centered cubic lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit cubic lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit cuboctahedron lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass 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:
AbstractLatticeClass to create a unit diamond lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit face-centered cubic lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit octahedron lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit octet-truss lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit rhombic cuboctahedron lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit rhombic dodecahedron lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit truncated cubic lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit truncated cuboctahedron lattice.
Built from a given cell size and density or strut radius.
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:
AbstractLatticeClass to create a unit truncated octahedron lattice.
Built from a given cell size and density or strut radius.