vcNode
Object type for nodes, which are used by components and other objects to form tree structures.
See in: Overview
Module: vcCore
Parent: vcObject
Children: vcComponent, vcLayout, vcLinkNode
Referenced by: vcAnnotation.Node, vcApplication.loadVCMX(), vcAuthorContext.ActiveNode, vcBaseFrame.Node, ... (see more)
vcAnnotation.Node
vcApplication.loadVCMX()
vcAuthorContext.ActiveNode
vcBaseFrame.Node
vcBehavior.Node
vcCollisionRecord.NodeA
vcCollisionRecord.NodeB
vcCore.getNode()
vcDimension.Node1
vcDimension.Node2
vcKinematics.FlangeNode
vcKinematics.RootNode
vcLinkJoint.ParentNode
vcPickedTopologyCurveInfo.Node
vcRaycastResult.Node
vcServoController.FlangeNode
vcServoController.RootNode
vcSetBaseStatement.Node
vcSetToolStatement.Node
vcSimAttachmentField.ConnectedTo
vcSimAttachmentField.Node
vcSimHierarchyField.Node
vcSweptVolume.TargetNode
vcTransportTarget.ProductPositionNode
vcTransportTarget.ResourcePositionNode
vcVolumeDetector.getHitNode()
Properties
Learn how to use properties here. The properties are also inherited from the parent class.
| Name | Type | Access | Description |
| Behaviors | vcList[vcBehavior] | R | Gets a list of all behaviors within this node. |
| BoundingBox | vcBoundingBox | R | Gets the bounding box of node. |
| Children | vcList[vcNode] | R | Gets a list of node's immediate child nodes. |
| Component | vcComponent | R | Gets the component of node. |
| Geometry | vcGeometryContainer | R | Gets the container of geometry in node. |
| InverseWorldPositionMatrix | vcMatrix | R | Gets inverse of node's position matrix in World coordinate system. |
| MaterialInheritance | vcMaterialInheritance | RW | Gets or sets the mode for managing NodeMaterial property. For example, node material could override feature materialsand child nodes. |
| Name | String | RW | Gets or sets node name. Exceptions: ValueError: When given name is empty or not unique. |
| NodeMaterial | vcMaterial | RW | Gets or sets the node's material. This See moreproperty is used with MaterialInheritance to define how the node's material is assigned to its features and child nodes. |
| NodeVisible | Boolean | RW | Gets or sets the visibility of the node but not its child nodes. |
| Parent | vcObject | R | Gets the parent node of this node. |
| PositionMatrix | vcMatrix | RW | Gets or sets the position matrix of a node in parent coordinate system. |
| Properties | vcPropertyContainer | R | Gets the properties of this node. |
| RootFeature | vcFeature | R | Gets the root feature of node. |
| Type | vcSimNodeType | R | Gets the node's type |
| UserGeometry | vcGeometryContainer | R | Gets a container of geometry that is unique to the node. That is, the geometry of this container is never shared with other nodes. |
| Visible | Boolean | RW | Gets or sets the visibility of the node and its child nodes. |
| World | vcWorld | R | Object type for nodes, which are used by components and other objects to form tree structures. |
| WorldPositionMatrix | vcMatrix | RW | Gets the position matrix of node in World coordinate system. |
Methods
Learn how to use methods here. The methods are also inherited from the parent class.
| Name | Return Type | Parameters | Description |
| attachChild | None | vcNode childNode, Optional Keyword[permanent = Boolean] | Attaches a given node to this node as a child.See moreParameters: childNode (vcNode): A node to attach to. permanent (Boolean): When set to False, the attachment will be reset on simulation reset. Exceptions: ValueError: When adding non-component to a world. ValueError: When adding world as a child to another node. ValueError: When adding parent of a node as its child. ValueError: When the node hierarchy is locked. |
| createBehavior | vcBehavior | vcBehaviorType type, String name, Optional Keyword[useExisting = Boolean] | Creates a new behavior of a given type and name in this node.See moreParameters: type (vcBehaviorType): The behavior type to create. name (String): The name for the newly created behavior. useExisting (Boolean): Whether to return an existing behavior with the given name name if True, or throw an error if the name is not unique if False. Defaults to False. Exceptions: RuntimeError: When there is no license for Modeling API or a more specific API required to create the desired type of behavior. ValueError: When behavior creation failed. Returns: vcBehavior: Newly created behavior object. |
| delete | None | None | Deletes the node.See moreExceptions: RuntimeError: When there is no license for Modeling API. RuntimeError: When the node or its sub-tree contains the calling Python script. RuntimeError: When the node is in transition. RuntimeError: When the node hierarchy is locked. |
| findBehavior | vcBehavior | String name, Optional Keyword[searchScope = vcNodeTreeScope] | Gets the first behavior matching a given name within given search scope.See moreParameters: name (String): Behavior's name to search for. searchScope (vcNodeTreeScope): Indicates the extent of the search. Returns: vcBehavior: Behavior matching given name; otherwise None. |
| findBehavior | vcBehavior | vcBehaviorType type, Optional Keyword[searchScope = vcNodeTreeScope] | Gets the first behavior matching a given type within given search scope.See moreParameters: type (vcBehaviorType): The behavior type to search for. searchScope (vcNodeTreeScope): Indicates the extent of the search. Returns: vcBehavior: Behavior matching given type, or None when no behavior match the search criteria. |
| findFeature | vcFeature | String name, Optional Keyword[searchScope = vcNodeTreeScope] | Returns the first feature matching a given name within given search scope.See moreParameters: name (String): Feature's name to search for. Returns: vcFeature: Feature matching given name; otherwise None. |
| findNode | vcNode | String name, Optional Keyword[searchScope = vcNodeTreeScope] | Finds the first child node matching a given name.See moreParameters: name (String): Node's name to search for. searchScope (vcNodeTreeScope): Indicates the extent of the search. Returns: vcNode: Found node matching the given name; otherwise None. |
| getBehaviors | list[vcBehavior] | Optional Keyword[retrievalScope = vcNodeTreeScope] | Gets a list of all behaviors within given retrieval scope.See moreParameters: retrievalScope (vcNodeTreeScope): Indicates the extent of the retrieval. Returns: List of vcBehaviors: All behaviors within retrieval scope. |
| getChildComponents | list[vcComponent] | Optional Keyword[searchScope = vcNodeTreeScope] | Gets a list of all components attached to the node.See moreParameters: searchScope (vcNodeTreeScope): Indicates the extent of the search. Returns: List of vcComponents: All components attached to given node. |
| localToWorld | vcVector | vcVector vector | Transforms given vector from node's local coordinate system to the world coordinate system.See moreParameters: vector (vcVector): vector in node's local coordinate system. Returns: vcVector: vector in world coordinate system. |
| localToWorld | vcMatrix | vcMatrix matrix | Transforms given matrix from node's local coordinate system to the world coordinate system.See moreParameters: matrix (vcMatrix): matrix in node's local coordinate system. Returns: vcMatrix: matrix in world coordinate system. |
| rebuild | None | Optional Keyword[updateTree = Boolean] | Rebuilds the geometry of node by re-evaluating its feature tree.See moreNote: Try to avoid using this method during a simulation. Parameters: updateTree (Boolean): When True, rebuilds also node's sub-tree, including any child components. Exceptions: RuntimeError: When rebuilding node that is in process of being removed. |
| update | None | Optional Keyword[updateTree = Boolean] | Updates the node.See moreParameters: updateTree (Boolean): When True, updates also node's sub-tree, including any child components. |
| worldToLocal | vcVector | vcVector vector | Transforms given vector from world coordinate system to the node's local coordinate system.See moreParameters: vector (vcVector): vector in world coordinate system. Returns: vcVector: vector in node's local coordinate system. |
| worldToLocal | vcMatrix | vcMatrix matrix | Transforms given matrix from world coordinate system to the node's local coordinate system.See moreParameters: matrix (vcMatrix): matrix in world coordinate system. Returns: vcMatrix: matrix in node's local coordinate system. |
Events
Learn how to use events here. The events are also inherited from the parent class.
| Name | Parameters | Description |
| OnNodeTransform | vcNode node | Triggered when node's pose in the world changes. Parameters: node (vcNode): The transformed node. |
Example: Create New Behavior
""" This example shows how to create a new behavior. """ import vcCore as vc import vcBehaviors as vc_beh comp = vc.getComponent() sensor_signal = comp.createBehavior(vc_beh.vcBehaviorType.BOOLEAN_SIGNAL, "SensorSignal")
Example: Node Visibility Toggle
"""Toggle node visibility""" import vcCore as vc comp = vc.getComponent() node = comp.findNode('Axis 2') # Tested with Generic Articulated Robot node.NodeVisible = False
Example: Node Access
"""Access the node that owns this script, and its parent and children nodes""" import vcCore as vc node = vc.getNode() parent = node.Parent print(parent) # Access immediate child of a node children = node.Children for child in children: print(child) # Access many children of the node def recursive_loop(node): children = node.Children for child in children: print(child) recursive_loop(child) recursive_loop(node)
Example: Node Attach
"""Attach one node (or component) to another during simulation run""" import vcCore as vc node = vc.getNode() # vc.getComponent() would also work world = vc.getWorld() other = world.findComponent('example') async def OnRun(): print(node.Children) # Retain position: node -> world -> other mtx = node.InverseWorldPositionMatrix * other.WorldPositionMatrix node.attachChild(other, False) # True value for permanent attachment, False to detach upon reset other.PositionMatrix = mtx print(node.Children)