Skip to content

csg

Constructive solid geometry operations on block models.

3 functions / 3 types

Modules

Index

FunctionDescription
block_modelCombines two block-model project nodes with CSG and returns a new project node ID.
get_configReturns the current project geometry settings, or the documented defaults if none were set.
set_configSets geometry settings for subsequent block-model CSG in this project.
TypeDescription
BlockModelCombines two block-model project nodes with CSG and returns a new project node ID.
BlockModelCsgConfigGeometry settings for block-model CSG, shared by local and server execution.
BlockModelCsgOpSelects which CSG operation UnsafeBlockModelCsg applies to its two inputs.

block_model

def block_model(
    *,
    left: types.project.object.ProjectNode,
    right: types.project.object.ProjectNode,
    csg_op: types.csg.BlockModelCsgOp,
    name: str,
    _transaction_id: str | None = None
) -> types.project.object.ProjectNode

Combines two block-model project nodes with CSG and returns a new project node ID.

Native-only. Reads the inputs’ current world transforms, hides both input nodes, and creates the result with the left node’s appearance. The input models remain in the model store. The result ID is a node ID, not a stored model handle or runtime scene ID.

The operation returns after its project writes are applied, before scene synchronization. Wait for scene synchronization before reading the result’s model info or inspecting rendering. To clear the result as one undoable change, delete its node and restore both input visibilities in one committed transaction. Browser CSG uses the low-level model-handle task with remote execution instead of this node-level operation.

Returns ProjectNode.

left : ProjectNode

The “base” node the operation is applied relative to. The result inherits its appearance.

right : ProjectNode

The node combined with left.

csg_op : BlockModelCsgOp

The CSG operation to apply.

name : str

Name of the newly created result node.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

get_config

def get_config(*, _transaction_id: str | None = None) -> types.csg.BlockModelCsgConfig

Returns the current project geometry settings, or the documented defaults if none were set.

Returns BlockModelCsgConfig.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

set_config

def set_config(
    *,
    config: types.csg.BlockModelCsgConfig,
    _transaction_id: str | None = None
) -> None

Sets geometry settings for subsequent block-model CSG in this project.

Applies to local and server runs. Each queued operation captures these values. Existing results are unchanged. Read std.csg.get_config and preserve its other field when changing one value.

Both supplied distances must be finite and non-negative. If the minimum block size is non-zero, epsilon must be smaller. Invalid settings are rejected before the current configuration changes. Zero disables the corresponding tolerance. This setting is not undone with the transaction.

Returns None.

config : BlockModelCsgConfig

Geometry settings for subsequent CSG operations in this project.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

BlockModel

BlockModel(
    *,
    left: types.project.object.ProjectNode,
    right: types.project.object.ProjectNode,
    csg_op: types.csg.BlockModelCsgOp,
    name: str
)

Combines two block-model project nodes with CSG and returns a new project node ID.

Native-only. Reads the inputs’ current world transforms, hides both input nodes, and creates the result with the left node’s appearance. The input models remain in the model store. The result ID is a node ID, not a stored model handle or runtime scene ID.

The operation returns after its project writes are applied, before scene synchronization. Wait for scene synchronization before reading the result’s model info or inspecting rendering. To clear the result as one undoable change, delete its node and restore both input visibilities in one committed transaction. Browser CSG uses the low-level model-handle task with remote execution instead of this node-level operation.

left : ProjectNode

The “base” node the operation is applied relative to. The result inherits its appearance.

right : ProjectNode

The node combined with left.

csg_op : BlockModelCsgOp

The CSG operation to apply.

name : str

Name of the newly created result node.

BlockModelCsgConfig

BlockModelCsgConfig(*, epsilon: float, min_block_size: float)

Geometry settings for block-model CSG, shared by local and server execution.

For models in meters, the defaults mean 1 mm boundary precision and a 1 cm minimum generated side length. Server execution requires a service version that supports configured CSG operations.

Both values are distances in the models’ common coordinate units (meters for meter-based models). Zero disables the corresponding tolerance. Values must be finite and non-negative; epsilon must be smaller than a non-zero minimum block size.

epsilon : float

Maximum distance for treating boundaries as coincident. Default: 0.001 model units. This controls overlap detection, coverage tests and merging adjacent faces.

min_block_size : float

Minimum full side length along every axis of a generated block. Default: 0.01 model units. Blocks exactly this size are retained. Reused input geometry and point/ball samples are exempt. Every emitted DAG block is checked, including copied input blocks. Increasing this value does not increase the face-merging distance.

BlockModelCsgOp

Enum

class BlockModelCsgOp(IntEnum)

Selects which CSG operation UnsafeBlockModelCsg applies to its two inputs.

Values: SUBTRACT = 0 Removes from left any geometric overlap with right. REPLACE = 1 Keeps every block of right as-is, plus every part of left that doesn’t overlap right. SELECT = 2 Keeps the subset of left’s blocks that overlap right (with left’s attributes only). MERGE = 3 Keeps the parts of left and right that don’t overlap each other, plus their overlap. INTERSECT = 4 Keeps the subset of left’s blocks that overlap right, with attributes combined.

SUBTRACT = 0

Removes from left any geometric overlap with right.

REPLACE = 1

Keeps every block of right as-is, plus every part of left that doesn’t overlap right.

SELECT = 2

Keeps the subset of left’s blocks that overlap right (with left’s attributes only).

MERGE = 3

Keeps the parts of left and right that don’t overlap each other, plus their overlap.

INTERSECT = 4

Keeps the subset of left’s blocks that overlap right, with attributes combined.