Volumetric Node and Property Reference
Nodes are added to a Graph through its GraphNodes collection with GraphNodes.add(name, nodeTypeString) . Output channels are retrieved with GraphNodes.outputNode and a GraphOutputNodeTypes constant; pins are wired with GraphNodePin.connect . See Graphs and channels for channel names and graph evaluation for how channels combine.
Listing Nodes in a Graph
To inspect an existing graph, iterate the node's collection and print each node's type, name, and properties:
import adsk.volume
primaryGraph = volumetricModel.getGraph(adsk.volume.GraphTypes.PrimaryGraphType)
for node in primaryGraph.nodes:
propNames = [node.properties.item(j).name for j in range(node.properties.count)]
print(node.nodeType, node.name, propNames)
You can also look up a node by name with GraphNodes.itemByName , or obtain a snapshot array with GraphNodes.asArray . List available node type strings with Graph.allPossibleNodeTypes .
Property Types
Node properties are accessed through GraphNode.properties and cast to the appropriate property class:
Node Type Catalog
The following type strings are valid arguments to GraphNodes.add . They are grouped by category. Unless noted, nodes can be used in either graph; coordinate and cell-shape nodes are typically placed in the Cell graph, while boundary and density nodes belong in the Primary graph.
SDF Primitives
BoxSDFAxis-aligned box signed distance field
CylinderSDFCylinder SDF
SphereSDFSphere SDF
TorusSDFTorus SDF
PlaneSDFPlane SDF
ReferencedGeometrySDFSDF from Fusion BRep geometry (bodies, faces). See Referenced geometry below.
ShellShell offset operation on an input SDF
Geometry References
ReferencedCurveLengthScalar field from curve length
ReferencedCurveCoordsCoordinates along a referenced curve
ReferencedFaceCoordsCoordinates on a referenced face
Constants and Noise
ConstantScalarFixed scalar value (value property)
ConstantColorFixed color value
PerlinNoiseScalarPerlin noise scalar field
VoronoiNoiseScalarVoronoi noise scalar field
InvertDensityInverts a density input
GradientVectorGradient of a scalar field as a vector
Image Samplers
ImageSamplerScalarSample a 2D image as scalar
ImageSamplerVectorSample a 2D image as vector
ImageSamplerColorSample a 2D image as color
3DImageSamplerScalarSample a 3D image volume as scalar
ExternalColorExternal color source
Coordinate Transforms
TransformCoordsScale, translate, and rotate cell coordinates
HomogenousTransformCoordsTransform using a homogeneous matrix
TwistCoordsTwist deformation of coordinates
AxisBasedDeformCoordsDeform coordinates about an axis
SphereCoordsConvert to spherical coordinates
TorusCoordsConvert to toroidal coordinates
CylinderCoordsConvert to cylindrical coordinates
Control Point Maps and Falloff
ControlPointMapScalarToScalarMap scalar input to scalar output via control points
ControlPointMapScalarToColorMap scalar input to color via control points
FalloffMappingDistance-based falloff mapping
Type Conversion and Math
VectorToColorConvert vector to color
CombineScalarsToVectorBuild a vector from scalars
CombineScalarsToColorBuild a color from scalars
SplitVectorToScalarsSplit vector into x, y, z scalars
SplitColorToScalarsSplit color into r, g, b, a scalars
LengthOfVectorVector magnitude
NormalizeVectorUnit vector
BinaryOperatorScalarBinary operation on two scalars
BinaryOperatorVectorBinary operation on two vectors
BinaryOperatorColorBinary operation on two colors
MultiplyScalarMultiply scalars
MultiplyVectorMultiply vectors
MultiplyColorMultiply colors
Function Nodes
FunctionScalarToScalarExpression with scalar input and scalar output
FunctionVectorToScalarExpression with vector input and scalar output (common for cell shapes)
FunctionVectorToVectorExpression with vector input and vector output
FunctionVectorToColorExpression with vector input and color output
Expression syntax for function nodes is documented in Volumetric Function Expression Syntax .
Referenced Fusion Geometry
The ReferencedGeometrySDF node converts Fusion BRep geometry into a signed distance field. Set the geometry reference on the node's GeometryGraphNodeProperty . Use Shell to offset the resulting SDF inward or outward.
import adsk.core, adsk.volume
primaryGraph = volumetricModel.getGraph(adsk.volume.GraphTypes.PrimaryGraphType)
# Reference a boundary body (use createForAssemblyContext in assemblies)
geomNode = primaryGraph.nodes.add("BoundaryBody", "ReferencedGeometrySDF")
geomProp = adsk.volume.GeometryGraphNodeProperty.cast(
geomNode.properties.itemByName("geometry"))
geomProp.value = [boundaryBody]
# Optional: shell the referenced geometry SDF
shellNode = primaryGraph.nodes.add("ShellOffset", "Shell")
shellNode.properties.itemByName("thickness").value = 0.1
geomNode.outputPins.item(0).connect(shellNode.inputPins.item(0))
boundaryChannel = primaryGraph.nodes.outputNode(
adsk.volume.GraphOutputNodeTypes.BoundarySDFOutputNodeType)
shellNode.outputPins.item(0).connect(boundaryChannel.inputPins.item(0))
Related topics