Writers and slicers#
- class pyvcad_compilers.InpWriter#
- __init__(self: pyvcad_compilers.pyvcad_compilers.InpWriter) None#
- setProgressCallback(self: pyvcad_compilers.pyvcad_compilers.InpWriter, callback: object) None#
Sets the progress callback for INP writing.
- Parameters:
callback (callable) – Callback receiving (progress, message), where progress is a float from 0.0 to 1.0. Pass None to clear it.
- write(*args, **kwargs)#
Overloaded function.
write(self: pyvcad_compilers.pyvcad_compilers.InpWriter, path: str, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, config_path: str, use_volumetric_dither: bool) -> None
Writes the INP (ABAQUS Input) file to the specified path using linear brick elements.
- Parameters:
Example
>>> writer.write('/tmp/mesh.inp', root, pv.Vec3(1, 1, 1), 'configs/default.json', False)
write(self: pyvcad_compilers.pyvcad_compilers.InpWriter, path: str, root: pyvcad.pyvcad.Node, voxel_size: pyvcad.pyvcad.Vec3, material_defs: pyvcad.pyvcad.MaterialDefs, use_volumetric_dither: bool) -> None
Writes the INP (ABAQUS Input) file to the specified path using linear brick elements.
- Parameters:
path (str) – Output INP file path.
root (Node) – Root node to sample into brick elements.
voxel_size (Vec3) – Brick element dimensions.
material_defs (MaterialDefs) – Loaded material definitions.
use_volumetric_dither (bool) – Use volumetric dithering for material sampling.
Example
>>> writer.write('/tmp/mesh.inp', root, pv.Vec3(1, 1, 1), pv.default_materials, False)
- class pyvcad_compilers.CrossSectionSlicer#
- __init__(self: pyvcad_compilers.pyvcad_compilers.CrossSectionSlicer, root: pyvcad.pyvcad.Node, min: pyvcad.pyvcad.Vec3, max: pyvcad.pyvcad.Vec3, voxel_size: pyvcad.pyvcad.Vec3) None#
Constructor. Creates a CrossSectionSlicer object.
- Parameters:
root (Node) – The root node of the tree.
min (glm::vec3) – The minimum point of the bounding box.
max (glm::vec3) – The maximum point of the bounding box.
voxel_size (glm::vec3) – The size of the voxel.
- slice_geometry(self: pyvcad_compilers.pyvcad_compilers.CrossSectionSlicer, z_height: SupportsFloat, stitching_tolerance: SupportsFloat = 1e-12, colinear_tolerance: SupportsFloat = 1e-12) list[pyvcad.pyvcad.Polygon2]#
Slices the geometry at a given z-height and iso value.
- Parameters:
z_height (double) – The z-height at which to slice.
stitching_tolerance (double) – (Optional) The tolerance for stitching. Defaults to 1e-12.
colinear_tolerance (double) – (Optional) The tolerance for colinear points. Defaults to 1e-12.
- slice_material(self: pyvcad_compilers.pyvcad_compilers.CrossSectionSlicer, z_height: SupportsFloat, material_chan: SupportsInt, ranges: collections.abc.Sequence[tuple[SupportsFloat, SupportsFloat]], stitching_tolerance: SupportsFloat = 1e-12, colinear_tolerance: SupportsFloat = 1e-12) list[tuple[float, float, list[pyvcad.pyvcad.Polygon2]]]#
ranges (List[Tuple[float, float]]): A list of tuples containing the lower and upper bounds of the material concentration to slice for. i.e. the ranges [0 to 0.5] and [0.5 to 1.0]. stitching_tolerance (double): (Optional) The tolerance for stitching. Defaults to 1e-12. colinear_tolerance (double): (Optional) The tolerance for colinear points. Defaults to 1e-12.Returns: List[Tuple[float, float, List[Polygon2]]]: A list of tuples containing the lower and upper bounds of the material concentration and a list of polygons that represent the cross section for the range.