Tree — composition nodes
Transforms, tiling, boolean CSG, offsets, shells, and warps.
- class pyvcad.Identity
A pass-through identity node that implements no transformations or operations of its own.
This node operates identically to the base Unary node. Its primary use case is to act as an attachment point for AttributeModifiers without affecting the global coordinate space of the attributes, which is useful when its child node contains an arbitrary transformation.
- Parameters:
child (Node) – The child node
Example
>>> import pyvcad as pv >>> child = pv.Sphere(10) >>> node = pv.Identity(child)
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Identity) -> None
Default constructor.
Example
>>> import pyvcad as pv >>> node = pv.Identity()
__init__(self: pyvcad.pyvcad.Identity, child: pyvcad.pyvcad.Node) -> None
Constructor with child.
- Parameters:
child (Node) – The child node to attach to the tree
Example
>>> import pyvcad as pv >>> child = pv.Sphere(10) >>> node = pv.Identity(child)
- class pyvcad.Rotate
Rotates a child node around a point. The rotation is specified by pitch, yaw, and roll angles. The rotation is performed in the order: roll, yaw, pitch.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Rotate) -> None
Default constructor. Defaults to no rotation.
__init__(self: pyvcad.pyvcad.Rotate, pitch: typing.SupportsFloat, yaw: typing.SupportsFloat, roll: typing.SupportsFloat) -> None
Constructor. Creates a Rotate with pitch, yaw, and roll angles in degrees.
- Parameters:
pitch (double) – Pitch angle in degrees.
yaw (double) – Yaw angle in degrees.
roll (double) – Roll angle in degrees.
__init__(self: pyvcad.pyvcad.Rotate, pitch: typing.SupportsFloat, yaw: typing.SupportsFloat, roll: typing.SupportsFloat, child: pyvcad.pyvcad.Node) -> None
Constructor. Creates a Rotate with pitch, yaw, roll angles, and an initial child node.
- Parameters:
pitch (double) – Pitch angle in degrees.
yaw (double) – Yaw angle in degrees.
roll (double) – Roll angle in degrees.
child (std::shared_ptr<Node>) – The child node.
__init__(self: pyvcad.pyvcad.Rotate, rotation_angles: pyvcad.pyvcad.Vec3) -> None
Constructor. Creates a Rotate from Euler angles packed in a glm::vec3 (pitch, yaw, roll in degrees).
- Parameters:
rotation_angles (glm::vec3) – Euler angles in degrees (pitch, yaw, roll).
__init__(self: pyvcad.pyvcad.Rotate, rotation_angles: pyvcad.pyvcad.Vec3, child: pyvcad.pyvcad.Node) -> None
Constructor. Creates a Rotate from Euler angles and a child node.
- Parameters:
rotation_angles (glm::vec3) – Euler angles in degrees (pitch, yaw, roll).
child (std::shared_ptr<Node>) – The child node.
- class pyvcad.Scale
Scales a child by a factor in each dimension. This node is unary, therefore can only have one child. The scale is applied during evaluate() and performs the inverse of the scaling on the point.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Scale) -> None
Default constructor. Sets the scale to 1.0 in each dimension.
__init__(self: pyvcad.pyvcad.Scale, x: typing.SupportsFloat, y: typing.SupportsFloat, z: typing.SupportsFloat) -> None
Constructor. Sets the scale to the supplied values.
- Parameters:
x (double) – The scale in the x dimension.
y (double) – The scale in the y dimension.
z (double) – The scale in the z dimension.
__init__(self: pyvcad.pyvcad.Scale, x: typing.SupportsFloat, y: typing.SupportsFloat, z: typing.SupportsFloat, child: pyvcad.pyvcad.Node) -> None
Constructor. Sets the scale to the supplied values and sets the child.
- Parameters:
x (double) – The scale in the x dimension.
y (double) – The scale in the y dimension.
z (double) – The scale in the z dimension.
child (std::shared_ptr<Node>) – The child node.
- class pyvcad.Translate
Translates a child in Cartesian space by a given amount. This node is unary, with only one child, and performs the inverse translation on coordinates during material() and evaluate().
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Translate) -> None
Default constructor. Sets the translation to 0, 0, 0.
__init__(self: pyvcad.pyvcad.Translate, x: typing.SupportsFloat, y: typing.SupportsFloat, z: typing.SupportsFloat) -> None
Constructor. Sets the translation to given values in Cartesian space.
- Parameters:
x (double) – Translation in the x direction.
y (double) – Translation in the y direction.
z (double) – Translation in the z direction.
__init__(self: pyvcad.pyvcad.Translate, x: typing.SupportsFloat, y: typing.SupportsFloat, z: typing.SupportsFloat, child: pyvcad.pyvcad.Node) -> None
Constructor. Sets the translation to given values and sets the child.
- Parameters:
x (double) – Translation in the x direction.
y (double) – Translation in the y direction.
z (double) – Translation in the z direction.
child (std::shared_ptr<Node>) – The child to set.
- class pyvcad.Sum
A node that sums all child Signed Distance Fields (SDFs). This node is N-ary, meaning it can have multiple children. The sum is calculated during evaluate() and results in the combined sum of all child SDFs.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Sum) -> None
Default constructor.
__init__(self: pyvcad.pyvcad.Sum, iso_value: typing.SupportsFloat) -> None
Constructor. Sets the iso value for the sum node.
- Parameters:
iso_value (double) – The iso value for the sum node.
__init__(self: pyvcad.pyvcad.Sum, iso_value: typing.SupportsFloat, children: collections.abc.Sequence[pyvcad.pyvcad.Node]) -> None
Constructor. Sets the iso value and the children for the sum node.
- Parameters:
iso_value (double) – The iso value for the sum node.
children (std::vector<std::shared_ptr<Node>>) – The children of the sum node.
- class pyvcad.Tile
A node that tiles a child geometry in a grid pattern. This unary operator repeats a geometry based on specified cell dimensions. The tiling occurs when evaluate() or material() is called, which can be used to create lattice structures.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Tile) -> None
Default constructor. The cell dimensions will be calculated from the child node when prepare is called.
__init__(self: pyvcad.pyvcad.Tile, child: pyvcad.pyvcad.Node) -> None
Constructor. Sets the child node. The cell dimensions will be calculated from the child node.
- Parameters:
child (std::shared_ptr<Node>) – The child node.
__init__(self: pyvcad.pyvcad.Tile, cell_x: typing.SupportsFloat, cell_y: typing.SupportsFloat, cell_z: typing.SupportsFloat) -> None
Constructor. Sets the dimensions of a cell in the grid.
- Parameters:
cell_x (double) – The x dimension of a cell.
cell_y (double) – The y dimension of a cell.
cell_z (double) – The z dimension of a cell.
__init__(self: pyvcad.pyvcad.Tile, cell_x: typing.SupportsFloat, cell_y: typing.SupportsFloat, cell_z: typing.SupportsFloat, child: pyvcad.pyvcad.Node) -> None
Constructor. Sets the dimensions of a cell in the grid and sets the child.
- Parameters:
cell_x (double) – The x dimension of a cell.
cell_y (double) – The y dimension of a cell.
cell_z (double) – The z dimension of a cell.
child (std::shared_ptr<Node>) – The child node.
- class pyvcad.Difference
A difference binary node. The difference is taken as the left child minus the right child. This node is binary, so it can have two children. Supports optional smooth blending with a radius parameter k.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Difference) -> None
Default constructor. Creates a Difference node.
__init__(self: pyvcad.pyvcad.Difference, left: pyvcad.pyvcad.Node, right: pyvcad.pyvcad.Node) -> None
Constructor. Creates a Difference node with the given left and right children.
Example
>>> from libvcad import pyvcad as pv >>> radius = 5 >>> left_sphere = pv.Sphere(pv.Vec3(-radius/2, 0, 0), radius, 1) >>> right_sphere = pv.Sphere(pv.Vec3(radius/2, 0, 0), radius, 1) >>> difference = pv.Difference(left_sphere, right_sphere)
__init__(self: pyvcad.pyvcad.Difference, k: typing.SupportsFloat) -> None
Constructor for smooth difference.
- Parameters:
k (float) – The smoothing radius. When k > 0, produces a smooth subtraction.
Example
>>> from libvcad import pyvcad as pv >>> smooth_diff = pv.Difference(1.0) >>> smooth_diff.set_left(left_sphere) >>> smooth_diff.set_right(right_sphere)
__init__(self: pyvcad.pyvcad.Difference, k: typing.SupportsFloat, left: pyvcad.pyvcad.Node, right: pyvcad.pyvcad.Node) -> None
Constructor for smooth difference with children.
- Parameters:
Example
>>> from libvcad import pyvcad as pv >>> left_sphere = pv.Sphere(pv.Vec3(-2, 0, 0), 3, 1) >>> right_sphere = pv.Sphere(pv.Vec3(2, 0, 0), 3, 1) >>> smooth_diff = pv.Difference(1.0, left_sphere, right_sphere)
- class pyvcad.Intersection
Intersection of two or more nodes. This node is N-ary, so it can have multiple children. Supports optional smooth blending with a radius parameter k.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Intersection) -> None
Default constructor. Creates an Intersection node.
__init__(self: pyvcad.pyvcad.Intersection, lhs: pyvcad.pyvcad.Node, rhs: pyvcad.pyvcad.Node) -> None
Constructor with two children.
__init__(self: pyvcad.pyvcad.Intersection, k: typing.SupportsFloat, intersect_distribution: bool = False) -> None
Constructor for smooth intersection.
- Parameters:
k (float) – The smoothing radius. When k > 0, produces a smooth blend.
intersect_distribution (bool) – If true, the distribution will be intersected.
__init__(self: pyvcad.pyvcad.Intersection, k: typing.SupportsFloat, intersect_distribution: bool, children: collections.abc.Sequence[pyvcad.pyvcad.Node]) -> None
Constructor for smooth intersection with children.
- Parameters:
k (float) – The smoothing radius. When k > 0, produces a smooth blend.
intersect_distribution (bool) – If true, the distribution will be intersected.
children (list[Node]) – The children nodes.
- class pyvcad.BBoxIntersection
Intersection of multiple nodes using an AABB tree to speed things up. This node is N-ary, so it can have any number of children.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.BBoxIntersection) -> None
Default constructor for BBoxIntersection.
__init__(self: pyvcad.pyvcad.BBoxIntersection, children: collections.abc.Sequence[pyvcad.pyvcad.Node]) -> None
Constructor that creates a BBoxIntersection node with the given list of child nodes.
- Parameters:
children (list of Node) – The list of child nodes.
- class pyvcad.Union
A union of two or more nodes. This is equivalent to the summing of the children. This node is N-ary, so it can have multiple children. Supports optional smooth blending with a radius parameter k.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Union) -> None
Default constructor. Creates a Union node with no children.
__init__(self: pyvcad.pyvcad.Union, left_child: pyvcad.pyvcad.Node, right_child: pyvcad.pyvcad.Node) -> None
Constructor. Creates a Union node with two children.
__init__(self: pyvcad.pyvcad.Union, k: typing.SupportsFloat, should_union_distribution: bool = False) -> None
Constructor for smooth union.
- Parameters:
k (float) – The smoothing radius. When k > 0, produces a smooth blend between children.
should_union_distribution (bool) – If true, the distribution will be unioned.
__init__(self: pyvcad.pyvcad.Union, k: typing.SupportsFloat, should_union_distribution: bool, children: collections.abc.Sequence[pyvcad.pyvcad.Node]) -> None
Constructor for smooth union with children.
- Parameters:
k (float) – The smoothing radius. When k > 0, produces a smooth blend between children.
should_union_distribution (bool) – If true, the distribution will be unioned.
children (list[Node]) – The children nodes.
- class pyvcad.BBoxUnion
An n-ary node that represents the union of bounding boxes.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.BBoxUnion) -> None
Default constructor for BBoxUnion.
__init__(self: pyvcad.pyvcad.BBoxUnion, children: collections.abc.Sequence[pyvcad.pyvcad.Node]) -> None
Constructor that creates a BBoxUnion node with the given list of child nodes.
- Parameters:
children (list of Node) – The list of child nodes.
- class pyvcad.Offset
Shifts a child’s signed distance by a constant value. Negative offset moves the surface inward and positive offset moves it outward.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Offset) -> None
Default constructor with zero offset.
__init__(self: pyvcad.pyvcad.Offset, arg0: typing.SupportsFloat) -> None
Constructor with a specified offset.
- Parameters:
offset (double) – The offset to apply to the signed distance.
__init__(self: pyvcad.pyvcad.Offset, arg0: typing.SupportsFloat, arg1: pyvcad.pyvcad.Node) -> None
Constructor with a specified offset and a child node.
- Parameters:
offset (double) – The offset to apply to the signed distance.
child (Node) – The child node.
- set_child(self: pyvcad.pyvcad.Offset, child: pyvcad.pyvcad.Node) None
Sets the single child of this node.
- class pyvcad.Shell
Computes an inward shell of a child node using a specified thickness.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Shell, thickness: typing.SupportsFloat) -> None
Constructor with shell thickness. Thickness must be positive.
__init__(self: pyvcad.pyvcad.Shell, thickness: typing.SupportsFloat, child: pyvcad.pyvcad.Node) -> None
Constructor with shell thickness and a child node. Thickness must be positive.
- class pyvcad.ConformalMap
A conformal map node that wraps a pattern node onto the surface of a base node. This mapping preserves angles during the transformation. The base node serves as the surface to wrap onto (left child) while the pattern node (right child) is mapped onto this surface.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.ConformalMap) -> None
Default constructor. Creates an empty ConformalMap node.
Example
>>> from libvcad import pyvcad as pv >>> base_surface = pv.Sphere(pv.Vec3(0, 0, 0), 10.0, 1) >>> pattern = pv.RectPrism(pv.Vec3(-1, -1, -0.2), pv.Vec3(1, 1, 0.2), 2) >>> conformal = pv.ConformalMap() >>> conformal.set_left(base_surface) >>> conformal.set_right(pattern)
__init__(self: pyvcad.pyvcad.ConformalMap, base: pyvcad.pyvcad.Node, pattern: pyvcad.pyvcad.Node) -> None
Constructor that sets the base surface and pattern children.
- Parameters:
base (std::shared_ptr<Node>) – The base surface node to wrap onto (left child).
pattern (std::shared_ptr<Node>) – The pattern node to be wrapped onto the base surface (right child).
Example
>>> from libvcad import pyvcad as pv >>> base_surface = pv.Sphere(pv.Vec3(0, 0, 0), 10.0, 1) >>> pattern = pv.RectPrism(pv.Vec3(-1, -1, -0.2), pv.Vec3(1, 1, 0.2), 2) >>> conformal = pv.ConformalMap(base_surface, pattern)
__init__(self: pyvcad.pyvcad.ConformalMap, base: pyvcad.pyvcad.Node, pattern: pyvcad.pyvcad.Node, ref_dir: pyvcad.pyvcad.Vec3) -> None
Constructor with explicit reference direction.
- Parameters:
base (std::shared_ptr<Node>) – The base surface node to wrap onto (left child).
pattern (std::shared_ptr<Node>) – The pattern node to be wrapped onto the base surface (right child).
ref_dir (Vec3) – A reference direction vector used to orient the mapping.
Example
>>> from libvcad import pyvcad as pv >>> base_surface = pv.Sphere(pv.Vec3(0, 0, 0), 10.0, 1) >>> pattern = pv.RectPrism(pv.Vec3(-1, -1, -0.2), pv.Vec3(1, 1, 0.2), 2) >>> ref_direction = pv.Vec3(0, 1, 0) # Use Y-axis as reference >>> conformal = pv.ConformalMap(base_surface, pattern, ref_direction)