Tree — attribute nodes
Unary nodes that modify or filter attributes on the tree.
- class pyvcad.AttributeModifier
An attribute modifier node that applies a converter to its child’s attributes.
Note: Setting or getting attributes directly on this node via set_attribute or get_attribute is not supported and will raise an error.
- __init__(self: pyvcad.pyvcad.AttributeModifier, converter: AttributeConverterBase, child: pyvcad.pyvcad.Node) None
Constructor. Creates an AttributeModifier with a converter and a child node.
- Parameters:
converter (AttributeConverterBase) – The attribute converter to apply.
child (Node) – The child node to be modified.
- class pyvcad.ConvolveKernel
- __init__(*args, **kwargs)
- get_radius_x(self: pyvcad.pyvcad.ConvolveKernel) int
Gets the X radius of the kernel.
- get_radius_y(self: pyvcad.pyvcad.ConvolveKernel) int
Gets the Y radius of the kernel.
- get_radius_z(self: pyvcad.pyvcad.ConvolveKernel) int
Gets the Z radius of the kernel.
- class pyvcad.BoxKernel
A Box Kernel acts as a simple uniform average over a local radius volume.
- Parameters:
radius (int) – Uniform radius in all three axes. If set to 1, samples a 3x3x3 grid.
Example
>>> from libvcad import pyvcad as pv >>> kernel = pv.BoxKernel(1)
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.BoxKernel, radius: typing.SupportsInt) -> None
__init__(self: pyvcad.pyvcad.BoxKernel, rx: typing.SupportsInt, ry: typing.SupportsInt, rz: typing.SupportsInt) -> None
- class pyvcad.CustomKernel
A Custom Convolution Kernel created from an array of explicit weights.
- Parameters:
weights (list[float]) – A flattened list of 3D kernel weights.
rx (int) – The X radius. The array should have size (2*rx+1)*(2*ry+1)*(2*rz+1)
ry (int) – The Y radius.
rz (int) – The Z radius.
Example
>>> from libvcad import pyvcad as pv >>> target_size = 27 # 3x3x3 >>> kernel = pv.CustomKernel([1.0]*target_size, 1, 1, 1)
- __init__(self: pyvcad.pyvcad.CustomKernel, weights: collections.abc.Sequence[SupportsFloat], rx: SupportsInt, ry: SupportsInt, rz: SupportsInt) None
- class pyvcad.Convolve
A Unary node that applies a convolution kernel to the continuous attributes of its child node.
This is highly useful for blending, blurring, or sharpening color or material distributions without affecting the raw signed distance field geometry.
- Parameters:
child (Node) – The node to process.
attributes (list[str]) – Names of the attributes to target. Pass an empty list to target all.
kernel (ConvolveKernel) – The kernel to apply.
physical_radius (list[float]) – [rx, ry, rz] physical bounds (in mm) that the kernel spans.
enable_cache (bool) – Toggles the internal volumetric LRU cache. Defaults to true.
Example
>>> from libvcad import pyvcad as pv >>> kernel = pv.BoxKernel(2) >>> blur_node = pv.Convolve(my_shape, ['Temperature'], kernel, [5.0, 5.0, 5.0])
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pyvcad.pyvcad.Convolve, child: pyvcad.pyvcad.Node, attributes: collections.abc.Sequence[str], kernel: pyvcad.pyvcad.ConvolveKernel, physical_radius: collections.abc.Sequence[typing.SupportsFloat]) -> None
__init__(self: pyvcad.pyvcad.Convolve, child: pyvcad.pyvcad.Node, attributes: collections.abc.Sequence[str], kernel: pyvcad.pyvcad.ConvolveKernel, physical_radius: collections.abc.Sequence[typing.SupportsFloat], enable_cache: bool) -> None
- cache_capacity(self: pyvcad.pyvcad.Convolve) int
Gets the current cache capacity limit
- set_cache_capacity(self: pyvcad.pyvcad.Convolve, capacity: SupportsInt) None
Sets the cache capacity limit
- set_use_cache(self: pyvcad.pyvcad.Convolve, enabled: bool) None
Toggle the internal cache.
- use_cache(self: pyvcad.pyvcad.Convolve) bool
Check if the cache is active.