Tree — leaf nodes
Primitive leaves. Composition operators are under Tree — composition nodes; surface
parameterization mapping is the Map leaf.
- class pyvcad.Function
A function geometry primitive/leaf node. This is analogous to an F-rep. Functions can be defined in Cartesian, cylindrical, or spherical coordinates.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Function, function: str, min: pyvcad.pyvcad.Vec3 = <pyvcad.pyvcad.Vec3 object at 0x108d315b0>, max: pyvcad.pyvcad.Vec3 = <pyvcad.pyvcad.Vec3 object at 0x108d31570>) -> None
Constructor that takes a function to evaluate, a material, and bounding box.
- Parameters:
function (string) – The function expression to evaluate. This can be any math expression, such as x^2 + y^2 + z^2 - 1.
min (glm::vec3) – The minimum bounding box coordinates.
max (glm::vec3) – The maximum bounding box coordinates.
__init__(self: pyvcad.pyvcad.Function, function: collections.abc.Callable[[typing.SupportsFloat, typing.SupportsFloat, typing.SupportsFloat, typing.SupportsFloat, typing.SupportsFloat, typing.SupportsFloat, typing.SupportsFloat, typing.SupportsFloat], float], min: pyvcad.pyvcad.Vec3 = <pyvcad.pyvcad.Vec3 object at 0x108d312b0>, max: pyvcad.pyvcad.Vec3 = <pyvcad.pyvcad.Vec3 object at 0x108d31270>) -> None
Constructor that takes a native python function to evaluate, a material id, and bounding box.
- Parameters:
function (function<double(double x, double y, double z, double rho, double phic, double r, double theta, double phis)>) – The function to evaluate. This must return the signed distance to the surface. The function must take three parameters (all vec3): xyz, cylindrical coordinates, and spherical coordinates. You may use those to compute the signed distance.
min (glm::vec3) – The minimum bounding box coordinates.
max (glm::vec3) – The maximum bounding box coordinates.
- class pyvcad.Mesh
A mesh geometry primitive/leaf node. The mesh is loaded from a file and converted into a signed distance field using OpenVDB.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Mesh, path: str, center: bool = False, disable_validation: bool = False) -> None
Constructor. Creates a Mesh with a file path.
- Parameters:
path (string) – The path to the mesh file to load.
center (bool) – Defaults to false. If true, the mesh will be centered at the origin after loading.
disable_validation (bool) – Defaults to false. If true, the mesh will not be validated for errors. This is useful for meshes where we know it’s ok if the mesh is not watertight or has self-intersections.
__init__(self: pyvcad.pyvcad.Mesh, path: str, sample_size: pyvcad.pyvcad.Vec3, disable_validation: bool = False) -> None
Constructor. Creates a Mesh with a file path and sample size.
- Parameters:
path (string) – The path to the mesh file to load.
sample_size (glm::vec3) – The size of each voxel in the grid. Make this your sample size if your are missing small mesh features disable_validation (bool): Defaults to false. If true, the mesh will not be validated for errors. This is useful for meshes where we know it’s ok if the mesh is not watertight or has self-intersections.
__init__(self: pyvcad.pyvcad.Mesh, mesh: SurfaceMesh) -> None
Constructor. Creates a Mesh with a SurfaceMesh.
- Parameters:
mesh (SurfaceMesh) – The mesh to load.
__init__(self: pyvcad.pyvcad.Mesh, path: str, override_voxel_size: typing.SupportsFloat, disable_validation: bool = False) -> None
Constructor. Creates a Mesh with a file path and an explicit voxel size for SDF voxelization, bypassing the minimum bound heuristic.
- Parameters:
path (string) – The path to the mesh file to load.
override_voxel_size (float) – The explicit voxel size to use when voxelizing the mesh into an SDF.
disable_validation (bool) – Defaults to false. If true, the mesh will not be validated for errors.
- class pyvcad.RectPrism
A rectangular prism leaf node/geometric primitive. This node is a rectangular prism with a center point, size, and material ID.
- static FromMinAndMax(min: pyvcad.pyvcad.Vec3, max: pyvcad.pyvcad.Vec3) pyvcad.pyvcad.RectPrism
Create a RectPrism from the given minimum and maximum points.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.RectPrism) -> None
Default constructor. Creates a RectPrism with a center of (0, 0, 0), size of (1, 1, 1).
__init__(self: pyvcad.pyvcad.RectPrism, center: pyvcad.pyvcad.Vec3, size: pyvcad.pyvcad.Vec3) -> None
Constructor. Creates a RectPrism with a center, size.
- class pyvcad.Sphere
A sphere leaf node/geometric primitive. This node is a sphere with a center point, radius
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Sphere) -> None
Default constructor. Creates a Sphere with a center of (0, 0, 0), radius of 1
Example
>>> from libvcad import pyvcad as pv >>> sphere = pv.Sphere()
__init__(self: pyvcad.pyvcad.Sphere, center: pyvcad.pyvcad.Vec3, radius: typing.SupportsFloat) -> None
Constructor. Creates a Sphere with a center, radius, and material id.
- Parameters:
center (vec3) – The center point of the Sphere.
radius (double) – The radius of the Sphere.
- class pyvcad.Strut
A leaf node that represents a strut.
- __init__(self: pyvcad.pyvcad.Strut, start: pyvcad.pyvcad.Vec3, end: pyvcad.pyvcad.Vec3, radius: SupportsFloat) None
Constructor. Creates a Strut with a start point, end point, radius.
- class pyvcad.CAD
A CAD geometry primitive/leaf node. The CAD is loaded from a file into memory for sampling. The node supports .STEP and .igs files. NOTE: using fast mode will convert the CAD model into a mesh for faster sampling. This hurts acuracy but dramatically speeds up performance. For the Inkjet compiler fast mode is recommended.
- __init__(self: pyvcad.pyvcad.CAD, path: str, use_fast_mode: bool = True) None
Constructor that takes a path to the CAD file to load, whether to use fast mode.
- Parameters:
path (string) – The path to the CAD file to load.
use_fast_mode (bool) – Whether to use fast mode.
- class pyvcad.Cylinder
A cylinder leaf node/ geometric primitive. The cylinder is aligned along the Z-axis, standing upright, and centered at (0,0,0).
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Cylinder) -> None
Default constructor. Creates a Cylinder with a center of (0,0,0), radius of 1, height of 1.
__init__(self: pyvcad.pyvcad.Cylinder, center: pyvcad.pyvcad.Vec3, radius: typing.SupportsFloat, height: typing.SupportsFloat) -> None
Constructor. Creates a Cylinder with a center, radius, height.
- Parameters:
center (vec3) – The center point of the Cylinder.
radius (double) – The radius of the Cylinder.
height (double) – The height of the Cylinder.
- class pyvcad.Cone
A cone leaf node/geometric primitive.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Cone) -> None
Default constructor. Creates a Cone with default dimensions.
__init__(self: pyvcad.pyvcad.Cone, angle: typing.SupportsFloat, height: typing.SupportsFloat) -> None
Constructor. Creates a Cone defined by an angle and height.
- Parameters:
angle (double) – The aperture half-angle in radians.
height (double) – The height of the cone.
- class pyvcad.Torus
A torus leaf node/geometric primitive. This node is a torus with a major and minor radius
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Torus) -> None
Default constructor. Creates a Torus with a center of (0, 0, 0), major radius of 2 and minor radius of 1.
__init__(self: pyvcad.pyvcad.Torus, r1: typing.SupportsFloat, r2: typing.SupportsFloat) -> None
Constructor. Creates a Torus with a major and minor radii.
- Parameters:
r1 (double) – Major radius.
r2 (double) – Minor radius.
- class pyvcad.GraphLattice
A graph lattice leaf node. This class represents a lattice structure defined by a set of edges and a radius for the struts.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.GraphLattice, edges: collections.abc.Sequence[tuple[pyvcad.pyvcad.Vec3, pyvcad.pyvcad.Vec3]], radius: typing.SupportsFloat) -> None
Constructor. Creates a GraphLattice with edges, radius, and material.
- Parameters:
__init__(self: pyvcad.pyvcad.GraphLattice, type: pyvcad.pyvcad.LatticeType, size: pyvcad.pyvcad.Vec3, radius: typing.SupportsFloat) -> None
Constructor. Creates a GraphLattice with a lattice type, size, radius.
- Parameters:
type (LatticeType) – The type of the lattice (BodyCenteredCubic, FaceCenteredCubic, Cubic, or KelvinCell).
size (Vec3) – The size of the lattice unit cell.
radius (float) – The radius of the struts.
- class pyvcad.Text
A text leaf node which generates a 3D text object by extruding the text along the Z-axis. The node takes a string, height, depth, material id, font aspect, font name, and alignment options. The CAD part is created from the provided text.
- __init__(self: pyvcad.pyvcad.Text, text: str, height: SupportsFloat, depth: SupportsFloat, aspect: pyvcad.pyvcad.FontAspect = <FontAspect.Regular: 0>, font: str = 'Consolas', h_align: pyvcad.pyvcad.HorizontalAlignment = <HorizontalAlignment.Center: 1>, v_align: pyvcad.pyvcad.VerticalAlignment = <VerticalAlignment.Center: 1>) None
Constructor. Creates a Text node with the provided text content, height, depth, material id, font aspect, font name and alignment options.
- Parameters:
text (str) – The text content for the 3D text.
height (float) – The height of the text.
depth (float) – The extrusion depth of the text.
aspect (FontAspect, optional) – The font aspect. Defaults to FontAspect.Regular.
font (str, optional) – The name of the font to use. Defaults to Consolas.
h_align (HorizontalAlignment, optional) – Horizontal alignment of the text. Defaults to Center.
v_align (VerticalAlignment, optional) – Vertical alignment of the text. Defaults to Center.
- class pyvcad.SignedDistanceField
Represents a signed distance field using OpenVDB.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.SignedDistanceField) -> None
__init__(self: pyvcad.pyvcad.SignedDistanceField, grid: openvdb::v13_0::Grid<openvdb::v13_0::tree::Tree<openvdb::v13_0::tree::RootNode<openvdb::v13_0::tree::InternalNode<openvdb::v13_0::tree::InternalNode<openvdb::v13_0::tree::LeafNode<float, 3u>, 4u>, 5u>>>>) -> None
__init__(self: pyvcad.pyvcad.SignedDistanceField, occupancy_grid: openvdb::v13_0::Grid<openvdb::v13_0::tree::Tree<openvdb::v13_0::tree::RootNode<openvdb::v13_0::tree::InternalNode<openvdb::v13_0::tree::InternalNode<openvdb::v13_0::tree::LeafNode<bool, 3u>, 4u>, 5u>>>>) -> None
__init__(self: pyvcad.pyvcad.SignedDistanceField, vdb_volume: VDBVolume<openvdb::v13_0::Grid<openvdb::v13_0::tree::Tree<openvdb::v13_0::tree::RootNode<openvdb::v13_0::tree::InternalNode<openvdb::v13_0::tree::InternalNode<openvdb::v13_0::tree::LeafNode<float, 3u>, 4u>, 5u>>>>>) -> None
__init__(self: pyvcad.pyvcad.SignedDistanceField, vdb_file_path: str, grid_name: str = ‘occupancy’) -> None
- bounding_box(self: pyvcad.pyvcad.SignedDistanceField) tuple[pyvcad.pyvcad.Vec3, pyvcad.pyvcad.Vec3]
- clone(self: pyvcad.pyvcad.SignedDistanceField) pyvcad.pyvcad.Node
- evaluate(self: pyvcad.pyvcad.SignedDistanceField, x: SupportsFloat, y: SupportsFloat, z: SupportsFloat) float | None
- prepare(self: pyvcad.pyvcad.SignedDistanceField, voxel_size: pyvcad.pyvcad.Vec3, bandwidth: SupportsFloat) None
- save_openvdb_grid(self: pyvcad.pyvcad.SignedDistanceField, file_path: str) None
- class pyvcad.PolygonExtrude
An extruded polygon leaf node/geometric primitive. Takes a planar polygon defined by 3D vertices and extrudes it along its computed normal (right-hand rule) by a given height.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.PolygonExtrude) -> None
Default constructor. Creates a unit square in the XY plane extruded 1 unit in +Z.
Example
>>> from libvcad import pyvcad as pv >>> poly = pv.PolygonExtrude()
__init__(self: pyvcad.pyvcad.PolygonExtrude, vertices: collections.abc.Sequence[pyvcad.pyvcad.Vec3], height: typing.SupportsFloat, symmetric: bool = False) -> None
Constructor. Creates an extruded polygon from coplanar 3D vertices.
- Parameters:
vertices (list[Vec3]) – The vertices of the planar polygon (minimum 3, must be coplanar).
height (float) – The extrusion distance along the polygon normal.
symmetric (bool) – If True, extrudes height/2 on each side of the polygon plane.
Example
>>> from libvcad import pyvcad as pv >>> verts = [pv.Vec3(0,0,0), pv.Vec3(10,0,0), pv.Vec3(10,10,0), pv.Vec3(0,10,0)] >>> poly = pv.PolygonExtrude(verts, 5.0, False)
- class pyvcad.Map
Maps a surface parameterization onto a closed mesh.
- __init__(self: pyvcad.pyvcad.Map, surface_path: str, closed_mesh_path: str) None
Constructor with surface and closed mesh paths.
- Parameters:
surface_path (str) – Path to the surface file.
closed_mesh_path (str) – Path to the closed mesh file.