Overview

The following is a quick overview of Python API naming conventions, properties and class structure.

Contents ShowHide

Properties

Naming

Python Classes

Properties

Properties are accessed as attributes of objects. There is also a vcProperty object that is used for registering events and setting the attributes of property objects themselves.

Naming

Name | Format | Example
Constants | VC_[CONSTANT_NAME] | Prefix of "VC_" with all letters capitalized, and each word is separated with an underscore (_).
Events | On[EventName] | Prefix of event name is "On" and for every following word its first character is capitalized, for example OnStart.
Methods | [methodName]() | First character is lowercase and for every following word its first character is capitalized, for example getConnection().
Objects | vc[ObjectName] | vcGeometryFeature.
Properties | [PropertyName] | First character is capitalized, for example Speed, Mass and Name.

Python Classes

vcAction

vcApplication

vcBaseFrame

vcBehaviour

vcActionContainer

vcBaseContainer

vcBooleanSignalMap

vcExecutor

vcFlow

vcComponentFlowProxy

vcContainer

vcComponentContainer

vcPatternContainer

vcComponentCreator

vcInterpolatingTransportController

vcMotionPath

vcOneDirectionalPath

vcRoutingRule

vcTwoDirectionalPath

vcTransport

vcIntegerSignalMap

vcJogInfo

vcKinematics

vcNodelist

vcPythonKinematics

vcProcessController

vcProcessExecutor

vcProcessPointSensor

vcProductCreator

vcRslProcessHandler (Deprecated) use vcPythonProcessHandler

vcRslProgramExecutor (Deprecated) use vcExecutor

vcScript

vcServoController

vcRobotController

vcSignal

vcBoolSignal

vcComponentSignal

vcIntegerSignal

vcMatrixSignal

vcRealSignal

vcStringSignal

vcSimVehicle

vcSimInterface

vcStatistics

vcStringSignalMap

vcToolContainer

vcTransportController

vcPythonTransportController

vcTransportNode

vcBitMap

vcCamera

vcCommand

vcInteractiveCommand

vcTopologyPickCommand

vcTranslateCommand

vcSelectCommand

vcSnapCommand

vcCommandEvent (Deprecated)

vcConnector

vcContext

vcAuthorContext

vcConfigureContext

vcDrawingContext

vcTeachContext

vcDistributionModeProductLineEntry

vcDof

vcFeature

vcFrameFeature

vcGeometryFeature

vcFrameSetVisualization

vcGeometryContainer

vcGeometrySet

vcCompactLineSet

vcCurveData

vcFrameSet

vcLineSet (Deprecated) Use vcCompactLineSet

vcPoint (Deprecated)

vcPointSet

vcPolygonSet (Deprecated) Use vcTriangleSet

vcText2DSet

vcText3DSet

vcTriangleSet

vcJacobian

vcJoint

vcKinObject

vcLayer

vcLayoutItem

vc3DIcon

vcAnnotation

vcCollisionDetector

vcDimension

vcLayoutPackFolder

vcLayoutPropertyList

vcLayoutSchemaPropertyList

vcPathObject (Deprecated)

vcProcessControllerData

vcReport

vcSweptVolume

vcViewAnimation

vcLight

vcMaterial

vcMatrix

vcMotionInterpolator

vcMotionTarget

vcNode

vcComponent

vcPathObjectNode (Deprecated)

vcPathObjectActionNode (Deprecated)

vcPathObjectMotionNode (Deprecated)

vcPathObjectParameterNode (Deprecated)

vcPathObjectReferenceNode (Deprecated)

vcPathObjectSegment (Deprecated)

vcPositionFrame

vcPositionFrameIterator

vcPrimitive

vcEdge (Deprecated)

vcLine (Deprecated)

vcPoint (Deprecated)

vcPolygon (Deprecated)

vcProductCreator

vcProductCreatorDistributionMode

vcProductCreatorSequenceMode

vcProductCreatorTableMode

vcProductType

vcProgram

vcProperty

vcPropertyListValue

vcRslRoutine (Deprecated) use vcRoutine

vcRslStatement (Deprecated) use vcStatement

vcRslMotionStatement (Deprecated) use vcMotionStatement

vcRslProcessStatement (Deprecated) use vcPositionStatement

vcScalarQuantity

vcVectorQuantity

vcSchemaPositionFrame

vcScope

vcRoutine

vcProcessRoutine

vcScopeStatement

vcSelection (Deprecated)

vcSelectionManager

vcSimInterfaceField

vcSimInterfaceSection

vcSimulation

vcStatisticsManager

vcStatement

vcIfStatement

vcPathStatement

vcPositionStatement

vcMotionStatement

vcProcessIfStatement

vcProcessWhileStatement

vcScopeStatement

vcSwitchCaseStatement

vcStatisticsChart

vcStatisticsDashboard

vcStatisticsSeries

vcStatisticsTab

vcToolFrame

vcTopology

vcUnit

vcUnitFamily

vcUnitGroup

vcVector

vcView

vcVREvents

vcVolumeDetector


Python Syntax

Python is an interpreted, object-oriented, high-level programming language optimized for quality, productivity, portability and integration. Developed by the open source community and arbitrated by Guido van Rossum, the creator of Python. Python is now used by hundreds of thousands of developers around the world. The available libraries combined with Python's high-level built in data structures and dynamic typing make it very attractive for rapid application development, and the ideal scripting language to extend and customize the application simulation framework and components.

The application uses a "stackless" version of Python 2.7.1 which can be downloaded at http://www.python.org/download/releases/. Links to the 3rd party documentation, tutorials and modules are available at http://www.python.org as well. The Python community has developed a substantially large set of resources to help all levels of users from an absolute beginner to an experienced coder learn Python in the most efficient way. Before purchasing a user manual we recommend checking this web site first.

For more information about stackless Python itself, you should visit the stackless Python web site at http://www.stackless.com.

Contents ShowHide

Modules

Methods

Modules

A module is a file containing Python definitions and statements. The name of the file (without the .py or .pyc) extension is used as the name of the module. Definitions from a module can be imported into other modules using the import statement. A module can contain executable statements as well as function definitions. These statements are intended to initialize the module. They are executed only the first time the module is imported somewhere.

Standard Modules

Python comes with a library of standard modules, described in Python Library Reference, available at http://www.python.org. The integrated Python also includes main application framework specific modules or API such as vcScript, vcApplication and vcKinematics. These and other API modules are described in the Python API reference guide.

3rd Party Modules

Common 3rd party modules (TCP/IP communication, ODBC, Win32, COM, TkInter) are also installed with the product.

If you use any extensions that are not included in the product installer, you must copy the extension package into the main application's Python library directory, usually located at C:\Program Files\[Provider]\[Product Name]\Python.

Python scripts are copied to the lib\ subdirectory. Python assemblies can be copied to the DLLs\ subdirectory.

Modules are imported using the import statement with the module name. The definitions from a module can then be accessed by prefixing the module name to the function name.

# Fibonacci numbers module
# write Fibonacci series up to n
def fib(n):
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b

# return Fibonacci series up to n
def fib2(n):
result = []
a, b = 0, 1
while b < n:
result.append(b)
a, b = b, a+b
return result

Example. Import and use a module

import fibo
fibo.fib2(8)

A user can also import specific or all definitions from a module, after which they can be accessed directly.

Example. Import all definitions and use a module

from fibo import *
fib2(8)

Methods

Python has a remarkably simple, readable and maintainable syntax, which makes it easy to learn for the application engineer, while at the same time powerful enough for the software developer. The following is a brief overview of the syntax used in Python.

Note: Python uses indentation for conclusion of logical sequences so there are no end-for, endif or endwhile type statements.

Built-in Types (objects)

Python supports the following built-in types:

  • Numbers (integer, floating point and complex)
  • Strings
  • Lists
  • Dictionaries
  • Files

Variables

Variables do not have a type and users are not required to declare them. Variables are initialized when you first use them. Assignment is done using the = operator.

Example. Assign value with = operator

a=5
a=6.7

A user can assign the same value to multiple variables.

Example. Assign same value to multiple variables

x=y=z=8

A user can also assign multiple values to several variables.

Example. Assign multiple values to several variables

x=y=z=8

Expressions

Python uses infix notation with standard order of evaluation (i.e. * and / before + and -) with the order of evaluation changed using parenthesis.

Supported operations include but not limited to:

  • Arithmetic
    < - + >
  • Logical
    and or not
  • Bitwise
    & | ^
  • Membership
    in
  • Shifts
    << >>
  • Comparison
    < == != <= >=

Example. Expression

2*(5-3)

Statements

Python does not use an explicit end of statement token; the end of the line marks the end of the statement. A semi-colon (;) is used as a statement separator for writing more than one statement on a line.

Example. Statements with statement separator

a=5
b=a+8
a=5; b=a+8

Statement Blocks

Block markers are grouped using indentation. That is, statements on the same indentation level belong to the same statement group or code block. Indentation of statements and code can be referred to as nesting statements.

Example. Python

a=5
b=a+8
c = b-3

Control Structures

The following are examples of the types of control structures often used by a user.

Example. IF

if test:
#statements
elif test:
#statements
elif test:
#statements
else:
#statements

In an if statment, elif and else are optional.

Example. WHILE

while test:
#statements
else:
#statements
#statements are only executed if the loop exits normally from the while statement

Example. FOR

for target in objects:
#statements
else:
#statements

Example. BREAK

a = 0

#Breaks the innermost loop.
#Execution continues with the statement following the loop (else statements are not executed)
while a < 5:
a = a + 1
if a == 3:
break

# prints 3
print a

Example. CONTINUE

#print all numbers in range except 3
for i in range(8):
if i == 3:
continue #continues to the next iteration of loop
print i

Example. PASS

#if number in range is 3, do nothing
for i in range(8):
if i == 3:
pass
else:
print i

Functions

Functions are defined using a def keyword and a format shown in the following example.

Example. Function

def functionname(arguments):
#statements

def div(x,y):
return x / y


Constants

Action Constants

Approach Axis Constants

Behavior Constants

Bitmap Constants

Collider Constants

Collision Detector Constants

Command Constants

Command Event Constants

Component Constants

Connector Constants

Container Constants

Context Constants

Controller Constants

Entity Constants

Feature Constants

Feed Mode Constants

Frame Set Visualization Constants

Geometry Constants

Interactive Constants

Interface Constants

Interpolation Constants

Joint Axis Constants

Joint Constants

Light Constants

Layout Item Constants

Material Constants

Menu Constants

Motion Constants

Motion Path Constants

Motion Target Constants

Node Constants

Path Object Constants

Process Modeling Constants

Process Point Constants

Property Constants

Quantity Constants

Recording Constants

Render Shadows Constants

Routing Constants

Selection Constants

Solution Constants

Statement Constants

Statistics Constants

Swept Volume Constants

Topology Constants

Unit Constants

Action Constants

Action Types

Name | Description
VC_ACTION_WORK | Work for a specific time or using specific RSL sequence.
VC_ACTION_TRANSPORT | Transport component to target component.
VC_ACTION_MOVE | Move resource component to the specific component (and location).
VC_ACTION_LOAD | Load component to the resource.
VC_ACTION_UNLOAD | Unload component from resource to given component.

Python keyword Notation and Arguments

VC_ACTION_WORK

Work for a specific time or using specific RSL sequence at current place or location defined by component or vcMatrix.

Work action can use Python keyword notation or arguments alone (using keyword argument order).

Name | Type | Required | Description
Worktime | Real | Always | Defines work time in seconds.
Place vcComponent Optional Defines component where work takes place.

If Place is not defined, work is executed at resources current location.

If Place is defined together with Location, Location is used as resource location.

If only Place argument is defined, then resource location is defined by locating frame feature named ResourceLocation in the Place component.

If ResourceLocation frame feature is not defined, then component origin is used as resource location.
Location | vcMatrix | Optional | Defines resource position during work in world coordinate system.
Sequence | String | Optional | Defines work animation/rsl sequence name.

VC_ACTION_TRANSPORT

Transport moves part using resource to the world location, specified node or to the component container. Transporting can define optional FromComponent and FromLocation parameters to define the place where part can be loaded for transportation. If FromComponent is not defined, then part owner component is used instead. Transporting requires Part and any of the ToComponent, ToContainer, ToConnector parameters to define the place where part is transported. Optional PartLocation parameter defines exact part location.

Transporting to the specific component requires ToComponent and optional ToLocation to specify the exact resource location at component, otherwise the resource will use a frame called ResourceLocation as default location. Transporting to container can be expressed using ToContainer or ToConnector parameter. ToContainer parameter can use PartLocation to define the exact location.

Transport action can use Python keyword notation or parameters alone (using keyword parameter order).

Name | Type | Required | Description
Part | vcComponent | Always | Defines the component to be delivered.
FromComponent | vcComponent | Optional | Defines the component where to pick up Part.
ToComponent | vcComponent | Optional | Defines the component where to deliver Part.
ToContainer | vcContainer | Optional | Defines the container type behavior Part is attached to in the 3D world. Optional ToLocation can define position in relation to container node coordinate system.
ToLocation | vcMatrix | Optional | Defines resource location. ToLocation used together with ToComponent uses world coordinate system to define the exact location.
ToConnector | vcConnector | Optional | Defines (input) connector where Part will be transferred. If Part cannot be transferred immediately due capacity, then action will wait until capacity is available.
PartLocation | vcMatrix | Optional | Defines the part location in the target component. PartLocation used together with ToContainer uses container owner node coordinate system to define the exact location.
FromLocation | vcMatrix | Optional | Defines resource location from where it will transport. FromLocation uses world coordinate system.

VC_ACTION_MOVE

Move resource to the specified component place or vcMatrix defined location. Action must include either Place or Location argument or both.

Move action can use Python keyword notation or parameters alone (using keyword parameter order).

Name | Type | Required | Description
Place vcComponent Optional Defines resource movement target.

If Place is defined together with Location, Location is used as target location. If only Place argument is defined, then target location is defined by locating frame feature named ResourceLocation in the Place component.

If ResourceLocation frame feature is not defined, then component origin is used as target location.
Location | vcMatrix | Optional | Defines resource movement target location in world coordinate system.

VC_ACTION_LOAD

Load component to resource which can then move with it to other location or unload it to some other place.

Load action can use Python keyword notation or parameters alone (using keyword parameter order).

Name | Type | Required | Description
Part | vcComponent | Always | Defines component to be loaded. Resource component defines independently where the component is loaded, e.g. human worker carries component with one or two hands or a forklift carries the component using forks.

VC_ACTION_UNLOAD

Unloads carried part component to the world, specified node or to the component container. Unloading to world requires only Part to be defined. Unloading to the specific node requires ToNode and optional ToNodeLocation to specify the exact part location at node. Unloading to container can be expressed either using ToContainer or ToConnector parameter. ToContainer parameter can use ToNodeLocation to define the exact location.

Unload action can use Python keyword notation or parameters alone (using keyword parameter order).

Name | Type | Required | Description
Part | vcComponent | Always | Defines component to be unloaded.
ToNode | vcNode | Optional | Defines node where Part will be attached.
ToContainer | vcContainer | Optional | Defines container behavior where part will be grabbed. Optional ToNodeLocation can define position in relation to container node coordinate system.
ToNodeLocation | vcMatrix | Optional | Defines exact position where part will be grabbed. Defines part origin position relative to ToNode or ToContainer owner node coordinate system.
ToConnector | vcConnector | Optional | Defines (input) connector where Part will be transferred. If Part cannot be transferred immediately due capacity, then action will wait until capacity is available.

Approach Axis Constants

Name | Description
VC_APPROACH_AXIS_POSITIVE_Z | Approach from positive Z-axis direction.
VC_APPROACH_AXIS_NEGATIVE_Z | Approach from negative Z-axis direction.
VC_APPROACH_AXIS_POSITIVE_Y | Approach from positive Y-axis direction.
VC_APPROACH_AXIS_NEGATIVE_Y | Approach from negative Y-axis direction.
VC_APPROACH_AXIS_POSITIVE_X | Approach from positive X-axis direction.
VC_APPROACH_AXIS_NEGATIVE_X | Approach from negative X-axis direction.

Behavior Constants

Name | Object
VC_ACTIONCONTAINER | vcActionContainer
VC_ARTICULATEDKINEMATICS | (Deprecated) vcBehaviour
VC_ARTICULATEDKINEMATICS2 | vcBehaviour
VC_BASECONTAINER | vcBehaviour
VC_BEHAVIOURSIGNAL | vcSignal
VC_BOOLEANPROPERTYCREATOR | vcFlow
VC_BOOLEANSIGNAL | vcBoolSignal
VC_BOOLEANSIGNALMAP | vcBooleanSignalMap
VC_BUCKETPATH | vcContainer
VC_CAPACITYCONTROLLER | vcBehaviour
VC_CARTESIANKINEMATICS | vcBehaviour
VC_COMPONENTCONTAINER | vcContainer
VC_COMPONENTCREATOR | vcComponentCreator
VC_COMPONENTFLOWPROXY | vcComponentFlowProxy
VC_COMPONENTGRABBER | (Deprecated) vcBehaviour
VC_COMPONENTPATHSENSOR | vcBehaviour
VC_COMPONENTSIGNAL | vcComponentSignal
VC_CONTAINER | vcBehaviour
VC_CONTAINERFILLER | vcFlow
VC_DELTAKINEMATICS | vcBehaviour
VC_DOCUMENTLINK | vcBehaviour
VC_FLOW | vcFlow
VC_FRAMESIGNAL | vcSignal
VC_INTEGERPROPERTYCREATOR | vcFlow
VC_INTEGERSIGNAL | vcIntegerSignal
VC_JOGINFO | vcBehaviour
VC_KINEMATICS | vcKinematics
VC_MATRIXSIGNAL | vcMatrixSignal
VC_NODELIST | vcNodeList
VC_NOTE | vcBehaviour
VC_ONEDIRECTIONALPATH | (Deprecated) vcContainer
VC_ONETOMANYINTERFACE | vcSimInterface
VC_ONETOONEINTERFACE | vcSimInterface
VC_ONEWAYPATH | vcMotionPath
VC_PARALLELLOGRAMKINEMATICS | vcBehaviour
VC_PARTICLESYSTEM | (Deprecated) vcBehaviour
VC_PATTERNCONTAINER | vcPatternContainer
VC_PROCESSEXECUTOR | vcProcessExecutor
VC_PROCESSPOINT | vcProcessPointSensor
VC_PRODUCTCREATOR | vcProductCreator
VC_PYTHONKINEMATICS | vcBehaviour
VC_PYTHONPROCESSHANDLER | vcRslProcessHandler
VC_PYTHONTRANSPORTCONTROLLER | vcPythonTransportController
VC_RAYCASTSENSOR | vcBehaviour
VC_REALPROPERTYCREATOR | vcFlow
VC_REALSIGNAL | vcRealSignal
VC_REALSIGNALMAP | vcBehaviour
VC_ROBOTCONTROLLER | vcRobotController
VC_ROBOTEXECUTOR | vcExecutor
VC_ROUTINGRULE | vcRoutingRule
VC_RSLEXECUTOR | (Deprecated) vcRslProgramExecutor
VC_SCARAKINEMATICS | (Deprecated) vcBehaviour
VC_SCARAKINEMATICS2 | vcBehaviour
VC_SCRIPT | vcScript
VC_SERVOCONTROLLER | vcServoController
VC_STATISTICS | vcStatistics
VC_STRINGPROPERTYCREATOR | vcFlow
VC_STRINGSIGNAL | vcStringSignal
VC_TOOLCONTAINER | vcBehaviour
VC_TRICEPTKINEMATICS | vcBehaviour
VC_TRANSPORT | vcBehaviour
VC_TRANSPORTNODE | vcTransportNode
VC_TWODIRECTIONALPATH | (Deprecated) vcContainer
VC_TWOWAYPATH | vcMotionPath
VC_VEHICLE | vcBehaviour
VC_VOLUMESENSOR | vcBehaviour

Path

Name | Description
VC_PATH_NO_TRIGGER | Sensor is not triggered at all by the component.
VC_PATH_LEADING_EDGE_TRIGGER | Sensor is triggered by the leading edge of the component.
VC_PATH_ORIGIN_TRIGGER | Sensor is triggered by the origin of the component.
VC_PATH_TRAILING_EDGE_TRIGGER | Sensor is triggered by the trailing edge of the component.

Bitmap Constants

Name | Description
VC_BITMAP_RGB | Bitmap format of red green blue color model.
VC_BITMAP_RGBA | Bitmap format of red green blue alpha color model; uses RGB color model and allows for Alpha compositing (opacity and transparency).

Collider Constants

Name | Description
VC_PHYSICSCOLLIDER_UNSPECIFIED | Collider is not defined nor created for feature.
VC_PHYSICSCOLLIDER_NONE | Collider not created for feature, for example root feature of node.
VC_PHYSICSCOLLIDER_BOX | Collider is a bounding box encompassing all geometry of feature and its subfeatures.
VC_PHYSICSCOLLIDER_BOXES | Collider is a set of bounding boxes, one for each geometry set of feature and its subfeatures.
VC_PHYSICSCOLLIDER_PRECISE | Collider is convex hull encompassing all geometry of feature and its subfeatures.

Collision Detector Constants

A collision test detects a collision between one or more objects. A volume detector detects if a component collides with a box defined by two corner points, for example a safety zone. A collision detector detects if a component collides with another component.

A collision test uses node lists. Each node list contains one or more entries. Each entry is a node in a component, its scope, and whether or not the node is included/excluded in the test. For example, you could detect a collision between the arm of a robot and a positioner, ignore a collision between the tip of a welding torch and workpiece, and whether or not a human walks too close to a robot executing its program.

Collision Scope

Scope defines what a node represents, for example all nodes in the same component as that node.

Name | Description
VC_NODELIST_NODE | Adds only the node not its child nodes.
VC_NODELIST_COMPONENT | Adds all nodes in the same component.
VC_NODELIST_TREE | Adds the node and its child nodes.

Inclusion Type

Inclusion defines if a node is active or ignored in collision test. Be aware the inclusion filter affects the node as well as its scope.

Name | Description
VC_NODELIST_INCLUDE | Includes the node in test.
VC_NODELIST_EXCLUDE | Excludes the node in test.

Testing Method

Testing defines how to check for collisions when using a volume detector. You can detect a collision using either the geometry or bound box of a node.

Name | Description
VC_INTERSECT | Checks if specified node(s) intersects the surface of volume detector. This is similar to using a collision detector that detects the collision of geometry.
VC_CENTER_INSIDE | Checks if center of bounding box of specified node(s) is inside volume detector.
VC_INSIDE | Checks if bounding box of specified node(s) is completely inside volume detector.

Command Constants

Name | Description
VC_COMMAND_NORMAL | Abort all active commands when this command starts.
VC_COMMAND_TOOL | Executes this command on top of all active commands. Any previously active commands are suspended, which resume when command execution is complete.
VC_COMMAND_MODE | Abort all active commands that also are of type VC_COMMAND_MODE, and execute on top of the others. The camera control commands that implement panning, orbiting and zooming all have this type.
VC_COMMAND_OVERRIDE | Abort only the topmost command before executing this command. When command execution is completed any command that was aborted initially is restarted (only if the aborted command supports override activation).

Command Event Constants

Shift State

(Deprecated)

Name | Description
VC_SHIFTSTATE_SHIFT | A shift key is pressed.
VC_SHIFTSTATE_ALT | An Alt key is pressed.
VC_SHIFTSTATE_CTRL | A control key is pressed.
VC_SHIFTSTATE_MOUSELEFT | The left mouse button is pressed.
VC_SHIFTSTATE_MOUSEMIDDLE | The middle mouse button is pressed. In some instances this can be the scroll button on a mouse.
VC_SHIFTSTATE_MOUSERIGHT | The right mouse button is pressed.
VC_SHIFTSTATE_CLICK | A single click has been detected.
VC_SHIFTSTATE_DOUBLECLICK | A double click has been detected.

Type

(Deprecated)

Name | Description
VC_EVENT_MOUSE_DOWN | A mouse button has been pressed in the 3D window.
VC_EVENT_MOUSE_UP | A mouse button has been released in the 3D window.
VC_EVENT_MOUSE_MOVE | The mouse has been moved over the 3D window.
VC_EVENT_MOUSE_WHEEL | The mouse when has been moved over the 3D window.
VC_EVENT_KEY_DOWN | A key has been pressed.
VC_EVENT_KEY_UP | A key has been released.

Component Constants

Back Face Mode

Name | Description
VC_USE_FEATURE_BACKFACE_MODE | Backfaces of component geometry are visible or invisible based on the ShowBackfaces property of each Geometry feature.
VC_FORCE_BACKFACE_OFF | Backfaces of component geometry are invisible.
VC_FORCE_BACKFACE_ON | Backfaces of component geometry are visible.

Node Configuration Change

Name | Description
VC_NODE_REBUILD | The component node tree is rebuilt.
VC_NODE_UPDATE_NODE | Node1 is updated.
VC_NODE_ADD_FIRST_CHILD | Node2 is added as first child for node1.
VC_NODE_ADD_LAST_CHILD | Node2 is added as last child for node1.
VC_NODE_REMOVE_NODE | Node1 is removed.
VC_NODE_INSERT_FIRST_SIBLING | Node2 is added as first sibling for node1.
VC_NODE_INSERT_LAST_SIBLING | Node2 is added as last sibling for node1.
VC_NODE_INSERT_AFTER_SIBLING | Node2 is added as sibling after node1.
VC_NODE_INSERT_BEFORE_SIBLING | Node2 is added as sibling before node1.
VC_NODE_REPLACE_NODE | Node1 is replaced by node2.

PDF Export Level

Name | Description
VC_EXPORT_NONE | Component geometry is not exported into the 3D PDF document.
VC_EXPORT_COMPLETE | Component geometry is fully exported into the 3D PDF document.
VC_EXPORT_GEOMETRY_BOUND | Component geometry sets are exported as blocks.
VC_EXPORT_NODE_BOUND | Component links are exported as blocks.
VC_EXPORT_COMPONENT_BOUND | Component is exported as a block.

Simulation Level

Name | Integer | Description
VC_SIMULATION_DETAILED | 0 | Use this mode to simulate component movements as accurate as possible, thereby simulating full range of motion for component.
VC_SIMULATION_BALANCED | 1 | Use this mode to simulate component movements in a way that is balanced with performance of simulation, thereby component may move from point to point without simulating unnecessary joint motions.
VC_SIMULATION_FAST | 2 | Use this mode to simulate component movements as quickly as possible, thereby component may snap to joint configuration or jump from point to point.

Transportation

Name | Description
VC_NOT_AVAILABLE | Target is not available for transportation, e.g. no capacity.
VC_AVAILABLE | Target is available.
VC_REDIRECTED | Target is available as redirected. For example, a machine has a buffer where it places components instead of allowing the component to be transported directly to the machine.

Connector Constants

Capacity Test Location

Name | Description
VC_CONNECTOR_CAPACITY_LEADING | Test before component's leading edge can transfer.
VC_CONNECTOR_CAPACITY_ORIGIN | Test before component's origin can transfer.
VC_CONNECTOR_CAPACITY_TRAILING | Test before component's trailing edge can transfer.

Connection Type

Name | Description
VC_CONNECTOR_NONE | Connection cannot receive or send components.
VC_CONNECTOR_INPUT | Connection can receive components.
VC_CONNECTOR_OUTPUT | Connection can send components.
VC_CONNECTOR_INPUT_OUTPUT | Connection can receive and send components.

Container Constants

Conveyor Direction Modes

Name | Description
VC_PATH_FORWARD | Conveyor contents are moved forwards from the first frame to the last frame.
VC_PATH_BACKWARD | Conveyor contents are moved backwards from the last frame to the first frame.
VC_PATH_FORWARD_AUTO | Similar to VC_PATH_FORWARD. However, the conveyor automatically changes direction to VC_PATH_BACKWARD_AUTO if a component is transferred in from the conveyor's second connector (InOut2).
VC_PATH_BACKWARD_AUTO | Similar to VC_PATH_BACKWARD. However, the conveyor automatically changes direction to VC_PATH_FORWARD_AUTO if a component is transferred in from the conveyor's first connector (InOut1).

Conveyor Interpolation Modes

Name | Description
VC_PATH_STEP | No interpolation is performed between frames, so a component's position changes from one frame to the next without any movement in between frames.
VC_PATH_LINEAR | The path is interpolated as straight lines between the frames.
VC_PATH_CUBIC | A cubic spline is used to interpolate the path from one frame to the next.

Context Constants

Name | Description
VC_CONTEXT_AUTHOR | "Author" context for modeling components.
VC_CONTEXT_CONFIGURE | "Configure" context for building a layout.
VC_CONTEXT_DRAWING | "Drawing" context for creating drawings.
VC_CONTEXT_TEACH | "Teach" context for teaching robots.
VC_CONTEXT_PROCESS | "Process" context for process modelling.

Controller Constants

Name | Description
VC_CONTROLLER_START | Event type for a controller.
VC_CONTROLLER_RUNNING | Event type for a controller.
VC_CONTROLLER_END | Event type for a controller.
VC_CONTROLLER_STOP | Event type for a controller.
VC_CONTROLLER_UNREACHABLE | Event type for a controller.
VC_CONTROLLER_COLLISIONS | Event type for a controller.

Track World Frame Modes

Name | Description
VC_TRACKWORLDFRAME_TRACKORIGIN | The origin of track component is used as Robot World Frame.
VC_TRACKWORLDFRAME_ROBOTWORLD | The Robot World Frame of robot is used not the track origin.

Entity Constants

Name | Description
VC_PHYSICS_INPHYSICS | Object affected by physics, including internal and external forces.
VC_PHYSICS_OUTOFPHYSICS | Object not affected by physics.
VC_PHYSICS_KINEMATIC | Object affected by physics, excluding internal forces such as gravity.
VC_PHYSICS_INCONTAINER | Object affected by physics, and system monitors transition of object into and out of containers.

Feature Constants

Name | Feature | Python Class
VC_ANGULARCLONE | Angular Clone | vcFeature
VC_BLOCK | Block | vcFeature
VC_CONE | Cone | vcFeature
VC_CYLINDER | Cylinder | vcFeature
VC_EXTRUDE | Extrude | vcFeature
VC_FRAME | Frame | vcFeature
VC_GEOMETRY | Geometry | vcGeometryFeature
VC_LINEARCLONE | Linear Clone | vcFeature
VC_MIRROR | Mirror | vcFeature
VC_PLANE | Plane | vcFeature
VC_PYTHONFEATURE | Python feature | vcFeature
VC_REVOLVE | Revolve | vcFeature
VC_SPHERE | Sphere | vcFeature
VC_SWITCH | Switch | vcFeature
VC_TEXT |  |
VC_TRANSFORM | Transform | vcFeature
VC_WEDGE | Wedge | vcFeature

Feed Mode Constants

Name | Integer | Description
VC_SINGLE_FEED_MODE | 0 | Creates products at a given time interval until the limit is reached.
VC_BATCH_FEED_MODE | 1 | Creates batches of products in a sequence.
VC_TABLE_FEED_MODE | 2 | Creates products by reading from an Excel file. See vcProductCreatorTableMode for more information.
VC_DISTRIBUTION_FEED_MODE | 3 | Creates products using a series of entries with a weighted probability. See vcProductCreatorDistributionFeed for more information.

Name | Description
VC_DISTRIBUTION_FEED_MODE | Creates products using a series of entries with a weighted probability. See vcProductCreatorDistributionMode for more information.
VC_SEQUENCE_FEED_MODE | Creates products using a sequence of statements. See vcProductCreatorSequenceMode for more information.
VC_SINGLE_FEED_MODE | Creates products using a single statement.
VC_TABLE_FEED_MODE | Creates products by reading from an Excel file. See vcProductCreatorTableMode for more information.

Frame Set Visualization Constants

Frame Display Mode

Name | Description
VC_FRAMEDISPLAY_DOT | Frames rendered as dots.
VC_FRAMEDISPLAY_COLOR_AXIS | Frames rendered using individually colored axis lines. Red X-axis Green Y-axis Blue Z-axis
VC_FRAMEDISPLAY_AXIS | Frames rendered using axis lines with the same material as the frame set.
VC_FRAMEDISPLAY_CUSTOM | Frames rendered using the icon defined in CustomIcon property.

Line Display Mode

Name | Description
VC_LINEDISPLAY_LINE | Connecting lines rendered as a single line.
VC_LINEDISPLAY_EXTRUDE | Connecting lines rendered by extruding the icon specified by CustomIcon along the lines.

Geometry Constants

Name | Description
VC_COMPACTLINESET | Contains line sets.
VC_FRAMESET | Contains frame sets.
VC_LINESET | Contains line primitives. (Deprecated) Use VC_COMPACTLINESET.
VC_POINTSET | Contains point sets.
VC_POLYGONSET | Contains polygonal primitives. (Deprecated) Use VC_TRIANGLESET.
VC_TEXT2DSET | Contains 2D text geometry sets.
VC_TEXT3DSET | Contains 3D text geometry sets.
VC_TRIANGLESET | Contains triangle sets.
VC_AMBIENT_OCCLUSION_NONE | Ambient occlusion rendering is not used.
VC_AMBIENT_OCCLUSION_VERTEX | Geometry uses vertex ambient occlusion values. Ambient occlusion value is located in the point texture coordinate U parameter. Ambient occlusion value is defined by a range of 0 - 1.0 in which 0 defines the point is fully occluded and 1.0 means the point is fully visible for lighting.
VC_VERTEXCOLOR | Vertex color overrides the lighting calculations.
VC_VERTEXCOLOR_LIGHTED | Lighting calculation is blended with the color of the vertex.

Color Formats

Name | Description
VC_COLOR_CONFIGURATION_BGRA | A BGRA color format.
VC_COLOR_CONFIGURATION_RGBA | A RGBA color format.

Edge Types

Name | Description
VC_EDGE_BOUNDARY | The edge is shared with one polygon.
VC_EDGE_CO_PLANAR | The angle between neighboring polygons is near zero.
VC_EDGE_HARD | The angle between neighboring polygons is greater than the CreaseAngle of the vcPolygonSet.
VC_EDGE_INTERSECTION | (Currently not implemented)
VC_EDGE_LINE | (Currently not implemented)
VC_EDGE_NON_MANIFOLD | The edge is shared with more than one polygon.
VC_EDGE_SOFT | The angle between neighboring polygons is less than the CreaseAngle of the vcPolygonSet.

Interactive Constants

Name | Description
VC_IEVENT_OPEN | Indicates the command starts.
VC_IEVENT_CHANGE | Indicates any change has happened.
VC_IEVENT_INTERACTIVE_START | Indicates that interactive manipulation, such as dragging a handle, starts.
VC_IEVENT_INTERACTIVE_CHANGE | Indicates that interactive change has happened, such as handle movement.
VC_IEVENT_INTERACTIVE_END | Indicates the interaction ends.
VC_IEVENT_CLOSE | Indicates the command closes.

Interface Constants

Name | Integer | Description
VC_FLOWFIELD | 0 | Delivers material flow between two behaviors.
VC_HIERARCHYFIELD | 1 | Attaches this component into the hierarchy of the other component.
VC_SIGNALFIELD | 2 | Delivers signals to behaviors that the signal is connected to. Allows communication between components.
VC_RSLFIELD | 3 | (Deprecated) Publishes/subscribes vcRslRoutine objects of RSL programs between components.
VC_JOINTEXPORTFIELD | 4 | Exports the joint definitions allowing connected component to drive external joints.
VC_TOOLEXPORTFIELD | 5 | Exports/Imports joint definitions allowing connected component to use external tools.
VC_BASEEXPORTFIELD | 6 | Exports/Imports base definitions allowing connected components to use external bases.
VC_INTEGERCOMPATIBILITYFIELD | 7 | Used for controlling what interfaces can connect to. In order to connect, the opposing interface needs to have a matching integer compatibility field definition.
VC_ACTIONFIELD | 8 | Used for sending and receiving actions associated with an Action Container, e.g. a robot and tool grasp and release action.
VC_TRANSPORTFIELD | 9 | Used for input/output of transportation tasks via a Transport Protocol, e.g. two conveyors send pickup requests and the request is outputted to a resource.
VC_PROCESSORFIELD | 10 | Used for parent/child connection and interaction with path and sensor behaviors contained in separate components.

Interpolation Constants

Name | Description
VC_INTERPOLATION_MODE_NONE | A base or tool frame has no effect on external configuration.
VC_INTERPOLATION_MODE_BASE | The External TCP property is set to false (base) or true (tool).
VC_INTERPOLATION_MODE_TCP | The External TCP property is set to true (base) or false (tool).

Joint Axis Constants

Name | Description
VC_JOINTAXIS_MINUS_X | Negative x-axis.
VC_JOINTAXIS_MINUS_Y | Negative y-axis.
VC_JOINTAXIS_MINUS_Z | Negative z-axis.
VC_JOINTAXIS_PLUS_X | Positive x-axis.
VC_JOINTAXIS_PLUS_Y | Positive y-axis.
VC_JOINTAXIS_PLUS_Z | Positive z-axis.

Joint Constants

Link Types

Name | Description
VC_JOINTTYPE_CUSTOM | A joint defined by an expression.
VC_JOINTTYPE_FIXED | A static joint, which has no DOF object.
VC_JOINTTYPE_ROTATIONAL | A rotational joint.
VC_JOINTTYPE_ROTATIONAL_FOLLOWER | A rotational joint that is dependent on the value of another joint.
VC_JOINTTYPE_TRANSLATIONAL | A linear joint.
VC_JOINTTYPE_TRANSLATIONAL_FOLLOWER | A linear joint that is dependent on the value of another joint.

Servo Types

Name | Description
VC_JOINT_ROTATIONAL | Defines a joint assigned to a controller as a rotational joint.
VC_JOINT_TRANSLATIONAL | Defines a joint assigned to a controller as a linear joint.

Light Constants

Name | Description
VC_LIGHT_AMBIENT | Ambient type of light.
VC_LIGHT_DIRECTIONAL | Directional type of light.
VC_LIGHT_POINT | Point type of light.
VC_LIGHT_SPOT | Spot type of light.

Layout Item Constants

Name | Type | Python Class
VC_LAYOUTITEM_IT_3DICON | 3D Icon | vc3DIcon
VC_LAYOUTITEM_IT_ANNOTATION | Annotation | vcAnnotation
VC_LAYOUTITEM_IT_COLLISIONDETECTOR | Collision Detector | vcCollisionDetector
VC_LAYOUTITEM_IT_DIMENSION | Dimension | vcDimension
VC_LAYOUTITEM_IT_LAYOUTPROPERTYLIST | Layout Property List/Container | vcLayoutPropertyList
VC_LAYOUTITEM_IT_LAYOUTSCHEMAPROPERTYLIST | Layout Schema Property List/Container | vcLayoutSchemaPropertyList
VC_LAYOUTITEM_IT_LAYOUTPACKFOLDER | Pack Folder for Layout File | vcPackFolder
VC_LAYOUTITEM_IT_PATHOBJECT | Path Object/Data Container | vcPathObject
VC_LAYOUTITEM_IT_REPORTCHART | Report/Chart | vcReport
VC_LAYOUTITEM_IT_SWEPTVOLUME | Swept Volume | vcSweptVolume
ViewAnimation | View Animator | vcViewAnimation

Material Constants

Color Mask

Name | Description
VC_MATERIAL_COLORMASK_RED | Color used to render a RGB or RGBA color mask.
VC_MATERIAL_COLORMASK_GREEN | Color used to render a RGB or RGBA color mask.
VC_MATERIAL_COLORMASK_BLUE | Color used to render a RGB or RGBA color mask.
VC_MATERIAL_COLORMASK_ALPHA | Color used to render a RGBA color mask with opacity.

Depth Comparison

Name | Description
VC_MATERIAL_DEPTH_NEVER | Testing never passes, so geometry pixels are not rendered.
VC_MATERIAL_DEPTH_ALWAYS | Depth testing passes always, so geometry pixels are rendered.
VC_MATERIAL_DEPTH_LESS | Testing passes if geometry pixel distance is less than Z buffer stored value.
VC_MATERIAL_DEPTH_LEQUAL | Testing passes if geometry pixel distance is less than or equal to Z buffer stored value.
VC_MATERIAL_DEPTH_EQUAL | Testing passes if geometry pixel distance is equal to Z buffer stored value.
VC_MATERIAL_DEPTH_GEQUAL | Testing passes if geometry pixel distance is greater than or equal to Z buffer stored value.
VC_MATERIAL_DEPTH_GREATER | Testing passes if geometry pixel distance is greater than Z buffer stored value.
VC_MATERIAL_DEPTH_NOTEQUAL | Testing passes if geometry pixel distance is not equal to Z buffer stored value.

Opacity Type

Name | Description
VC_MATERIAL_TRANSPARENCY_NONE | Defines opacity not be used in the material.
VC_MATERIAL_TRANSPARENCY_CONSTANT | Opacity is constant using an Opacity value.
VC_MATERIAL_TRANSPARENCY_MAP | Opacity uses a texture alpha map to define what areas are opaque. Alpha value of 0.5 is used as a threshold.

Render Order

Name | Description
VC_MATERIAL_PRE_ORDER | Renders geometry before normal rendering.
VC_MATERIAL_NORMAL_ORDER | Renders geometry during normal pass.
VC_MATERIAL_POSTSORT_ORDER | Renders geometry using sorted order after normal rendering.
VC_MATERIAL_POST_ORDER | Renders geometry after normal pass.

Texture Mapping

Name | Description
VC_MATERIAL_MAP_NORMAL | Uses geometry texture coordinates U and V to map textures/project them.
VC_MATERIAL_MAP_SPHERICAL | Uses spherical projection which calculates automatically texture coordinates.

Menu Constants

Name | Description
VC_MENU_DRAWING | When Drawing tab is active, context menu of drawing world.
VC_MENU_FEATURE | When Modeling tab is active, context menu of node feature tree in Component Graph panel.
VC_MENU_HOME | When Home tab is active, context menu of 3D world.
VC_MENU_MODELING_TOOLGALLERY_FEATURE | On Modeling tab, in Geometry group, Tools menu.
VC_MENU_MODELING_WIZARDS | On the Modeling tab, in the Extra group, Wizards menu. This requires a string that designates an existing or new section in the Wizards menu. VC_MENU_MODELING_WIZARDS + '/<SectionName>'
VC_MENU_PROGRAM_EXPORT_PROGRAMS | On the Program tab, in the Program Modules group, Export menu. This requires a string that designates an existing or new section in the Export menu. VC_MENU_PROGRAM_EXPORT_PROGRAMS + '/<SectionName>'
VC_MENU_PROGRAM_IMPORT_PROGRAMS | On the Program tab, in the Program Modules group, Import menu. This requires a string that designates an existing or new section in the Import menu. VC_MENU_PROGRAM_IMPORT_PROGRAMS + '/<SectionName>'
VC_MENU_PROGRAM_STATEMENT | When the Program tab is active, context menu of statements in robot program displayed in Program Editor panel.

Appearance

Name | Description
VC_TOOLSIZE_IMAGE_AND_TEXT_LARGE | The tool image is shown as large with text.
VC_TOOLSIZE_IMAGE_AND_TEXT_NORMAL | The tool image is shown as normal with text.
VC_TOOLSIZE_IMAGE_ONLY | Only the tool image is shown.

You can also use the following string ids.

Context Menu

Name | Description
VcAuthor3DContextMenu | When Modeling tab is active, context menu of 3D world.
VcAuthorTreeViewBasesContextMenu | In Component Graph panel, context menu of Bases collection for Robot Controller and Base Container behaviors.
VcAuthorTreeViewBehaviorsContextMenu | In Component Graph panel, context menu of behavior.
VcAuthorTreeViewFeaturesContextMenu | In Component Graph panel, context menu of feature.
VcAuthorTreeViewNodesContextMenu | In Component Graph panel, context menu of node/link.
VcAuthorTreeViewPropertiesContextMenu | In Component Graph panel, context menu of property in root node.
VcAuthorTreeView | In Component Graph panel, context menu of Tools collection for Robot Controller and Tool Container behaviors.
VcConfigure3DContextMenu | When Home tab is active, context menu of 3D world.
VcTeach3DContextMenu | When Program tab is active, context menu of 3D world.

Quick Menu

Name | Description
VcConfigureQuickmenu | When Home tab is active, mini toolbar for a selected component.

Ribbon Group

Name | Description
VcTabAuthor/<group name> | On the Modeling tab, in a new or existing Ribbon group.
VcTabDrawing/<group name> | On the Drawing tab, in a new or existing Ribbon group.
VcTabHome/<group name> | On the Home tab, in a new or existing Ribbon group.
VcTabTeach/<group name> | On the Teach tab, in a new or existing Ribbon group.

Message

Buttons

Name | Integer | Description
VC_MESSAGE_BUTTONS_ABORTRETRYIGNORE | 0 | Displays Abort, Retry and Ignore buttons.
VC_MESSAGE_BUTTONS_OK | 1 | Displays OK button.
VC_MESSAGE_BUTTONS_OKCANCEL | 2 | Displays OK and Cancel buttons.
VC_MESSAGE_BUTTONS_RETRYCANCEL | 3 | Displays Retry and Cancel buttons.
VC_MESSAGE_BUTTONS_YESNO | 4 | Displays Yes and No buttons.
VC_MESSAGE_BUTTONS_YESNOCANCEL | 5 | Displays Yes, No and Cancel buttons.

Result

Name | Integer | Description
VC_MESSAGE_RESULT_ABORT | 0 | Returns Abort message, e.g. Abort button clicked.
VC_MESSAGE_RESULT_CANCEL | 1 | Returns Cancel message.
VC_MESSAGE_RESULT_IGNORE | 2 | Returns Ignore message.
VC_MESSAGE_RESULT_NO | 3 | Returns No message.
VC_MESSAGE_RESULT_OK | 4 | Returns OK message.
VC_MESSAGE_RESULT_RETRY | 5 | Returns Retry message.
VC_MESSAGE_RESULT_YES | 6 | Returns Yes message.

Type

Name | Integer | Description
VC_MESSAGE_TYPE_INFO | 0 | Displays Information type message.
VC_MESSAGE_TYPE_QUESTION | 1 | Displays Question type message.
VC_MESSAGE_TYPE_WARNING | 2 | Displays Warning type message.
VC_MESSAGE_TYPE_ERROR | 3 | Displays Error type message.
VC_MESSAGE_TYPE_CUSTOM | 4 | Displays Custom type message.

Motion Constants

Motion Type

Name | Description
VC_MOTION_JOINT | Joint type of movement executed by robot. See also Motion Target Constants.
VC_MOTION_LINEAR | Linear motion executed by robot.

Orientation Interpolation Mode

Name | Description
VC_MATRIXMODE_AXISX | Rotates with minimal movement around X-axis.
VC_MATRIXMODE_AXISY | Rotates with minimal movement around Y-axis.
VC_MATRIXMODE_AXISZ | Rotates with minimal movement around Z-axis.
VC_MATRIXMODE_AXISWPR | Interpolates yaw, pitch and roll angles separately for movement.
VC_MATRIXMODE_AXISZYZ | Interpolates Euler angles separately for movement.
VC_MATRIXMODE_ONEAXIS | Rotates around axis of shortest rotation for movement.
VC_MATRIXMODE_WRIST | Rotates by directly interpolating wrist joints for movement.

Motion Path Constants

Path Axis Mode

The following constants specify how component space utilization is calculated for paths.

Name | Description
VC_PATH_AXIS_AUTOMATIC | The general direction of the path is determined and the most appropriate axis is selected automatically. If the axis cannot be determined to a reasonable tolerance, VC_PATH_AXIS_GENERIC is used.
VC_PATH_AXIS_X_POSITIVE | The distance from the origin to the maximum X axis extent of the component bound box is used to space the component. This corresponds to the behavior of the old conveyor types.
VC_PATH_AXIS_Y_POSITIVE | The distance from the origin to the maximum Y axis extent of the component bound box is used to space the component.
VC_PATH_AXIS_Z_POSITIVE | The distance from the origin to the maximum Z axis extent of the component bound box is used to space the component.
VC_PATH_AXIS_X_NEGATIVE | The distance from the origin to the minimum X axis extent of the component bound box is used to space the component.
VC_PATH_AXIS_Y_NEGATIVE | The distance from the origin to the minimum Y axis extent of the component bound box is used to space the component.
VC_PATH_AXIS_Z_NEGATIVE | The distance from the origin to the minimum Z axis extent of the component bound box is used to space the component.
VC_PATH_AXIS_GENERIC | A worst-case maximum extent value is calculated from the component bound box, and used to space the component.

Path Motion State

The following constants define the motion state of a component on a path.

Name | Description
VC_MOTION_STOPPED | The component is stopped, either because the conveyor or the component itself has been explicitly stopped.
VC_MOTION_MOVING | The component is moving on the conveyor.
VC_MOTION_BLOCKED | The component has been stopped because it is being blocked by a component or conveyor in front of it.
VC_MOTION_FAILURE | The component has been stopped as a result of the conveyor entering a failure state.

Motion Target Constants

Accuracy Method

Name | Description
VC_MOTIONTARGET_AM_DISTANCE | Defines the accuracy for a motion target based on distance, e.g. 5 mm.
VC_MOTIONTARGET_AM_TIME | Defines the accuracy for a motion target based on time, e.g. a time limit for reachability. An accuracy method that utilizes time should be considered if, for example, a user sets a Cycle Time for a particular motion.
VC_MOTIONTARGET_AM_VELOCITY | Defines the accuracy for a motion target based on velocity.

Configuration Mode

These constants refer to linear interpolation.

Name | Description
VC_MOTIONTARGET_CM_FIXED | A robot's configuration does not change (no change).
VC_MOTIONTARGET_CM_FOLLOW_FRAME | A robot's configuration changes slightly to minimize joint value difference between its previous configuration (small change).
VC_MOTIONTARGET_CM_INTERPOLATE_JOINT_VALUES | A robot's configuration is determined by point to point interpolation of its joint values.

Configuration Warnings

Name | Description
VC_MOTIONTARGET_KW_OK | Motion target can be reached.
VC_MOTIONTARGET_KW_UNREACHABLE | Motion target cannot be reached.
VC_MOTIONTARGET_KW_JOINTLIMIT | Motion target cannot be reached due to joint limit constraints.
VC_MOTIONTARGET_KW_SINGULAR | Motion target, or the position creates a singularity, i.e. infinite solutions when one or two joints no longer represent independent controlling variables. For example, joints have a 0º value and become parallel.

Coordinate System

Name | Description
VC_MOVECORD_TOOL | An offset uses the tool coordinate system for moving a robot to a relative position.
VC_MOVECORD_BASE | An offset uses the base coordinate system for moving a robot to a relative position.
VC_MOVECORD_WORLD | An offset uses the world coordinate system for moving a robot to a relative position.

Joint Turn Mode

Name | Description
VC_MOTIONTARGET_TURN_NEAREST_WITHIN_LIMITS | A joint's turn behavior is based on a solution nearest to the target position and within the joint's limits.
VC_MOTIONTARGET_TURN_NEAREST | Similar to turning within limits, except solution is not restricted to limitations of joints.
VC_MOTIONTARGET_TURN_ZERO | A joint's turn behavior is based on a solution within -180º to 180º and within the joint's limits. Some robots can perform motions ± 360 degrees.

Motion Type

Name | Description
VC_MOTIONTARGET_MT_JOINT | Joint type of motion a robot controller uses to move to a target, i.e. motion is based on joint values and tolerance.
VC_MOTIONTARGET_MT_LINEAR | Linear type of motion a robot controller uses to move to a target. For example, the motion itself is a straight or linear motion based on a vector from a start point to target position.

Target Mode

Name | Description
VC_MOTIONTARGET_TM_NORMAL | The target matrix uses a default or normal type of relationship with a robot.
VC_MOTIONTARGET_TM_ROBOTROOT | The target matrix relates to a robot's root node.
VC_MOTIONTARGET_TM_STATICTOOL | The target matrix relates to a robot's static tool.
VC_MOTIONTARGET_TM_EXTERNALBASE | The target matrix relates to an external base in relation to a robot.
VC_MOTIONTARGET_TM_WORLDTARGET | The target matrix relates to a world target in relation to a robot.

Node Constants

Material Inheritance

Name | Description
VC_MATERIAL_DISABLED | Never use node's material.
VC_MATERIAL_INHERIT | Inherit node's material to geometries in the node and its child nodes that do not have VC_MATERIAL_FORCE set.
VC_MATERIAL_FORCE_INHERIT | Inherit node's material to geometries in the node and all its child nodes.
VC_MATERIAL_INHERIT_NODE | Inherit node's material to all geometries in the node that do not have VC_MATERIAL_FORCE set.
VC_MATERIAL_FORCE_INHERIT_NODE | Inherit node's material to all geometries in this node.
VC_MATERIAL_INHERIT_LEVEL | Inherit node's material to all geometries on the same level that do not VC_MATERIAL_FORCE set. If node is world root then all the nodes in the world will be affected. If node is a component then all the nodes inside the component will be affected. Otherwise, only the node itself will be affected.
VC_MATERIAL_FORCE_INHERIT_LEVEL | Inherit node's material to all geometries on the same level. If node is world root then all the nodes in the world will be affected. If node is a component then all the nodes inside the component will be affected. Otherwise, only the node itself will be affected.

Type

Name | Description
VC_WORLD | Node is world root.
VC_COMPONENT | Node is vcComponent.
VC_NODE | Node is vcNode. Node can never exist without a component.

Path Object Constants

Name | Type | Python Class
VC_PATHOBJECT_NT_ANY | Node | (Deprecated) Any type of node called with this constant.
VC_PATHOBJECT_NT_ACTION | Action | (Deprecated) Path Object type to vcPathObjectActionNode
VC_PATHOBJECT_NT_MOTION | Motion | (Deprecated) Path Object type to vcPathObjectMotionNode
VC_PATHOBJECT_NT_PARAMETER | Parameter | (Deprecated) Path Object type to vcPathObjectParameterNode
VC_PATHOBJECT_NT_REFERENCE | Reference | (Deprecated) Path Object type to vcPathObjectReferenceNode

Process Modeling Constants

BufferMode Enumeration

Name | Description
VC_BUFFERMODE_FIFO | First-In, First-Out order, like a queue.
VC_BUFFERMODE_LIFO | Last-In, First-Out order, like a stack.

NodeVisibilityState Enumeration

Name | Description
VC_NODEVISIBILITYSTATE_TOGGLE | Toggle between visible and invisible.
VC_NODEVISIBILITYSTATE_VISIBLE | Make the node visible.
VC_NODEVISIBILITYSTATE_INVISIBLE | Make the node invisible.

StatisticsFlowDirection Enumeration

Name | Description
VC_STATISTICSFLOWDIRECTION_ENTER | Product enters.
VC_STATISTICSFLOWDIRECTION_LEAVE | Product leaves.

TimeSource Enumeration

Name | Value | Description
VC_TIMESOURCE _DISTRIBUTION | 0 | Sample from a distribution.
VC_TIMESOURCE_EXPRESSION | 1 | Evaluate an expression.

TransportInType

Name | Description
VC_TRANSPORTINTYPE_PREVIOUSPROCESS | Reserve a product instance and use the transport system to transport it.
VC_TRANSPORTINTYPE_CONTAINER | Wait for a matching product to arrive to a component container.

TransportOutType Enumeration

Name | Description
VC_TRANSPORTOUTTYPE_NEXTPROCESS | Send the product to the next process by using the transport system.
VC_TRANSPORTOUTTYPE_CONTAINER | Place the product to a component container.
VC_TRANSPORTOUTTYPE_TRANSPORTNODE | Send the product to a transport node using the transport system.

Process Point Constants

Name | Description
VC_PROCESSPOINT_OWNER | Owner component of the behavior used.
VC_PROCESSPOINT_PROCESSED | Component being processed is used.
VC_PROCESSPOINT_STOP_PATH | Processing stops all components in the path.
VC_PROCESSPOINT_STOP_COMPONENT | Processing stops only processed component at path.

Property Constants

Constraints

Name | Description
VC_PROPERTY_DEFAULT | No constraints used.
VC_PROPERTY_LIMIT | Property will have upper and lower limits.
VC_PROPERTY_STEP | Property will have defined steps.

Types

Name | Description
List<Ref<Behaviour>> | A vcBehaviour reference list property.
List<Ref<Component>> | A vcComponent reference list property.
List<Ref<Feature>> | A vcFeature reference list property.
List<Ref<Node>> | A vcNode reference list property.
List<Ref<Parameter>> | A vcProperty reference list property.
Ref<Behaviour> | A vcBehaviour reference property.
Ref<Component> | A vcComponent reference property.
Ref<Feature> | A vcFeature reference property.
Ref<Material> | A vcMaterial reference property.
Ref<Node> | A vcNode reference property.
Ref<Parameter> | A vcProperty reference property.
VC_BOOLEAN | A boolean property.
VC_DISTRIBUTION | A real distribution property.
VC_INTEGER | An integer property.
VC_REAL | A real property.
VC_STRING | A string property.
VC_VECTOR | A vector property.
VC_MATRIX | A matrix property.
VC_EXPRESSION | An expression property.
VC_URI | An Uri property.
VC_BUTTON | A button property.

Quantity Constants

Name | Description
VC_QUANTITY_SCALAR | Creates a scalar quantity.
VC_QUANTITY_VECTOR | Create a vector quantity.

Recording Constants

Name | Description
VC_RECORDER_PDF | Records a PDF file for a simulation.
VC_RECORDER_VIDEO | Records a video file for a simulation.

Render Shadows Constants

Name | Description
VC_NO_SHADOW | Renders no shadows in an application.
VC_HARD_FLOOR_SHADOW | Renders hard type floor shadows for components.

Routing Constants

Name | Description
VC_ROUTING_OWNER | Owner component of the behavior is used for rule processing.
VC_ROUTING_PROCESSED | Component being routed is used for rule processing.

Selection Constants

Name | Type | Python Class
VC_SELECTION_ANNOTATION | Annotation | Selection type to vcAnnotation
VC_SELECTION_BEHAVIOUR | Behavior | Selection type to vcBehaviour
VC_SELECTION_COMPONENT | Component | Selection type to vcComponent
VC_SELECTION_DIMENSION | Dimension | Selection type to vcDimension
VC_SELECTION_EDGE | Edge | Selection type to vcEdge
VC_SELECTION_FEATURE | Feature | Selection type to vcFeature
VC_SELECTION_GEOMETRYSET | Geometry Set | Selection type to vcGeometrySet
VC_SELECTION_LINE | Line | Selection type to vcLine
VC_SELECTION_NODE | Node | Selection type to vcNode
VC_SELECTION_PARENTNODE | Node | Selection type to vcNode
VC_SELECTION_POINT | Point | Selection type to vcPoint
VC_SELECTION_POLYGON | Polygon/Triangle Set | Selection type to vcPolygon
VC_SELECTION_PATHOBJECT | Path Object | Selection type to vcPathObject
VC_SELECTION_PATHOBJECT_ACTIONNODE | Action Node | (Deprecated) Selection type to vcPathObjectActionNode
VC_SELECTION_PATHOBJECT_MOTIONNODE | Motion Node | (Deprecated) Selection type to vcPathObjectMotionNode
VC_SELECTION_PATHOBJECT_PARAMETERNODE | Parameter Node | (Deprecated) Selection type to vcPathObjectParameterNode
VC_SELECTION_PATHOBJECT_REFERENCENODE | Reference Node | (Deprecated) Selection type to vcPathObjectReferenceNode
VC_SELECTION_PATHOBJECT_SEGMENT | Segment | (Deprecated) Selection type to vcPathObjectSegment
VC_SELECTION_ROBOTBASE | Base | Selection type to vcBaseFrame
VC_SELECTION_ROBOTTOOL | Tool | Selection type to vcBaseFrame
VC_SELECTION_RSLPROGRAM | RSL Program | (Deprecated) Selection type to vcRslProgramExecutor Use vcTeachContext
VC_SELECTION_RSLROUTINE | RSL Routine | (Deprecated) Selection type to vcRslRoutine Note: Use vcTeachContext
VC_SELECTION_RSLSTATEMENT | RSL Statement | (Deprecated) Selection type to vcRslStatement Note: Use VC_SELECTION_STATEMENT or vcTeachContext
VC_SELECTION_SELECTION | Command | Selection type to vcSelection. This constant registers a command regardless if there is a selection of components. Single Section VC_SELECTION_SINGLESELECTION Multi Selection VC_SELECTION_MULTISELECTION
VC_SELECTION_STATEMENT | Robot Statement | Selection type to vcStatement

Solution Constants

Name | Integer | Description
VC_SOLUTION_REACHABLE | 0 | Indicates solution target is reachable.
VC_SOLUTION_UNREACHABLE | 1 | Indicates solution target is unreachable.
VC_SOLUTION_JOINT_LIMIT | 2 | Indicates joint values for solution exceed limits.
VC_SOLUTION_SINGULARITY | 4 | Indicates solution causes joint singularity.
VC_SOLUTION_NOT_CALCULATED | 8 | Indicates joint values have not been calculated for solution.

Statement Constants

Statements constants are used for adding new statements in vcScope.

Common statements

Name | Description
VC_STATEMENT_BREAK | Ends the execution of a loop statement.
VC_STATEMENT_COMMENT | Creates a user defined message.
VC_STATEMENT_CONTINUE | Jumps to the next iteration in a loop statement.
VC_STATEMENT_HALT | Halts a simulation until a user defined event triggers the continuation of the simulation.
VC_STATEMENT_SETPROPERTY | Defines the value of a property either in the same routine, program, component or robot executor.

Process statements

Name | Description
VC_STATEMENT_APPENDTOLIST | Joins content of source variable to end of the target variable.
VC_STATEMENT_ATTACHPRODUCT

Sets the value of a variable in a routine. The statement and variable must belong to the same routine in a robot program.
VC_STATEMENT_BUFFERPRODUCTS

Buffer statement creates a temporary storage for products in a grid pattern. Multiple products can be coming in and leaving the buffer in parallel.
VC_STATEMENT_CHANGEPRODUCTTYPE

Change Type statement changes one or more product instances to be of another product type both logically and visually.

VC_STATEMENT_CREATEPRODUCT

Create product statement waits for free capacity at the target Container and then creates a new product instance.

VC_STATEMENT_DETACHPRODUCT

Detach statement detaches one or more components of one or more products from the component of a common parent product.

VC_STATEMENT_GETPROPERTY

Get Property statement creates a runtime variable that acts as a proxy to a property. The proxy variable’s value and the targeted property’s value are tied together such that changing one means changing the other as well. The targeted property can be a static component’s property or a static component’s behavior’s property.

VC_STATEMENT_MOVEJOINT

Move Joint statement uses a servo controller behavior to move a joint to given value and waits until the motion completes.
VC_STATEMENT_PRINT | A Print statement allows you to print feedback in the Output panel.
VC_STATEMENT_PROCESSDELAY | Delay statement waits for a specified amount of simulation time.
VC_STATEMENT_PROCESSIF | Creates a conditional statement for executing a collection of statements if a given expression evaluates as True.
VC_STATEMENT_PROCESSWHILE | While statement executes Scope in a loop as long as Condition evaluates to True.
VC_STATEMENT_PROPERTYCONDITION

Creates a process requirement based on a property value. The targeted property can be a static component’s property or a static component’s behavior’s property.

Note: This is a requirement statement and thus can be only added to the Requirements routine of a process routine.
VC_STATEMENT_RELEASEPRODUCTRESERVATION

Release Product Reservation statement releases reserved product instances which are reserved by ReserveProduct one or more statements. Reservation cannot be released after a product’s transport has started.
VC_STATEMENT_REMOVEPRODUCT | Remove statement deletes one or more product instances and resets value of the variable.
VC_STATEMENT_RESERVEPRODUCT

Reserve Product statement creates a process requirement for a matching product to be available and reserves it for this process.

Note: This is a requirement statement and thus can be only added to the Requirements routine of a process routine.
VC_STATEMENT_RUNROBOTROUTINE

Waits until the robot is idle, then evaluates the given RoutineName expression and tries to find the routine, then start the routine, and waits until the routine has been executed to completion.
VC_STATEMENT_SELECTPRODUCTS

Copies product instance references from one list to another variable. Product type filtering can be applied to only copy some product references.
VC_STATEMENT_SENDSIGNAL

Send Signal statement sends a simulation signal, i.e. triggers a vcSignal behavior, with a given value.
VC_STATEMENT_SETNODEMATERIAL

Set Node Material statement changes the material of a node in one or more product instances’ components.
VC_STATEMENT_SETNODEVISIBILITY | Changes the visibility of a node in one or more product instances’ components.
VC_STATEMENT_SETSTATISTICSFLOW

Flow statement updates statistics behavior and it records one or more products’ components transferring in or out. If more than one product is given as input, they are all recorded at once.
VC_STATEMENT_SETSTATISTICSSTATE | Sets the current state of a statistics behavior.
VC_STATEMENT_STARTTRANSPORTIN

Start Transport In statement transports one or more products into the process. More than one pre-reserved product can be transported in, otherwise transports only a single product.

The statement execution is asynchronous, meaning that next statements may execute before the transport is finished. Must be used in combination with the Wait Transport statement.
VC_STATEMENT_STARTTRANSPORTOUT

Transports one or more products out from the process in parallel. The statement execution is asynchronous, meaning that next statements may execute before the transport is finished. Must be used in combination with the Wait Transport statement.
VC_STATEMENT_SWITCHCASE

Switch Case statement executes the first vcCaseScope for which the value of its CaseCondition property matches that of statement’s Condition property.
VC_STATEMENT_TRANSPORTIN

Transport In statement sequentially transports one or more products into the process and waits until they have arrived. More than one pre-reserved product can be transported in, otherwise transports only a single product.
VC_STATEMENT_TRANSPORTOUT | Defines a transport node where to send the products using the transport system.
VC_STATEMENT_TRANSPORTPATTERNIN

Sequentially transports products into a regular grid pattern and waits until they have arrived.

VC_STATEMENT_WAITPROPERTYCONDITION

Waits for a variable’s value to pass a specified condition.

VC_STATEMENT_WAITSIGNAL

Wait Signal statement waits for signal to be triggered with a value that matches a given condition or until an optional timeout is reached.
VC_STATEMENT_WAITTRANSPORT

Wait Transport statement waits for one or more transport operations started with StartTransportIn or StartTransportOut statements to complete.
VC_STATEMENT_WORK

Sends a work request to a transport controller and waits until the work is complete.

Robot statements

Name | Description
VC_STATEMENT_CALL | Calls a subroutine sequence/program.
VC_STATEMENT_CUSTOM | Creates a template for executing a user-defined statement.
VC_STATEMENT_DELAY | Creates a user defined delay measured in seconds.
VC_STATEMENT_GRASP | (Deprecated) Creates a Grasp action for a robot's tool.
VC_STATEMENT_HOME | (Deprecated) Returns to default robot state pre-simulation.
VC_STATEMENT_IF | Creates a conditional statement for executing a collection of statements if a given expression evaluates as True.
VC_STATEMENT_LINMOTION | Creates a linear motion for a robot to a position; similar to VC_MOTION_LINEAR.
VC_STATEMENT_PATH | Creates a statement for executing a path of positions.
VC_STATEMENT_PRINT | Prints feedback to the Output panel.
VC_STATEMENT_PROCESS | Creates a position statement of type vcPositionStatement that is implemented as a process statement.
VC_STATEMENT_PTPMOTION | Creates a point to point motion using a robot's joints; similar to VC_MOTION_JOINT.
VC_STATEMENT_RELEASE | (Deprecated) Creates a Release action for a robot's tool.
VC_STATEMENT_REMOTECALL | (Deprecated) Triggers a remote robotic action via a subscriber to a publisher, i.e. parent robot triggers child sequence/program.
VC_STATEMENT_REMOTEWAIT | (Deprecated) Defines if a robot waits for remote action to finish or to receive IO in a parent-child relationship.
VC_STATEMENT_RETURN | Ends the execution of a called subroutine and returns to caller of that routine.
VC_STATEMENT_SETBIN | Creates an output signal map (bool), e.g. pick up and retain a box with a robot's tool.
VC_STATEMENT_WAITBIN | Creates an input signal map (bool), e.g. a robot waits to receive a signal from another component before executing other statements.
VC_STATEMENT_WHILE | Creates a conditional statement for executing a collection of statements in a loop while a given expression evaluates as True.
VC_STATEMENT_DEFINE_BASE | Defines a base location for RSL programming.
VC_STATEMENT_DEFINE_TOOL | Defines a tool location for RSL programming.
VC_STATEMENT_PROG_SYNC | Creates a method for synchronizing robotic motions with two or more robots.

Notes:

  • Statements marked as deprecated are not supported by new robot executor.

Statistics Constants

Chart Types

Name | Description
VC_CHARTTYPE_NONE | Empty chart.
VC_CHARTTYPE_LINE | Line chart.
VC_CHARTTYPE_COLUMN | Column chart.
VC_CHARTTYPE_BAR | Bar chart.
VC_CHARTTYPE_AREA | Area chart.
VC_CHARTTYPE_PIE | Pie chart.

Chart Tile Type

Name | Description
VC_TILETYPE_DUMMY | Location is used for grid layout purposes only.
VC_TILETYPE_PLACEHOLDER | Location is empty.
VC_TILETYPE_ACTUALTILE | Location is not empty.

Data Types

Constants for defining the data type of statistics chart.

Name | Description
VC_DATATYPE_ONESAMPLEDVALUE | Used for interval-based statistics. For example, discrete values reported for a recorded interval.
VC_DATATYPE_MINMAXAVERAGEVALUES | Used for cumulative statistics. For example, values that accumulate over time.

States

Constants for defining the state of Statistics behavior.

Name | Integer | Description
VC_STATISTICS_WARMUP | 1 | Reports when a component is in a warm up state.
VC_STATISTICS_BREAK | 2 | Reports when a component is in a break state.
VC_STATISTICS_IDLE | 3 | Reports when a component is in an idle state.
VC_STATISTICS_BUSY | 4 | Reports when a component is in a busy state.
VC_STATISTICS_BLOCKED | 5 | Reports when a component is in a blocked state.
VC_STATISTICS_BROKEN | 6 | Reports when a component is in a broken state.
VC_STATISTICS_REPAIR | 7 | Reports when a component is in a repair state.
VC_STATISTICS_SETUP | 8 | Reports when a component is in a setup state.

Swept Volume Constants

Decomposition Modes

Name | Integer | Description
VC_CONVEXHULL | 0 | One convex hull with no decomposition.
VC_DECOMPOSITION | 1 | Convex decomposition with one or more convex hulls.
VC_CONVEXHULL_TRIMESH | 2 | One convex hull for each triangle mesh

Swept Generation

Name | Integer | Description
VC_SWEPT_LOFTING | 0 | Uses lofting to generate swept geometry.
VC_SWEPT_HULL_FROM_HULLS | 1 | Uses hull from hulls method to generate geometry.
VC_SWEPT_HULL_FROM_SILHOUETTES | 2 | Uses hull from silhouettes method to generate geometry.

Topology Constants

Name | Description
VC_CURVE_TESSELLATED | A tessellated line or polyline.
VC_CURVE_POLYLINE | A polyline curve (spline of degree 1).
VC_CURVE_SPLINE | A spline curve.
VC_FACE_TESSELATED | A tessellated face without mathematical representation.
VC_FACE_PLANAR | A mathematical planar face.
VC_FACE_NURBS | A mathematical NURBS face.
VC_FACEDISPLAY_OUTER_CURVELOOP | Display only surface outer curved loop.
VC_FACEDISPLAY_INNER_CURVELOOPS | Display only inner curved loop(s).
VC_FACEDISPLAY_ALL_CURVELOOPS | Display all surface curved loops.
VC_FACEDISPLAY_FACE | Display shaded surface.

Unit Constants

Name | Description
VC_QUANTITY_SCALAR | Quantity type in which a magnitude or numerical value is given.
VC_QUANTITY_VECTOR | Quantity type in which both a magnitude or numerical value and direction are given.


Snippets

A

C

D - E

G - L

M - P

R

S

T - U

W

A

Access and create features, behaviors, properties and nodes in components

Access and use connectors

Access simulation data, e.g. run time and speed

Add, delete and reset data series in statistics chart

Add, edit and trigger events with property values

Add a new bar chart to statistics dashboard

Add menu items to user interface

Add path statement and populate position table

Add robot statement with custom icon

Attach a node to another node during a simulation

C

Calculate a local minimum for a numerical error

Cartesian and Scara kinematic solutions

Change a material's opacity

Check and update status of path positions

Conditions and triggers of conditions

Control robotic motions as well as record RSL routines (Deprecated)

Connect signal to signal map via abstract interface

Convert unit values

Create a keydown event for a command (Deprecated)

Create a path of motion nodes

Create a new tab in statistics dashboard

Create and edit bitmap properties

Create and implement a schema layout property list

Create base container and frames

Create container for geometry file

Create geometry using triangle sets

Create material inheritance in tree structures

Create modal/non-modal dialog boxes

Create OnValue event for process point sensors

Create position matrices for components

Create ray cast intersection test

Create tool container and frames

Customize names of path positions

D - E

Define a source of data series in statistics chart

Detect collisions using volume detector

Detecting collisions using a minimum distance threshold

Execute snap commands and events

G - L

Get components with shared features

Get node and feature position matrices

Get layout schema

Get URI of layout

Load and save bitmaps

M - P

Manipulate conveyors on a production line

Measure the minimum distance between geometries in given nodes

Modify and print matrix values

Modify the execution of motion statements

R

Receive feedback on products

Receive position matrices relative to other objects

Render swept volume displacement

Resolve geometric problems, e.g. get side and angle values

Restrict the selection of geometry in 3D world

Retrieve data based on selection, e.g. points on all lines

Retrieve surface information on polygons

S

Search and work with nodes in tree structure

Search for specific behaviors in components

Set the next state of a Python command

Set up a vehicle's speed and work area

Set up camera position in 3D world

Set up collision test with robot gripper

Set up interval and limit for creating products

Set up motion time and targets for robot/servo controllers

Set up new materials

Show message box after initializing application

T - U

Toggle visibility of node and/or child nodes

Toggle visibility of labels for path positions

Use signals as trigger mechanisms

Use vectors to adjust components positions

W

Work with a robot's joints and access their values

Work with component metadata

Work with robot RSL executor, its routines and statements (Deprecated)


Creating a Python Add-on

Adding your own tools to the user interface can be accomplished in a few simple steps.

Contents ShowHide

Step 1. Create Command File

Simple Command

Contextual Command

Command Task Pane

Step 2. Create Add-on Image

Color

Path

Step 3. Create Initialization File

Register Command

Manage Command

Command Execution

Command Menu Item

Gallery Menu

Ribbon Tab

Contextual Tab Group

Step 4. Localize using XAML File (optional)

Step 5. Put Files

Step 6. Test

Step 1. Create Command File

A command file contains the actions executed by your add-on. Every command must have at least one state defined by a function. For example, when a user clicks a button that event executes the first state of a command tied to that button.

To add command states, import vcCommand and use the addState() method. The states of a command are initialized when the command is registered and loaded by the application.

Tip: You can edit a command file while running the application since it will detect changes and automatically recompile the command before executing it.

Simple Command

  1. Open a text editor, for example Notepad, and then create a new file.
  2. In the file, type the following code to define the first state or action of the command.
from vcCommand import *

def first_state():
print "Hello World"

addState(first_state)
  3. Save the file as a Python file. That is, with a .py file extension.

Contextual Command

The context of the application can be used to define access to and the functionality of your add-on. In some cases, you can place the menu item of a command in a way that requires no additional work. For example, menu items bound to the Program tab would not appear when the Home tab is active in the workspace. This also applies to menu items that are displayed in context menus, for example the context menu of a statement in the Program Editor panel.

You can get a handle for the application, and then use its context properties to affect the execution of your add-on.

  1. Edit your command file so that it prints a different message for the 3D world and drawing world.
from vcCommand import *

cmd = getCommand()

def first_state():
app = cmd.Application

if app.CurrentContext.Id == "Drawing":
print "Hello Drawing World"
else:
print "Hello 3D World"

addState(first_state)
  2. Save the file.

Command Task Pane

Properties can be added to a command and displayed in a task pane. This allows you to customize the execution of a command in real time using a graphical interface. Any property of a command that is set to visible will be displayed in its task pane.

Note: A task pane is sometimes referred to as an action panel.

  1. Edit your command file so that it displays a String property and a Button property in a task pane. The String property can be used to read in a message that can be printed to the Output panel using the Button property.
from vcCommand import *

cmd = getCommand()
message = cmd.createProperty(VC_STRING, "Message")
end_button = cmd.createProperty(VC_BUTTON, "Respond")

def first_state():
executeInActionPanel()

app = cmd.Application
if app.CurrentContext.Id == "Drawing":
print "Hello Drawing World"
else:
print "Hello 3D World"

addState(first_state)

def OnRespond(args):
print cmd.Message

end_button.OnChanged = OnRespond
  2. Save the file.

Step 2. Create Add-on Image

Add some style to your add-on by including an image. The image must be a SVG file and contain a <path> element that defines its shape. It is recommended to use dimensions of 16x16 pixels, otherwise the application will automatically scale down your image.

Color

An SVG for an add-on can have color . If your SVG uses hexadecimal color #393939, the color will change depending on the Theme setting of the application. For example, color #393939 is white in Dark theme and black in Light theme.

Path

If your SVG uses basic shapes or primitives, you would need to convert them to compound paths. That is, the shape or object is rendered using a <path> element. Most SVG editors should have an option available to perform the conversion.

Example. Basic Shape converted to Path

<polygon fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" points="20.182,10.809 30.07,12.047 23.072,19.144 24.951,28.932 16.04,24.469 7.312,29.279 8.803,19.426 1.53,12.612 11.362,10.983 15.595,1.961 "/>

converted in Adobe Illustrator using Compound Path > Make command or CTRL+8 shortcut

<path fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" d="M20.182,10.809l9.889,1.238l-6.998,7.097l1.879,9.788l-8.912-4.463 l-8.728,4.811l1.491-9.854L1.53,12.612l9.832-1.629l4.233-9.022L20.182,10.809z"/>

Step 3. Create Initialization File

An initialization file contains instructions for loading and displaying your add-on when you start the application.

Register Command

To register a command, import vcApplication, get the path to the command file of your add-on, and then use the loadCommand() method.

In all cases, the initialization and command files of your add-on will be in the My Commands folder of the application's documents. You can use the getApplicationPath() method and then concatenate a string that identifies your command file to form a URI. You can put your add-on files in a subfolder to better organize the My Commands folder. In that case, the application would still be able to find your commands by name without knowing its absolute path.

  1. In your text editor, create a new file.
  2. In the file, type the following code to register your command.
from vcApplication import *

def OnAppInitialized():
cmduri = getApplicationPath() + "hello.py"
cmd = loadCommand("hello",cmduri)
  4. Save the file as "__init__.py" in order for the application to initialize the add-on.

Manage Command

The netCommand allows you to call .NET API commands and use them in Python. This is helpful since some API might not be available in Python.

In this case, you will use the netCommand to call SetLocalizationCommand, which means a total of six command arguments.

  • The first argument defines what command you want to call from .NET side of API. In this case, SetLocalizationCommand. The five remaining arguments will be passed to that command.
  • The second argument defines the language for localization. You must reference a language supported by the application.
  • The third argument defines the context/scope of the command, which in this case is Python.
  • The fourth argument defines what command id/name to localize, so refer to the name you used when registering the command for your add-on. You can also localize command properties using this format, <command_name.property_name>.
  • The fifth argument defines what to localize in your command, which can be one of three things. "Text" allows you to edit the label of a command or one of its properties. "Icon" allows you to set the icon for the command. "Tooltip" allows you to edit the description of a command or one of its properties shown in a tooltip.
  • The sixth argument defines the content for the command or property attribute you are localizing. If you are localizing an icon, you must pass a URI or string that provides the points of a path needed to generate an SVG. By default, the application references the Icons folder in its program files, so you can refer to any image there by its relative path.

In all cases, if a command has not been localized for a language supported by the application, the command will use certain defaults. The label of a command will be the caption given to it when you add it to a menu. The labels of command properties will use the name of each property. The icon of a command or its properties will either be empty or use a default icon picked by the application.

  1. Edit your initialization file so that it localizes your add-on for English and German.
from vcApplication import *

def OnAppInitialized():
cmduri = getApplicationPath() + "hello.py"
cmd = loadCommand("hello",cmduri)

localize = findCommand("netCommand")
localize.execute("SetLocalizationCommand", "English", "Python", "hello", "Text", "Hello")
localize.execute("SetLocalizationCommand", "English", "Python", "hello", "Tooltip", "Print Hello World")
localize.execute("SetLocalizationCommand", "English", "Python", "hello", "Icon", "HelloWorld.svg")
localize.execute("SetLocalizationCommand", "German", "Python", "hello", "Text", "Hallo")
localize.execute("SetLocalizationCommand", "German", "Python", "hello", "Text", "Print Hallo Welt")
localize.execute("SetLocalizationCommand", "German", "Python", "hello", "Icon", "HelloWorld.svg")
  2. Save the file.

Tip: The application automatically checks the Icons folder located in its program files to source an icon for a command. Any image in the Icons folder can be referenced by name or its file path in that directory. Otherwise, you need to pass the full URI of an icon or a string that provides the 'd' attribute value of an SVG <path> element.

Example. Description of path for rendering icon

icon = """M11.477,11.12l4.303-9.092l4.599,8.945l9.977,1.282l-7.086,7.139 l1.864,9.884l-8.979-4.532l-8.825,4.826l1.537-9.94L1.549,12.73L11.477,11.12z"""

localize = findCommand("netCommand")
localize.execute("SetLocalizationCommand", "English", "Python", "hello", "Icon", icon)

Note: When the size of the main window becomes too small to display all items of a Ribbon group, the Ribbon group and its items are displayed as a drop-down menu. The icon of that drop-down menu can be an icon assigned to the Ribbon group.

Example. Define icon of Ribbon group

from vcApplication import *

def OnAppInitialized():
localize = findCommand("netCommand")

##sets the group icon by referring to group name
##when group is collapsed it becomes a drop-down menu that uses its group icon
localize.execute("SetLocalizationCommand", "English", "Python", "rMyGroup", "Icon", "rAdd")

##adds two items to group that have default Python icon
addMenuItem("VcTabHome/rMyGroup", "Item 1", -1, "")
addMenuItem("VcTabHome/rMyGroup", "Item 2", -1, "")

Command Execution

As long as the commands of an add-on are registered with the application, you can execute them. For component scripting, you can use the findCommand() method in vcApplication to get handle for a command in your add-on. You can do the same for application scripting, but remember in both cases to take into consideration the command stack of the application. For example, a command might not end when another command is called, so use the cancelCommand() in vcApplication to manage this issue.

Command Menu Item

You may want to start and stop the execution a command using menu items. A menu item is an area of the user interface commonly referred to as a section. Each section can be identified by either a constant or an id. In some cases, you might use a constant plus an id to refer to a section. In other cases, you would use as many IDs as needed to identify the section where you want to add a menu item.

If you refer to an existing section, the application will add your item to that section with some exceptions.

  • Due to current limitations, you cannot add items to the Backstage view of the user interface using Python.
  • A Ribbon group has a maximum of three rows, so in some cases your item might not fit there.

If you refer to a section that does not exist, the application will either add or not add your item.

  • If you give an unknown constant or invalid id, the item will not be added and the exception will print an error message.
  • If you give a constant or id that is too vague, the item will not be added. For example, some constants refer to menu lists, so an extra id is needed to define which category or "gallery" to nest the item within that list. If the gallery name does not exist, a new one will be added for that item. Another example is "VcTabHome" which points to the Home tab, but is not enough for the application to know where on the Ribbon you want to add the item.
  • If you give a valid constant and/or id that ends with an unknown section, the item might be added depending on the menu. For example, "VcTabHome/Example" points to the Home tab, but there is no Ribbon group with an id of Example. So the application will create a Ribbon group called "Example" and add the item there. Some shortcut menus may not allow gallery names, so in most cases it is safer to add the item to the menu without any type of category or divider.

Caution: You can refer to the <UXSitesSection> element of your application's configuration file to know valid IDs. Each id is an 'ItemId' attribute of a <Site> element. However, some ids might not work, and you should not directly edit the configuration file. Refer to the EULA of the application as needed. In most cases, you should use the Forum or contact support to know what IDs you need to use for your add-on.

  1. Edit your initialization file so that it adds a menu item for your add-on to the context menu of both the 3D world and drawing world.
from vcApplication import *

def OnAppInitialized():
cmduri = getApplicationPath() + "hello.py"
cmd = loadCommand("hello",cmduri)

localize = findCommand("netCommand")
localize.execute("SetLocalizationCommand", "English", "Python", "hello", "Text", "Hello")
localize.execute("SetLocalizationCommand", "English", "Python", "hello", "Tooltip", "Print Hello World")
localize.execute("SetLocalizationCommand", "English", "Python", "hello", "Icon", "HelloWorld.svg")
localize.execute("SetLocalizationCommand", "German", "Python", "hello", "Text", "Hallo")
localize.execute("SetLocalizationCommand", "German", "Python", "hello", "Tooltip", "Print Hallo Welt")
localize.execute("SetLocalizationCommand", "German", "Python", "hello", "Icon", "HelloWorld.svg")

addMenuItem(VC_MENU_HOME, "hello", -1, "hello")
addMenuItem(VC_MENU_DRAWING, "hello", -1, "hello")
  2. Save the file.

Gallery Menu

A gallery menu (drop-down menu) is a type of control that allows you to list add-ons and group them by section. The menu item itself is a placeholder but can also be associated with a command.

You can add a gallery menu to the Ribbon by specifying a group in its site path, and then define its control type as a GalleryMenuTool. Next, a menu item for that gallery would reference the same group in its site path followed by its section. The menu item would then need to reference the id of the gallery menu, and then define its control type as a GalleryMenuToolItem. For localization, refer to the control id or command of a gallery menu and its items. You can also localize sections by referring to them by name.

Example. Create a gallery menu placeholder

from vcApplication import*

def OnAppInitialized():
addMenuItem("VcTabHome/Test", "Widgets", -1, "GalleryMenuId01", "A gallery of my widgets", "rDetach", "", "GalleryMenuTool")

Example. Create gallery menu items with sections

from vcApplication import*

def OnAppInitialized():
addMenuItem("VcTabHome/Test", "Widgets", -1, "GalleryMenuId01", "A gallery of my widgets", "rDetach", "", "GalleryMenuTool")
addMenuItem("VcTabHome/Test/SectionA", "Clear", -1, "", "Clears the Output panel","rClearAll", "GalleryMenuId01","GalleryMenuToolItem")
addMenuItem("VcTabHome/Test/SectionA", "Save", -1, "", "Saves the content of Output panel","rSave", "GalleryMenuId01","GalleryMenuToolItem")
addMenuItem("VcTabHome/Test/SectionB", "Export", -1, "", "Exports metadata of layout components","rExpanderIcon", "GalleryMenuId01","GalleryMenuToolItem")

Example. Localize a gallery menu as well as its sections and items

from vcApplication import*

def OnAppInitialized():
localize = findCommand("netCommand")
localize.execute("SetLocalizationCommand", "English", "Python", "GalleryMenuId01", "Text", "Widgets")
localize.execute("SetLocalizationCommand", "English", "Python", "SectionA", "Text", "SectionA")
localize.execute("SetLocalizationCommand", "English", "Python", "GalleryMenuId01", "Text", "Widgets")
localize.execute("SetLocalizationCommand", "German", "Python", "GalleryMenuId01", "Text", "Widgets")
localize.execute("SetLocalizationCommand", "German", "Python", "SectionA", "Text", "Abschnitt")
localize.execute("SetLocalizationCommand", "German", "Python", "ItemId01", "Text", "Speichern")

addMenuItem("VcTabHome/Test", "Widgets", -1, "GalleryMenuId01", "A gallery of my widgets", "rDetach", "", "GalleryMenuTool")
addMenuItem("VcTabHome/Test/SectionA", "Save", -1, "ItemId01", "Saves the content of Output panel ","rSave", "GalleryMenuId01","GalleryMenuToolItem")

Important: If you are placing your add-on in a gallery menu that is not defined by the initialization (INI) file of your add-on, the files of your add-on must be in a child folder of the INI file defining the menu. For example, the INI file of your add-on might reference a gallery menu before it is created when initializing the application. This rule does not apply to gallery menus defined by the application.

Example. __init__ file defines gallery menu that is referenced by __init__ file in child folder

Ribbon Tab

A Ribbon tab is a type of control that allows you to display groups of commands in a ribbon. The menu item would need to reference itself using its site id, which needs to contain the word "Tab", for example Tab<Tab name>. The control type is RibbonTab.

Example. Add tabs to ribbon

from vcApplication import *

def OnAppInitialized():
localize = findCommand("netCommand")
localize.execute("SetLocalizationCommand", "English", "Python", "TabExample01", "Text", "My Tab 01")
localize.execute("SetLocalizationCommand", "English", "Python", "TabExample02", "Text", "My Tab 02")
#long form
addMenuItem("TabExample01", "", -1, "TabExample01", "", "", "", "RibbonTab")

#short form
addMenuItem(UxSite="TabExample02", Index=-1, Id="TabExample02", ControlType="RibbonTab")

Contextual Tab Group

A contextual tab group is a group of Ribbon tabs that appear based on the context of main application. The menu item would need to reference itself using its site id, which needs to contain the word "ContextTab", for example ContextTab<Group name>. The control type is ContextualTabGroup and supports a custom background color for the group.

A custom Ribbon tab can be attached to the group by referencing the site id of the group in the path and parent arguments.

Example. Turn on/off the visibility of contextual tab group

## create command file that uses event handler and vcApplication method to toggle the tab group
from vcCommand import *

app = getApplication()
cmd = getCommand()

def ShowOrHideCustomRibbonTab():
'''Shows contextual tab group when context is Teach/programming robot'''
if app.CurrentContext.Id == "Teach":
app.setContextualTabGroup("MyContextTabGroup",True)
else:
app.setContextualTabGroup("MyContextTabGroup",False)

app.OnContextChanged = ShowOrHideCustomRibbonTab

Example. Add contextual tab group to Ribbon

## __ini__ file for the contextual tab group and its tabs
from vcApplication import *

def OnAppInitialized():
##load your command used as toggle for tab group visibility
cmduri = getApplicationPath() + "toggleTabGroup.py"
cmd = loadCommand("toggleTabGroup", cmduri)

##add the tab group first, and then use its Id to attach Ribbon tabs
##currently, you need to use keyword arguments to add a contextual tab group
addMenuItem(UxSite="MyContextTabGroup", Index=-1, Id="MyContextTabGroup", ControlType="ContextualTabGroup", BaseBackColor="orange")
addMenuItem("MyContextTabGroup/TabExample01", "", -1, "TabExample01", "", "", "MyContextTabGroup", "RibbonTab")
addMenuItem("MyContextTabGroup/TabExample02", "", -1, "TabExample02", "", "", "MyContextTabGroup", "RibbonTab")

Step 4. Localize using XAML File (optional)

For localizing your add-on, you can use the netCommand, as shown in previous examples, to call the SetLocalizationCommand defined in .NET API. You can also use a XAML resource dictionary to localize your add-on for one or more languages. Each language is a separate file stored with your add-on. The language must be supported by the application, but you can modify the labels and tooltips of properties as needed for intended users. For example, you can have an add-on that supports English with tooltips in both English, Creole, and English-based Pidgin.

Each language file must be named "PyResource.<language>" and saved as a XAML file.

Note: In some cases, you might see a language file prefixed with the name of its directory. This can be done to avoid checking language files not associated with your add-on.

Example. English language file for add-on

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib">

<!-- This localizes the group where I put the command -->
<s:String x:Key="ComboKey::Python.rMyGroup.Text">Label for group</s:String>
<s:String x:Key="ComboKey::Python.rMyGroup.Tooltip">Tooltip for group</s:String>
<s:String x:Key="ComboKey::Python.rMyGroup.Icon">pLock.svg</s:String>

<!-- This localizes the command itself -->
<s:String x:Key="ComboKey::Python.example.Text">Label for command</s:String>
<s:String x:Key="ComboKey::Python.example.Tooltip">Tooltip for command</s:String>
<s:String x:Key="ComboKey::Python.example.Icon">rUndo.svg</s:String>

<!-- This localizes command properties -->
<s:String x:Key="ComboKey::Python.example.ExampleProperty.Name">Label for command property</s:String>
<s:String x:Key="ComboKey::Python.example.ExampleProperty.Description">Tooltip for command property</s:String>

</ResourceDictionary>

Notes:

  • The names of the command and its properties that were registered to application are referenced in the language file.
  • A command uses Text for its label, whereas a command property uses Name.
  • A command uses Tooltip for its tooltip, whereas a command property uses Description.
  • For localizing the step values (drop-down menu options) of a command property, reference the step value to localize its text. For example "ComboKey::Python.example.ExampleProperty.red" would be a key for localizing the step value of red in that property.
  • For localizing message boxes, create unique keys for its title and message, for example "ComboKey::Python.ExampleMsgBoxTitle.Text" and "ComboKey::Python.ExampleMsgBoxMessage.Text".
  • The files for this example can be downloaded here.

Step 5. Put Files

In order for the application to load and initialize your add-on, you must put its initialization and command files in the My Commands folder of your application's documents. It is recommended to put the icons of your add-on in the Icons folder of your application's program files. Otherwise, make sure the URI of an icon matches the one you reference in your initialization file.

Source files of example add-on

Step 6. Test

Run the application, and then test your add-on. One benefit is that you can edit the command files of your add-on in real time since the application will automatically recompile them for you.


Template for Python Add-on

This template can help you quickly develop and localize your Python add-on. You can download the files here. Remember to put the files in the My Commands folder of your application's documents. As follows are sections that briefly explain each file and its use.

Contents ShowHide

Initialization File

Command Files

Icon File

Resource File

Initialization File

An initialization file (__init__.py) is used to register your add-on with the application and define its location in the user interface. You can, of course, develop an add-on that runs in the background and listens for events.

'''
template for add-on that uses contextual tab group, ribbon tab and group
a contextual tab group requires a command that defines when to show or hide it
'''
from vcApplication import *

def OnAppInitialized():
cmduri = getApplicationPath() + "ShowContextualRibbonTab.py"
cmd = loadCommand("ShowContextualRibbonTab",cmduri)

cmduri2 = getApplicationPath() + "printHelloLocalized.py"
cmd = loadCommand("printHelloLocalized",cmduri2)

iconPath = getCommandPath() + "Hello.svg"
localize = findCommand("netCommand")

localize.execute("SetLocalizationCommand", "English", "Python", "printHelloLocalized", "Icon", iconPath)
localize.execute("SetLocalizationCommand", "English", "Python", "NewRibbonGroup", "Icon", iconPath)

#Step 1: First add Ribbon Contextual tab group. Id is the id of the group which Ribbon tab created in step 2 is going to associate.
addMenuItem(UxSite = 'pyContextTabGroup',UxName = "PythonExtraContextTab", Index = -1, Id = "pyContextTabGroup",Parent="gmAction",ControlType="ContextualTabGroup",BaseBackColor="#ff1985") #ssisss
#Step 2: Add Ribbon Tab and associated it with Contextual ribbon group.The Parent attribute is to set the Contextual tab group. Id of Ribbon tab is the id it is used to be identified.
addMenuItem(UxSite = "pyContextTabGroup/TabHeader", UxName="1st Tab", Index = -1, Id = "TabHeader",Parent="pyContextTabGroup", ControlType="RibbonTab")
# now you can add ribbon items in this
addMenuItem('pyContextTabGroup/TabHeader/NewRibbonGroup', "R Group" , -1, "printHelloLocalized" , "","","","")

Important: If you are placing your add-on in a gallery menu that is not defined by the initialization (INI) file of your add-on, the files of your add-on must be in a child folder of the INI file defining the menu. For example, the INI file of your add-on might reference a gallery menu before it is created when initializing the application. This rule does not apply to gallery menus defined by the application.

Example. __init__ file defines gallery menu that is referenced by __init__ file in child folder

Command Files

A command file defines the functionality of your add-on. Your add-on can have one or more command files. Generally, a command has at least one state that occurs when you execute the command. You have the option of extending a command by adding properties, using pre/post-execution events, showing message boxes, and executing a command with the help of a task pane/action panel.

'''
template for command executed in action panel/task pane
you can see how to localize:
message box
command property
command property with step values
command property grouped in tab other than default
'''
from vcCommand import *
app = getApplication()
cmd = getCommand()

def showMessage(prop):
title = app.getLocalizedString("Python","MsgBoxTitle","Text") #1st way
message = app.getLocalizedString("ComboKey::Python.MsgBoxMessage.Text") #2nd way
retval = app.messageBox(message,#message text
title, #Title
iconValues['Information'], #icon
buttonValues['YesNoCancel'], #button
0, #default result
"yep!", #yesbutton
"no...", #nobutton
"idk") #cancelbutton

prop1 = cmd.createProperty(VC_BUTTON,"btnPropName")
prop1.OnChanged = showMessage

prop2 = cmd.createProperty(VC_STRING,"ColorPropName",VC_PROPERTY_STEP)
prop2.StepValues = ["red","green","blue"]
prop2.Value = prop2.StepValues[0]

prop3 = cmd.createProperty(VC_BOOLEAN,"Advanced::togglePropName")
prop3.Value = False

def state():
executeInActionPanel()

cmd.addState(state)
returnValues = {0 : 'None',
1 : 'OK',
2 : 'Cancel',
6 : 'Yes',
7 : 'No'}
buttonValues = { 'OK' : 0,
'OKCancel': 1,
'YesNoCancel' : 3,
'YesNo' : 4}
iconValues = { 'None' : 0,
'Error': 16,
'Question' : 32,
'Warning' : 48,
'Information' : 64}

In some cases, another command file is needed to show or hide your add-on or disable it.

#example on how to show/hide contextual tab group
#in this case, the command runs in background as event handler
from vcCommand import *

app = getApplication()
cmd = getCommand()

def ShowOrHideCustomRibbonTab():
if app.CurrentContext.Id == "Drawing":
app.setContextualTabGroup("pyContextTabGroup",False)
print "Your custom pyContextTabGroup is hidden in " + app.CurrentContext.Id + "context"
elif app.CurrentContext.Id == "Teach":
app.setContextualTabGroup("pyContextTabGroup",True)
print "Your custom pyContextTabGroup is shown in " + app.CurrentContext.Id + "context"
else:
app.setContextualTabGroup("pyContextTabGroup",True)
print "Your custom pyContextTabGroup is shown in " + app.CurrentContext.Id + "context"

app.OnContextChanged = ShowOrHideCustomRibbonTab

Icon File

An SVG file can be used as an icon for your add-on. You can either create your own or reference the ones used by the application. For example, in the program files of the application you will find an Icons folder. In that case, the Icons folder can be a working directory, so you could pass a relative path, for example "rUndo.svg", instead of an absolute path. In any case, an SVG file must have a <path> tag with a 'd' attribute to be rendered in the user interface.

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g id="XMLID_20_">

<path id="XMLID_79_" fill="#393939" d="M10.912,3v1.623L9.403,6.34L8.808,7.016l0.611,0.662L11,9.391V11H5V9.377L6.509,7.66L7.09,7
l-0.58-0.66L5,4.623V3H10.912 M11.912,2H4v3l1.758,2L4,9v3h8V9l-1.846-2l1.758-2V2L11.912,2z M16,13H0v1h16V13L16,13z"/>

</g>
<path id="XMLID_25_" fill="#FAA519" d="M5.45,11l2.2-4l-1.2-2h3l-1,2l2.1,4H5.45z"/>
<g id="XMLID_26_">
</g>
<g id="XMLID_28_">
</g>
<g id="XMLID_29_">
</g>
<g id="XMLID_30_">
</g>
<g id="XMLID_31_">
</g>
<g id="XMLID_32_">
</g>
</svg>

Tip: The hex color of #393939 can be used to contrast the Light and Dark themes of the application. The color is white when using Dark theme and black when using Light theme.

Resource File

A resource file allows you to localize your add-on for languages supported by the application. A resource file uses key-value pairs that define localized strings. These key-value pairs are then merged with other resource files to create a one large dictionary for the application. In this case, the localized strings are added from Python not .NET. When localizing your add-on, make sure to reference keys not values. A key is then used to get localized text based on the active language of the application. To create and use a resource file, name it "PyResource.<language>" and save it with a .xaml file extension.

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib">

<!-- for ribbon button/command -->
<s:String x:Key="ComboKey::Python.printHelloLocalized.Text">Print Hello(in English)</s:String>
<s:String x:Key="ComboKey::Python.printHelloLocalized.Tooltip">Print hello World in message panel(in English)</s:String>
<s:String x:Key="ComboKey::Python.printHelloLocalized.Icon">rUndo.svg</s:String>

<!-- for ribbon group -->
<s:String x:Key="ComboKey::Python.NewRibbonGroup.Text">Localized Group (in English)</s:String>
<s:String x:Key="ComboKey::Python.NewRibbonGroup.Tooltip">Contains localized button(in English)</s:String>

<!-- for ribbon context tab and tab group -->
<s:String x:Key="ComboKey::Python.TabHeader.Text">English Tab</s:String>
<s:String x:Key="ComboKey::Python.pyContextTabGroup.Text">English</s:String>

<!-- for message box -->
<s:String x:Key="ComboKey::Python.MsgBoxTitle.Text">Hello (in English)</s:String>
<s:String x:Key="ComboKey::Python.MsgBoxMessage.Text">I am localized Message in English</s:String>

<!-- for properties in content panel -->
<s:String x:Key="ComboKey::Python.printHelloLocalized.btnPropName.Name">Button (in English)</s:String>
<s:String x:Key="ComboKey::Python.printHelloLocalized.ColorPropName.Name">Color (in English)</s:String>
<s:String x:Key="ComboKey::Python.printHelloLocalized.Advanced::togglePropName.Name">Toogle (in English)</s:String>

<!-- for step values -->
<s:String x:Key="ComboKey::Python.printHelloLocalized.ColorPropName.red">Red (in English)</s:String>
<s:String x:Key="ComboKey::Python.printHelloLocalized.ColorPropName.blue">Blue (in English)</s:String>
<s:String x:Key="ComboKey::Python.printHelloLocalized.ColorPropName.green">Green (in English)</s:String>

</ResourceDictionary>

Note: You do have the option of localizing your add-on by using the netCommand to call the SetLocalizationCommand in .NET API. However, a resource file is easier to manage, share and edit. It has also been shown that the application performs better when a Python add-on uses resource files.


Executing a .NET Command

The netCommand allows you to call a command defined in .NET API and registered with your Visual Components product.

A .NET command is an IActionItem and stored in the main application's command registry, which is of type ICommandRegistry. You can access this registry to find out what commands you can call and the arguments you need to pass to execute each command. One approach is to create a simple plugin in Visual Studio for your Visual Components product (main application). From there, create a breakpoint that would allow you to inspect actions in the registry using Intellisense in Visual Studio.

Some .NET commands are executed using an action panel or task pane. In most cases, that would require passing command arguments when executing the netCommand.


vc3DIcon

vc3DIcon is a layout item used for rendering sets of Frame features (vcFrameSet), path points (vcMotionPath), and path objects (vcPathObject) as 3D icons in a layout.

Inherits: vcLayoutItem

Properties

Name | Type | Access | Description
Geometry | vcGeometryContainer | R | Gets the container used by the icon to store its geometry.
Layer | vcLayer | RW | Defines the layer the icon belongs to in the 3D world.
Name | String | RW | Defines the icon's name.
Uri | String | RW | Defines the URI of the icon file.


vcAction

vcAction is a container of information and user-defined properties for an action that can be executed during a simulation.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
ActionContainer | vcActionContainer | R | Gets the action container of action.
ActionTime | Real | R | Gets the creation time of action.
AllProperties | List of vcProperty | R | Gets a list of all user-defined properties for the action.
Filter | String | RW | Defines a filter for limiting what resource can perform the action.
From | vcActionContainer | RW | Defines the original sender of this action. Generally, this is used to track and manipulate where an action is sent from. For example, an action might be forwarded and passed to different resources and task managers.
Message | String | RW | Defines the status information about the action's execution.
Name | String | RW | Defines the name of action.
AllProperties | List of vcProperty | R | Gets a list of all user-defined properties for the action.
Properties | List of vcProperty | R | Gets a list of all user-defined properties created for the action after the action container was loaded.
Receiver | vcActionContainer | RW | Defines the receiver of action in its current workflow. For example, an action might need to be handled at a workstation before the action is sent to a target defined by its To property.
Sender | vcActionContainer | RW | Defines the current sender of the action. Generally, this is used to clearly identify which object is responsible for sending this action.
To | vcActionContainer | RW | Defines the final target where the action should be sent to. In some cases, an action's final destination might be redefined to handle issues such as quality inspections, rerouting of materials, and availability of resource providers.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Adds a new user-defined property of a given type and name to action, and then returns the new property. An optional constraints argument can be given to define the constraints of the property, which must be given at the time of creation. See Property constants for available property types and constraints.
deleteProperty | None | vcProperty property | Deletes a given property from action.
getProperty | vcProperty | String name | Returns the first property matching a given name in action; otherwise returns None.
send | None | [vcActionContainer container] | Sends action to the defined container. If no arguments are given, the action is broadcast to all connected Action Containers.
sendMessage | None | String message, [vcActionContainer container] | Sends action with a given message to all connected Action Containers. An optional container argument can be given to specify which action container receives the action. Generally, the message of an action defines the action's type and is used by an action container to execute the action. In some cases, the message is used to filter actions.


vcActionContainer

vcActionContainer is a container of vcAction objects used for storing, buffering, sending and receiving actions between resource clients, providers and brokers.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
ActionCount | Integer | R | Gets the total number of actions in container.
Actions | List of vcAction | R | Gets a list of all actions in container.
Brokers | List of vcActionContainer | RW | Defines a list of connected brokers.
Clients | List of vcActionContainer | RW | Defines a list of connected clients.
PendingActionCount | Integer | R | Gets the number of actions in the PendingActions property list.
NextFreeTime | Real | RW | Defines the next available time this container is able to process actions during a simulation.
PendingActions | List of vcAction | R | Gets a list of pending action stored in the container. That is, actions that are received from other action containers and buffered for action processing.
Processing | Boolean | RW | Defines if this container is executing actions.
Providers | List of vcActionContainer | RW | Defines a list of connected providers.
Reserved | vcActionContainer | RW | Defines if this container is reserved by other action container.

Methods

Name | Return Type | Parameters | Description
clear | None | None | Deletes all actions in container.
clearPending | None | None | Deletes all pending actions in container.
createAction | vcAction | String action_name | Creates a new vcAction in container, and then returns the new action.
createPendingAction | vcAction | String name | Creates a new pending action in the container.
deleteAction Boolean vcAction action

or

Integer index

 Deletes a given action or one at a given index from container.

If deletion is successful, returns True; otherwise returns False.
deletePendingAction | Boolean | vcAction action | Deletes a given action from the PendingActions property list.
do Boolean String action_type, [arg...],[name=arg...] Executes an action using the container.

If action can be performed, returns True; otherwise returns False.

Each action type has its own set of arguments which are described in Action Constants. Action arguments can be added in the order how they are described in the action parameter table.

An alternative approach is to use Python keywords, which allows only using specific keyword arguments.

See list of possible action types and their arguments.
getAction | vcAction | Integer index | Returns an action found at the given index in container.
getPendingAction | vcAction | Integer index | Returns a pending action found at a given index in container.
getResources | List of vcActionContainer | None | Returns a list of immediate resources connected to container.
moveAction Boolean vcAction action, Integer index Moves a given action to a given index in Actions property list.

If moving is successful, returns True; otherwise returns False.
movePendingAction Boolean vcAction action, Integer index Moves a given action to a new position in the PendingActions property list.

If moving is successful, returns True, otherwise False is returned.
popPending vcAction [Integer index] Removes the last action from the PendingActions property list, and then returns that action; otherwise returns None.

If an index argument is given, the action found at that position in the PendingActions property list will be removed and returned by the method; otherwise, returns None.
release | Boolean | None | Releases the container from the action container defined in the Resource property. If the release is successful, returns True; otherwise returns False.
removePendingAction | Boolean | vcAction action | Removes a given action from the PendingActions property list.
reserve vcActionContainer String resource_filter, [String action_type],
[Timeout=real] 		Reserves a resource provider matching resource_filter, and then returns the reserved resource.

If resource is not available immediately, the method will wait until resource is available. If no matching resource is available, the method returns None.

An optional action_type argument can be given to reserve the resource for a specific action.

See list of possible action types.

An optional Timeout argument can be given to define how long the method will wait (in seconds) in order to reserve a resource. If the resource cannot be reserved before Timeout expires, the method returns None.
start Boolean String action_type, [arg...], [name_arg...] Executes an action using container regardless if an other action is still running.

If action can be performed, returns True; otherwise returns False.

Generally, start() is used with the wait() method in order to catch when an action executed with start() has been completed.

Each action type has its own set of arguments which are described in Action Constants. Action arguments can be added in the order how they are described in the action parameter table.

An alternative approach is to use Python keywords, which allows only using specific keyword arguments.

See list of possible action types.
use Boolean String resource_filter, String action_type, [arg...],[name=arg...], [Real timeout] Executes an action using a specific resource.

If no resource is found based on resource_filter and the action is available immediately (not in queue), the method will wait until the specified resource is available. If resource can be used to perform action, returns True; otherwise returns False.

Optional timeout keyword argument defines how long the method will wait (in seconds) for the reserved resource to become available. If resource cannot be reserved before timeout expires, return False.

Each action type has its own set of arguments which are described in Action Constants. Action arguments can be added in the order how they are described in the action parameter table.

An alternative approach is to use Python keywords, which allows only using specific keyword arguments.

See list of possible action types.
wait Boolean [Real timeout] Waits until action called in start() method is completed, and then returns True.

If an optional timeout argument is used, the method will return False if an action is not completed within the allocated time period (in seconds).


vcAnnotation

vcAnnotation is a layout item used for authoring new and existing annotations in a layout.

Inherits: vcLayoutItem

Contents ShowHide

Properties

Methods

Examples

Properties

Property | Type | Access | Description
Height | Real | RW | Defines the height of text displayed in annotation.
LineWidth | Real | RW | Defines the line width of annotation.
Location | vcMatrix | RW | Defines the position matrix of annotation in World coordinate system).
LockToNode | Boolean | RW | Defines if the annotation is attached to a node in component. That is, whether or not the annotation is anchored to a component or 3D world.
Material | vcMaterial | RW | Defines the material of annotation.
Name | String | RW | Defines the annotation's name.
Node | vcNode | RW | Defines the node the annotation is attached to in the 3D world. If the annotation is not locked to a node, the value is None.
Position | vcMatrix | RW | Defines the location of the annotation in its parent's coordinate system. That is, the anchor point of the annotation. If the annotation is not anchored to a component, the location is based in the World (simulation root node) coordinate system.
Text | String | RW | Defines the text of the annotation displayed in an environment.
Thickness | Real | RW | Defines the thickness of the annotation's text in an environment.

Methods

Method | Return Type | Parameters | Description
getProperty | vcProperty | String name | Returns a property matching a given name in the annotation; otherwise returns None.

Examples

Example. Find and get annotation in layout

from vcScript import *

app = getApplication()
annotation = app.findLayoutItem("[AnnotationName]")


vcApplication

vcApplication is the object type for the main application, thereby granting access to the application's GUI, commands and other common properties.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
ActivationKey | String | R | Gets the current product key being used by the application.
Animate Boolean RW Turns on/off the animation of components in the 3D world during a simulation.

If False, components are static during a simulation.
AuthorContext | vcAuthorContext | R | Gets the Modeling tab context.
Commands | List of vcCommand | R | Gets a list of commands in the application's command registry. That is, registered commands available in the application.
Components | List of vcComponent | R | Gets a list of all components in the 3D world.
ConfigureContext | vcConfigureContext | R | Gets the Home tab context.
Contexts | List of vcContext | R | Gets a list of all contexts defined in the application.
CurrentContext | vcContext | RW | Defines the current context of the application.
CurrentSelection vcSelection RW Defines the current selection in the active environment.

(Deprecated) Use selection type methods or the SelectionManager property.
Dashboard | vcStatisticsDashboard | R | Gets the Statistics dashboard.
DrawingContext | vcDrawingContext | R | Gets the Drawing tab context.
IgnoreEvents Boolean RW Defines if the application ignores events.

Generally, a True value is used in situations where events could create cyclic calls and unintentional loops.
Layers | List of vcLayer | R | Gets a list of all layers in the current layout.
LayoutItems | List of vcLayoutItem | R | Gets a list of all layout items in the current layout.
LayoutModified Boolean RW Defines if the current layout has been modified since it was loaded or its last save.

LayoutModified acts as a flag for determining if you are prompted to save a layout and the current state of the Save command.

The value is set to True when a user makes a change to the current layout using the GUI.

A script that makes changes to a layout should set the value to True in order for the application to know whether or not the layout needs to be saved. This is not needed if the script only makes temporary changes to a layout during a simulation.
LayoutPath String R Gets the local path of current layout.

Generally, the path is the same one you would get from the address bar of the File Explorer in Windows. For example, spaces would not be encoded as + signs.

See System.Uri.LocalPath in the .NET Framework for more information.
LayoutUri String R Gets the URI of current layout.

The URI would contain its scheme, for example a "file:///" prefix, and spaces would be encoded as + signs.

See Example. Print URI of current layout for more information.
LayoutUriInCompatibilityFormat String R Gets the URI of current layout in a format that was used in older product versions.

The URI is similar to LayoutUri. One exception is a forward slash in the URI path is replaced with a backslash.
Lights | List of vcLight | R | Gets a list of all lights in the application.
Materials | List of vcMaterial | R | Gets a list of all materials in the application.
PdfFileName String RW Defines the filename for a recorded 3D PDF.

(Deprecated) Use the RecordingFileName property.
PdfRecord Boolean RW Defines if a simulation is recorded as a 3D PDF.

(Deprecated) Use the Recording property.
PdfShow Boolean RW Defines if the created 3D PDF is opened after recording a simulation.

(Deprecated) Use the RecordingShow property.
PdfStepSize Real RW Defines the keyframe rate for recording simulations as 3D PDF.

(Deprecated) Use the RecordingFrameRate property.
ProcessContext | ProcessContext | R | Gets the Process tab context.
ProductClass String R Gets the name of the application's product class.

Product classes are Creator, Configurator and Viewer.
ProductKey | String | R | Gets the product key of the application.
ProductName | String | R | Gets the product name of the application.
ProductVersion String R Gets the product version of the application.

The product version format is the major version number, minor version number and the revision number in that order separated by periods.
ProgressStatus String RW Defines the product status message given when the ProgressValue property is set to True.

Caution: ProgressValue must always be set after setting ProgressStatus. Failure to do so may cause the application's GUI to enter an indefinite locked state.
ProgressValue Real RW Defines the current state of the application's progress bar.

Value < 0.0
Progress is unknown or stalled. Setting this value will lock the GUI and activate the progress bar.

0.0 <= Value <= 1.0
The current state of progress is within this range in which 0.0 indicates no progress and 1.0 indicates full progress. Setting this value will lock the GUI and activate progress bar.

Value > 1.0
The operation has been completed. Setting this value will unlock the GUI and deactivate the progress bar.

Caution: If ProgressValue is used to indicate the status of an operation, the set value must always be greater than 1.0 after completing the operation to unlock the application's GUI. Otherwise, the GUI may enter an indefinite locked state.
PythonActionPanel | vcPythonActionPanel | R | The action panel can be opened when executing a python command
Quantities | List of vcScalarQuantity | R | Gets a list of all scalar quantities in the application.
RealTime | Real | R | Gets the current computer time (in seconds).
RealTimeMode Boolean RW Defines if a simulation runs in real time or virtual time.

A True value means the simulation runs at a speed indicative of the real world environment. A False value means the simulations runs at speed based on the device's CPU processing speed.
Recorder Enumeration RW Defines if a simulation is recorded as a 3D PDF or video.

See Recording Constants for more information.
Recording Boolean RW Turns on/off the recording of a simulation.

A True value will start a simulation (if it was not already running) and the recording, whereas a False value will stop a simulation and the recording.

You should define other Recording properties before you start the recording. In order to stop the recording you need to set Recording to False. In cases where you are recording a 3D PDF, stopping or resetting the simulation before you set Recording to False will lose the recording and not generate a file.

Note: A recording cannot be stopped and continued without generating a new file.
RecordingFileName | String | RW | Defines the absolute path of a recorded simulation file.
RecordingFrameRate | Integer | RW | Defines the frame rate for recording simulations.
RecordingHeight | Integer | RW | Defines the height (number of pixels) for a simulation recorded as a video.
RecordingShow | Boolean | RW | Turns on/off the opening of the recorded simulation file after recording is stopped in the 3D world.
RecordingWidth | Integer | RW | Defines the width (number of pixels) for a simulation recorded as a video.
RecordScreen Boolean RW Defines if the size of the 3D world viewport defines the dimensions of a simulation recorded as a video.

A False value means the values of the RecordingHeight and RecordingWidth properties define the dimensions of a recorded video.
RenderShadows Enumeration RW Defines the mode for rendering shadows in the 3D world.

See Render Shadows Constants for more information.
ResetSimulationAtLoading Boolean RW Turns on/off the automatic reset of a component to its initial state when a new component is added to the 3D world.

The default value is True. Generally, a False value is used in cases where you want to retain the current joint configuration of robots in the 3D world when teaching positions.

The effect is the same as executing the Reset button on the simulation controls.
SelectionManager | vcSelectionManager | R | Gets the selection manager of the application which is used for handling selections in an environment.
Selections List of vcSelection R Gets a list of selection type objects registered with the application. That is, the types of objects you can select in an environment such as the 3D world.

(Deprecated) Use vcSelectionManager.
Simulation vcSimulation R Gets the simulation object of the application.

Generally, the simulation object is used to control the execution of a simulation in the 3D world.
TeachContext | vcTeachContext | R | Gets the Program tab context.
UnitFamilies | List of vcUnitFamily | R | Gets a list of all unit families in the application.
UnitGroups | List of vcUnitGroup | R | Gets a list of all unit groups in the application.

VREvents

vcVREvents

R

Gets VR events object of the application.

Generally, the VR events object is used for interactive Virtual Reality.
Views | List of vcView | R | Gets a list of all user-defined views in the current layout.

Methods

Bitmap

Name | Return Type | Parameters | Description
loadBitmap | vcBitmap | String uri | Loads a bitmap image from a given uri. If loading is successful, the bitmap's filename is used to register the bitmap with the application. Returns the loaded bitmap image; otherwise returns None.
saveBitmap | None | vcBitmap bitmap, String uri, [String writer_info] | Writes a given bitmap to a given uri. By default, the bitmap is saved as a BMP file. An optional writer_info argument can be given to write the bitmap to a different format. rbmp writes to BMP. rjpegstd or rjpegnstd writes to JPEG. rpng writes to PNG. rtargareader writes to TGA. See vcBitmap for more information.

Camera

Name | Return Type | Parameters | Description
findCamera | vcCamera | [String name] | Returns a camera used by the application in an environment. An optional name argument can be given to find a specific camera; otherwise the method returns the first found camera. If no camera is found, returns None.

Command

Name | Return Type | Parameters | Description
cancelCommand | None | [Boolean all] | Cancels the execution of the currently active command, after which the default command of the application is activated. An optional all argument of can be given to cancel all commands in the command stack or just the top-most command by giving a False value.
deleteCommand | Boolean | String name | Deletes a registered command that matches a given name.
findCommand | vcCommand | String name | Returns a registered command that matches a given name; otherwise returns None.
getCommands | List of vcCommand | None | Returns a list of commands registered to the application.
loadCommand | vcCommand | String name, String uri | Loads a defined script of a given name at a given uri into the application as a Python command. Loading registers a command with the given name in the application, which can be used to launch the command itself. Successful command loading returns the command as an object; otherwise, returns None.

Component

Name | Return Type | Parameters | Description
clearWorld | None | None | Removes all components from the 3D world.
cloneComponent | vcComponent | vcComponent component | Clones a given component, and then returns the clone. Note: This is only for static components when simulation is not running. To clone components when a simulation is running, use vcComponent.clone().
connectComponents | Boolean | vcComponent comp1, vcComponent comp2 | Connects all matching interfaces between two given components. If a physical connection requires repositioning then comp2 is snapped to comp1. If a connection forms a parent-child hierarchy, the child component is moved and attached to the parent component.
createComponent | vcComponent | None | Creates a new component at the 3D world origin, and then returns the new component.
deleteComponent | None | vcComponent component | Deletes a given component from the 3D world.
findComponent | vcComponent | String name | Returns a component in the 3D world that matches a given name. If no match is found, returns None.
load | vcComponent | String uri | Loads a component from a given uri in the 3D world. If loading is successful, returns the component; otherwise returns None. Note: In most cases, the file URI scheme is file:/// followed by the full path to file.

Context

Name | Return Type | Parameters | Description
setContext | None | String id | Sets the context of application to the given id. Standard ids are: Author Component modeling Configure Layout configuration Drawing 2D drawing Teach Robot programming.

Frame Grab

Name | Return Type | Parameters | Description
beginFrameGrab | None | String image_format, Integer image_width, Integer image_height | Starts frame grabbing process using given image_format, image_width and image_height arguments to use with the executeFrameGrab() method.
endFrameGrab | None | None | Ends screen grabbing process and performs cleanup.
executeFrameGrab | None | String uri | Creates a video frame of the current 3D world view and saves the frame at a given uri. The frame's format and size are defined using the beginFrameGrab() method.

Jogging

Name | Return Type | Parameters | Description
doJogging | None | vcVector vector | Does the actual jogging using given vector as a reference location in world coordinates where the jogging ends.
startJogging | None | vcVector vector, vcNode node | Initializes jogging process by defining what node is jogged and vector where the jogging starts, that is a reference starting location in the world coordinate system.
stopJogging | None | None | Stops jogging.

Layer

Name | Return Type | Parameters | Description
createLayer | vcLayer | String name | Creates a new layer with a given name in the application. If a layer with the given name exists, that layer is returned; otherwise the method returns the new layer. If the layer cannot be created, returns None.
deleteLayer | None | String name | Deletes a layer that matches a given name unless the layer is a system layer.
findLayer | vcLayer | String name | Returns a layer that matches a given name; otherwise returns None.

Layout Item

Name | Return Type | Parameters | Description
createLayoutItem | vcLayoutItem | Enumeration type | Creates a new layout item of a given type in the current layout. See Layout Item constants for types and descriptions.
deleteLayoutItem | None | String name or vcLayoutItem layout_item | Deletes a given layout_item or one that matches a given name from the current layout.
findLayoutItem | vcLayoutItem | String name | Returns a layout item that matches a given name in current layout; otherwise returns None.

Light

Name | Return Type | Parameters | Description
createLight | vcLight | String name | Creates a new light with a given name which is attached to the 3D world.
deleteLight | None | String name | Deletes a light that matches a given name.
findLight | vcLight | [String name] | Returns the first found light in the 3D world or a light matching a given name. If no light is found with the given name, returns None.

Material

Name | Return Type | Parameters | Description
addMaterial | Boolean | vcMaterial material | Adds a given material to a group of materials registered with the application. If the material is registered, returns True. If a material with the same name already exists, returns False.
createMaterial | vcMaterial | String name | Creates a new material with a given name.
findMaterial | vcMaterial | String name | Returns a material matching a given name; otherwise returns None.

Menu

Name | Return Type | Parameters | Description
addMenuButton Boolean

String menu, String caption, String command, [Enum toolSize]

 Adds a new menu button in the ribbon (similar to the item). The first three parameters are the same as in addMenuItem, and the toolSize parameter defines the appearance of the button.
addMenuItem Boolean Enumeration menu, String caption, Integer position, String command

or

String menu, String caption, Integer position, String command

or

String menu, String caption, Integer position, String command, String tool_tip, String image, String reference_id, String control_type

(Deprecated)
String menu, String caption, [Integer position], vcCommand command

or

(Deprecated)
String menu, String caption, [Integer position], String command

or

(Deprecated)
Enumeration menu, String caption, [Integer position], vcCommand command

or

(Deprecated)
Enumeration menu, String caption, [Integer position], String command

 Adds a new menu item to a given menu.

The menu argument can be a Menu Constant or id indicating the area of user interface where you want to add the menu item.

The caption argument specifies a default label for the menu item.

The position parameter specifies where the menu item will be added in the given menu. Any value less than zero is indexed from the end of the menu. By default, a new menu item is appended to the end of a menu.

The command argument specifies a command by name that is executed when you interact with the menu item. For example, you can pass the name of a command registered to the application or an id that can be referenced when adding gallery menu items.

The tool_tip argument specifies a default tooltip for the menu item.

The image argument specifies the icon of the menu item.

The reference_id argument refers to another menu item by its command name or id. Generally, you would use this to add items to a gallery menu on the Ribbon in which both the gallery and its items are created using the same Python command.

The control_type argument specifies the control type of the menu item. Generally, you would use this to indicate an item as a GalleryMenuTool or GalleryMenuToolItem. If you are creating a contextual tab group in the Ribbon, you would use this to indicate a ContextualTabGroup or RibbonTab.

Each call returns an integer that is a handle for the new menu item. Use that value in the removeMenuItem() method to delete the menu item.

See Creating a Python Add-on for more information and examples.

See Template for Python Add-on for a template that can be used to quickly implement a new add-on.
createBehaviourMenuItem Boolean String menu_name, Integer pos, vcCommand command Creates a new menu item in Behavior tab add-on menu.

(Deprecated) Use addMenuItem() method.
createFeatureMenuItem Boolean String menu_name, Integer pos, vcCommand command Creates a new menu item in Geometry tab add-on menu.

(Deprecated) Use addMenuItem() method.
createGeometryMenuItem Boolean String menu_name, Integer pos, vcCommand command Creates a new menu item in Geometry tab add-on menu.

(Deprecated) Use addMenuItem() method.
createMenuItem Boolean String menu_name, Integer pos, vcCommand command Creates a new menu item in Add-ons menu.

(Deprecated) Use addMenuItem() method.
getLocalizedString String String key

or

String key_container, String key_item, String key_type

Gets the value of a given key in a resource file based on the language of the application.

Generally, this is used to localize add-ons. If the key is not found, returns the key itself as a string.

You have two options:

1-key
Pass the entire key, for example "ComboKey::Python.MsgBoxTitle.Text".

3-key
Pass the key in three separate arguments, for example ("Python","MsgBoxTitle","Text").

The key_container argument should be "Python" if the localized string was added from Python, for example a PyResouce file associated with your Python add-on.

The key_item argument should be a unique key for the item you want to localize. For example, "printHelloLocalized.ColorPropName.red" would refer to a step value of a property named "ColorPropName" associated with a command registered to the application as "printHelloLocalized."

The key_type argument specifies the attribute of an item. For example, a command can have a label, tooltip and icon.

An item can have one or more attributes:

Text
Label for command, ribbon tab or group, message box, etc.

Name
Label for command property.

Tooltip
Tooltip for command.

Description
Tooltip for command property.

Icon
Icon for ribbon group or command. In this case, the value is the path to icon file.

<step value>
Label for step value of command property.

See Template for Python Add-on for an example on how to use this method.
removeMenuItem | Boolean | Integer position | Remove a menu item that was previously added using the addMenuItem() method.
setContextualTabGroup None String tab_id, Boolean show Turns on/off the visibility of a contextual tab group in Ribbon.

The tab_id argument refers to the Id of the contextual tab group.

See Template for Python Add-on for an example.

See Creating a Python Add-on for more information and other examples.

Notes:

  • If you are using a menu constant that refers to a drop-down menu, you should in some cases add a string that designates a section or divider in the list. If the drop-menu section does not exist, the application will create that placeholder for you.
  • If you are using an id, it can be a concatenated string or path, thereby allowing you to specify a section of the user interface or naming a new section. For example, 'VcTabDrawing/Example' would place a command on the Drawing tab, in a new ribbon group called Example.

Caution: You can refer to the <UXSitesSection> element of your application's configuration file to know valid IDs. Each id is an ItemId attribute of a <Site> element.

  • For labeling menu items, it is recommended to pass the caption argument the default name you want for the item, and then use the netCommand to localize the text of the item name in the user interface. Otherwise, caption will be used as the default label of the command in the user interface. This is also true for the tool_tip argument. With this approach, you might encounter a performance issue, so consider localizing the menu item with a resource file.
  • For localization, it is recommended to accompany a command/menu item/add-on with one or more resource files.
    • A resource file is used to define key-value pairs for localizing the names, icons and tooltips of an add-on. This can include ribbon tabs and groups, message boxes as well as command names and its properties.
    • To support a language, create a XAML file and name it "PyResource.<language>" and define the key-value pairs. In such cases, a key is passed as string and points to its value depending on the language of the application. In most cases, this requires the use of the getLocalizedString() method, which can point to any string in a resource file.
  • See Template for Python Add-on for a working example.

Selection

Name | Return Type | Parameters | Description
getSelection | vcSelection | Enumeration type | Returns a selection object for a given type. See Selection constants for available types. (Deprecated) Use vcSelectionManager.
getSelections | List of vcSelection | None | Returns a list of selection objects for all types registered to the application. (Deprecated) Use vcSelectionManager.

Simulation

Name | Return Type | Parameters | Description
delayRealTime | None | Real delay | Executes a delay (in seconds) that halts a running simulation.
getSimulation | vcSimulation | None | Returns the simulation object of application.
resetSimulation | None | None | Resets the simulation to its initial state. Resetting a simulation removes all dynamic components and returns static components to their initial state at the start of a simulation.
startSimulation | None | [Real stop_time] | Starts a simulation. An optional stop_time argument can be given to indicate when to stop running the simulation. If the simulation of the application is not at its initial state, the simulation will continue from its current state. That is, the simulation clock will not reset to zero.
stopSimulation | None | None | Immediately stops the execution of a simulation.

Unit

Name | Return Type | Parameters | Description
createQuantity | vcScalarQuantity | String name, Enumeration type | Create a new quantity of a given name and type. The name argument specifies the full name of the new quantity. The type argument specifies whether a scalar or vector quantity. See Quantity Constants for more information.
createUnitFamily | vcUnitFamily | String name | Create a new unit family of a given name in application. The name argument specifies the name of the unit family and may not contain dot characters.
createUnitGroup | vcUnitGroup | String name | Create a new unit group of a given name. The name argument specifies the name of the unit group and may not contain dot characters.
deleteUnitFamily | None | vcUnitFamily family | Deletes a unit family given as an argument. Only user-created unit families can be deleted.
deleteUnitGroup | None | vcUnitGroup group | Deletes a unit group given as an argument. Only user-created unit groups can be deleted.
findQuantity | vcScalarQuantity | String name | Returns a quantity matching a given name; otherwise returns None.
findUnit | vcUnit | String name | Returns a unit matching a given name; otherwise returns None. This method will try to match either the name or suffix of a unit to the given name.
findUnitFamily | vcUnitFamily | String name | Returns a unit family matching a given name; otherwise returns None.
findUnitGroup | vcUnitGroup | String name | Returns a unit group matching a given name; otherwise returns None.

View

Name | Return Type | Parameters | Description
createView | vcView | String name | Creates a new view of a given name based on the current 3D world view. The view itself is saved with a layout and listed as a User View in the GUI whenever the layout is loaded in the 3D world.
deleteView | None | String name | Deletes a view matching a given name from the current layout.
findView | vcView | String name | Returns a view matching a given name in the current layout; otherwise returns None.
useView | None | String view_name, [real time] | Switches the view of the 3D world to a view matching a given name in the current layout. An optional time argument can be given to interpolate the linear movement of the camera to new view. That is, a timed camera movement (in seconds).

Miscellaneous

Name | Return Type | Parameters | Description
autoShareFeatureTrees None None Shares the feature trees of identical components in 3D world.

For example, exact copies of a conveyor with the same VCID and feature trees can be shared to consume less memory.

If you need to make a vcComponent object unique again, edit a property that affects one of its features or call its makeUnique() method.
clearMessages | None | None | Clears Output panel.
clearUndo | None | None | Clears the undo history.
detectFrameOwnerNode vcNode vcMatrix position, Real tolerance, [vcNode exclude] Returns a node containing the closest Frame feature to a given position based on a distance tolerance.

An optional exclude argument can be given to exclude frames belonging to specific node.
getApplicationPath String None Returns the Uri of this application's script as a formatted string.

Generally, this method is used to register a command used in a Python add-on.
getRandomSeed | Integer | Integer index | Returns the integer of a random generator at a given index.
getMessages | String | None | Returns all messages currently listed in the Output panel.
messageBox Enumeration integer String message, [string title], [Enumeration type], [Enumeration buttons] Shows a message box displaying the given message.

An optional title argument can be given to define the title of the message box.

An optional type argument can given to define the box type and icon.

An optional buttons argument can be given to show a message box with buttons.

The method returns a result based on the type of message box and which button is clicked by a user.

See Message Constants for more information.

See Example on how to implement this method.

See Template for Python Add-on on how to localize a message box.

Warning: If you want to open a message box when you start the application, you should use the OnAppInitialized event to verify it is safe to generate the box.
rayCast 3-tuple or 5-tuple

0
The vcNode object hit by the ray.

1
None or a deprecated vcPolygon object hit by the ray. If None, the tuple will have five elements.

2
The location where the ray hit as a vcMatrix object. The Z-axis is parallel with the normal of the surface hit by the ray.

3
The vcTriangleSet object hit by the ray if the second element is None.

4
The index of the triangle hit by the ray in the fourth element.

 vcMatrix start_position, Real ray_length, [vcNode exclude_node], [Boolean use_backface], [List of 3-tuple (vcNode node, Enumeration inclusion_type, Enumeration inclusion_scope)] Tests if a ray with a given ray_length and start_position intersects an object in the current layout.

The position of the ray is based in the World coordinate system, and the length of the ray is directed along the positive Z-axis.

An optional exclude_node argument can be given to exclude a node, thereby allowing the ray to cast through and ignore collision with the given node and its child nodes.

An optional use_backface argument has a default True value to include geometry backfaces in ray casting. A False value means the ray ignores geometry backfaces.

An optional tuple argument of node, inclusion_type and inclusion scope can be given to exclude or include nodes. Excluding nodes allows the ray to cast through and ignore collision with the given nodes. Including one or more nodes will automatically exclude all the other nodes not included.

See Collision Detector Constants for more information.

If a ray collides with an object, the collision data is returned as tuple with three or five elements; otherwise returns None.

See Example on how to implement this method.
render | None | None | Renders the scene of 3D world.
save | None | String uri | Saves the contents of 3D world as a layout using a given uri.

Events

Name | Parameters | Description
OnAppInitialized | None | Triggered when the application has been initialized and a window is created to display its user interface.
OnContextChanged | None | Triggered when the context changes in application.
OnComponentAdded | vcComponent component | Triggered when a component is added to 3D world.
OnComponentRemoved | vcComponent component | Triggered when a component is removed from 3D world.
OnDynamicComponent | vcComponent component, vcContainer container, Boolean added | Triggered when a component is created in 3D world during a simulation.
OnIdle | None | Triggered when the application is in an Idle state. (Deprecated)
OnProgress | Real fraction, String status | Triggered each time the application's progress bar is updated.
OnRender | vcSimulation simulation | Triggered when the application renders a scene in 3D world.
OnSelectionPreChange | vcSelection selection | Triggered when the selection type of application is changing to a new type. The current selection type is passed as an event argument. (Deprecated) Use vcSelectionManager.
OnSelectionPostChange | vcSelection selection | Triggered when the selection type of the application has changed to a new type. The previous selection type is passed as an argument. (Deprecated) Use vcSelectionManager.
OnStart | None | Triggered at the start of the application when main window is being built. (Deprecated) Use OnAppInitialized.

Examples

Example. Create message boxes

from vcScript import *
from vcApplication import *

comp = getComponent()
app = getApplication()

#example function with different messageBox types and buttons
def msgBox(arg):
info = app.messageBox("Message", "Title", 0, 0)
if info == 0:
print "Command aborted"
elif info == 5:
question = app.messageBox("Retry again?", "Title",1,4)
if question == 6:
print "Command completed"
else:
print "Command canceled"
else:
warning = app.messageBox("You are ignoring the error!","Title", 2,1)
if warning == 4:
print "The error was ignored. Command completed."

#get button and display message box when clicked
foo = comp.getProperty("Example")
foo.OnChanged = msgBox

Example. Show message box after initializing application

##this is just a simple __init__.py file you can put in My Commands folder
from vcApplication import *

def OnAppInitialized():
messageBox("Example")

Example. Raycast intersection test

from vcScript import *
import vcVector
import vcMatrix

#start by creating a new component with one Block feature (use default values)
#create a new link to exclude in the test

app = getApplication()
comp = getComponent()
node = comp.findNode('Link1')

m = vcMatrix.new()
startposition = vcVector.new(50,50,50)
m.P = startposition

test = app.rayCast(m, 50.0,node,True)
print test

Example. Get schema of the current layout

from vcScript import *

app = getApplication()
layout_items = app.LayoutItems

schema_collection = []
for item in layout_items:
if item.Type == "VC_LAYOUTITEM_IT_LAYOUTSCHEMAPROPERTYLIST":
schema_collection.append(item)

Example. Print URI of current layout

'''
test layout is Assembly cell Cobots.vcmx
layout is loaded in 3D world and then script is used to print its local path and uri
'''
from vcScript import *

app = getApplication()

print app.LayoutPath
print app.LayoutUri
print app.LayoutUriInCompatibilityFormat


vcAuthorContext

vcAuthorContext is the context of the application for component modeling.

Inherits: vcContext

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
ActiveComponent | vcComponent | RW | Defines the active component in context, thereby clearing ActiveNode and ActiveFeatures properties.
ActiveFeatures | List of 2-tuple (vcNode, List of vcFeature) | R | Gets a list of active features in context and pairs them with containing node.
ActiveNode | vcNode | RW | Defines the active node in context, thereby clearing the ActiveFeatures properties.

Methods

Name | Return Type | Parameters | Description
setActiveFeature | None | vcFeature activeFeature, vcNode activeNode | Sets a given feature in a given node as the active feature in context.
setActiveFeatures | None | List of 2-tuple (vcNode, List of vcFeature activeFeatures) | Sets a given list of features in nodes as the active features in context.

Events

Name | Parameters | Description
ActiveComponentChanged | None | Triggered when a different component becomes the active component in context.
ActiveFeaturesChanged | None | Triggered when a different feature or set of features become the active feature(s) in context.


vcBaseContainer

vcBaseContainer is a container of Frame features used as base frames.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Bases | List of vcBaseFrame | R | Gets a list of all base frames in container.

Methods

Name | Return Type | Parameters | Description
addBase | vcBaseFrame | None | Adds a new base frame to container.
removeBase | None | vcBaseFrame base | Deletes a given base from container.

Examples

Example. Create a Base Container behavior and base frames

from vcScript import *

#create Base Container
comp = getComponent()
foo = comp.createBehaviour(VC_BASECONTAINER, 'Example')

#create Base Frame
bar = comp.findBehaviour('Example')
bar.addBase()


vcBaseFrame

vcBaseFrame allows you to manipulate a Frame feature used as base or tool frame for robot programming.

A base frame is a robot coordinate system used for simplifying robot positions. A tool frame is a tool center point (TCP) used for defining the end of a robot arm or target position. How a robot interpolates base and tool frames is dependent on the IPO mode of each frame. Generally, a robot position is defined at a tool frame (point robot must reach/target) and references the coordinate system of a base frame. In some cases, the relationship between base and tool frames can be switched, thereby affecting the external configuration of robot. For example, a robot might use an external tool frame to reference a static tool, thereby the robot moves around not with the tool frame.

Contents ShowHide

Common Properties

Frame Specific Properties

Methods

Common Properties

Name | Type | Access | Description
IPOMode | Integer | RW | Defines the interpolation mode of the frame and the external configuration of a referencing robot controller. 0 Default setting, so no effect on robot's external configuration. 1 Robot position inherits orientation of base frame. 2 Robot position inherits orientation of tool frame. Interpolation constants can be used with this property. Note: A conflict can occur if a base-tool pair in a referencing robot have the same IPOMode property value or cannot be used with the robot's current configuration.
Name | String | RW | Defines the name of the frame.
Node | vcNode | RW | Defines the node the frame is attached to in the 3D world.
PositionMatrix | vcMatrix | RW | Defines the frame's position and orientation in the Node property's coordinate system. The position matrix is a result of the node's offset, pivot and joint expressions but can be set manually.
PositionExpression | String | RW | The matrix offset expression for the frame's location.
Properties | List of vcProperty | R | Gets a list of all user defined properties for base frame.

Frame Specific Properties

Tool Frame

Name | Type | Access | Description
CenterOfGravity | vcMatrix | RW | Defines the mass center point of payload and if needed the orientation for LoadInertia.
Inertia | vcVector | RW | Defines the inertia value (kgm^2) for each axis defined by LoadCenterOfGravity.
Mass | Real | RW | Defines the weight (kg) of payload.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | Enumeration type, String name [Enumeration constraints] | Adds a new property of a given type and name to component, and then returns the new property. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property from component.
getProperty | vcProperty | String name | Returns a property matching a given name in component; otherwise returns None.


vcBehaviour

vcBehaviour is the basic implementation of all behavior type objects.

Contents ShowHide

Hierarchy

Common Properties

Behavior Specific Properties

Methods

Examples

Hierarchy

Most behaviors have specific implementations that inherit vcBehaviour, while others can be manipulated directly as vcBehaviour type objects. In order to create a behavior, use the createBehaviour() method in vcNode.

  1. vcBehaviour
    1. vcActionContainer
    2. vcBaseContainer
    3. vcBooleanSignalMap
    4. vcFlow
      1. vcComponentFlowProxy
      2. vcContainer
        1. vcComponentContainer
          1. vcPatternContainer
        2. vcComponentCreator
        3. vcMotionPath
        4. vcOneDirectionalPath (Deprecated) use vcMotionPath
        5. vcRoutingRule
        6. vcTwoDirectionalPath (Deprecated) use vcMotionPath
        7. vcTransport
    5. vcIntegerSignalMap
    6. vcJogInfo
    7. vcPythonKinematics
    8. vcNodelist
    9. vcProcessPointSensor

    10. vcProductCreator

    11. vcRslProcessHandler (Deprecated) use vcPythonProcessHandler
    12. vcPythonProcessHandler
    13. vcExecutor
    14. vcRslProgramExecutor (Deprecated) use vcExecutor
    15. vcScript
    16. vcServoController
      1. vcRobotController
    17. vcSignal
      1. vcBoolSignal
      2. vcComponentSignal
      3. vcIntegerSignal
      4. vcMatrixSignal
      5. vcRealSignal
      6. vcStringSignal
    18. vcSimVehicle
    19. vcSimInterface
    20. vcStatistics
    21. vcStringSignalMap
    22. vcToolContainer
    23. vcTransportNode
    24. vcProcessExecutor
    25. vcTransportController
      1. vcPython
      2. vcInterpol

Common Properties

The following properties are common in all behavior types.

Name | Type | Access | Description
Component | vcComponent | R | Gets the component of the behavior.
Enabled | Boolean | RW | Turns on/off the use of the behavior.
IgnoreEvents | Boolean | RW | Defines if the behavior ignores events. For example, a container type behavior may disregard the transition of a component into and out of the container to avoid passing the event to a user-defined function.
Name | String | RW | Defines the name of the behavior which is unique for every behavior in a component.
Parent | vcNode | R | Gets the node the behavior belongs to in a component.
Properties | List of vcProperty | R | Gets a list of all properties in the behavior.
Type | Enumeration integer | R | Gets the behavior's type. See Behavior Constants for more information.
World | vcNode | R | Gets the 3D world (simulation root node).

Behavior Specific Properties

Articulated Kinematics (old)

An old, deprecated version Articulated Kinematics might be used in some components. This is not exposed in the GUI and can only be created intentionally by a user.

Important: The constant value for this behavior type is VC_ARTICULATEDKINEMATICS.

Name | Type | Access | Description
LinkLength1...5 | Real | RW | See Articulated Kinematics for descriptions of properties.
JointOffset1 | Real | RW
JointOffset3 | Real | RW
ConfigName1...8 | String | RW
PalletizingMode | Boolean | RW
PalletizingNormal | vcVector | RW

Articulated Kinematics (new)

Articulated Kinematics is a forward and inverse kinematics solver for articulated robots.

Important: The constant value for this behavior type is VC_ARTICULATEDKINEMATICS2.

Name | Type | Access | Description
L01Z...L56Z | Real | RW | See Articulated Kinematics for descriptions of properties.
A45 | Real | RW
JointZeroOffset1...6 | Real | RW
JointSign1...6 | Integer | RW
Coupling23 | Integer | RW
ShoulderValid | Boolean | RW
ElbowValid | Boolean | RW
WristValid | Boolean | RW
ConfigName1...8 | String | RW
PalletizingMode | Boolean | RW
PalletizingNormal | vcVector | RW
PolarSingularityTolerance | Real | RW
WristSingularityTolerance | Real | RW
ExtendedPositionTolerance | Real | RW
Coupling456 | Real | RW

Base Container

See vcBaseContainer for more information.

Capacity Controller

Capacity Controller manages the total allotted capacity for a group of container type behaviors. Be aware vcCapacityController is the type of a Capacity Controller in Python API. However, it does not have a separate implementation.

Name | Type | Access | Description
Capacity | Integer | RW | Total logical capacity of the controller.

Component Grabber

Component Grabber is an old, deprecated behavior for grasping and releasing components in different containers. This is not exposed in the GUI and has been replaced by an Action Script behavior and robot I/O statements.

Name | Type | Access | Description
ComponentSignalIn | vcComponentSignal | RW | Defines the signal used for signaling the arrival of components into the grabber's container.
Container | vcContainer | RW | Defines the container type behavior used for storing components grasped by the grabber.
DoneSignalOut | vcBoolSignal | RW | Defines the signal used for signaling the completion of an action by the grabber.
FunctionalitySignalIn | vcSignal | RW | Defines the behavior signal used for signalling the current state of the grabber. Note: A Behaviour Signal has a constant value of VC_BEHAVIOURSIGNAL and can only be created using the API.
GrabReleaseSignalIn | vcBoolSignal | RW | Defines the signal used for triggering the grasp and release of components by the grabber.
GrabTriggerSignalOut | vcBoolSignal | RW | Defines the signal used for signaling the completion of a grasp action.
Interface | vcSimInterface | RW | Defines the interface used for exchanging components between containers.
ReleaseMode | String | RW | Defines the mode for releasing components from the grabber.
ReleaseTriggerSignalOut | vcBoolSignal | RW | Defines the signal used for signaling the completion of a release action.

Cartesian Kinematics

Cartesian Kinematics is a forward and inverse kinematics solver for Cartesian type (gantry/portal) robots. It has no additional properties.

Component Path Sensor

Component Path Sensor detects components moving along a path, and then signals the detected information.

Name | Type | Access | Description
BoolSignal | vcBoolSignal | RW | Defines the signal used for signaling the value of the BoolSignalValue property.
BoolSignalValue | Boolean | RW | Defines the current state of the sensor. That is, a True value means the sensor has been triggered, whereas a False value means the sensor has either not been triggered or has been reset.
ComponentSignal | vcComponentSignal | RW | Defines the signal used for signaling which component triggered the sensor.
Frame | vcFrameFeature | RW | Defines the Frame feature referenced as the sensor's physical location.
ResetAt | Enumeration integer | RW | Defines the mode for resetting the sensor. See Path Constants for more information.
TriggerAt | Enumeration integer | RW | Defines the mode for triggering the sensor. See Path Constants for more information.

Delta Kinematics

Delta Kinematics is a forward and inverse kinematics solver for delta type parallel kinematic robots.

Name | Type | Access | Description
Height1 | Real | RW | See Delta Kinematics for descriptions of properties.
Height2 | Real | RW
LinkLength1 | Real | RW
LinkLength2 | Real | RW
ShoulderOffset | Real | RW
WristOffset | Real | RW

Document Link

Document Link has no additional Python properties.

Jog Info

Jog Info manipulates a component's parameter values interactively.

Name | Type | Access | Description
DOF | String | RW | Defines the degree of freedom (DOF) for interaction, which is either a rotation or translation based in a coordinate axis.
Message | String | RW | Defines the message written to the Output panel when the pointer hovers over the Variable property and the Interact or Jog command is enabled.
Offset | vcMatrix | RW | Defines the offset matrix (pivot point) where interaction can occur in the containing node's coordinate system.
Scale | Real | RW | Defines the scale factor for jogging. Generally, the value is 1.0 or -1.0 in order to invert the method of interaction in the 3D world.
Variable | vcProperty | RW | Defines the property that is modified during interaction, which in all cases must be a Real type property.

Note

Note is a container of user-defined notes, free-form text that can include web links to other documents.

Name | Type | Access | Description
Note | String | RW | Defines the text in the note.

Parallelogram Kinematics

Parallelogram Kinematics is a forward and inverse kinematics solver for articulated robots with the tool pointing down (palletization).

Note: Parallelogram kinematics is different from parallel kinematics.

Name | Type | Access | Description
JointOffset1 | Real | RW | See Parallelogram Kinematics for descriptions of properties.
JointOffset3 | Real | RW
LinkLength1 | Real | RW
LinkLength2 | Real | RW
LinkLength3 | Real | RW
LinkLength4 | Real | RW
LinkLength5 | Real | RW

Particle System

(Deprecated) Particle System allows you to create swarms of particles in the 3D world for visualization purposes. A Particle System can only be created using Python API and must be triggered by a connected Boolean Signal during a simulation in order to generate particles.

Name | Type | Access | Description
BurstAmount | Integer | RW | Defines the amount of particles to use in the burst.
BurstLife | Real | RW | Defines the life span of the particle burst.
BurstMode | Boolean | RW | Defines the burst mode of the particle system.
BurstSpeed | Real | RW | Defines the speed of the particle burst.
Frame | vcFrameFeature | RW | Defines the Frame feature referenced as the physical location of the particle system and the departure point for particles.
Interval | Real | RW | Defines the time interval of each burst or swarm.
Material | vcMaterial | RW | Defines the material of each particle. Note: The material must have a texture (vcBitmap) assigned to it in order for particles to be visible in the 3D world.
ParticleSize | Real | RW | Defines the size of each particle.

Physics Cable

Physics Cable generates a cable and spring in the 3D world that can be anchored/pinned to nodes. The cable can have a fixed length and stretch based on its physical properties.

Name | Type | Access | Description
CableLength | Real | RW | Defines the length of cable. If 0.0, the length is dynamic and based on the location of cable endpoints.
ColliderLength | Real | RW | Defines the size of collider relative to length of cable.
ColliderOverlap | Real | RW | Defines an acceptable overlap of collider in relation to others.
EndType1 | Enumeration integer | RW | Defines an anchor type of the first endpoint. 0 = Free The cable hangs freely while attached to Node1. 1 = Rotating The cable can swing back and forth or rotate while attached to Node1. 2 = Fixed The cable is securely anchored to Node1.
EndType2 | Enumeration integer | RW | Defines an anchor type of the second endpoint. 0 = Free The cable hangs freely while attached to Node2. 1 = Rotating The cable can swing back and forth or rotate while attached to Node2. 2 = Fixed The cable is securely anchored to Node2.
Material | vcMaterial | RW | Defines the material of cable.
MaterialDensity | Real | RW | Defines the density of cable material.
MaterialFrictionDynamic | Real | RW | Defines the dynamic friction of cable material.
MaterialFrictionStatic | Real | RW | Defines the static friction of cable material.
MaterialRestitution | Real | RW | Defines the restitution of cable material.
Node1 | vcNode | RW | Defines the node the first endpoint of cable is attached to in 3D world.
Node2 | vcNode | RW | Defines the node the second endpoint of cable is attached to in 3D world.
RenderingSteps | Integer | RW | Defines the amount of steps for rendering cable.
SolverIterExternal | Integer | RW | Defines the number of iterations for solving external setting of cable.
SolverIterInternal | Integer | RW | Defines the number of iterations for solving internal setting of cable.
SolverIterPosition | Integer | RW | Defines the number of iterations for solving position of cable.
SolverIterProjections | Integer | RW | Defines the number of iterations for solving the projection of cable.
SolverIterVelocity | Integer | RW | Defines the number of iterations for solving the velocity of cable.
SolverSeparationLimit | Real | RW | Defines a limit for cable separation.
SpringDamping | Real | RW | Defines the damping of cable, thereby affecting its bounciness.
SpringStrength | Real | RW | Defines the strength of cable relative to applied force when compressing or stretching the cable, for example its tensile strength.
SpringTangentialDamping | Real | RW | Defines the tangential damping of cable relative to applied forced when contacting a surface.
SpringTangentialStrength | Real | RW | Defines the tangential strength of cable relative to applied force when contacting a surface.
Stiffness | Enumeration integer | RW | Defines the rigidity of cable. 0 = Low Cable is very flexible. 1 = Medium (Default) Cable is fairly flexible. 2 = High Cable is very rigid.
Thickness | Real | RW | Defines the thickness of cable.
TotalLengthFactor | Real | RW | Defines a factor for determining cable length.

Physics Entity

Physics Entity allows its node to be defined as a physical body that is affected by the physics of the 3D world.

Name | Type | Access | Description
AngularDamping | Real | RW | Defines the angular damping of entity.
CenterOfGravity | vcMatrix | RW | Defines the mass center point of payload and if needed the orientation for LoadInertia.
DynamicFriction | Real | RW | Defines the kinetic friction of entity.
Inertia | vcVector | RW | Defines the inertia value (kgm^2) for each axis defined by LoadCenterOfGravity.
LinearDamping | Real | Real | Defines the linear damping of entity.
Mass | Real | RW | Defines the weight (kg) of payload.
MaterialDensity | Real | RW | Defines the density of entity.
PhysicsType | Enumeration integer | RW | Defines the physics type of entity. See Entity Constants for more information.
Restitution | Real | RW | Defines the restitution of entity.
SolverPositionIterations | Integer | RW | Defines the number of iterations for solving the motion of entity in relation to its position.
SolverVelocityIterations | Integer | RW | Defines the number of iterations for solving the motion of entity in relation to its velocity.
StaticFriction | Real | RW | Defines the static friction of entity.

Physics Joint

Physics Joint allows you to configure a D6 joint with multiple degrees of freedom for nodes in a component. The joint itself can be attached to any node in component and you can manipulate its constraint frame. The joint can have linear movement in XYZ axes. The swing of a D6 joint is around its X- and Y-axes, whereas twist is around the Z-axis of joint. All motions depend on how the joint is configured in a component, specifically the constraints and parent node of joint.

Name | Type | Access | Description
Attachinchildmat | vcMatrix | RW | Defines anchor point of joint in coordinate system of connected node.
Attachinparentmat | vcMatrix | RW | Defines anchor point of joint in coordinate system of parent node. Note: The joint behavior can be contained in one node, but attached to a different node. The node attached to a joint is its parent.
BreakForce | Real | RW | Defines force needed to break joint.
BreakTorque | Real | RW | Defines torque needed to break joint.
ExMotion | Enumeration integer | RW | Defines movement of joint in X-axis. 0 = Locked 1 = Limited 2 = Free
EyMotion | Enumeration integer | RW | Defines movement of joint in Y-axis. 0 = Locked 1 = Limited 2 = Free
EzMotion | Enumeration integer | RW | Defines movement of joint in Z-axis. 0 = Locked 1 = Limited 2 = Free
LinearLimitdamping | Real | RW | Defines damping of spring for linear limit of joint.
LinearLimitdistance | Real | RW | Defines limit for linear movement of joint based on the distance from its origin.
LinearLimitextend | Real | RW | Defines extended limit for linear movement of joint.
LinearLimitrestitution | Real | RW | Defines restitution for linear limit of joint.
LinearLimitsoft | Boolean | RW | Turns on/off soft linear limit of joint.
LinearLimitspring | Real | RW | Defines stiffness of spring for linear limit of joint.
Parent | vcNode | RW | Defines the node the joint attaches itself to in component.
ProjectionAngular | Real | RW | Defines angular tolerance for solver to project joint and its bodies back together.
ProjectionLinear | Real | RW | Defines linear tolerance for solver to project joint and its bodies back together.
Swing1Motion | Enumeration integer | RW | Defines freedom of joint to rotate around its X-axis. 0 = Locked 1 = Limited 2 = Free Note: Swing refers to rotation around X- and Y-axes of joint.
Swing2Motion | Enumeration integer | RW | Defines freedom of joint to rotate around its Y-axis. 0 = Locked 1 = Limited 2 = Free
SwingLimitdamping | Real | RW | Defines damping of spring for swing limit of joint.
Swinglimitdistance | Real | RW | Defines limit for swing movement of joint based on the distance from its origin.
SwingLimitrestitution | Real | RW | Defines restitution for swing limit of joint.
SwingLimitsoft | Boolean | RW | Turns on/off soft swing limit of joint.
SwingLimitspring | Real | RW | Defines stiffness of spring for swing limit of joint.
SwingLimitYangle | Real | RW | Defines limit for swing movement of joint around its X-axis.
SwingLimitZangle | Real | RW | Defines limit for swing movement of joint around its Y-axis.
TwistLimitdamping | Real | RW | Defines damping of spring for twist limit of joint.
Twistlimitdistance | Real | RW | Defines limit for twist movement of joint based on the distance from its origin.
TwistLimitLower | Real | RW | Defines lower limit for twist movement of joint.
TwistLimitrestitution | Real | RW | Defines restitution for twist limit of joint.
TwistLimitsoft | Boolean | RW | Turns on/off soft twist limit of joint.
TwistLimitspring | Real | RW | Defines stiffness of spring for twist limit of joint.
TwistLimitUpper | Real | RW | Defines upper limit for twist movement of joint.
TwistMotion | Enumeration integer | RW | Defines freedom of joint to rotate around its Z-axis. 0 = Locked 1 = Limited 2 = Free Note: Twist refers to rotation around Z-axis of joint.

Physics Path

Name | Type | Access | Description
Path | List of vcFrameFeature | RW | Defines the points of path.
PushingFeatures | List of vcFeature | RW | Defines the geometry of path used to push objects.
Speed | Real | RW | Defines the speed of the path. If a negative value is given, the path direction will be the opposite.

Python Kinematics

Python Kinematics is a kinematics object that can be defined by a user with Python API. See vcPythonKinematics for more information.

Python Script

Python Script customizes component behavior by controlling other objects. The script's execution may use signals and other events to control script execution.

Name | Type | Access | Description
Script | String | RW | Defines the code of the script.

Raycast Sensor

Raycast Sensor detects the closest component intersecting with a finite ray in the 3D world.

Name | Type | Access | Description
BoolSignal | vcBoolSignal | RW | Defines the signal used for signaling whether or not a component has intersected the ray within a distance tolerance set by the DetectionThreshold property.
ComponentSignal | vcComponentSignal | RW | Defines the signal used for signaling the component detected by the ray.
DetectionContainer | vcContainer | RW | Defines if the sensor only detects components in a specific container type behavior.
DetectionThreshold | Real | RW | Defines the distance at which the RangeSignal property will start to send distance information for a detected component.
Frame | vcFrameFeature | RW | Defines the Frame feature that is referenced as the physical location of the sensor. The ray is cast along the positive Z-axis of its location.
MaxRange | Real | RW | Defines the length of the ray cast by the sensor.
RangeSignal | vcRealSignal | RW | Defines the signal used for signaling the range of a detected component to sensor's location.
SampleTime | Real | RW | Defines the time interval (in seconds) for detecting components when the UseSampling property has a True value.
ShowRay | Boolean | RW | Turns on/off the visibility of the ray in the 3D world. The ray is rendered as a red line.
TestParent | Boolean | RW | Defines if the sensor can detect geometry contained in the sensor's node. Generally, a True value is used when you want to detect self collisions.
UpdateScene | Boolean | RW | Turns on/off the rendering of the scene in the 3D world when a component triggers the sensor. Generally, a True value is used in cases where there are many moving parts, whereas a False value should be used if only the sensor's component moves during a simulation.
UseSampling | Boolean | RW | Defines the rate at which the sensor detects components. A True value means detection occurs at a sampling interval defined by the SampleTime property. A False value means detection occurs when a signal is received from a connected Boolean Signal (pulse mode).

Real Signal Map

Real Signal Map signals values to ports in a continuous IO space used in logic executors.

Name | Type | Access | Description
Listeners | List of vcBehaviour | RW | Defines a list of behaviors using the signal map.
PortCount | Integer | RW | Defines the amount of ports in the signal map.

Scara Kinematics (Old)

An old, deprecated version Scara Kinematics might be used in some components. This is not exposed in the GUI and can only be created intentionally by a user.

Important: The constant value for this behavior type is VC_SCARAKINEMATICS.

Name | Type | Access | Description
JointOffset1 | Real | RW | See Scara Kinematics for descriptions of properties.
JointOffset3 | Real | RW
LinkLength1 | Real | RW
LinkLength2 | Real | RW

Scara Kinematics (New)

Scara Kinematics is a forward and inverse kinematics solver for SCARA type robots.

Important: The constant value for this behavior type is VC_SCARAKINEMATICS2.

Name | Type | Access | Description
ConfigName1...2 | String | RW | See Scara Kinematics for descriptions of properties.
JointSign1...4 | Integer | RW
L12X...L04Z | Real | RW
JointZeroOffset1...4 | Real | RW

Tool Container

See vcToolContainer for more information.

Volume Sensor

Volume Sensor detects components anywhere in the 3D world by using a detection box defined by two Frame features.

Name | Type | Access | Description
BoolSignal | vcBoolSignal | RW | Defines the signal used for signaling the current state of the sensor. That is, a True value means the sensor has been triggered, whereas a False value means the sensor has either not been triggered or reset.
ComponentSignal | vcComponentSignal | RW | Defines the signal used for signaling the component that triggered the sensor.
DetectionContainer | vcContainer | RW | Defines if the sensor only tests components in a specific container type behavior.
LowerFrame | vcFrameFeature | RW | Defines the bottom-left corner of the sensor's detection box.
SampleTime | Real | RW | Defines the time interval (in seconds) for detecting components when the UseSampling property has a True value.
ShowVolume | Boolean | RW | Turns on/off the visibility of the sensor's detection box in the 3D world.
TestMethod | Integer | RW | Defines the mode used by the sensor for detecting components. 0 BBox Intersect 1 BBox Center Inside 2 BBox Fully Inside 3 Precise Test
TestOnlyContained | Boolean | RW | Defines if the sensor only tests components stored in container type behaviors.
TestParent | Boolean | RW | Defines if the sensor can detect geometry contained in the sensor's node. Generally, a True value is used when you want to detect self collisions.
TestSiblings | Boolean | RW | Defines if the sensor can detect geometry at the same level of the sensor in a node hierarchy. That is, any geometry contained in siblings of the sensor's node.
UpdateScene | Boolean | RW | Turns on/off the rendering of the scene in the 3D world when a component triggers the sensor. Generally, a True value is used in cases where there are many moving parts, whereas a False value should be used if only the sensor's component moves during a simulation.
UpperFrame | vcFrameFeature | RW | Defines the top-right corner of the sensor's detection box.
UseSampling | Boolean | RW | Defines the rate at which the sensor detects components. A True value means detection occurs at a sampling interval defined by the SampleTime property. A False value means detection occurs when a signal is received from a connected Boolean Signal (pulse mode).
VolumeMaterial | vcMaterial | RW | Defines the material of the sensor's detection box.

Methods

Name | Return Type | Parameters | Description
delete | None | None | Deletes the behavior.
update | None | None | Updates the behavior.

Examples

Example. Find a behavior and its node

from vcScript import *

# use a robot from the library with this snippet
comp = getComponent()
container = comp.findBehaviour('GraspContainer')
# search a behaviour matching the given name in the whole nodal component tree

mountPlateNode = container.Parent

# the owner node of the behaviour
if comp == container.Component:
print 'It truly is a back-pointer to the same thing'

for prop in container.Properties:
print prop.Name, prop.Value


vcBitmap

vcBitmap represents an image file used in the application, for example as material textures.

Contents ShowHide

Properties

Examples

Properties

Name | Type | Access | Description
Format | Enumeration | R | Gets the format of bitmap. See Bitmap Constants for more information.
Height | Integer | R | Gets the height (in pixels) of bitmap.
Name | String | RW | Defines the name of bitmap.
URI | String | R | Gets the filename of source file.
Width | Integer | R | Gets the width (in pixels) of bitmap.

Examples

Example. Create and edit bitmap property

from vcScript import *

app = getApplication()
comp = getComponent()
prop = comp.getProperty("BmpProp")
if not prop:
prop = comp.createProperty(VC_BITMAP_PROPERTY, "BmpProp")
bmPath = ""

def OnReset():
pass

def OnRun():
global prop, bmPath

if bmPath != r"C:\Temp\picture1.jpg":
bmPath = r"C:\Temp\picture1.jpg"
else:
bmPath = r"C:\Temp\picture2.jpg"

print "path:", bmPath

prop.Value = app.loadBitmap(bmPath);

Example. Load and save bitmap to different image types

from vcScript import *

#options for using vcApplication.saveBitmap()
app = getApplication()
uri = "file:///C:\\temp\\"
bmp = app.loadBitmap(uri+"test.png")

app.saveBitmap(bmp, uri + "test1.bmp")
app.saveBitmap(bmp, uri + "test2.png", "rpng")
app.saveBitmap(bmp, uri + "test3.bmp", "rbmp")
app.saveBitmap(bmp, uri + "test4.jpeg", "rjpegstd")
app.saveBitmap(bmp, uri + "test5.jpeg", "rjpegnstd")
app.saveBitmap(bmp, uri + "test6.tga", "rtargareader")

Example. Save view of 3D world to different image types

from vcScript import *

#options for using saveBitmap command
_app = getApplication()
width = 500
cmd = _app.findCommand("saveBitmap")

cmd.execute("file:///C:\\temp\\test1.png", "png",width, width)
cmd.execute("file:///C:\\temp\\test2.bmp", "bmp",width, width)

cmd.execute("file:///C:\\temp\\test3.png", "rpng",width, width)
cmd.execute("file:///C:\\temp\\test4.bmp", "rbmp",width, width)

cmd.execute("file:///C:\\temp\\test5.tga", "tga",width, width)
cmd.execute("file:///C:\\temp\\test6.tga", "rtargareader",width, width)

cmd.execute("file:///C:\\temp\\test7.jpeg", "jpeg",width, width)
cmd.execute("file:///C:\\temp\\test8.jpeg", "rjpegstd",width, width)
cmd.execute("file:///C:\\temp\\test9.jpeg", "rjpegnstd",width, width)


vcBoolSignal

vcBoolSignal is a signal that can send a Boolean value.

Inherits: vcBehaviour, vcSignal

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Value | Boolean | RW | Defines the value of signal. Setting this value does not trigger the OnSignal event unless you use the signal() method.

Methods

Name | Return Type | Parameters | Description
signal | None | [Boolean value] | Signals the current value of signal to all connected behaviors, thereby triggering the OnSignal event. An optional value argument can be given to set the Value property of the signal.

Examples

Example. Use a signal and its value to turn on/off the path of a conveyor

from vcScript import*

comp = getComponent()
sensorSignal = comp.findBehaviour("SensorBooleanSignal")
path = comp.findBehaviour("MyPathWayBehaviour")

# set path behavior ON
path.Enabled = True

# next line blocks execution until the 'sensorSignal' is trigged to value 'True'
# (i.e. component arrives on sensor)
# the trigger, in this case, is specific as is its value
triggerCondition(lambda : getTrigger() == sensorSignal and sensorSignal.Value == True)

# set path behavior OFF (i.e. stop conveyor)
path.Enabled = False

Example. Connect a signal to a port in a different component

from vcScript import *

app = getApplication()
comp = getComponent()

signal1 = comp.findBehaviour("BooleanSignal")
signal2 = app.findComponent("Example").findBehaviour("SignalMap")

#A connection between a signal and signal map port is established
signal2.connect(0,signal1)


vcBooleanSignalMap

vcBooleanSignalMap allows you to map Boolean signals to ports in a continuous IO space.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Listeners | List of vcBehaviour | RW | Defines a list of behaviors using the signal map.
PortCount | Integer | RW | Defines the amount of ports in the signal map.

Methods

Name | Return Type | Parameters | Description
addPort None Integer index, vcBoolSignal signal Connects a port at a given index to a given signal.

The port index starts from 0. The PortCount property should have enough ports. In other words, to add a boolean signal to port 3 the PortCount value should be at least 4 (ports 0-3), otherwise calling this method will return an error.
connect None Integer indexPort1, vcBooleanSignalMap SignalMap2, Integer indexPort2

-or-

Integer indexPort1, vcBoolSignal signal

Creates a remote connection with another signal map or signal.

If a port is connected to a signal, refer to the abstract interface of the connection to disconnect only that signal. Otherwise, the disconnect() method will disconnect all signals connected to the port.

Signals in components can act as abstract interfaces between ports, sending and receiving information via signal maps.

See vcBoolSignal for more information.
disconnect | None | Integer index | Disconnects a port at a given index from its connections.
getAllConnectedPorts | List of integers | None | Returns a list of all connected ports in the signal map.
getPortName String Integer index Returns the name of a port at a given index.

Note: If the port has no signal then its name is an empty string.
getInternalPortSignal | vcBoolSignal | Integer index | Returns the signal connected to a port at given index; otherwise returns None.
getConnectedExternalSignals | List of vcBoolSignal | Integer index | Returns a list of all signals in other components connected to a local port at the given index in the signal map; otherwise returns an empty list.
getConnectedExternalPorts | List of 2-tuple (vcBooleanSignalMap, Integer) | Integer index | Returns a list of all ports in other components connected to a local port at a given index in the signal map; otherwise returns an empty list.
input | Boolean | Integer index | Returns the value of a port at a given index.
output | None | Integer index, Boolean value | Sets the value of a port at a given index to a given value.
setPortName None Integer index, String name Sets the name of a port at a given index to a given name.

Note: The port must have a signal in order to be assigned a name.
setPortSignal None Integer index, [vcBoolSignal signal] Sets the signal of a port at a given index.

An optional signal argument can be given to assign the port a signal in its component. Otherwise, the port is assigned a dynamic, application signal.

Events

Name | Parameters | Description
OnSignalTrigger | vcBooleanSignalMap signal_map, Integer port, Boolean value | Triggered when the value of a signal mapped to a port has a new value.


vcCamera

vcCamera provides the capability of controlling a virtual camera and its view for an environment.

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
ClipFar | Real | RW | Defines how far objects can be from a camera in order to be displayed. If objects are too far then they are not visible.
ClippingMethod Enumeration RW Defines the clipping mode for a camera's view.

Clipping is used to determine how close and far objects can be from a camera to be displayed on screen.

0 = VC_RENDER_CLIPPING_AUTOMATIC

1 = VC_RENDER_CLIPPING_CLASSIC

2 = VC_RENDER_CLIPPING_MANUAL

Classic is the default setting for the application. Automatic tries to keep all objects in view of a camera visible. Manual allows a user to specify the near and far distances for clipping.

Manual mode uses ClipNear and ClipFar properties to define a clip-volume space of a camera's projected view. Objects within the area defined by ClipNear and ClipFar are displayed based on a camera's center of interest and eye settings.

Example. Clipping a camera's perspective view

Clipping can be defined manually in orthographic view when needed; otherwise, Classic mode is recommended.
ClipNear | Real | RW | Defines how close objects can be to a camera in order to be displayed. If objects are too close then they are not visible.
Coi | vcVector | RW | Defines camera's center of interest location.
Eye | vcVector | RW | Defines camera's eye location.
Matrix | vcMatrix | R | Defines the whole camera matrix.
Name | String | RW | Defines the name of the camera.
NavigationDisabled | Boolean | RW | Defines if navigation commands in GUI are turned on or off to allow camera orientation with other tools.

Methods

Name | Return Type | Parameters | Description
getRay | vcMatrix position, Real length | Real px, Real py | Gets the ray based on the image coordinate system.

Examples

Example. Define camera's eye and center of interest

from vcScript import *
import vcVector

app = getApplication()
camera = app.findCamera()
eyeV = vcVector.new(5000,5000,2000)
coiV = vcVector.new(1500,500,0)

#tip: set coi first, and then set eye of camera
camera.Coi = coiV
camera.Eye = eyeV
app.render()


vcCaseScope

vcCaseScope is the case clause to use in “Switch Case” statement.

Properties

Name | Type | Access | Description
CaseCondition | String | RW | Gets or sets an expression which will be evaluated against statement’s Condition.


vcCollisionDetector

vcCollisionDetector is a layout item used for detecting the collision of objects in the 3D world. A collision test can detect a collision using geometry in different nodes and/or a bound box defined by two corner points.

Generally, a collision detector compares the geometry in two node lists. It tests if the geometry in one list collides with geometry in another list. A tolerance/minimum distance can be used to detect a collision before it occurs in the 3D world. A collision detector can test for the first collision or all collisions between nodes in both lists.

If you use a bound box, one point defines the bottom left corner of the box, and the other point defines the upper right corner of the box. Also, consider using a volume detector instead of a collision detector.

Inherits: vcLayoutItem

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Active | Boolean | RW | Turns on/off the use of collision test.
CollisionMaterial | vcMaterial | RW | Get/Set material of the collided node.
DisplayMinimumDistance | Boolean | RW | Turns on/off the display of minimum distance in the 3D world between objects in a collision test that uses a distance tolerance greater than zero.
FirstCollision | Boolean | RW | Defines if collision test only records the first detected collision. A True value records the first collision. A False value records all collisions. FirstCollision is automatically disabled when the Tolerance property has a value greater than zero. This is done in order to calculate the minimum distance between two objects based on all detected collisions in the test.
HitCount | Integer | R | Gets the number of detected collisions.
IgnoreClosestNodes | Boolean | RW | Ignores collisions between two nodes if a node is either parent or child to the other node. This can be used to test self-collision of a component. Default value is False.
IgnoreDifferentComponents | Boolean | RW | Ignores collisions between nodes when they are on different components. This can be used to test multiple self-collisions of components. Default value is False.
NodeBCollisionMaterial | vcMaterial | RW | Get/Set material of the collided node B. This property will define the node B material over CollisionMaterial.
NodeListA | List of 3-tuple (vcNode node, Enumeration type, Enumeration inclusion_scope) | RW | Defines a list of nodes to compare with NodeListB. See Collision Detector Constants for more information.
NodeListB | List of 3-tuple (vcNode node, Enumeration inclusion_type, Enumeration inclusion_scope) | RW | Defines a list of nodes to compare with NodeListA. See Collision Detector Constants for more information.
StopOnCollision | Boolean | RW | Defines if a simulation is stopped when there is a detected collision.
Tolerance | Real | RW | Defines a distance tolerance for detecting collisions before objects in the test collide with one another.

Methods

Name | Return Type | Parameters | Description
getBBoxGeometry | vcPolygonSet | vcVector corner1, vcVector corner2, [vcMatrix transformation] | Returns a bound box defined by given corner points as a set of geometry. An optional transformation argument can be given to transform the bound box using World coordinates.
getHitFeatureA | vcFeature | Integer index | Returns the feature in NodeListA in the detected collision.
getHitFeatureB | vcFeature | Integer index | Returns the feature in NodeListB in the detected collision.
getHitGeometrySetA | vcGeometrySet | Integer index | Returns the geometry set in NodeListA in the detected collision.
getHitGeometrySetB | vcGeometrySet | Integer index | Returns the geometry set in NodeListB in the detected collision.
getHitNodeA | vcNode | Integer index | Returns the node in NodeListA in the detected collision.
getHitNodeB | vcNode | Integer index | Returns the node in NodeListB in the detected collision.
getMinimumDistanceDistance | Real | Integer index | Returns the distance between objects in a detected collision when testing with a tolerance/minimum distance.
getMinimumDistancePoint1 | vcVector | Integer index | Returns the point in NodeListA in a detected collision when using a tolerance.
getMinimumDistancePoint2 | vcVector | Integer index | Returns the point in NodeListB in a detected collision when using a tolerance.
testAllBBoxCollisions | Boolean | vcVector corner1, vcVector corner2 [vcMatrix transformation], [Real tolerance] | Returns true if any collision between NodeListA and a bound box defined by given corner points. An optional transformation argument can be given to transform the bound box using World coordinates. If no tolerance is given, test uses zero distance.
testAllCollisions | Boolean | [Real tolerance] | Returns true if any collision between NodeListA and NodeListB. If no tolerance is given, test uses zero distance.
testBBoxComponentCollisions | Boolean | vcVector corner1, vcVector corner2, [vcMatrix bbox_reference] | Returns true if a component collides with a bound box defined by given corner points. An optional bbox_reference argument can be given to transform the bound box using World coordinates.
testBBoxNodeCollisions | Boolean | vcVector corner1, vcVector corner2, [vcMatrix bbox_reference] | Returns true if a node collides with a bound box defined by given corner points. An optional bbox_reference argument can be given to transform the bound box using World coordinates.
testComponentCollisions | Boolean | None | Returns true if collision detected with component.
testMinimumDistance | Boolean | Real tolerance | Returns true if collision detected with a given tolerance value.
testNodeCollisions | Boolean | None | Returns true if collision detected with node.
testOneBBoxCollision | Boolean | vcVector corner1, vcVector corner2 [vcMatrix transformation] [Real tolerance] | Returns true for first collision between NodeListA and a bound box defined by given corner points. An optional transformation argument can be given to transform the bound box using World coordinates. If no tolerance is given, test uses zero distance.
testOneCollision | Boolean | [Real tolerance] | Returns true for first collision between NodeListA and NodeListB. If no tolerance is given, test uses zero distance.

Events

Name | Parameters | Description
OnCollision | vcCollisionDetector detector | Triggered when a collision is detected and test is active.

Examples

Example. Detecting if gripper (or anything the gripper is holding) collides with something

from vcScript import *

def OnSignal( signal ):
pass

def OnRun():
detector = simu.newCollisionDetector()
detector.NodeListA = [(gripper_node, VC_NODELIST_INCLUDE, VC_NODELIST_TREE )]
detector.NodeListB = [(simu.World, VC_NODELIST_INCLUDE, VC_NODELIST_TREE ),(Component_, VC_NODELIST_EXCLUDE, VC_NODELIST_TREE )]

while True:
delay(0.1)
hit = detector.testOneCollision(0.1)
if hit:
#part = detector.Component < --------------- please remove
print 'collision detected'

simu = getSimulation()
app = getApplication()
gripper_node = getComponent()
Component_ = app.findComponent('BinPartBlockTemplate')

Example. Detecting collisions using a minimum distance tolerance

node1.update()
node2.update()
sim = getSimulation()
detector = sim.newCollisionDetector()
detector.NodeListA = [ (node1, VC_NODELIST_INCLUDE, VC_NODELIST_TREE ) ]
detector.NodeListB = [ (node2, VC_NODELIST_INCLUDE, VC_NODELIST_TREE ) ]
hit = detector.testMinimumDistance( some_dist )
print 'Minimum distance: %f mm' % detector.getMinimumDistanceDistance( 0 )
v1 = detector.getMinimumDistancePoint1( 0 )
v2 = detector.getMinimumDistancePoint2( 0 )
line_set = sim.World.UserGeometry.createGeometrySet(VC_COMPACTLINESET)
line_set.addLine( [v1,v2] )
line_set.update()


vcCommand

vcCommand is the object type for commands that can be executed using Python API and made available in user interface of application.

Contents ShowHide

Hierarchy

Properties

Methods

Events

Available Standard Commands

Examples

Hierarchy

Some commands have specific implementations.

  1. vcCommand
    1. vcInteractiveCommand
      1. vcTranslateCommand
      2. vcSelectCommand
    2. vcSnapCommand
    3. vcTopologyPickCommand

Properties

Name | Type | Access | Description
Application | vcApplication | R | Gets the application object.
Checked | Boolean | RW | Defines if command is checked or visually indicated as active in the GUI, which is only for Python commands.
Enabled | Boolean | RW | Defines if command is enabled/disabled, which is only for Python commands. A False value means the command will be greyed out in the GUI.
ExecutionType | Enumeration | RW | Defines how other active commands are managed when executing this command. See Command Constants for more information.
Icon | vcBitmap | RW | Defines the icon of command in the GUI.
IgnoreEvents | Boolean | RW | Defines if event passing is ignored when executing command. This flag is used in situations where events could create cyclic calls.
IsActive | Boolean | R | Gets the current state of command. A True value means the command is active.
IsModelingCommand | Boolean | RW | Defines if command is used for manipulating geometry and related properties.
Name | String | RW | Defines the name of command.
Properties | List of vcProperty | R | Gets a list containing all properties of command. Generally, properties are used to pass information to and from the command implementation for execution.
Simulation | vcSimulation | R | Gets the simulation object.
SupportsOverrideActivation | Boolean | RW | Defines if command is restarted after the execution of an override command, which is only for Python commands.

Methods

Name | Return Type | Parameters | Description
addState None Function state_func Adds a command state function to Python command.

The first added command state is the function called when command is executed.

This method is only available for user-defined Python commands.
cancelNextClick None None Cancels a next click event.

This prevents a mouse click from being detected during the next mouse up event. This is only useful when called from an event processing handler function. Generally, this is used to prevent the activation of the Select command in response to a mouse click.

This method is only available for user-defined Python commands and can only be called from within the command script itself.
createProperty vcProperty Enumeration type, String name, [enumeration constraints] Adds a new property of a given type and name to command object.

An optional constraints argument can be used to define constraints for property, which must be done at time of creation.

See Property Constants for more information.

This method is only available for user-defined Python commands.
deleteProperty None vcProperty property

or

String name

 Removes a given property or one matching a given name from command.

This method is only available for user-defined Python commands.
execute None [arg . . .]

o-

[name=arg . . .]

 Executes the command, and then waits for the execution of first command state to be completed.

If this method is called with no arguments, the arguments used are those currently set in the command object.

If this method is called with positional arguments, each value is assigned to command properties in the order they were created before command execution.

If the method is called with keyword arguments, the corresponding command parameter property is looked up and assigned the argument value. If a parameter cannot be found, the function fails.
executeAsTool None [arg . . .]

or

[name=arg . . .]

 Executes the command as if its execution type is VC_COMMAND_TOOL.

This method overrides the command's ExecutionType property.
executeInActionPanel None None Executes a command using a task pane.

Generally, you would use a task pane to display the options of a registered Python or .NET command and to further control its execution.

For more information, see Command Task Pane in Creating a Python Add-on topic.
getApplication | vcApplication | None | Returns the application object.
getCommand | vcCommand | None | Returns the command object.
getCommandPath String None Returns the URI used by application to load the Python file of command.

This method returns an empty string if the command is not a Python command.
getProperty | vcProperty | String name | Returns a property matching a given name in command; otherwise returns None.
getSimulation | vcSimulation | None | Returns the simulation object.
genVarSpaceDialog None String command_name, String dialog_title, String first_tab_caption Shows a modal property dialog containing the properties of a registered command matching a given command_name.

Note: The command_name is specific to Python, so COM or other programming commands cannot be used as an argument.

The title of the dialog window is set to dialog_title. The first_tab_caption parameter determines whether a tabbed dialog is used. If first_tab_caption is an empty string, the properties are displayed in a single pane. Otherwise, the properties are displayed in separate tabs. In that case, property names are parsed as "tabName::propertyName" and distributed into tabs according to tabName; and properties without a double colon "::" in the name are displayed in the first tab, which will have the caption set to first_tab_caption.

After the command is executed, the Param_4 property of the command object contains the result of the dialog, as an integer. A value of 1 means a user clicked OK, whereas a value of 2 means a user clicked Cancel.
recompile | None | None | Recompiles the command.
setEventState None Function state_func Enters event processing mode. This method also sets event state handler function, where interactive events can be processed.

The event handler function is called with one parameter, which is of type vcCommandEvent. The only way to leave event processing mode is to call setNextState() method.

This method is only available with Python commands, and can only be called from within the command script itself.
setNextState None Function state_func Sets the next command state function. This is a function which is called with no parameters in order to execute the next state. If None is passed as a parameter, the command will exit after the current state function or event processing function returns.

Calling this method will also cause the command to leave event processing mode.

This method is only available in Python commands, and can only be called from within the command script itself.

For more information, see an example for setting the next state of a snap command.

Events

OnStart and OnStop event handlers will automatically be called if they are defined in the Python command script.

Name | Parameters | Description
OnStart | None | Triggered at the start of command execution.
OnStop | None | Triggered at the end of command execution, regardless if the command exited properly or was aborted.

Event Properties

The command object can be given as an argument in OnPreExecute and OnPostExecute event handlers defined in the Python command script.

Name | Parameters | Description
OnPreExecute | vcCommand command | Triggered immediately before the start of command execution.
OnPostExecute | vcCommand command | Triggered immediately after the end of command execution.

Available Standard Commands

Name | Parameters | Description
centerView | None | Centers the view of the 3D world.
clearWorld | None | Clears the simulation world.
countData | None | Counts the amount of items in the current simulation.
dialogOpen String uri, Boolean defined, String filter Opens a dialog box for opening a file in the application.

A uri argument defines the initial directory for the dialog box.

A filter argument defines file extension filter(s) using a standard Windows filter format.

A defined property will have a true value if a file was selected, and then the uri property is set as the output.
dialogSave String uri, Boolean defined Opens a dialog box for saving a file.

A uri property defines the initial directory for the dialog box.

A defined property will have a true value if a path is defined, and then the uri property is set as the output.
dialogSaveFile | String uri, Boolean defined, String filter, String title | Same as dialogSave() method with additional arguments for filtering file types and the title of the dialog box.
exportLayoutAsGeometry | None | Opens a dialog box for saving the current layout as a supported file type.
fillView | None | Adjusts the camera in order to center and fill the 3D world view with all components in the current layout
genPropertyDialog String Param_1, String Param_2 Displays a modal property dialog that allows a user to edit the property values of a Python command.

The first argument given must be the registered name of the Python command whose properties you want to list in the dialog.

The second argument defines the title of the dialog.

In order to be listed in the dialog, a command property must have been created using Python API, for example using the command object with the createProperty() method.
getUniqueComponentName | String seed | Generates a unique name based on the given seed name.
interactiveBoolValue | None | Opens a Yes/No dialog box in which the result can be read from the first parameter.
interactiveCenterView | None | Allows a user to center the 3D world view by picking a type of geometry in the current layout.
interactiveClearWorld None Removes all components from the current layout in the 3D world.

If a layout contains one or more components, a prompt is given to confirm command execution.
interactiveComponentSelect | None | Allows a user to select a component in the 3D world.
interactiveCreatePackage | None | Opens a dialog box for creating a package of components.
interactiveDoubleValue | None | Opens a dialog box for entering a real number in which the result can be read from the first parameter.
interactiveImportModel | None | Opens a dialog box for importing a supported file as a component in the current layout.
interactiveJogJoints | None | Allows a user to interact with joints and other objects in the 3D world.
interactiveLoadModel | None | Opens a dialog box for opening a supported file as a new layout, thereby closing the current layout in the 3D world.
interactiveMeasureDistance | None | Allows a user to take measurements in a simulated environment.
interactiveOrbitView | None | Allows a user to orbit/rotate the camera of the 3D world by using a mouse.
interactivePanView | None | Allows a user to pan the camera of the 3D world by using a mouse.
interactivePickPosition | None | Allows a user to pick a location in the 3D world by using a mouse.
interactivePlugPlay | None | Enables Plug and Play mode in the 3D world.
interactiveRotate None

Allows a user to rotate a selection in the 3D world.
interactiveRotateTCP | None | Allows a user to rotate the active tool frame for a selected robot in the 3D world.
interactiveSaveBitmap | None | Opens a dialog box for saving the current 3D view or drawing as an image.
interactiveSaveComponent | None | Opens a dialog box for saving a selected component.
interactiveSaveComponentAs | None | Opens a dialog box for saving a selected component as a new component.
interactiveSaveLayout | None | Saves the current layout.
interactiveSaveLayoutAs | None | Saves the current layout as a new layout.
interactiveSnap | None | Allows a user to snap a selection to a location picked in the 3D world by using a mouse.
interactiveToggleCollisionTesting | None | Turns on/off collision testing globally in the 3D world.
interactiveTopologyPick None Allows a user to pick geometric topology elements in the 3D world.

See vcTopologyPickCommand for more information.
interactiveTranslate | None | Allows a user to move a selection in the 3D world by using a mouse.
interactiveTranslateTCP | None | Allows a user to move the active tool frame for a selected robot in the 3D world.
interactiveZoomView | None | Allow a user to zoom the camera of a simulated environment by using a mouse.
loadGeometryAsComponent String uri,
vcVector position 		Opens a supported CAD file from a given uri as a new component in the 3D world at a given position.
loadLayout | String uri | Opens a component or layout from a given uri at the 3D world origin.
loadLayoutToPosition String uri,

vcVector position

 Opens a component from a given uri to a given position in the 3D world. You can open a layout, but the layout would be opened at the 3D world origin.
netCommand String command_name, [args*] Allows a .NET command to be executed using Python.

The command_name argument specifies a .NET command by id. You would then need to pass arguments for executing that command. For example, the SetLocalizationCommand takes five arguments.

For more information and example, see Executing a NET Command.
readLicenseData | String product_name, String product_key, String product_activation_code | Gets license information for a given product and its key.
rebuildECatalog | None | Rebuilds all mappings in the product's eCatalog library.
resetSimulation | None | Resets a simulation.
saveBitmap String uri, String filter, Integer xres, Integer yres Saves the current 3D world view as a supported image type with a given resolution.

The filter argument allows you to write to a specific format.

bmp or rbmp writes to BMP.

jpeg, rjpegstd or rjpegnstd writes to JPEG.

png or rpng writes to PNG.

tga or rtargareader writes to TGA.

See vcBitmap for more information.
saveComponentToUri String uri, vcComponent component, Boolean new_vcid Saves a given component at the given uri.

The component will be given a new VCID if its VCID property is an empty string or a False value is passed as a third argument with this method.

Warning: Do not pass an empty string in the first argument.
saveLayoutToUri | String uri | Saves the current layout at the given uri.
saveScreen | String uri | Saves the current view and screen size of the 3D world as a bitmap image at the given uri.
saveState None Saves the current state of a simulation, which affects all components in the current layout.

Generally, this is used to save the joint configurations of robots and other types of equipment when collisions occur or at the end of a simulated process.
setNotesVisibility | Boolean flag | Turns on/off the global visibility of notes in the 3D world.
simLimitTest | None | Defines if a simulation is stopped when a joint in a component exceeds its limits.
writeLicenseData | String product_name, String product_key, String product_activation_code | Sets license information for a given product and its key.

Examples

Example. Set next state for Python command

Download the Python add-on

#command file for Python add-on
from vcCommand import *

def testSet(cmd):
if cmd.TargetAvailable:
print "##------------SET--------------"
print cmd.TargetGeoset
p = cmd.TargetPosition
print p.X, p.Y, p.Z

#continue if target was selected
setNextState(pick)
else:
#stop if no target selected
print "Command exit"
setNextState(None)

def pick():
print "pick!"
cmd.execute()

app = getApplication()
cmd = app.findCommand("interactiveSnap")
cmd.SnapOnCurve = True
cmd.SnapOnEdge = True
cmd.SnapOnSurface = True
cmd.OnTargetSet = testSet
addState(pick)


vcCommandEvent

vcCommandEvent contains information about mouse and/or keyboard events related to the execution of commands. For example, an instance of vcCommandEvent is an argument passed to the OnInteractive event handler.

Contents ShowHide

Properties

Examples

Properties

Name | Type | Access | Description
EyeToMouse | vcVector | R | Gets offset (in World coordinates) from the camera eye point to the pointer on view plane.
Key | Integer | R | Gets either the Windows scan code for a pressed key or an offset value for a mouse wheel movement in which a negative value indicates a downward rotation of a mouse wheel.
MouseOnFloor | vcVector | R | Gets the position of the mouse on the layout floor (ex: Z == 0) in World coordinates.
MouseOnViewPlane | vcVector | R | Gets the position of the pointer on the view plane in World coordinates.
ShiftState | Enumeration | R | Gets the bit mask indicating which mouse buttons or modifier keys are pressed by a user. There are also bits for single and double click detection. See Command Event Constants more for information.
Type | Enumeration | R | Gets the command event type. See Command Event Constants more for information.
X | Integer | R | Gets the X-axis coordinate of pointer in the 3D window.
Y | Integer | R | Gets the Y-axis coordinate of pointer in the 3D window.

Examples

Example. Create a keydown event for a command

from vcApplication import *

# Copy the following code in a python command __init__.py file

def OnStart():
cmduri = getApplicationPath() + 'CommandEvent.py'
cmd = loadCommand("CommandEvent",cmduri)
addMenuItem(VC_MENU_ADDONS,"Command Event", -1, cmd)

# And copy the following code in a CommandEvent.py file.
# Place both files in a folder, and then store the folder in My Commands folder

from vcCommand import *

cmd = getCommand()

def endState():
print "Command event deactivated"

def setState():
cmd.ExecutionType = VC_COMMAND_TOOL
cmd.setEventState(event_handler)

def event_handler(arg):
print "Mouse cursor cordinates on 3DWorld"
print " X: ", str(arg.X), " Y:", str(arg.Y)
print "*"*100
if arg.Type == VC_EVENT_MOUSE_DOWN:
print "Mouse Down at"
vec = arg.MouseOnFloor
print "X:", str(vec.X), " Y:", str(vec.Y), " Z:", str(vec.Z)
print "*"*100

if arg.ShiftState == VC_SHIFTSTATE_CTRL:
cmd.setNextState(endState)

addState(setState)


vcCompactLineSet

vcCompactLineSet is used for creating and reading line type geometry, which is a set of two or more points.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
CurveData | vcCurveData | R | Gets the container of mathematical information used for rendering curves.
Lines | Two-dimensional list of vcVector | R | Gets a list of lines where each line is a list of position vectors for its points.
LineCount | Integer | R | Gets the total number of lines in the set.
LineWidth | Real | RW | Defines the width of each line in the set.

Methods

Name | Return Type | Parameters | Description
addLine | None | List of vcVector points | Creates a new line in set using a list of given points.
deleteLine | None | Integer index | Deletes a line at a given index from set.
getLinePointCount | Integer | Integer index | Returns the number of points in a line at a given index in set.
getLine | List of vcVectors | Integer index | Returns a list of position vectors for each point of a line at a given index in set.

Examples

Example. Creating a line

from vcScript import *
import vcVector

app = getApplication()
comp = getComponent()
gf = comp.RootFeature.createFeature(VC_GEOMETRY, "MyGeometry")
ls = gf.Geometry.createGeometrySet(VC_COMPACTLINESET)

line = [vcVector.new(0,0,0), vcVector.new(1000,0,0)]
ls.addLine(line)
ls.LineWidth = 1000.0

gf.rebuild()
app.render()


vcComponent

vcComponent is the object type for a component and its associated root node.

Inherits: vcNode

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
BackfaceMode Enumeration RW Defines the mode for rendering geometry backfaces of component. That is, geometry not facing active camera.

See Component Constants for more information.
BOM | Boolean | RW | If a component is included in the bill of materials.
BOMdescription | String | RW | Component description in the bill of materials.
BOMname | String | RW | Component name in the bill of materials.
Category | String | RW | Defines the component group in Cell Graph.
Container vcContainer R Gets the container storing the component.

If a component is not stored in a container, the value is None.

Note: Container refers to a behavior that can store components, for example a One Way Path.
CreationTime Real RW Defines the creation time of component.

Generally, creation time is used for gathering statistics about components created during a simulation.

In some cases, you might want to edit the creation time of a component for filtering, tracking, assembly and manufacturing purposes.
IsUnique | Boolean | R | Indicates if the component is sharing its feature trees with other components.
Locked | Boolean | RW | Defines if the component is locked from being edited or manipulated in 3D world.
Material vcMaterial RW Defines the material of component and any of its features which do not have an assigned material or whose node is set to inherit a material.

This material definition is persistent data, meaning that the definition is stored when saving component.

Note: Changing the material definition of a component causes all geometries to be rebuilt, which can be a computing intensive operation. For in-simulation visualization purposes, we recommend using the NodeMaterial property instead.
MovementOrigin | vcMatrix | RW | Defines the offset of component when moving on a path.
PackFolder | vcPackFolder | R | Gets the mechanism for attaching files to component.
PathAcceleration | Real | RW | Defines the acceleration of component when moving on a path.
PathDeceleration | Real | RW | Defines the deceleration of component when moving on a path.
PathVelocity Real RW Defines the velocity of component when moving on and in the direction of a path.

If a zero value, the velocity of the component is defined by the path.
PDFExportLevel Enumeration RW Defines the level of detail when exporting component to a 3D PDF.

See Component Constants for more information.
Product | vcProduct | R | The Process Modeling product instance linked to this component, if any.
Properties | List of vcProperty | R | Gets a list of all user defined properties in component.
SimulationLevel Enumeration RW Defines the simulation level of the component.

See Component Constants for more information.
Uri | String | R | Gets the URI of component
VCID String RW Defines the VCID of component. That is, the unique key identifier of the component.

Generally, you should never set this property. Instead, allow the application to generate a VCID when you save the component.
Visible | Boolean | RW | Turns on/off the visibility of component in 3D world.

Methods

Name | Return Type | Parameters | Description
clone | vcComponent | [Integer shared] | Creates a clone of component in 3D world, and then returns the new component. If shared argument is non-zero the clone and original share geometry. That is, feature tree is shared not copied. This improves performance during simulation, but the cloned components cannot be edited separately (changing the appearance of either clone or original component affects all the others.)
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Adds a new property of a given type and name to component, and then returns the new property. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property from component.
getPathDistance | Real | None | If component is on a path, for example a conveyor path, returns the distance of component on path.
getProperty | vcProperty | String name | Returns a property matching a given name in component; otherwise returns None.
getTransportInfo | 4-tuple (Enumeration availability, vcNode node, vcContainer container, vcMatrix location) | vcComponent targetComponent | Returns information about a transport action for a given component. Generally, a transport action is defined using an Action Container, Python Script and Transport Protocol. See Transportation Constants for information on availability options.
incrementRevision | None | None | Increments the revision number of a file when using the save() method. The effect is the same as the Increment Revision property in the Credits dialog when saving a file.
makeUnique | None | None | Makes the feature trees of the component unique, thereby they are not shared with other components.
save | None | String uri | Saves component to file using a given uri. To save the component with a new VCID, set the VCID property of the component to an empty string.
saveState | None | None | Saves the current state of component as its initial state.
startMovement | None | [Boolean] | Start the movement of component in a flow, for example a path. An optional Boolean argument can be used to override flow logic, thereby forcing component to move in flow.
stopMovement | None | [Boolean] | Stops the movement of component in a flow, for example a path. An optional Boolean argument can be used to override flow logic, thereby forcing component to not move in flow.
transfer | None | vcBehaviour behaviour, Integer port or vcConnector connector | Transfers component into a flow and blocks Python execution until completion of transfer. One option allows you to give two separate arguments for a behavior and port. Another option allows you to give a connector for performing transfer. A given behavior must be or derive from vcFlow and you should check for available capacity.
transferNonBlocking | None | vcBehaviour behaviour, Integer port | Transfers component into a flow defined by a given behaviour and port without blocking Python execution. That is, call is executed immediately and does not wait for completion of transfer. A given behavior must be or derive from vcFlow and you should check for available capacity.

Events

Name | Parameters | Description
OnNodeConfigurationChange | Enumeration type, vcNode node1, vcNode node2 | Triggered when a change occurs in component node hierarchy. The node1 and node2 arguments are nodes affected by change. The type argument is the type of change that occurred in component. See Component Constants for more information.
OnContainerTransition | vcContainer container, Boolean value | Triggered when component enters or exits a vcContainer object. The value argument will be True if component is entering a container; otherwise value is False if component exiting a container.

Examples

Example. Basic uses of vcComponent

from vcScript import *
# note: some of the methods called via comp in this snippet are documented under vcNode

def OnRun():

## COMPONENT
## get the handle to a vcComponent object
app = getApplication()
comp = app.findComponent('MyConveyor') # access any component in the layout by name
comp = getComponent()# typical way to access the owner component of the python script (preferred approach)

## BEHAVIOURS
## this is how you can create new behaviours in python
cont = comp.createBehaviour(VC_ONEWAYPATH,'MainPath')
cont = comp.createBehaviour(VC_COMPONENTCONTAINER,'MyCont')
creator = comp.createBehaviour(VC_COMPONENTCREATOR,'MyCreator')

## this is how you can access the existing behaviours in the component (note: british english spelling)
path = comp.findBehaviour('MainPath') # by name
paths = comp.findBehavioursByType(VC_ONEWAYPATH) # by name (returns a list)
path = paths[0] # access the first item in the list like this

## FEATURES
## this is how you can create new features in python
transform = comp.RootFeature.createFeature(VC_TRANSFORM,'Trans')
transform.Expression = 'Tx(200.0).Tz(400.0)'
transform.Expression = 'Tx(%f).Tz(%f)' % (200.0, 400.0) # more pythonic way to do the same
cylinder = transform.createFeature(VC_CYLINDER,'MyCylinder')
cylinder.Height = str(500)

## this is how you can access the existing features
block = comp.findFeature('Block') # find feature by name in the whole component
root = comp.RootFeature # root feature exists for all nodes even if the component contains no geometry
kids = root.Children # returns the list of all the direct children

## PARAMETERS i.e. properties
## this is how you can create new parameters
radius_prop = comp.createProperty(VC_REAL, 'CylinderRadius')
bool_prop = comp.createProperty(VC_BOOLEAN, 'ToggleThis')

## this is how you can access existing properties
prop = comp.getProperty('CylinderRadius')
prop.Value = 250.0

# or
comp.CylinderRadius = 250.0
all_props = comp.Properties # list of all user defined properties in the component
for p in all_props: # (Visible, PDFExportLevel and BackfaceMode -properties are also included)
# loop the list and print name and value for each
print p.Name, p.Value

## NODES i.e. links
## this is how you can create new links
link1 = comp.createNode(VC_NODE, 'FirstLink')
link1.OffsetExpression = 'Tz(200).Ry(45)'
path = link1.getBehaviour('MainPath') # use get- instead of findBehaviour to search behs in specific node

## this is how you can access existing nodes
link2 = comp.findNode('SecondLink')
if link2:
# test if a node named "SecondLink" exists
print 'It is there! :) '
else:
print "It's missing! :( "

Example. Create Real Property with Min, Max and Default Values

from vcScript import *

comp = getComponent()
comp.createProperty(VC_REAL, "SurfaceLength",1)

foo = comp.getProperty("SurfaceLength")
foo.MinValue = 100
foo.MaxValue = 1000
foo.Value = 800

Example. Save file and increment revision number

from vcScript import *
app = getApplication()
comp = app.findComponent("component_name")
name = comp.Name
uri = "file:///C:\\Users\\[Username]\\Documents\\[ProductName]\\4.0\My Models\\" + name + ".vcm"

comp.incrementRevision()
comp.save(uri)

Example. Identify components stored in containers

from vcScript import *

#when the simulation is paused
def OnStop():
app = getApplication()
for c in app.Components:
if c.Container != None:
print c.Name
#prints the name of components in storage

Example. Get components with shared features

from vcScript import *

app = getApplication()
shared = [c for c in app.Components if c.IsUnique == False]
for c in shared:
#prints the same memory address
print c.RootFeature


vcComponentFlowProxy

vcComponentFlowProxy gives information about components attempting to enter a flow proxy, and then routes components by testing the available capacity of connected behaviors.

Inherits: vcFlow

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
ComponentSignal | vcComponentSignal | RW | Defines the signal used for signaling what component has been transferred into proxy. This property and PortSignal should be used to determine what and where a component has entered the proxy.
DynamicConnections | Boolean | RW | Defines if the connectors of proxy are dynamic. That is, connections will be established during a simulation by using a Python script or command.
InternalConnectorCount | Integer | R | Gets the number of connectors in proxy. An internal connector is always paired with an external connector, so this count will match the count for the proxy's external connectors.
PortSignal | vcIntegerSignal | RW | Defines the signal used for signaling which connector a component used to enter proxy. The value is the index position of the connector in the proxy's list of connectors.

Methods

Name | Return Type | Parameters | Description
connectInternally | None | Integer index, vcConnector to_connector | Connects an internal connector at a given index in proxy to a given connector.
createConnector | vcConnector | None | Creates a new connector in proxy. This creates a pair of internal and external connectors.
deleteConnector | None | Integer index | Deletes a connector at a given index from proxy. This deletes a pair of internal and external connectors.
getInternalConnector | vcConnector | Integer index | Returns an internal connector at a given index in proxy.
resetConnectorPort | None | Integer index | Resets a connector at a given index in proxy, thereby disconnecting the connector from all of its connections.


vcComponentCreator

vcComponentCreator uses a component as a template for creating other components.

Inherits: vcBehaviour, vcFlow, vcContainer

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
BlockingOptimization Boolean RW Turns on/off the optimization of creator when making new components, thereby improving simulation performance.

If True, the creator will not check for capacity rather listen for event. The creator is informed, for example by component or capacity controller, when there is capacity to make a new component.
Interval | Real | RW | Defines the interval (in seconds) for creating components.
Limit | Integer | RW | Defines the maximum number of components that can be created by creator during a simulation.
Part | String | RW | Defines the URI or VCID of template component.
PartPooling Boolean RW Turns on/off the reuse of components made by the creator, thereby improving simulation performance.

If True, dynamic components removed during simulation are recirculated to make new components, thereby reducing memory allocation.

Caution: Be careful when recirculating components that were modified during simulation, for example a change in node material.
TemplateComponent vcComponent RW Defines the template used by creator to create new components during a simulation.

Either this property or Part can be used to define the template component of creator.

Methods

Name Return Type Parameters Description
create vcComponent

[Boolean wait]

 Creates a new component from template, and then returns the new component.

An optional wait argument can be given to use BlockingOptimization. If True, the creator waits for capacity before trying to make a component.

If creation fails, returns None. Generally, this occurs when the template is undefined or because of capacity issues.

Tip: Set the Limit property to zero in order to disable the internal logic of the creator.

Examples

Example. Set creation interval and limit

from vcScript import *

app = getApplication()
comp = app.findComponent("Feeder Template")
creator = comp.findBehaviour("ComponentCreator")
creator.Interval = 20
creator.Limit = 99999

Example. Print created products and their details during simulation

from vcScript import *

comp = getComponent()
creator = comp.findBehaviour("ComponentCreator")

def OnStart():
creator.Interval = 3
creator.Limit = 0

def OnRun():
while True:
part = creator.create() # returns None if creation fails (e.g. if path is blocked)

#test if part creation was successful
#then print name and height of created component
if part: # test if part creation was successful
print part.Name, part.BoundDiagonal.Z*2
delay(creator.Interval)


vcComponentSignal

vcComponentSignal is a signal that can send a vcComponent object.

Inherits: vcBehaviour, vcSignal

Properties

Name | Type | Access | Description
Value | vcComponent | RW | Defines the value of signal. Setting this value does not trigger the OnSignal event unless you use the signal() method.

Methods

Name | Return Type | Parameters | Description
signal |  | [vcComponent value] | Signals the current value of signal to all connected behaviors, thereby triggering the OnSignal event. An optional value argument can be given to set the Value property of the signal.


vcConfigureContext

vcConfigureContext is the context of the application for building layouts. Currently, there are no additional properties, methods or events for this context.

Inherits: vcContext


vcConnector

vcConnector allows you to establish connections between behaviors in order to transfer components. For example, flow type behaviors may have any number of connections (ports/connectors) to manage the receiving and sending of components.

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Behaviour | vcBehaviour | R | Gets the behavior that the connector is connected to in a component. If no connection, the value is None.
CapacityTest | Enumeration | RW | Define the mode for testing capacity before transferring a component to an outgoing connection. See Connector Constants for more information.
Connection | vcConnector | RW | Defines connector that the connector is connected to in a component. If no connection, the value is None.
Index | Integer | R | Gets the position of the connector in its behavior's list of connectors.
Name | String | RW | Defines the name of connector.
Type | Enumeration | RW | Defines the connector's type. That is, whether the connector is an Input, Output or Input/Output type port. See Connector Constants for more information.

Methods

Name | Return Type | Parameters | Description
connect | None | [vcConnector connector] | Connects the connector to a given connector. If no argument is given, this method will remove all connections of the connector.
testCapacity | Boolean | None | Tests the capacity of connector's behavior. Returns True if not at capacity; otherwise returns False if at full capacity. If the behavior of a connector does not have physical capacity, for example Component Flow Proxy, returns None.
testConnectedCapacity | Boolean | None | Tests the capacity of behavior connected to the connector. Returns True if not at capacity; otherwise returns False if at full capacity. If the behavior of a connector does not have physical capacity, for example Component Flow Proxy, returns None.

Examples

Example. Access and connect the connectors of paths

def OnRun():
comp = getComponent()
path1 = comp.findBehaviour('InPath')
path2 = comp.findBehaviour('OutPath')

#option 1: access connector
outConnector = path1.getConnector('Output')

#option 2: access connector
inConnector = path2.Connectors[0]
outConnector.connect( inConnector )


vcContainer

vcContainer is a base class for all behaviors that can contain components, for example buffers, stackers and conveyors.

Inherits: vcBehaviour, vcFlow

Contents ShowHide

Hierarchy

Common Properties

Behavior Specific Properties

Methods

Events

Hierarchy

Some container type behaviors have specific implementations, while others have additional properties.

vcContainer

vcComponentContainer

vcPatternContainer

vcComponentCreator

vcMotionPath

vcOneDirectionalPath

vcRoutingRule

vcTwoDirectionalPath

vcTransport

Common Properties

The following are properties common to all container type behaviors.

Name | Type | Access | Description
Capacity | Integer | RW | Defines the maximum number of components that can be stored in the container at any given time. That is, the logical capacity of the container.
CapacityBlocks | List of vcBehaviour | RW | Defines a list of Capacity Controller type behaviors that globally control the capacity of the container. This property overrides the container's Capacity.
ComponentCount | Integer | R | Gets the amount of components stored in the container.
Components | List of vcComponent | R | Gets a list of components stored in the container.
ContentVisible | Boolean | W | Sets the visibility of components stored in the container.
HeadComponent | vcComponent | R | Gets a component stored at the head of the container.
Statistics | vcStatistics | RW | Defines a Statistics behavior that collects data generated by the container during a simulation.
TailComponent | vcComponent | R | Gets a component stored at the tail of the container.
TransitionSignal | vcBoolSignal | RW | Defines the signal used for signaling when a component enters/exits the container. A True value means a component has entered the container, whereas a False value means a component has exited the container.

Behavior Specific Properties

Bucket Path

Bucket Path is a type of path that contains components in buckets which are defined by two Geometry features. Generally, a Bucket Path is used as a conveyor that supports indexing and continuous modes of material flow.

Name | Type | Access | Description
BackBucket | vcGeometryFeature | RW | Defines a Geometry feature that represents the back section of each bucket. The geometry will be visible only if the ShowContent property of the feature is set to False.
Buckets | Integer | RW | Defines the amount of buckets used in the path.
BucketSize | Real | RW | Defines the minimum distance between each bucket.
Direction | Enumeration | RW | Defines the direction buckets move along the path. See Conveyor Direction Constants for more information.
FrontBucket | vcGeometryFeature | RW | Defines a Geometry feature that represents the front section of each bucket. The geometry will be visible only if the ShowContent property of the feature is set to False.
Interpolation | Enumeration | RW | Defines the mode of interpolating the motion of each bucket along the path. See Conveyor Interpolation Mode Constants for more information.
OutFrame | vcFeature | RW | Defines a Frame feature that is referenced as the location of the path's output port. The path must have a defined output port in order to empty the contents of a passing bucket. Therefore, the OutFrame must be included in the Path property's list of frames.
Path | List of vcFeature | RW | Defines an ordered list of Frame features that represent waypoints of the path.
PulseDriven | Boolean | RW | Defines if the path is pulse driven in which a connected Integer signal sends a step size for moving each bucket.
RetainOffset | Boolean | RW | Defines if the location of a component is retained when the component is placed or transferred onto the path. A True value means a component is not snapped to the axis of the path defined by its waypoints.
Sensors | List of vcBehaviour | RW | Defines a list of sensor type behaviors connected to the path.
Speed | Real | RW | Defines the speed (mm/s) of the path.
StatusSignal | vcBoolSignal | RW | Defines a signal that signals when the path is moving/not moving in pulse mode.

Component Container

Component Container is a static container of components with no additional properties. Generally, a Component Container is used for simulating buffers and storage areas and is often used to contain components grasped by a robot's end-of-arm tool.

One Directional Path

One Directional Path is a deprecated motion path that is similar to a One Way Path behavior but with less functionality.

Name | Type | Access | Description
Interpolation | Enumeration | RW | Defines the mode of interpolating the motion of components along the path. See Conveyor Interpolation Mode Constants for more information.
Path | List of vcFeature | RW | Defines an ordered list of Frame features that represent waypoints of the path.
RetainOffset | Boolean | RW | Defines if the location of a component is retained when the component is placed or transferred onto the path. A True value means a component is not snapped to the axis of the path defined by its waypoints.
Sensors | List of vcBehaviour | RW | Defines a list of sensor type behaviors connected to the path. This type of path only supports Component Path and Process Point sensors.
Speed | Real | RW | Defines the speed (mm/s) of the path.

One Way Path

One Way Path is a motion path that can move contained components in one direction. See vcMotionPath for more information.

Two Directional Path

Two Directional Path is a deprecated motion path that is similar to a Two Way Path behavior but with less functionality.

Name | Type | Access | Description
Direction | Enumeration | RW | Defines the direction components move along the path. See Conveyor Direction Constants for more information.
Interpolation | Enumeration | RW | Defines the mode of interpolating the motion of components along the path. See Conveyor Interpolation Mode Constants for more information.
Path | List of vcFeature | RW | Defines an ordered list of Frame features that represent waypoints of the path.
RetainOffset | Boolean | RW | Defines if the location of a component is retained when the component is placed or transferred onto the path. A True value means a component is not snapped to the axis of the path defined by its waypoints.
Sensors | List of vcBehaviour | RW | Defines a list of sensor type behaviors connected to the path. This type of path only supports Component Path and Process Point sensors.
Speed | Real | RW | Defines the speed (mm/s) of the path.

Two Way Path

Two Way Path is a motion path that can move contained components in a forward and/or backward direction. See vcMotionPath for more information.

Methods

Name | Return Type | Parameters | Description
getComponent | vcComponent | Integer component_index | Returns a component at a given index stored in the container.
getPathPosition | vcMatrix | Real path_distance | Returns a position matrix for a point on the path at a given distance. The position matrix is based in the node coordinate system of the container.
getContainerProximity | Real | vcVector position | Returns the orthogonal distance from a given position to the container. Note: If the container is static, this method may return a very large value for any position.
grab | None | vcComponent component | Attaches a given component to this container. If the container is static, the component will automatically retain its location.
startFailure | None | None | Sets the state of container to failure. In a failure state, a container cannot react to anything during a simulation until its shifted to a different state.
stopFailure | None | None | Shifts state of component to a different state, thereby ending a failure. Generally, this method is used to end a failure state and mark the end of a repair made to the container.

Events

Name Parameters Description
OnTransition vcComponent component, Boolean arrive_leave Triggered when a component is transferred to or from the container.

The component argument is the component in question, and the arrive_leave argument is a Boolean value that is True if the component has arrived to the container or False if the component has departed.

If the OnTransition() event is triggered with an arrive_leave value True, the component has just been added and is in a well-defined state with respect to its container. It is then safe to manipulate the component.

If arrive_leave value is False, the component is in the process of being removed and its Container is not well-defined. In this case, DO NOT use the Container property of the component being transferred.


vcContext

vcContext is a base class for all contexts defined in the application. A context refers to the current state of main window, its workspace and scene, and the availability of commands.

Hierarchy

vcContext

vcAuthorContext

vcConfigureContext

vcDrawingContext

vcProcessContext

vcTeachContext

Common Properties

The following properties are common in all contexts recognized by the application.

Name | Type | Access | Description
Id | String | R | Gets the id of the context.


vcCurveData

vcCurveData provides access to mathematical information used for rendering curves and curved surfaces in components.

Contents ShowHide

Curve Types

Access

Methods

Examples

Curve Types

The types of curves supported in the 3D world are:

  • Spline
  • Polyline
  • Non-uniform rational basis spline (NURBS)

Access

You can use the CurveData property of a vcCompactLineSet object to get a handle for a vcCurveData object.

Methods

Name | Return Type | Parameters | Description
clearCurves | None | None | Removes all curves from set.
createCurveNurbs | Integer | Integer degree, List of vcVector pts | Adds a new NURBS to set, and then returns the index of curve in set.
createCurvePolyLine | Integer | List of vcVector pts | Adds a new polyline to set, and then returns the index of curve in set.
createCurveSpline | Integer | Integer degree, List of vcVector pts, List of Integer multiplicities, List of Real knots, List of Real weights | Adds a new spline to set, and then returns the index of curve in set.
deleteCurve | None | Integer curve | Deletes a curve at a given index in set. Note: Update the scene in order to show visualization changes in the 3D world.
getCurveEnds | 4-tuple(vcVector pt1, vcVector pt2, Real w1, Real w2) | Integer curve | Returns curve end point information for a curve at a given index in set. The information defines both curve endpoint vectors and their weight values, for example if a NURBS curve is selected.
getCurveLength | Real length | Integer curve | Returns the length of a curve at a given index in set.
getCurveMinCurveDistance | 3-tuple (Real min_dist, Real curve_dist, Real othercurve_dist) | Integer curve, Integer othercurve | Returns the minimum distance between two curves at given indices in set. The returned value describes the minimum distance between curves and minimum distance between either end points of curves.
getCurveMinDistance | 2-tuple (Real min_dist_to_point, Real curve_dist) | Integer curve, vcVector point | Returns the minimum distance of a curve at a given index in set to a given point as well as the length of curve.
getCurvePoint | vcVector point | Integer curve, Real distance | Returns a point on a curve at a given index in set and distance from beginning of curve.
getCurvePointAndDerivate | 2-tuple(vcVector point, vcVector derivate) | Integer curve, Real distance | Returns a point and first derivate vector of a curve at a given index in set and distance from beginning of curve.
getCurvePointCount | Integer | Integer curve | Returns the total number of points for a curve at a given index in set.
getCurvePositions | List of vcMatrix | Integer curve | Returns a list of position matrices for each point on a curve at a given index in set.
getCurveType | Enumeration type | Integer curve | Returns the type of curve at a given index in set. See Topology Constants for more information.
getPolyLineCurvePoints | List of vcVector pts | Integer curve | Returns a list of points for a polyline at a given index in set; otherwise returns an empty list.
getSplineCurveControlPoint | List of vcVector ctrl_pts | Integer curve | Returns a list of control points for a spline at a given index in set; otherwise returns an empty list.
getSplineCurveControlWeights | List of Real weights | Integer curve | Returns a list of control weight values for a spline at a given index in set; otherwise returns an empty list.
getSplineCurveDegree | Integer degree | Integer curve | Returns the degree of a spline at a given index in set.
getSplineCurveKnots | 2-tuple (List of Integer multiplicities, List of real knots) | Integer curve | Returns spline knot multiplicities (knot recurrence) and knot values for a curve at a given index in set.

Examples

Example. Create and access curve data

#Create a Geometry feature then a Python script behavior
#Copy the following script in the Python script

from vcScript import *
import vcVector

comp = getComponent()
geof = comp.getFeature("Geometry")
tset = None
if geof.Geometry.GeometrySetCount == 0:
cset = geof.Geometry.createGeometrySet(VC_COMPACTLINESET)
else:
cset = geof.Geometry.GeometrySets[0]

# Get Curve interface
curves = cset.CurveData
print "0. Curve count"
print "CurveCount = ", curves.CurveCount
print "1. Clear curves"
curves.clearCurves()
print "CurveCount = ", curves.CurveCount
print "2. Create Curve"

# Define curve degree
Degree = 3

# Add knot values and multipliers
Knots = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]
KnotMultiplicities = [4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4]

# Add control points
pts = []
pts.append(vcVector.new(12438, 0, 4622.7))
pts.append(vcVector.new(12409, 0, 4519.525))
pts.append(vcVector.new(11815, 0, 3660))
pts.append(vcVector.new(11193, 0, 2970))
pts.append(vcVector.new(10570, 0, 1880))
pts.append(vcVector.new(9948, 0, 518))
pts.append(vcVector.new(9325, 0, 0))
pts.append(vcVector.new(8703, 0, 0))
pts.append(vcVector.new(8080, 0, 0))
pts.append(vcVector.new(7458, 0, 0))
pts.append(vcVector.new(6835, 0, 0))
pts.append(vcVector.new(6213, 0, 0))
pts.append(vcVector.new(5590, 0, 0))
pts.append(vcVector.new(4968, 0, 0))
pts.append(vcVector.new(4345, 0, 0))
pts.append(vcVector.new(3723, 0, 0))
pts.append(vcVector.new(3100, 0, 0))
pts.append(vcVector.new(2478, 0, 0))
pts.append(vcVector.new(1855, 0, 0))
pts.append(vcVector.new(1233, 0, 0))
pts.append(vcVector.new(610, 0, 0))
pts.append(vcVector.new(339, 0, 1000))
pts.append(vcVector.new(246, 0, 1550))
pts.append(vcVector.new(210, 0, 1780))
weigths = []
curve = curves.createCurveSpline(Degree, pts, KnotMultiplicities, Knots, weigths)
print "Curve created ",curve
pts = []
pts.append(vcVector.new(300, 100, 100))
pts.append(vcVector.new(600, 50, 200))
pts.append(vcVector.new(900, 0, 400))
pts.append(vcVector.new(1000, -20, 900))
curve2 = curves.createCurveNurbs(Degree, pts)
print "Curve2 created ",curve2
print "3. Get curve length"
length = curves.getCurveLength(curve)
print "Curve length = ",length
print "4. Get curve ends"
sp, ep, sw, ew = curves.getCurveEnds(curve)
print "Curve start point(",sp.X,",",sp.Y,",",sp.Z,") weight = ",sw
print "Curve end point(",ep.X,",",ep.Y,",",ep.Z,") weight = ",ew
print "5. Get point at curve using distance"
p = curves.getCurvePoint(curve, length*0.5)
print "Curve point(",p.X,",",p.Y,",",p.Z,")"
print "6. Get point minimum projected distance to curve"
point = vcVector.new(10000,0,500)
min_dist, dist = curves.getCurveMinDistance(curve, point)
print "Curve Min distance ",min_dist," at curve distance ",dist
p = curves.getCurvePoint(curve, dist)
print "Curve projected point(",p.X,",",p.Y,",",p.Z,")"
print "7. Get curve point and derivate"
p, d = curves.getCurvePointAndDerivate(curve, 15000)
print "Curve point(",p.X,",",p.Y,",",p.Z,")"
print "Curve normalized derivate(",d.X,",",d.Y,",",d.Z,")"
print "8. Get two curves minimum distance"
min_dist, dist1, dist2 = curves.getCurveMinCurveDistance(curve, curve2)
print "Curve & curve2 Min distance ",min_dist," at curve dist1 ",dist1, " dist2 ",dist2
p1 = curves.getCurvePoint(curve, dist1)
print "Curve projected point(",p1.X,",",p1.Y,",",p1.Z,")"
p2 = curves.getCurvePoint(curve2, dist2)
print "Curve2 projected point(",p2.X,",",p2.Y,",",p2.Z,")"
pts = []
pts.append(p1)
pts.append(p2)
curve3 = curves.createCurveNurbs(1, pts)
print "Curve3 created ",curve3
cset.update()
comp.rebuild()

# Inquiry curve information
print
print "CurveCount=",curves.CurveCount
print
for c in range(0,curves.CurveCount):
print "Curve[",c,"]"
type = curves.getCurveType(c)
if type == VC_CURVE_POLYLINE:
print " Type=Polyline"
for p in curves.getPolyLineCurvePoints(c):
print " P(",p.X,",",p.Y,",",p.Z,")"
if type == VC_CURVE_SPLINE:
print " Type=Spline"
print " Degree=",curves.getSplineCurveDegree(c)
for p in curves.getSplineCurveControlPoints(c):
print " P(",p.X,",",p.Y,",",p.Z,")"
weights = curves.getSplineCurveControlWeights(c)
print " Weights=",weights
knots,kms = curves.getSplineCurveKnots(c)
print " Knots=",knots
print " Kms=",kms


vcDataContainer

General purpose Python wrapper for data such as event arguments. The available Properties are different depending on each use case.

Examples

Example. Custom transport controller to handle "Work" statements

from vcScript import *
global events
events = []
comp = getComponent()
def my_work(data_cont_):
# gets an event when "Work" statement gets executed
# store the "Work" data to "events" global list
global events
data = ["Work", data_cont_]
events.append(data)
trigger.signal(True)
def OnRun():
# simulation starts
global events
while True:
# waits until "events" global list has content
condition(lambda: events)
event = events.pop(0)
if event[0] == "Work":
data_cont = event[1]
# read data_cont (vcDataContainer)
work_id = data_cont.RequestId
work_time = data_cont.ProcessTime
resource_mtx = data_cont.ResourcePositionMatrix
#move_resource(resource_mtx) # not implemented
delay(work_time)
tc.workDone(work_id)
# initialize variables
tc = comp.findBehaviour("TransportController")
tc.OnBeginWorkEx = my_work
trigger = comp.findBehaviour('Trigger')


vcDimension

vcDimension is a type of layout item used for authoring new and existing dimensions in a layout.

Inherits: vcLayoutItem

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
ArrowSize | Real | RW | Defines the size of the head and tail arrows of dimension.
Dimension | Real | R | Gets the magnitude (distance in millimeters) of dimension.
Height | Real | RW | Defines the height of text in dimension.
LineWidth | Real | RW | Defines the line width of dimension.
Location | vcMatrix | RW | Defines the position matrix of the dimension in World coordinate system.
Material | vcMaterial | RW | Defines the material of dimension.
Node1 | vcNode | RW | Defines the node the head of the dimension is attached to in 3D world.
Node2 | vcNode | RW | Defines the node the tail of the dimension is attached to in 3D world.
Position1 | vcMatrix | RW | Defines the position matrix of dimension's head relative to Node1 property's coordinate system.
Position2 | vcMatrix | RW | Defines the position matrix of dimension's tail relative to Node2 property's coordinate system.
Thickness | Real | RW | Defines the thickness of text in dimension.

Methods

Name | Return Type | Parameters | Description
getProperty | vcProperty | String name | Returns the first property matching a given name in the dimension.


vcDistributionModeProductLineEntry

vcDistributionModeProductLineEntry is an entry used for creating a product based on a weighted probability. Entries are associated with a vcProductCreatorDistributionMode and used when a vcProductCreator object is using a distribution feed mode.

Properties

Name | Type | Access | Description
Probability | Real | RW | Defines the weight of the product type, which is used to calculate the probability for creating product instances of. It is evaluated as relative to the sum of all configured probabilities like a weight value in a weighted sum. The value must be greater than or equal to zero.
ProductType | vcProductType | RW | Defines the product type of entry to create product instances of.


vcDof

vcDof defines the joint properties of a node, its degrees of freedom, and whether or not the joint is assigned to a controller of a robot or servo.

Contents ShowHide

Common Properties

Joint Specific Properties

Controller Properties

Common Properties

The following properties are common in all DOF objects and joint types, except for fixed joints. A fixed joint does not have a DOF object.

Name | Type | Access | Description
JointLinkType | Enumeration | R | Gets the JointType of the link. See Joint Constants for more information.
JointServoType | Enumeration | RW | Defines whether a joint assigned to a controller is rotational or translational. See Joint Constants for more information.
Name | String | RW | Defines the name of DOF object and joint.
VALUE | Real | RW | Defines the current value of the joint.

Joint Specific Properties

Custom Joint

Name | Type | Access | Description
Controller | vcServoController or vcRobotController | RW | Gets/Sets the controller assigned the joint.
InitialValue | Real | RW | Defines the default value of the joint at its initial state.
Joint | String | RW | Defines an expression that when evaluated returns the joint definition of the joint. VALUE can be used to referenced the current value of the joint, for example "VALUE+10".
MinLimit | String | RW | Defines an expression that when evaluated returns the minimum value of the joint.
MaxLimit | String | RW | Defines an expression that when evaluated returns the maximum value of the joint.
Pivot | String | RW | Defines an expression that when evaluated returns the pivot point definition of the joint. VALUE can be used to referenced the current value of the joint, for example "VALUE+10".

Follower Joint

Name | Type | Access | Description
AxisType | Enumeration | RW | Defines the axis of the joint. See Joint Axis Constants for more information.
Driver | vcDof | RW | Defines the DOF object and joint referenced by a follower joint.
ValueExpression | String | RW | Defines an expression that when evaluated returns the value of the joint. VALUE can be used to referenced the current value of the joint, for example "VALUE+10".

Rotational Joint

Name | Type | Access | Description
AxisType | Enumeration | RW | Defines the axis of the joint. See Joint Axis Constants for more information.
Controller | vcServoController or vcRobotController | RW | Gets/Sets the controller assigned the joint.
InitialValue | Real | RW | Defines the default value of the joint at its initial state.
MinLimit | String | RW | Defines an expression that when evaluated returns the minimum value of the joint.
MaxLimit | String | RW | Defines an expression that when evaluated returns the maximum value of the joint.
ValueExpression | String | RW | Defines an expression that when evaluated returns the value of the joint. VALUE can be used to referenced the current value of the joint, for example "VALUE+10".

Translational Joint

Name | Type | Access | Description
AxisType | Enumeration | RW | Defines the axis of the joint. See Joint Axis Constants for more information.
Controller | vcServoController or vcRobotController | RW | Gets/Sets the controller assigned the joint.
InitialValue | Real | RW | Defines the default value of the joint at its initial state.
MinLimit | String | RW | Defines an expression that when evaluated returns the minimum value of the joint.
MaxLimit | String | RW | Defines an expression that when evaluated returns the maximum value of the joint.
ValueExpression | String | RW | Defines an expression that when evaluated returns the value of the joint. VALUE can be used to referenced the current value of the joint, for example "VALUE+10".

Controller Properties

The following properties are dynamically added to a DOF whose joint is assigned to servo/robot controller.

Name | Type | Access | Description
LagTime | Real | RW | Defines the lag time (in seconds) of joint.
MaxAcceleration | Real | RW | Defines the maximum acceleration (units/degrees per second squared) of joint.
MaxDeceleration | Real | RW | Defines the maximum deceleration (units/degrees per second squared) of joint.
MaxSpeed | Real | RW | Defines the maximum speed (units/degrees per second squared) of joint.
SettleTime | Real | RW | Defines the settle time (in seconds) of joint.
SoftMinLimit | Real | RW | Defines the soft limit for minimum joint value.
SoftMaxLimit | Real | RW | Defines the soft limit for maximum joint value.


vcDrawingContext

vcDrawingContext is the context of the application for making 2D drawings. Currently, there are no additional properties, methods or events for this context.

Inherits: vcContext


vcEdge

vcEdge is an edge defined by two points and may be shared with one or more polygons.

Inherits: vcPrimitive

Properties

Name | Type | Access | Description
Direction | vcVector | R | Gets a vector from the first point to the second point in edge.
Points | List of vcPolygonPoint | R | Gets a list of two points that define the edge.
Polygons | List of vcPolygon | R | Gets a list of polygons that share the edge.
Type | Enumeration | R | Gets the edge type. See Edge Types for more information.


vcEventReturnData

Events do not have return values, so having this object as a parameter allows passing some information back from event handler(s) to the event publisher.

Properties

Name Type Access Description
Handled Boolean RW

Defines if this event has already been handled.

This is used when an event should only be handled once. All listeners of the event should begin by checking this value before performing any operations. If True, then no further operations should be performed. Otherwise, logic can continue.

If the listener then handles this event and no further handling should be done to it, the listener should write True here.


vcExecutor

vcExecutor allows you to execute a robot or servo program.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Controller | vcRobotController or vcServoController | RW | Defines the controller associated with the executor.
CurrentStatement | vcStatement | R | Gets the statement currently being executed by the executor.
DigitalInputSignals | vcBooleanSignalMap | RW | Defines the input signal device associated with the executor.
DigitalOutputSignals | vcBooleanSignalMap | RW | Defines the output signal device associated with the executor.
IsEnabled | Boolean | RW | Defines if the program is executed during simulation.
IsLooping | Boolean | RW | Defines if the executor loops its program.
ProcessHandlers | List of vcPythonProcessHandler | RW | Defines a list of process handlers for overriding or modifying statements of robot program and executing process statements. (Deprecated) Use StatementHandler.
Program | vcProgram | R | Gets the program associated with the executor.
StatementHandler | vcPythonProcessHandler | RW | Defines a process handler for controlling the execution of statements in robot program. See an example of modifying a point-to-point motion statement. Important: Process statements and Path statements with assigned process handlers are executed by their handlers. That is, those statements are not passed on to the statement handler of executor. Do not call nor try to execute them with the statement handler.
UseExternalExecutor | Boolean | RW | Defines if the component is controlled by external execution mechanism, for example a virtual robot controller.

Methods

Name | Return Type | Parameters | Description
callRoutine None vcRoutine routine, [Boolean suspendScript], [Boolean clearCallStack]

or

String name, [Boolean suspendScript], [Boolean clearCallStack]

 Executes a routine.

By default, Python execution is suspended until the routine has been completed.

An optional suspendScript argument can be given a False value, thereby Python execution continues immediately.

An optional clearCallStack argument can be given a False value, thereby the call stack of executor is not cleared before executing routine.

callStatement

None

vcStatement statement, [Boolean suspendScript]

Executes a statement.

By default, Python execution is suspended until the statement has been completed.

An optional suspendScript argument can be given a False value, thereby Python execution continues immediately.

Note: You can use callStatement() with a process handler to modify the default execution of statements in robot program, for example point-to-point motions, as well as the pre/post execution of statements.
setOutput | None | Integer output_index, Boolean value | Sets the value of a signal connected to a port at a given output_index in robot.
waitInput None Integer input_index, Boolean value Schedules the executor to wait until a signal connected to a port at a given input_index in robot has a given value.

Note: Python execution continues immediately.

Events

Name | Parameters | Description
OnCurrentStatementChanged | None | Triggered when the current statement of executor changes to a different statement. (Deprecated) Use OnPreExecuteStatement.
OnPostExecuteStatement | vcStatement statement, bool isImmediate | Triggered after execution of a statement.
OnPreExecuteStatement | vcStatement statement, bool isImmediate | Triggered before execution of a statement. The isImmediate argument defines if the statement will be executed immediately (non time-consuming mode)
OnProgramFinished | vcExecutor executor | Triggered when the execution of program has finished.


vcFeature

vcFeature is the base class for all types of features in a component.

Contents ShowHide

Hierarchy

Common Properties

Feature Specific Properties

Methods

Examples

Hierarchy

Only Geometry and Frame features have a specific implementations. For example, a vcGeometry type object and its vcGeometryContainer type property can be used to create custom geometry. All other features can be manipulated as vcFeature type objects.

vcFeature

vcFrameFeature

vcGeometryFeature

Features can represent geometry loaded from a CAD file, generated from a primitive or the result of an operation applied to subfeatures. The result of a feature tree evaluation is placed into the geometry container of a vcNode object. This process is governed by properties in feature objects, which are accessible through vcFeature.

Common Properties

The following properties are common in all feature types.

Name | Type | Access | Description
Children | List of vcFeature | R | Gets a list of feature's immediate child features.
Name | String | RW | Defines the name of feature.
NodePositionMatrix | vcMatrix | R | Gets the position matrix of the feature relative to its node's coordinate system.
Parent | vcFeature | R | Gets the parent of this feature in the node feature tree. If the feature is root feature, return value is None.
PhysicsCollider | Enumeration | RW | Defines the type of collider used by the feature for physics. Note: A feature inherits the collider of its parent feature. See Collider Constants for more information.
PositionMatrix | vcMatrix | RW | Defines the position matrix of this feature relative to its parent feature's coordinate system.
Properties | List of vcProperty | R | Gets a list of all properties in feature.
Type | Enumeration | R | Gets the feature type. See Feature Constants for more information.
Visible | Boolean | RW | Turns on/off the visibility of the frame in the 3D world.

Feature Specific Properties

Angular Clone

Name | Type | Access | Description
Count | Expression (integer) | RW | Defines an expression that when evaluated returns the number of times to clone the feature's subtree. 0 No geometry is rendered. 1 The original geometry of the feature's subtree is rendered. 1+n The original geometry is rendered and cloned n amount of times. When evaluated, the expression should return an integer.
Offset | Expression (vector) | RW | Defines an expression that when evaluated returns a vector used to offset the direction of each clone from one another.
Step | Expression (real) | RW | Defines an expression that when evaluated returns the angular distance used to offset each clone from one another.

Block

Name | Type | Access | Description
Height | Expression (real) | RW | Defines an expression that when evaluated returns the height of the block projected along its Z-axis.
Length | Expression (real) | RW | Defines an expression that when evaluated returns the length of the block projected along its X-axis.
Material | vcMaterial | RW | Defines the material of the block.
Width | Expression (real) | RW | Defines an expression that when evaluated returns the width of the block projected along its Y-axis.

Cone

Name | Type | Access | Description
BottomRadius | Expression (real) | RW | Defines an expression that when evaluated returns the bottom radius of the cone.
Caps | Boolean | RW | Turns on/off the rendering of caps for the cone.
EndSweep | Expression (real) | RW | Defines an expression that when evaluated returns the angle where the cone's geometry is swept to relative to the cone's center.
Height | Expression (real) | RW | Defines an expression that when evaluated returns the height of the cone projected along its Z-axis.
Material | vcMaterial | RW | Defines the material of the cone.
Sections | Expression (integer) | RW | Defines an expression that when evaluated returns the number of sections (sides) generated for the cone.
StartSweep | Expression (real) | RW | Defines an expression that when evaluated returns the angle where the cone's geometry is swept from relative to the cone's center.
TopRadius | Expression (real) | RW | Defines an expression that when evaluated returns the top radius of the cone.

Cylinder

Name | Type | Access | Description
Caps | Boolean | RW | Turns on/off the rendering of caps for th cylinder.
EndSweep | Expression (real) | RW | Defines an expression that when evaluated returns the angle the cylinder's geometry is swept to relative to the cylinder's center.
Height | Expression (real) | RW | Defines an expression that when evaluated returns the height of the cylinder projected along its Z-axis.
Material | vcMaterial | RW | Defines the material of the cylinder.
Radius | Expression (real) | RW | Defines an expression that when evaluated returns the radius of the cylinder.
Sections | Expression (integer) | RW | Defines an expression that when evaluated returns the number of sections (sides) generated for the cylinder.
StartSweep | Expression (real) | RW | Defines an expression that when evaluated returns the angle the cylinder's geometry is swept from relative to the cylinder's center.

Extrude

Name | Type | Access | Description
Direction | Expression (vector) | RW | Defines an expression that when evaluated returns a vector defining the direction of the extrusion.
Length | Expression (real) | RW | Defines an expression that when evaluated returns the length of the extrusion.
Material | vcMaterial | RW | Defines the material of the extrusion.
ShowBackFaces | Boolean | RW | Turns on/off the rendering of geometry backfaces in the extrusion.

Frame

Name | Type | Access | Description
UseAsGuide | Integer | RW | Defines if the frame can be selected when adding dimensions in the Drawing view.

Linear Clone

Name | Type | Access | Description
Count | Expression (integer) | RW | Defines an expression that when evaluated returns the number of times to clone the feature's subtree. 0 No geometry is rendered. 1 The original geometry of the feature's subtree is rendered. 1+n The original geometry is rendered and cloned n amount of times. When evaluated, the expression should return an integer.
Direction | Expression (vector) | RW | Defines an expression that when evaluated returns a vector used to offset the direction of each clone from one another.
Step | Expression (real) | RW | Defines an expression that when evaluated returns the linear distance used to offset each clone from one another.

Mirror

Name | Type | Access | Description
HideOriginal | Boolean | RW | Turns on/off the visibility of feature being mirrored.
Offset | Expression (vector) | RW | Defines an expression that when evaluated returns a vector/the axis of reflection, for example (1,0,0) would reflect along X-axis.

Plane

Name | Type | Access | Description
Size | Expression (real) | RW | Defines an expression that when evaluated returns the length and width of the plane.

Python Feature

Name | Type | Access | Description
Script | String | RW | Defines the code of the Python feature.

Revolve

Name | Type | Access | Description
Caps | Boolean | RW | Turns on/off the rendering of caps for revolved geometry.
Material | vcMaterial | RW | Defines the material of revolved geometry.
RevolveAngle | Expression (real) | RW | Defines an expression that when evaluated returns the angle for revolving geometry.
RevolveAxis | Expression (vector) | RW | Defines an expression that when evaluated returns a vector/direction for revolving geometry, for example (0,0,1) would revolve geometry around Z-axis.
RevolveOffset | Expression (real) | RW | Defines an expression that when evaluated returns an offset for revolved geometry.
Reverse | Boolean | RW | Turns on/off the inverting of revolved geometry.
Sections | Expression (real) | RW | Defines an expression that when evaluated returns the number of sections/sides for revolved geometry.

Sphere

Name | Type | Access | Description
Caps | Boolean | RW | Turns on/off the rendering of caps for the sphere.
EndSweep | Expression (real) | RW | Defines an expression that when evaluated returns the end angle for sweeping geometry.
Material | vcMaterial | RW | Defines the material of the sphere.
Radius | Expression (real) | RW | Defines an expression that when evaluated returns the radius of the sphere.
Sections | Expression (integer) | RW | Defines an expression that when evaluated returns the number of sections/sides along the longitude of swept geometry.
Spans | Expression (integer) | RW | Defines an expression that when evaluated returns the number of sections/sides between the equator and poles of swept geometry.
StartSweep | Expression (real) | RW | Defines an expression that when evaluated returns the starting angle for sweeping geometry.

Switch

Name | Type | Access | Description
Choice | Expression (integer) | RW | Defines an expression that when evaluated returns which immediate child of the switch to render in 3D world. A zero value selects the switch, thereby not rendering any of its subfeatures. That is, indexing starts at one.

Text

Name | Type | Access | Description
IsFloating | Boolean | RW | Defines if the text floats freely in 3D world or is anchored directly to feature location.
IsReadOnly | Boolean | RW | Defines if the text is read-only and locked from editing.
Material | vcMaterial | RW | Defines the material of the text.
Size | Real | RW | Defines the scale factor for sizing rendered text.
Text | String | RW | Defines an expression that when evaluated returns the text to be visualized in the 3D world.

Transform

Name | Type | Access | Description
Expression | Expression (matrix) | RW | Defines an expression for transforming subfeatures.

Wedge

Name | Type | Access | Description
BiggerHeight | Expression (real) | RW | Defines an expression that when evaluated returns the Z-axis height of the wedge's back end.
BiggerLength | Expression (real) | RW | Defines an expression that when evaluated returns the X-axis length of the wedge's bottom.
Material | vcMaterial | RW | Defines the material of the wedge.
MirrorBack | Boolean | RW | Turns on/off the mirroring of the wedge along its X-axis.
MirrorDown | Boolean | RW | Turns on/off the mirroring of the wedge along its negative Z-axis.
SmallerHeight | Expression (real) | RW | Defines an expression that when evaluated returns the Z-axis height of the wedge's front end.
SmallerLength | Expression (real) | RW | Defines an expression that when evaluated returns the X-axis length of the wedge's top.
Width | Expression (real) | RW | Defines an expression that when evaluated returns the Y-axis width of the wedge.

Methods

Name | Return Type | Parameters | Description
attach | Boolean | vcFeature feature, [Boolean rebuild] | Attaches a given feature to this feature, thereby allowing you to reorder the containing node's feature tree. The given feature cannot be the root feature or parent of this feature. An optional rebuild argument can be used to control the rebuilding of geometry for an attached feature. Default is False value and will not rebuild geometry, whereas a True value will rebuild geometry. Returns True if attachment is successful; otherwise returns False.
clone | vcFeature | None | Copies the feature to the same level in containing node's feature tree, and then returns the clone.
collapse | None | None | Collapses the feature into a new Geometry feature. The original feature will be deleted, thereby you need to get handle for the new feature.
createFeature | vcFeature | Enumeration type, String name | Adds a new feature of a given type and name as a child of this feature. See Feature Constants for more information.
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Adds a new property of a given type and name to the feature. An optional constraints argument can be given to define constraints for the new property, which must be done at the time of creation. See Property Constants for more information.
delete | Boolean | None | Deletes the feature and its subfeatures, and then returns True; otherwise returns False.
deleteProperty | None | vcProperty property | Deletes a given property from the feature.
getFeature | vcFeature | None | Returns the feature.
getProperty | vcProperty | String name | Returns a property of the feature that matches the given name; otherwise returns None.
rebuild | None | None | Rebuilds the feature and its subfeature tree.

Examples

Example. Create features and rebuild geometry

from vcScript import *

app = getApplication()
comp = app.findComponent("MyComponent")
transform = comp.findFeature("Transform")
transform.Expression = 'Tx(400.0)'
block = transform.createFeature(VC_BLOCK, "MyBlock")

# create feature under another feature
cylinder = comp.RootFeature.createFeature(VC_CYLINDER, "MyCylinder")

#create feature under the tree root
cylinder.Height = '300'

#expression properties are set as strings
cylinder.Radius = '150'
cylinder.Sections = '24'
cylinder.rebuild()
app.render()


vcFlow

vcFlow is a base class for behaviors that support the transfer of components and material flow using connectors/ports.

Inherits: vcBehaviour

Contents ShowHide

Hierarchy

Common Properties

Behavior Specific Properties

Methods

Hierarchy

Behaviors that inherit vcFlow do not need to have the capacity to store components rather the ability transfer/pass components in and out of their connectors.

vcFlow

vcComponentFlowProxy

vcContainer

vcComponentContainer

vcPatternContainer

vcComponentCreator

vcMotionPath

vcOneDirectionalPath

vcRoutingRule

vcTwoDirectionalPath

vcTransport

Common Properties

The following properties are common in all flow type behaviors.

Name | Type | Access | Description
CapacityAvailable | Boolean | RW | Defines if flow object will accept an incoming component. This is not the same as a logical capacity test since flow type behaviors do not to store components.
ConnectorCount | Integer | R | Gets the amount of connectors/ports in flow object.
Connectors | List of vcConnector | R | Gets a list of connectors in flow object.
Statistics | vcStatistics | RW | Defines a Statistics behavior that collects data generated by this flow during a simulation.

Behavior Specific Properties

Boolean Property Creator

Boolean Property Creator adds/sets the value of a Boolean type property in a component. It is recommended to use a Python Script to create and set properties.

Name | Type | Access | Description
Create | Boolean | RW | Defines if a property is created when no property in a component matches VariableName.
Enabled | Boolean | RW | Turns on/off the use of the creator.
Value | Boolean | RW | Defines the value of a property in a component matching VariableName.
VariableName | String | RW | Defines the name of a property to create/set in a component.

Container Filler

Container Filler fills a container type behavior in a component which has a defined pattern. Generally, a component will have a Component Pattern Location behavior. In such cases, a Container Filler will read the behavior's pattern, and then create the needed components. Be aware vcContainerFiller is the type of a Container Filler in Python API. However, it does not have a separate implementation.

Name | Type | Access | Description
Container | String | RW | Defines the name of the container to be filled with a component. Generally, you would not want to set this property unless you know the exact name of the container type behavior to be filled in a component.
Part | String | RW | Defines the URI or VCID of the filler's template.
TemplateComponent | vcComponent | RW | Defines the template used by filler to create components in a container.

Integer Property Creator

Integer Property Creator adds/sets the value of an integer type property in a component. It is recommended to use a Python Script to create and set properties.

Name | Type | Access | Description
Create | Boolean | RW | Defines if a property is created when no property in a component matches VariableName.
Enabled | Boolean | RW | Turns on/off the use of the creator.
Value | Integer | RW | Defines the value of a property in a component matching VariableName.
VariableName | String | RW | Defines the name of a property to create/set in a component.

Real Property Creator

Real Property Creator adds/sets the value of a real number type property in a component. It is recommended to use a Python Script to create and set properties.

Name | Type | Access | Description
Create | Boolean | RW | Defines if a property is created when no property in a component matches VariableName.
Enabled | Boolean | RW | Turns on/off the use of the creator.
Value | Real | RW | Defines the value of a property in a component matching VariableName.
VariableName | String | RW | Defines the name of a property to create/set in a component.

String property Creator

String Property Creator adds/sets the value of a string type property in a component. It is recommended to use a Python Script to create and set properties.

Name | Type | Access | Description
Create | Boolean | RW | Defines if a property is created when no property in a component matches VariableName.
Enabled | Boolean | RW | Turns on/off the use of the creator.
Value | String | RW | Defines the value of a property in a component matching VariableName.
VariableName | String | RW | Defines the name of a property to create/set in a component.

Methods

Name | Return Type | Parameters | Description
checkCapacity Boolean vcComponent component, Integer index Tests if the flow object has the capacity to store a given component that passes through a connector at a given index.

Generally, this method is used to test the arrival of components at different connectors in order to route components effectively and avoid bottlenecks.

The test passes if CapacityAvailable is set to True. In cases where the flow object has physical capacity to store components, the test depends on the container's ComponentCount and Capacity properties as well as the capacity test used by a connector.

See vcConnector for more information.
getConnectorCount | Integer | None | Gets the number of connectors/ports in the flow object.
getConnector vcConnector Integer index

or

String name

 Returns a connector at a given index or one that matches a given name in the flow object; otherwise returns None.
setConnection | vcConnector | Integer index, vcConnector to_connector | Connects a connector at a given index in the flow object to a given connector.


vcFrameFeature

vcFrameFeature is a type of feature used to reference a point in the 3D world.

Inherits: vcFeature

Properties

Name | Type | Access | Description
FramePositionMatrix | vcMatrix | R | Gets the position matrix of frame.
OriginalFramePositionMatrix | vcMatrix | R | Gets the original position matrix of frame.

Examples

Example. Frame position matrix relative to its containing node's coordinate system

from vcScript import *

app = getApplication()
comp = app.findComponent("Feeder Template")
node = comp.findNode("Feeder Template")
feature = node.findFeature("Frame" )
pos = feature.NodePositionMatrix
print pos.N.X, pos.N.Y, pos.N.Z


vcFrameSet

vcFrameSet is a type of geometry set that contains a collection of frames.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
FrameCount | Integer | R | Gets the number of frames in set.

Methods

Name | Return Type | Parameters | Description
createFrame | None | vcMatrix | Creates a new frame in set.
deleteFrame | None | Integer index | Deletes a frame at a given index from set.
getFrame | vcMatrix | Integer index | Returns the position matrix of a frame at a given index in set.
setFrame | None | Integer index, vcMatrix frame_matrix | Sets the position matrix of a frame at a given index in set.
update | None | None | Updates all frames in set, thereby updating the set's bound box.

Examples

Example. Create a ring of frames in a set

from vcScript import *
import vcMatrix as mtx

app = getApplication()
comp = getComponent()

#simple demo that clears geometry sets in root node Geometry container
#you could also use a Geometry feature and its Geometry container for this demo
comp.Geometry.clear()
gs = comp.Geometry.createGeometrySet(VC_FRAMESET)

#create full circle of frames in set
degrees = 360
for i in xrange(degrees):
gs.createFrame(mtx.new())
gs.update()

for i in xrange(gs.FrameCount):
frame = gs.getFrame(i)
frame.translateAbs(1000.0, 0.0, 0.0)
frame.rotateAbsY(degrees)
degrees = degrees - 1
gs.setFrame(i, frame)
gs.update()

comp.rebuild()
app.render()


vcFrameSetVisualization

vcFrameSetVisualization is a list containing properties that affect the display of frames in the 3D world.

Properties

Name | Type | Access | Description
AxisTextVisible | Boolean | RW | Turns on/off the display of axis labels for Frame features in set. That is, XYZ labels for coordinate axes in a Frame feature. This property is disabled if FramesVisible is set to False.
ConnectingLinesVisible | Boolean | RW | Defines if lines are drawn in the 3D world between each Frame feature in set. The line type is defined by the LineDisplayMode property.
CustomIcon | String | RW | Defines the name of a vc3DIcon object used for rendering each Frame feature in set. Other properties determine if and how a 3D icon is used with the set.
FixedSize | Boolean | RW | Defines if CustomIcon is scaled to have a constant size relative to a user's 3D world view. This property is enabled when FrameDisplayMode is set to use icons and FramesVisible is set to True.
FrameDisplayMode | Long | RW | Defines the mode for rendering Frame features in set. This property is disabled if FramesVisible is set to False. See Frame Display Mode Constants for more information.
FramesVisible | Boolean | RW | Turns on/off the display of Frame features in set.
LineDisplayMode | Long | RW | Defines the mode for rendering lines between Frame features in set. This property is disabled if ConnectingLinesVisible is set to False. See Line Display Mode Constants for more information.
LoopLines | Boolean | RW | Defines if a line is drawn to connect the first and last Frame feature in set. This property is disabled if ConnectingLinesVisible is set to False.
Material | String | RW | Defines the material of Frame features in set. This might be overridden by the material of CustomIcon or an individual Frame feature.
NamesVisible | Boolean | RW | Defines if the name of each Frame feature in set is displayed in the 3D world. This property is disabled if FramesVisible is set to False. Note: Displaying the names of Frame features can slow performance and degrade usability when a large amount of Frame features are contained in a small area.

See also vcPathObject and vcPathObjectSegment.


vcGeometryContainer

vcGeometryContainer is a container used to store all types of geometry sets for nodes and Geometry features.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
BoundCenter | vcVector | R | Gets a vector from the origin to the center of the container's bound box.
BoundDiagonal | vcVector | R | Gets a half diagonal vector from the center to an upper corner of the container's bound box using positive axis directions.
GeometrySetCount | Integer | R | Gets the amount of geometry sets in container.
GeometrySets | List of vcGeometrySet | R | Gets a list of geometry sets in container.

Methods

Name | Return Type | Parameters | Description
clear | None | None | Removes all geometry sets from container.
cloneGeometrySets None vcGeometryContainer container, [vcMatrix offset] Copies all geometry sets in the container to a given container.

An optional offset argument can be given to offset the copied geometry, thereby making it easier to distinguish the original from its copy.

In this case, geometry is shared between both containers.
createGeometrySet vcGeometrySet Enumeration type Creates a new geometry set of a given type in container.

See Geometry Constants for more information.
deleteGeometrySet None Integer index

or

vcGeometrySet set

 Deletes a given geometry set or one at a given index from container.
getGeometrySet | vcGeometrySet | Integer index | Returns a geometry set at a given index in container.
moveGeometrySets None vcGeometryContainer container, [vcMatrix offset] Moves all geometry sets in the container to a given container.

An optional offset argument can be given to offset the moved geometry, for example to apply a node offset.

In this case, geometry is not shared between both containers since the original container is now empty.
setModified | None | None | Marks the geometry of container as being modified, thereby alerting the application that changes need to be saved to file.
transformContent | None | vcMatrix matrix | Transforms all geometry sets of container by the given matrix.
update | None | None | Updates the bound box of container.


vcGeometryFeature

vcGeometryFeature is the object type for Geometry features in a component.

Inherits: vcFeature

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
AmbientOcclusion | Enumeration | RW | Defines if geometry supporting ambient occlusion is rendered in the 3D world. 0 VC_AMBIENT_OCCLUSION_NONE 1 VC_AMBIENT_OCCLUSION_VERTEX
CreaseAngle | Real | RW | Defines an angle tolerance for smoothing surfaces based on camera angle and lighting calculations. For example, if the angle between edges of a surface is less than CreaseAngle, the affected triangle sets will appear as one smooth face.
Geometry | vcGeometryContainer | R | Gets the container of feature's geometry.
IsUnique | Boolean | R | Indicates if the feature and its geometry is unique or shared with other features. (Deprecated) Use the IsUnique property in vcComponent.
OnDemandLoad | Boolean | RW | Defines if geometry of feature is loaded when the feature is being used or enabled in its node. Generally, this property is used with a Switch feature to show/hide geometry based on a user's choice.
Pickable | Boolean | RW | Turns on/off the ability to select geometry of feature in the 3D world. Note: This affects all commands and tools that use snap types.
ShowContent | Boolean | RW | Turns on/off the visibility of feature.
ShowBackfaces | Boolean | RW | Turns on/off the rendering of geometry in the feature that is not facing the camera of the 3D world.
TesselationQuality | Real | RW | Defines the quality of feature's geometry by affecting both angle and chord height tolerances used for tessellating the feature. Note: This property does not set any fractional tolerance values as it relates to the degree of accuracy.
Uri | String | RW | Defines the URI of source file for geometry used in feature. Writing this property will override any existing geometry in the feature and cannot be undone.

Methods

Name | Return Type | Parameters | Description
makeUnique | None | None | Makes the feature and its geometry unique, thereby the geometry is not shared with other features. (Deprecated) Use the makeUnique() method in vcComponent.

Examples

Example. Create a Geometry feature for a geometry file

from vcScript import *

app = getApplication()
comp = app.findComponent("Feeder Template")
node = comp.findNode("Feeder Template")
rootFeature = node.findFeature("Root")

geometryFeature = rootFeature.createFeature(VC_GEOMETRY, "Geometry")
geometryFeature.Uri = "file:///C:\Documents\car.3ds"

Example. Restrict the selection of Geometry feature in 3D world

from vcScript import *

comp = getComponent()
geo_f = [x for x in comp.RootFeature.Children if x.Type == VC_GEOMETRY]
for f in geo_f:
f.Pickable = False


vcGeometrySet

vcGeometrySet is the base class for any type of geometry set in a component.

Contents ShowHide

Hierarchy

Properties

Methods

Hierarchy

vcGeometrySet is a collection of one type of geometry primitives. Therefore, each type of geometry set has its own implementation, and different types cannot belong to the same geometry set.

vcGeometrySet

vcCompactLineSet

vcFrameSet

vcLineSet (Deprecated) use vcCompactLineSet

vcPoint (Deprecated)

vcPointSet

vcPolygonSet (Deprecated) use vcTriangleSet

vcText2DSet

vcText3DSet

vcTriangleSet

Properties

Name | Type | Access | Description
Billboard | Boolean | RW | Defines if geometry of set is always facing the 3D world camera. Generally, this property is used for billboard text and is only supported for the following types: vcCompactLineSet vcPointSet vcText2DSet vcTriangleSet
BoundCenter | vcVector | R | Gets a vector from the origin to the center of the container's bound box.
BoundDiagonal | vcVector | R | Gets a half diagonal vector from the center to an upper corner of the container's bound box using positive axis directions.
Container | vcGeometryContainer | R | Gets the geometry container of set.
Feature | vcFeature | R | Gets the feature that the set belongs to in node feature tree.
FixedSize | Boolean | RW | Defines if the size of set visually remains the same in the 3D world regardless of camera position. This property is only supported for the following types: vcCompactLineSet vcPointSet vcText2DSet vcTriangleSet
Layer | vcLayer | RW | Defines the layer that the set belongs to in layout.
LightAmbientTexture | Boolean | RW | Defines if the material texture of set is used to affect ambient light intensity and shininess of surfaces. (Deprecated)
LightAmbientVertex | Boolean | RW | Defines if vertex color/intensity is blended with light rays to render ambient lighting effect. (Deprecated)
Material | vcMaterial | RW | Defines the material of set. If None, the set uses default render settings.
Name | String | RW | Defines the name of set.
Type | Enumeration | R | Gets the set type. See Geometry Constants for more information.
UseBackface | Boolean | RW | Defines if geometry of set is rendered when not facing the 3D world camera.
VertexColor | Enumeration | RW | Defines if the set uses vertex coloring. See Geometry Constants for more information.

Methods

Name | Return Type | Parameters | Description
updateBoundIncrementally | vcVector | Real x, Real y, Real z or vcVector vector | Increments the bound box of the set's component.


vcHelpers.Application

vcHelpers.Application is a library of useful classes and methods designed to simplify common application related tasks. For example, the library contains methods for creating modal and non-modal dialog boxes as well as other methods involving user interaction and feedback.

Contents ShowHide

Non-modal Dialog Box

Constructors

Properties

Methods

Modal Dialog Box

Constructors

Methods

Miscellaneous Methods

Examples

Non-modal Dialog Box

Non-modal dialog box is a dialog that allows a user to interact with the 3D world while the dialog is open in the current session. Properties can be added to show or enter information.

See Example. Create a non-modal dialog box with tabs for a basic implementation of this dialog type.

Constructors

Name | Return Type | Parameters | Description
getDialog | vcHelpers.Application.DialogObject | [String caption] | Creates a new DialogObject object representing a non-modal dialog box. An option caption argument can be given to define the title caption of the dialog.

Properties

Name | Type | Access | Description
CurrentTab | String | RW | Defines the active tab in the dialog. This property can be overridden by using the showTabs() method.
GeneralTabCaption | String | RW | Defines the label for the first tab in the dialog.
Name | String | RW | Defines the text displayed in the title bar of the dialog.

Methods

Name | Return Type | Parameters | Description
addProperty | None | String name, Enumeration type, String onchanged, Enumeration constraints | Adds a new property to the dialog. If a property with the given name exists, that property is deleted and replaced with the new property. The onchanged argument can be used to call a function for handling property value changes; otherwise give a None value. A tab is added to the dialog when you add a property using the following format for its name argument. [TabName]::[PropertyName] See Property Constants for more information on property types and constraints.
destroyWindow | None | None | Hides and destroys the dialog.
getProperty | vcProperty | String name | Returns a property of the dialog matching the given name; otherwise returns None.
hide | None | None | Hides the dialog.
show | None | None | Shows the dialog.
showTabs | None | [String tabName] | Shows the dialog and its tabs. An optional tabName argument can be used to define which tab is listed first and active in the dialog. If there is no tab matching the given tabName or the method is called without any argument, the first listed tab is used in the dialog. By default, the first tab is named General.

Modal Dialog Box

The modal dialog box is a dialog used to request essential information for a user. When this type of dialog is shown, interaction with the 3D world cannot proceed until a user closes the dialog.

See Example. Command to create a modal dialog box with tabs for a basic implementation of this dialog type.

Constructors

None. This type of dialog box is created by using the displayPropertyDialog() method to call a modal dialog box bound to a vcCommand type object which acts as the owner of the dialog and its properties.

Methods

Name Return Type Parameters Description
addLimitProperty vcProperty vcCommand owner, Enumeration type, String name, Boolean visible, Boolean rebuild, Boolean update, var* value, String onchanged, var* units, var* min, var* max Adds a property with defined limits to the dialog's owner.

If a property with the given name exists, that property is deleted and replaced with the new property.

The onchanged argument can be used to call a function for handling property value changes; otherwise give a None value.

A tab is added to the dialog when you add a property using the following format for its name argument.

[TabName]::[PropertyName]

The rebuild argument can be used to rebuild geometry referencing the property's value; otherwise give a False value.

The update argument can be used to update a simulation when changing the property's value; otherwise give a False value.

The value argument defines the initial value of the property, whereas the min and max arguments define the property's limits.

The units argument can given as an empty string "" or a unit associated with the property's type.

To show/hide the property in the dialog, use the visible argument.

See Property Constants for more information.
addProperty vcProperty vcCommand owner, Enumeration type, String name, Boolean visible, Boolean rebuild, Boolean update, var* value, String onchanged, var* units Adds a property to the dialog's owner.

If a property with the given name exists, that property is deleted and replaced with the new property.

The onchanged argument can be used to call a function for handling property value changes; otherwise give a None value.

A tab is added to the dialog when you add a property using the following format for its name argument.

[TabName]::[PropertyName]

The rebuild argument can be used to rebuild geometry referencing the property's value; otherwise give a False value.

The update argument can be used to update a simulation when changing the property's value; otherwise give a False value.

The value argument defines the initial value of the property.

The units argument can given as an empty string "" or a unit associated with the property's type.

To show/hide the property in the dialog, use the visible argument.

See Property Constants for more information.
addStepProperty vcProperty vcCommand owner, Enumeration type, String name, Boolean visible, Boolean rebuild, Boolean update, var* value, String onchanged, var* units, List* [value1, ...] Adds a property with defined values to the dialog's owner.

If a property with the given name exists, that property is deleted and replaced with the new property.

The onchanged argument can be used to call a function for handling property value changes; otherwise give a None value.

A tab is added to the dialog when you add a property using the following format for its name argument.

[TabName]::[PropertyName]

The rebuild argument can be used to rebuild geometry referencing the property's value; otherwise give a False value.

The update argument can be used to update a simulation when changing the property's value; otherwise give a False value.

The value argument defines the initial value of the property, whereas possible values are given as optional values in a list.

The units argument can given as an empty string "" or a unit associated with the property's type.

To show/hide the property in the dialog, use the visible argument.

See Property Constants for more information.
displayPropertyDialog Boolean String cmdName, String title, String firstTabName Shows a modal property dialog bound to a command matching the given cmdName.

The cmdName argument is used to find a command owning the dialog and its properties.

The title argument defines the caption of the dialog's title bar.

The firstTabName argument defines the first and active tab of the dialog. You can given an empty string "" if no tabs are required in the dialog.

Miscellaneous Methods

The following methods are available when importing the vcHelpers.Application library.

Name | Return Type | Parameters | Description
copyProperties | None | vcComponent comp1, vcComponent comp2 | Copies the properties of a component to another component. The comp1 argument defines the component whose properties are copied. The comp2 argument defines the component which gets the copied properties.
endMessage | None | String message | Prints a given message to the Output panel and unblocks the application.
findCommand | vcCommand | String name | Returns a command in the application matching the given name; otherwise returns None.
progressMessage | None | String message, Real fraction | Prints a given message to the Output panel and updates the value of the progress bar based on a given fraction ranging from 0.0 to 1.0. Generally, this is used to provide feedback to a user about the progress of one or actions. This method does not unblock the application.
progressStdMessage | None | Real completed, Real total | Displays the status of an operation based on a given amount of work completed in relation to the total amount of work. This method does not unblock the application.
startMessage | None | String message | Prints a given message to the Output panel. Using this method, progressMessage() or progressStdMessage() will block the application, thereby preventing user interaction. To unblock the application, use the endMessage() method.

Examples

Example. Create a non-modal dialog box with tabs

### first create a button property in a component, name it 'Button_1' and
### then copy paste following script to test non-modal dialog box
from vcScript import *
from vcHelpers.Application import *

def button_event_1(arg):
global diag
diag = getDialog()

par1 = diag.addProperty('Text 1',VC_STRING, None)
par2 = diag.addProperty('Text 2',VC_STRING, None)
par3 = diag.addProperty('Text 3',VC_STRING, None)
par4 = diag.addProperty('Button', VC_BUTTON, button_event_1)

par2_1 = diag.addProperty('Tab2::Text2_1',VC_STRING, None)
par2_2 = diag.addProperty('Tab2::Text 2_2',VC_STRING, None)
par2_3 = diag.addProperty('Tab2::Text 2_3',VC_STRING, None)
par3_1 = diag.addProperty('Tab3::Property1',VC_BOOLEAN, None)

diag.Name = "Test non-modal Dialog"
diag.GeneralTabCaption = 'Tab1'
diag.showTabs()
diag.show()
comp = getComponent()
button_ = comp.getProperty('Button_1')
button_.OnChanged = button_event_1

Example. Command to create a modal dialog box with tabs

from vcScript import *
from vcHelpers.Application import *
from vcCommand import *

cmd = getCommand()

def create_cmd_properties():

#Read command existing properties
props = cmd.Properties

#First lets delete all the properties of the command
while(len(props)>0):
p = props.pop()
try:
cmd.deleteProperty(p.Name)
except:
pass

# Create some properties for Tab 1
par1 = addProperty(cmd,VC_STRING,'Text 1',True,False,False,'',None,'')
par2 = addProperty(cmd,VC_STRING,'Text 2',True,False,False,'',None,'')
par3 = addProperty(cmd,VC_STRING,'Text 3',True,False,False,'',None,'')

# For generating more Tabs just add properties with names as "Tab2::Property1","Tab3::Property2"...

par2_1 = addProperty(cmd,VC_STRING,'Tab2::Text 2_1',True,False,False,'',None,'')
par2_2 = addProperty(cmd,VC_STRING,'Tab2::Text 2_2',True,False,False,'',None,'')
par2_3 = addProperty(cmd,VC_STRING,'Tab2::Text 2_3',True,False,False,'',None,'')
par3_1 = addProperty(cmd,VC_STRING,'Tab3::Property',True,False,False,'',None,'')

# Method that displays the dialog waits until a button is pressed
def display_command_properties():
ok = displayPropertyDialog(cmd.Name,'Tabs Example', 'Tab 1')
if not ok:
print 'Aborted'
return False
return True

def first_State():

#Call the method that creates the properties
create_cmd_properties()
display_command_properties()

cmd.addState(first_State)


vcHelpers.Math

vcHelpers.Math is a library of helpful methods for calculating common geometric problems.

Contents ShowHide

Constants

Methods

Examples

Constants

Name | Value
DEG_TO_RAD | 0.017453292519943295769236907684886
PI | 3.1415926535897932384626433832795
RAD_TO_DEG | 57.296779513082320876798154814105
ZERO | 0.0001

Methods

Triangular Solvers

a = side1

b = side2

c = side3

alpha = angle1

beta = angle2

gamma = angle3

Name | Return Type | Parameters | Description
sasa | Real angle1 | Real side1, Real angle3, Real side2 | Returns the value of alpha in radians.
sass | Real side3 | Real side1, Real angle3, Real side2 | Returns the value of b.
sssa | Real angle1 | Real side1, Real side2, Real side3 | Returns the value of alpha in radians.

Quadrilateral Solvers

A = side1

B = side2

C = side3

D = side4

a = angle1

b = angle2

c = angle3

d = angle4

Name | Return Type | Parameters | Description
sasasa | Real angle3 | Real side1, Real angle1, Real side2, Real angle2, Real side3 | Returns the value of c in radians.
sasass | Real side4 | Real side1, Real angle1, Real side2, Real angle2, Real side3 | Returns the value of D.
sasssa1 | Real angle2 | Real side1, Real angle1, Real side2, Real side3, Real side4 | Returns the value of b in radians.
sasssa2 | Real angle3 | Real side1, Real angle1, Real side2, Real side3, Real side4 | Returns the value of c in radians.
sasasad | Real angle3 | Real side1, Real angle1, Real side2, Real angle2, Real side3 | Returns the value of c in degrees.
sasassd | Real side4 | Real side1, Real angle1, Real side2, Real angle2, Real side3 | Returns the value of D.
sasssa1d | Real angle2 | Real side1, Real angle1, Real side2, Real side3, Real side4 | Returns the value of b in degrees.
sasssa2d | Real angle3 | Real side1, Real angle1, Real side2, Real side3, Real side4 | Returns the value of c in degrees.
trapezoid | Real y | Real a, Real b, Real x, Real c, Real d | Return a value between 0-1 based on the x location on trapezoid defined by a,b,c,d.
trapesine | Real y | Real a, Real b, Real x, Real c, Real d | Return a value between 0-1 based on the x location on trapezoid defined by a,b,c,d with sinusoidal ramps.

Matrix to Expression Conversion

Name | Return Type | Parameters | Description
matrixExpr | String | vcMatrix M, [Real tolerance] | Converts a given vcMatrix object to a string expression.

Examples

Example. Print angle between side2 and side3 in a triangle

from vcScript import *
from vcHelpers.Math import *

#angle in radians
print sssa(1.0, 1.0, 1.0)

#angle in degrees
print (sssa(1.0,1.0,1.0)*180.0)/PI

Example. Print expression of 4x4 matrix

from vcHelpers.Math import *
import vcMatrix

#prints Tx(100).Ty(100).Tz(100)
m = vcMatrix.new()
m.translateAbs(100,100,100)
print matrixExpr(m)


vcHelpers.Robot

vcHelpers.Robot is a library of useful classes and methods designed to simplify common robot programming tasks.

Contents ShowHide

Constructors

Properties

Methods

Miscellaneous Methods

Examples

Constructors

vcRobot is the object type used for programming a robot, its controller and executor with this library.

Name Return Type Parameters Description
getRobot vcHelpers.Robot.vcRobot String interface_name

or

vcComponent robot_component

or

[no argument]

 Creates a new vcRobot object for a given component which must have a robot executor.

One option is to give the name of an interface a robot is connected to in a component as an argument, for example a robot mounted on a pedestal. If found, the robot connected at the interface is used by the constructor.

A second option is to give the component of a robot you want to program as an argument.

A third option is to not give any argument, thereby a component owning the script is used by the constructor.

Properties

Name | Type | Access | Description
Acc | Real | RW | Defines the Cartesian acceleration of robot for linear movements.
ActiveTool | String/Integer | RW | Defines the active tool frame of robot by referencing the name or index of a tool frame in Tools property.
AngularAcc | Real | RW | Defines the angular acceleration of robot for linear movements.
AngularSpeed | Real | RW | Defines the angular speed of robot for linear movements.
Bases | List of vcBaseFrame | R | Gets a list of all base frames available in robot.
Component | vcComponent | R | Gets the component of robot.
Configuration | String/Integer | RW | Defines the configuration of robot. Set this property to None to use the current configuration of the robot. Note: The default configuration is -1/last configuration in ConfigurationsList.
ConfigurationsList | List of String | R | Gets a list of robot's configurations by name.
Controller | vcRobotController | R | Gets the controller of robot.
Executor | vcRslProgramExecutor | R | Gets the executor of robot.
GraspContainer | vcContainer | RW | Defines the Component Container behavior in the robot's flange node used to contain components grabbed by the robot.
Joints | List of vcJoint | R | Gets a list of joints used by robot.
JointForce | Real | RW | Defines the joint force (0-100%) used by robot for joint/point-to-point movements.
JointSpeed | Real | RW | Defines the joint speed (0-100%) used by robot for joint/point-to-point movements.
MotionTime | Real | RW | Defines a time used for scaling the acceleration and speed of robot motions to match the given time. If zero value, a motion's acceleration and speed determines its motion time. That is, this property has no effect.
RecordRoutine | String | RW | Defines a sequence in the robot where new statements are added when RecordRSL is set to True. This property must be defined before setting RecordRSL to True. By default, new statements are added to the MainRoutine of the robot.
RecordRSL | Boolean | RW | Defines if actions executed by the robot are recorded as statements in the robot's program. If True, statements are added to a routine defined by RecordRoutine.
SignalMapIn | vcBooleanSignalMap | R | Gets the Boolean Signal Map behavior used for robot inputs.
SignalMapOut | vcBooleanSignalMap | R | Gets the Boolean Signal Map behavior used for robot outputs.
Speed | Real | RW | Defines the Cartesian speed used by the robot for linear movements.
Tools | List of vcBaseFrame | R | Gets a list of the robot's tool frames.

Methods

Name | Return Type | Parameters | Description
callSubRoutine | None | String rName | Calls a predefined routine by name in the robot's program.
comment | None | String comment | Prints a given comment to the Output panel and records a Comment statement for this action in the robot's program.
delay | None | Real delay | Executes a timed delay (in seconds) and records a Delay statement for this action in the robot's program.
driveJoints None [Real j1], [Real j2], [Real j3], [Real j4], [Real j5], [Real j6], [Real motiontime], [Boolean relative], [Real ExtraJoints] Drives one or more joints in the robot to given target values.

If no value is given for a joint, the current value of the joint is used by the robot.

Optional arguments j1 to j6 are target values for joints 1 through 6 in a robot, with six joints being common in articulated robots.

An optional motiontime argument can be given to scale the acceleration and speed of the robot's motion to match the given time. The default value is zero in which scaling is disabled.

An optional relative argument can be used to set target values as relative to the current value of each joint. The default value is False in which target values are absolute joint values.

An optional ExtraJoints argument can be given as a list of joint values for additional joints in a robot, for example external joints of a robot mounted on a track and remotely connected to a workpiece positioner.

Tip: Joints can be individually driven by controller; see methods in vcServoController.
followNode None vcNode Basenode, [Real FollowTime] Defines a node in the 3D world to be followed by the robot for a set amount of time.

An optional FollowTime argument can be given to set the amount of time the robot should follow the target node. The default value is 1.0/one second.
getConfigNames | List of String | vcRslProgramExecutor executor, vcRobotController controller | Returns a list of available configurations by name for the robot.
graspComponent | None | vcComponent graspthis | Grasps a given component using robot.
graspComponents | None | List of vcComponent graspthese | Grasps a given list of components using the robot.
jointMoveRel None [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz] Executes a joint movement relative to the current pose of robot based in active tool's coordinate system.

Optional arguments Tx, Ty and Tz are translation movements in the XYZ coordinate axes.

Optional arguments Rx, Ry and Rz are rotation offsets for the XYZ coordinate axes.
jointMoveToComponent None vcNode ToComp, [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [vcFeature/String ToFrame], [String OnFace] Executes a joint movement to a given component, which by default is the component's origin.

Optional arguments Tx, Ty and Tz are offsets for target position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target orientation. The default value for rotations is zero.

An optional ToFrame argument can be used to set the target location to be a Frame feature in a component. A Frame feature can be given as a vcFeature object or referenced by name.

An optional OnFace argument can be used to set the target location to be a face of a component's bound box. A bound box face can be referenced by using one of six recognized names (top, bottom, left, right, front, back).

If ToFrame and OnFace arguments are given, the method will first try to use ToFrame.
jointMoveToMtx None [vcMatrix ToMtx], [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [String CS] Executes a joint movement to a given target matrix, otherwise the 3D world origin.

An optional ToMtx argument defines the target matrix in the selected coordinate system for this method. By default, the identity matrix is based on World origin.

Optional arguments Tx, Ty and Tz are offsets for target matrix position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target matrix orientation. The default value for rotations is zero.

An optional CS argument can be used to set the coordinate system used for target calculation, which by default is the World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.
jointMoveToPosition None Real Tx, Real Ty, Real Tz, Real Rx, Real Ry, Real Rz, String CS Executes a joint movement to a target defined by given XYZ coordinate values and roll, pitch and yaw values based in a given coordinate system.

The Tx, Ty and Tz arguments define the target's XYZ coordinate values.

The Rx, Ry and Rz arguments define the target's orientation or ABC values.

Rx
C target value (Roll)

Ry
B target value (Pitch)

Rz
A target value (Yaw)

The CS argument defines the coordinate system used for target calculation, which default is World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.

After the target is calculated, a point-to-point motion statement is created in the robot's program which uses the robot's first indexed tool frame. The orientation of that tool frame can affect the TargetABC properties of the motion statement.
linearMoveRel None Real Tx, Real Ty, Real Tz, Real Rx, Real Ry, Real Rz Executes a linear movement relative to the current pose of robot based in active tool's coordinate system.

The Tx, Ty and Tz arguments are translation movements in XYZ coordinate axes.

The Rx, Ry and Rz arguments are rotation offsets for XYZ coordinate axes.
linearMoveToComponent None vcNode ToComp, [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [vcFeature/String ToFrame], [String OnFace] Executes a linear movement to a given component, which by default is the component's origin.

Optional arguments Tx, Ty and Tz are offsets for target position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target orientation. The default value for rotations is zero.

An optional ToFrame argument can be used to set the target location to be a Frame feature in a component. A Frame feature can be given as a vcFeature object or referenced by name.

An optional OnFace argument can be used to set the target location to be a face of a component's bound box. A bound box face can be referenced by using one of six recognized names (top, bottom, left, right, front, back).

If ToFrame and OnFace arguments are given, the method will first try to use ToFrame.
linearMoveToMtx None [vcMatrix ToMtx], [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [String CS] Executes a linear movement to a given target matrix, otherwise the 3D world origin.

An optional ToMtx argument defines the target matrix in the selected coordinate system for this method. By default, the identity matrix is based on World origin.

Optional arguments Tx, Ty and Tz are offsets for target matrix position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target matrix orientation. The default value for rotations is zero.

An optional CS argument can be used to set the coordinate system used for target calculation, which by default is the World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.
linearMoveToMtx_ExternalBase None vcNode Basenode, vcMatrix ToMtx, [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz] Executes a linear movement to a given target matrix based in given node's coordinate system.

Generally, this method is used when a robot needs to motion to a moving part, for example a pallet on a conveyor.

Optional arguments Tx, Ty and Tz are offsets for target matrix position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target matrix orientation. The default value for rotations is zero.
linearMoveToPosition None Real Tx, Real Ty, Real Tz, Real Rx, Real Ry, Real Rz, String CS Executes a linear movement to a target defined by given XYZ coordinate values and roll, pitch and yaw values based in a given coordinate system.

The Tx, Ty and Tz arguments define the target's XYZ coordinate values.

The Rx, Ry and Rz arguments define the target's orientation or ABC values.

Rx
C target value (Roll)

Ry
B target value (Pitch)

Rz
A target value (Yaw)

The CS argument defines the coordinate system used for target calculation, which default is World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.

After the target is calculated, a linear motion statement is created in the robot's program which uses the robot's first indexed tool frame. The orientation of that tool frame can affect the TargetABC properties of the motion statement.
mountTool | None | vcComponent Tool | Mounts a given component to flange node of robot.
moveAway None [Real Tz] Executes a linear retraction movement relative to current pose of robot.

An optional Tz argument can be given to set retraction distance, which by default is 200.
pick None vcComponent Part, [Real Approach], [Real Tx], [Real Ty], [Real Tz], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [String OnFace], [String ApproachAxis] Executes a sequence of actions in order for robot to pick a given component.

Action 1
Robot executes a joint movement based on target component origin and Approach, OnFace and ApproachAxis values.

Action 2
Robot executes a linear movement to target component based on OnFace value.

Action 3
Target component is grabbed by robot.

Action 4
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, the robot will use an approach distance of 200 aligned to Z-axis in order to pick from the top face of a given component's bound box.

The pick location can be offset using the optional Tx, Ty, Tz, Rx, Ry, and Rz arguments.

An optional OnFace argument allows you to set which face of Part bound box to use for Action 2.

An optional ApproachAxis argument sets the axis of alignment.
pickFromPallet vcComponent vcComponent Pallet, [Real Approach], [Boolean InversedOrder], [Integer Index] Executes a sequence of actions in order for the robot to pick a component from a given Pallet.

Action 1
Get a list of components attached to Pallet. That is, a list of child components.

Action 2
Select child component to pick based on InversedOrder and Index values.

Action 3
Robot executes a joint movement based on child component origin and Approach value.

Action 4
Robot executes a linear movement to top face of child component.

Action 5
Child component is grabbed by robot.

Action 6
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, the robot will use an approach distance of 200 to pick the last component of a list of child components for Pallet.

An optional Approach argument can be used to change the approach and retract distance used by robot.

An optional InversedOrder argument can be used to reverse the list of child components acquired in Action 1. A True value reverses the order, so last component attached to Pallet is first in list. The default value is False.

An optional Index argument can be used to select which child component of Pallet is picked by robot. The default value is -1, so last component in Action 1 child components list.
pickMovingPart None vcComponent Part, [Real Approach], [Real Tx], [Real Ty], [Real Tz], [Real Tz], [Real Rx], [Real Ry], [Real Rz] Executes a sequence of actions in order for the robot to pick a given component that is not stationary.

Action 1
Robot executes joint movement based on target component origin and Approach value.

Action 2
Robot executes linear movement to top face of target component bound box.

Action 3
Target component is grabbed by robot.

Action 4
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, the robot will use an approach distance of 200 and calculate motion targets based on speed of Part.

The pick location can be offset using the optional Tx, Ty, Tz, Rx, Ry, and Rz arguments.
place None vcComponent ToComp, [Real Approach], [Real Tx], [Real Ty], [Real Tz], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [vcComponent Part], [String ApproachAxis] Executes a sequence of actions in order for the robot to place a grasped component at a given component.

Action 1
Robot executes joint movement based on ToComp origin, Approach and ApproachAxis values.

Action 2
Robot executes linear movement to top face of ToComp.

Action 3
Grasped component is released by robot to ToComp.

Action 4
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, a robot will use an approach distance of 200 and the bound box of grasped component to calculate motion targets.

The place location can be offset using optional Tx, Ty, Tz, Rx, Ry, and Rz arguments.

An optional Part argument can be used to define which component is placed to ToComp. The default is the first component listed in robot's GraspContainer.

An optional ApproachAxis argument can be used to define the axis of alignment.
placeInPattern None vcComponent ToComp, Integer X_index, Integer Y_index, Integer Z_index, Integer PatternSize_X, PatternSize_Y, Integer PatternSize_Z, [Real Approach], [vcComponent Part], [Real StepSizeX], [Real StepSizeY], [Real StepSizeZ], [Real Rz] Executes a sequence of actions in order for the robot to place components in a given pattern.

Action 1
Robot executes joint movement to ToComp.

Action 2
Robot executes linear movement to place location.

Action 3
Grasped component is released by robot to ToComp.

Action 4
Robot executes linear retraction movement away from place location.

All three motions executed by the robot are created dynamically during a simulation.

By default, a robot will use an approach distance of 200, the bound box of grasped component and the given pattern to calculate motion targets.

The X_index, Y_index and Z_index arguments define the index position for placing a component based on pattern size.

The PatternSize_X, PatternSize_Y and PatternSize_Z arguments define the pattern size.

An optional ApproachAxis argument can be used to define the axis of alignment.

An optional Part argument can be used to define which component is placed to ToComp. The default is the first component listed in robot's GraspContainer.

Optional StepSizeX, StepSizeY and StepSizeZ arguments can be used to define the pattern step size for XYZ axes. The default step size values are length, width and height of Part.

An optional Rz argument can be used to define a Z-axis rotation offset for place location.
releaseAllComponents None vcNode/vcContainer ToObject Attaches all components of robot's GraspContainer to a given node or container type behavior.

If ToObject is a component, a target container is searched for automatically in the component. If not found, the components are directly attached to the given node.
releaseComponent None vcNode/vcContainer ToObject, vcNode ReleaseThis Attaches a component to a given node or container type behavior.

If ToObject is a component, a target container is searched for automatically in the component. If not found, the released component is directly attached to the given node.

The ReleaseThis argument is the component to be detached from robot; otherwise the method will search the robot's GraspContainer.
rsl_BinIn None Integer Index, Boolean Value Waits for a signal mapped to a given port to have the given value.

The Index argument defines the port in the robot's inputs, Boolean Signal Map behavior. The Value argument defines the value that should be received at the port in order to complete execution.

If RecordRSL is set to True, this action is recorded as a new input statement in the robot's program.
rsl_BinOut None Integer Index, Boolean Value Sends a given value to a signal mapped to a given port.

The Index argument defines the port in the robot's outputs, Boolean Signal Map behavior. The Value argument defines the value that should be sent to the mapped signal.

If RecordRSL is set to True, this action is recorded as a new output statement in the robot's program.
traceOff None Integer Index Turns off the tracing of the robot's motions at given tool frame.

The Index argument defines the index position of a tool frame in the robot's Tools which is mapped to a port used for tracing.
traceOn None Integer Index Turns on the tracing of the robot's motions at given tool frame.

The Index argument defines the index position of a tool frame in the robot's Tools which is mapped to a port used for tracing.
unmountTool None vcComponent Tool, vcContainer ToObject

or

vcComponent Tool, vcComponent ToObject

 Dismounts a tool mounted on the robot to either a container type behavior or component.

The Tool argument needs to be a tool component mounted on the robot.

Miscellaneous Methods

The following methods are functions that can be used by importing the vcHelpers.Robot library.

Name | Return Type | Parameters | Description
getSelectedRobotsData | List of robot data (vcRslProgramExecutor, vcRslRoutine, vcRobotController, String BaseName, String Toolname, List of String BaseNames, List of String ToolNames, Integer RobotConfig, List of String RobotConfigs) | None | Returns a list of data for the currently selected robot component in the 3D world. The list of data contains the following: robot program, current routine, robot controller, name of active base frame, name of active tool frame, list of names for all base frames, list of names for all tool frames, index of current configuration, and list of names for all configurations.
printMatrix | None | vcMatrix mtx | Prints a given matrix in a clear, readable format to the Output panel.

Examples

Example. Control a robot with vcHelpers.Robot

#Place this code in a Python Script editor
from vcScript import *
from vcHelpers.Robot import *

def OnRun():
# Get robot object and application object
robot = getRobot()
app = getApplication()

# Find the block component
block = app.findComponent("Block")

# Find the pedestal component
pedestal= app.findComponent("Pedestal")

#Set Robot Tool to Tool1
robot.ActiveTool = 'Tool1'

# Robot move to component
robot.jointMoveToComponent(block, Tz = 200, OnFace = 'top')

# Robot pick component 'block'
robot.pick(block)

# Robot moves away of the object Tz: 300
robot.moveAway(300)

#Robot place component in component 'pedestal'
robot.place(pedestal, 200)

# Robot moves away of the object Tz: 150
robot.moveAway(150)

Example. Drive joints

from vcScript import *
from vcHelpers.Robot import *

robot = getRobot()
#move all 6 joints with method
robot.driveJoints(0, 0, 90, 0, 45, 180)

#moves 4th joint to 45 degrees via controller
#joint numbering starts at 0, so 4th joint is numbered 3
robot.Controller.moveJoint(3, 45)

#move extra joints, e.g robot connected to track
robot.driveJoints(0, 0, 0, 0, 0, 0, 0, False, [-2000])

Example. Follow a Part with a Robot

from vcScript import *
from vcHelpers.Robot import *

#script is located in conveyor with sensor and signal

comp = getComponent()
app = getApplication()
r = getRobot(app.findComponent("Articulated Robot") )

def OnSignal(signal):
global parts

#get part
if signal.Value == True:
path = comp.findBehaviour("MainPath")
node = path.Components[0]
parts.append(node)

def OnRun():
global parts
parts = []
condition(lambda: parts)
p = parts.pop(0)

#move to part
r.linearMoveToMtx_ExternalBase(p, Tz = 100, Ry = 180)

#follow part
r.followNode(p, 1)

#grab part
r.graspComponent(p)
r.moveAway()

Example. Set motion time for movements

robo = getRobot()
robo.MotionTime = 3
robo.jointMoveToComponent('Part')

Example. Record actions as statements in robot program

#pick a component named 'Part'
robo = getRobot()
part = getApplication().findComponent('Part')

#define the location for RSL statements
robo.RecordRoutine = 'MyRecordRoutine'
robo.RecordRSL = True
robo.jointMoveToComponent( part, Tz = 100)
robo.linearMoveToComponent( part, Tz = 0)
robo.graspComponent(part)
robo.moveAway(100)


vcHelpers.Robot2

vcHelpers.Robot2 is a library of useful classes and methods designed to simplify common robot programming tasks.

Contents ShowHide

Constructors

Properties

Methods

Miscellaneous Methods

Examples

Constructors

vcRobot is the object type used for programming a robot, its controller and executor with this library.

Name Return Type Parameters Description
getRobot vcHelpers.Robot.vcRobot String interface_name

or

vcComponent robot_component

or

[no argument]

 Creates a new vcRobot object for a given component which must have a robot executor.

One option is to give the name of an interface a robot is connected to in a component as an argument, for example a robot mounted on a pedestal. If found, the robot connected at the interface is used by the constructor.

A second option is to give the component of a robot you want to program as an argument.

A third option is to not give any argument, thereby a component owning the script is used by the constructor.

Properties

Name | Type | Access | Description
Acc | Real | RW | Defines the Cartesian acceleration of robot for linear movements.
ActiveTool | String/Integer | RW | Defines the active tool frame of robot by referencing the name or index of a tool frame in Tools property.
AngularAcc | Real | RW | Defines the angular acceleration of robot for linear movements.
AngularSpeed | Real | RW | Defines the angular speed of robot for linear movements.
Bases | List of vcBaseFrame | R | Gets a list of all base frames available in robot.
Component | vcComponent | R | Gets the component of robot.
Configuration | String/Integer | RW | Defines the configuration of robot. Set this property to None to use the current configuration of the robot. Note: The default configuration is -1/last configuration in ConfigurationsList.
ConfigurationsList | List of String | R | Gets a list of robot's configurations by name.
Controller | vcRobotController | R | Gets the controller of robot.
Executor | vcExecutor | R | Gets the executor of robot.
GraspContainer | vcContainer | RW | Defines the Component Container behavior in the robot's flange node used to contain components grabbed by the robot.
Joints | List of vcJoint | R | Gets a list of joints used by robot.
JointForce | Real | RW | Defines the joint force (0-100%) used by robot for joint/point-to-point movements.
JointSpeed | Real | RW | Defines the joint speed (0-100%) used by robot for joint/point-to-point movements.
MotionTime | Real | RW | Defines a time used for scaling the acceleration and speed of robot motions to match the given time. If zero value, a motion's acceleration and speed determines its motion time. That is, this property has no effect.
RecordRoutine | String | RW | Defines a sequence in the robot where new statements are added when RecordRSL is set to True. This property must be defined before setting RecordRSL to True. You can refer to the main routine of robot program as 'MainRoutine', the name of an existing subroutine, or give a name for a new subroutine that will be created during the recording.
RecordRSL | Boolean | RW | Defines if actions executed by the robot are recorded as statements in the robot's program. If True, statements are added to a routine defined by RecordRoutine.
SignalMapIn | vcBooleanSignalMap | R | Gets the Boolean Signal Map behavior used for robot inputs.
SignalMapOut | vcBooleanSignalMap | R | Gets the Boolean Signal Map behavior used for robot outputs.
Speed | Real | RW | Defines the Cartesian speed used by the robot for linear movements.
Tools | List of vcBaseFrame | R | Gets a list of the robot's tool frames.

Methods

Name | Return Type | Parameters | Description
callSubRoutine | None | String rName | Calls a predefined routine by name in the robot's program.
comment | None | String comment | Prints a given comment to the Output panel and records a Comment statement for this action in the robot's program.
delay | None | Real delay | Executes a timed delay (in seconds) and records a Delay statement for this action in the robot's program.
driveJoints None [Real j1], [Real j2], [Real j3], [Real j4], [Real j5], [Real j6], [Real motiontime], [Boolean relative], [Real ExtraJoints] Drives one or more joints in the robot to given target values.

If no value is given for a joint, the current value of the joint is used by the robot.

Optional arguments j1 to j6 are target values for joints 1 through 6 in a robot, with six joints being common in articulated robots.

An optional motiontime argument can be given to scale the acceleration and speed of the robot's motion to match the given time. The default value is zero in which scaling is disabled.

An optional relative argument can be used to set target values as relative to the current value of each joint. The default value is False in which target values are absolute joint values.

An optional ExtraJoints argument can be given as a list of joint values for additional joints in a robot, for example external joints of a robot mounted on a track and remotely connected to a workpiece positioner.

Tip: Joints can be individually driven by controller; see methods in vcServoController.
followNode None vcNode Basenode, [Real FollowTime] Defines a node in the 3D world to be followed by the robot for a set amount of time.

An optional FollowTime argument can be given to set the amount of time the robot should follow the target node. The default value is 1.0/one second.
getConfigNames | List of String | vcExecutor executor, vcRobotController controller | Returns a list of available configurations by name for the robot.
graspComponent | None | vcComponent graspthis | Grasps a given component using robot.
graspComponents | None | List of vcComponent graspthese | Grasps a given list of components using the robot.
jointMoveRel None [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz] Executes a joint movement relative to the current pose of robot based in active tool's coordinate system.

Optional arguments Tx, Ty and Tz are translation movements in the XYZ coordinate axes.

Optional arguments Rx, Ry and Rz are rotation offsets for the XYZ coordinate axes.
jointMoveToComponent None vcNode ToComp, [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [vcFeature/String ToFrame], [String OnFace] Executes a joint movement to a given component, which by default is the component's origin.

Optional arguments Tx, Ty and Tz are offsets for target position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target orientation. The default value for rotations is zero.

An optional ToFrame argument can be used to set the target location to be a Frame feature in a component. A Frame feature can be given as a vcFeature object or referenced by name.

An optional OnFace argument can be used to set the target location to be a face of a component's bound box. A bound box face can be referenced by using one of six recognized names (top, bottom, left, right, front, back).

If ToFrame and OnFace arguments are given, the method will first try to use ToFrame.
jointMoveToMtx None [vcMatrix ToMtx], [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [String CS] Executes a joint movement to a given target matrix, otherwise the 3D world origin.

An optional ToMtx argument defines the target matrix in the selected coordinate system for this method. By default, the identity matrix is based on World origin.

Optional arguments Tx, Ty and Tz are offsets for target matrix position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target matrix orientation. The default value for rotations is zero.

An optional CS argument can be used to set the coordinate system used for target calculation, which by default is the World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.
jointMoveToPosition None Real Tx, Real Ty, Real Tz, Real Rx, Real Ry, Real Rz, String CS Executes a joint movement to a target defined by given XYZ coordinate values and roll, pitch and yaw values based in a given coordinate system.

The Tx, Ty and Tz arguments define the target's XYZ coordinate values.

The Rx, Ry and Rz arguments define the target's orientation or ABC values.

Rx
C target value (Roll)

Ry
B target value (Pitch)

Rz
A target value (Yaw)

The CS argument defines the coordinate system used for target calculation, which default is World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.

After the target is calculated, a point-to-point motion statement is created in the robot's program which uses the robot's first indexed tool frame. The orientation of that tool frame can affect the TargetABC properties of the motion statement.
linearMoveRel None Real Tx, Real Ty, Real Tz, Real Rx, Real Ry, Real Rz Executes a linear movement relative to the current pose of robot based in active tool's coordinate system.

The Tx, Ty and Tz arguments are translation movements in XYZ coordinate axes.

The Rx, Ry and Rz arguments are rotation offsets for XYZ coordinate axes.
linearMoveToComponent None vcNode ToComp, [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [vcFeature/String ToFrame], [String OnFace] Executes a linear movement to a given component, which by default is the component's origin.

Optional arguments Tx, Ty and Tz are offsets for target position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target orientation. The default value for rotations is zero.

An optional ToFrame argument can be used to set the target location to be a Frame feature in a component. A Frame feature can be given as a vcFeature object or referenced by name.

An optional OnFace argument can be used to set the target location to be a face of a component's bound box. A bound box face can be referenced by using one of six recognized names (top, bottom, left, right, front, back).

If ToFrame and OnFace arguments are given, the method will first try to use ToFrame.
linearMoveToMtx None [vcMatrix ToMtx], [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [String CS] Executes a linear movement to a given target matrix, otherwise the 3D world origin.

An optional ToMtx argument defines the target matrix in the selected coordinate system for this method. By default, the identity matrix is based on World origin.

Optional arguments Tx, Ty and Tz are offsets for target matrix position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target matrix orientation. The default value for rotations is zero.

An optional CS argument can be used to set the coordinate system used for target calculation, which by default is the World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.
linearMoveToMtx_ExternalBase None vcNode Basenode, vcMatrix ToMtx, [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz] Executes a linear movement to a given target matrix based in given node's coordinate system.

Generally, this method is used when a robot needs to motion to a moving part, for example a pallet on a conveyor.

Optional arguments Tx, Ty and Tz are offsets for target matrix position. The default value for translations is zero.

Optional arguments Rx, Ry and Rz are offsets for target matrix orientation. The default value for rotations is zero.
linearMoveToPosition None Real Tx, Real Ty, Real Tz, Real Rx, Real Ry, Real Rz, String CS Executes a linear movement to a target defined by given XYZ coordinate values and roll, pitch and yaw values based in a given coordinate system.

The Tx, Ty and Tz arguments define the target's XYZ coordinate values.

The Rx, Ry and Rz arguments define the target's orientation or ABC values.

Rx
C target value (Roll)

Ry
B target value (Pitch)

Rz
A target value (Yaw)

The CS argument defines the coordinate system used for target calculation, which default is World coordinate system. The argument can be either "world" or "irobot" which is the robot's coordinate system.

After the target is calculated, a linear motion statement is created in the robot's program which uses the robot's first indexed tool frame. The orientation of that tool frame can affect the TargetABC properties of the motion statement.
mountTool | None | vcComponent Tool | Mounts a given component to flange node of robot.
moveAway None [Real Tz] Executes a linear retraction movement relative to current pose of robot.

An optional Tz argument can be given to set retraction distance, which by default is 200.
pick None vcComponent Part, [Real Approach], [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [String OnFace], [String ApproachAxis] Executes a sequence of actions in order for robot to pick a given component.

Action 1
Robot executes a joint movement based on target component origin and Approach, OnFace and ApproachAxis values.

Action 2
Robot executes a linear movement to target component based on OnFace value.

Action 3
Target component is grabbed by robot.

Action 4
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, the robot will use an approach distance of 200 aligned to Z-axis in order to pick from the top face of a given component's bound box.

The pick location can be offset using the optional Tx, Ty, Tz, Rx, Ry, and Rz arguments.

An optional OnFace argument allows you to set which face of Part bound box to use for Action 2.

An optional ApproachAxis argument sets the axis of alignment.
pickFromPallet vcComponent vcComponent Pallet, [Real Approach], [Boolean InversedOrder], [Integer Index] Executes a sequence of actions in order for the robot to pick a component from a given Pallet.

Action 1
Get a list of components attached to Pallet. That is, a list of child components.

Action 2
Select child component to pick based on InversedOrder and Index values.

Action 3
Robot executes a joint movement based on child component origin and Approach value.

Action 4
Robot executes a linear movement to top face of child component.

Action 5
Child component is grabbed by robot.

Action 6
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, the robot will use an approach distance of 200 to pick the last component of a list of child components for Pallet.

An optional Approach argument can be used to change the approach and retract distance used by robot.

An optional InversedOrder argument can be used to reverse the list of child components acquired in Action 1. A True value reverses the order, so last component attached to Pallet is first in list. The default value is False.

An optional Index argument can be used to select which child component of Pallet is picked by robot. The default value is -1, so last component in Action 1 child components list.
pickMovingPart None vcComponent Part, [Real Approach], [Real Tx], [Real Ty], [Real Tz], [Real Tz], [Real Rx], [Real Ry], [Real Rz] Executes a sequence of actions in order for the robot to pick a given component that is not stationary.

Action 1
Robot executes joint movement based on target component origin and Approach value.

Action 2
Robot executes linear movement to top face of target component bound box.

Action 3
Target component is grabbed by robot.

Action 4
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, the robot will use an approach distance of 200 and calculate motion targets based on speed of Part.

The pick location can be offset using the optional Tx, Ty, Tz, Rx, Ry, and Rz arguments.
place None vcComponent ToComp, [Real Approach], [Real Tx], [Real Ty], [Real Tz], [Real Rx], [Real Ry], [Real Rz], [vcComponent Part], [String ApproachAxis] Executes a sequence of actions in order for the robot to place a grasped component at a given component.

Action 1
Robot executes joint movement based on ToComp origin, Approach and ApproachAxis values.

Action 2
Robot executes linear movement to top face of ToComp.

Action 3
Grasped component is released by robot to ToComp.

Action 4
Robot executes a linear retraction movement based on Approach value.

All three motions executed by the robot are created dynamically during a simulation.

By default, a robot will use an approach distance of 200 and the bound box of grasped component to calculate motion targets.

The place location can be offset using optional Tx, Ty, Tz, Rx, Ry, and Rz arguments.

An optional Part argument can be used to define which component is placed to ToComp. The default is the first component listed in robot's GraspContainer.

An optional ApproachAxis argument can be used to define the axis of alignment.
placeInPattern None vcComponent ToComp, Integer X_index, Integer Y_index, Integer Z_index, Integer PatternSize_X, PatternSize_Y, Integer PatternSize_Z, [Real Approach], [vcComponent Part], [Real StepSizeX], [Real StepSizeY], [Real StepSizeZ], [Real Rz] Executes a sequence of actions in order for the robot to place components in a given pattern.

Action 1
Robot executes joint movement to ToComp.

Action 2
Robot executes linear movement to place location.

Action 3
Grasped component is released by robot to ToComp.

Action 4
Robot executes linear retraction movement away from place location.

All three motions executed by the robot are created dynamically during a simulation.

By default, a robot will use an approach distance of 200, the bound box of grasped component and the given pattern to calculate motion targets.

The X_index, Y_index and Z_index arguments define the index position for placing a component based on pattern size.

The PatternSize_X, PatternSize_Y and PatternSize_Z arguments define the pattern size.

An optional ApproachAxis argument can be used to define the axis of alignment.

An optional Part argument can be used to define which component is placed to ToComp. The default is the first component listed in robot's GraspContainer.

Optional StepSizeX, StepSizeY and StepSizeZ arguments can be used to define the pattern step size for XYZ axes. The default step size values are length, width and height of Part.

An optional Rz argument can be used to define a Z-axis rotation offset for place location.
releaseAllComponents None vcNode/vcContainer ToObject Attaches all components of robot's GraspContainer to a given node or container type behavior.

If ToObject is a component, a target container is searched for automatically in the component. If not found, the components are directly attached to the given node.
releaseComponent None vcNode/vcContainer ToObject, vcNode ReleaseThis Attaches a component to a given node or container type behavior.

If ToObject is a component, a target container is searched for automatically in the component. If not found, the released component is directly attached to the given node.

The ReleaseThis argument is the component to be detached from robot; otherwise the method will search the robot's GraspContainer.
rsl_BinIn None Integer Index, Boolean Value Waits for a signal mapped to a given port to have the given value.

The Index argument defines the port in the robot's inputs, Boolean Signal Map behavior. The Value argument defines the value that should be received at the port in order to complete execution.

If RecordRSL is set to True, this action is recorded as a new input statement in the robot's program.
rsl_BinOut None Integer Index, Boolean Value Sends a given value to a signal mapped to a given port.

The Index argument defines the port in the robot's outputs, Boolean Signal Map behavior. The Value argument defines the value that should be sent to the mapped signal.

If RecordRSL is set to True, this action is recorded as a new output statement in the robot's program.
traceOff None Integer Index Turns off the tracing of the robot's motions at given tool frame.

The Index argument defines the index position of a tool frame in the robot's Tools which is mapped to a port used for tracing.
traceOn None Integer Index Turns on the tracing of the robot's motions at given tool frame.

The Index argument defines the index position of a tool frame in the robot's Tools which is mapped to a port used for tracing.
unmountTool None vcComponent Tool, vcContainer ToObject

or

vcComponent Tool, vcComponent ToObject

 Dismounts a tool mounted on the robot to either a container type behavior or component.

The Tool argument needs to be a tool component mounted on the robot.

Miscellaneous Methods

The following methods are functions that can be used by importing the vcHelpers.Robot library.

Name | Return Type | Parameters | Description
getSelectedRobotsData | List of robot data (vcExecutor, vcRoutine, vcRobotController, String BaseName, String Toolname, List of String BaseNames, List of String ToolNames, Integer RobotConfig, List of String RobotConfigs) | None | Returns a list of data for the currently selected robot component in the 3D world. The list of data contains the following: robot program, current routine, robot controller, name of active base frame, name of active tool frame, list of names for all base frames, list of names for all tool frames, index of current configuration, and list of names for all configurations.
printMatrix | None | vcMatrix mtx | Prints a given matrix in a clear, readable format to the Output panel.

Examples

Example. Control a robot with vcHelpers.Robot

#Place this code in a Python Script editor
from vcScript import *
from vcHelpers.Robot2 import *

def OnRun():
# Get robot object and application object
robot = getRobot()
app = getApplication()

# Find the block component
block = app.findComponent("Block")

# Find the pedestal component
pedestal= app.findComponent("Pedestal")

#Set Robot Tool to Tool1
robot.ActiveTool = 'Tool1'

# Robot move to component
robot.jointMoveToComponent(block, Tz = 200, OnFace = 'top')

# Robot pick component 'block'
robot.pick(block)

# Robot moves away of the object Tz: 300
robot.moveAway(300)

#Robot place component in component 'pedestal'
robot.place(pedestal, 200)

# Robot moves away of the object Tz: 150
robot.moveAway(150)

Example. Drive joints

from vcScript import *
from vcHelpers.Robot2 import *

robot = getRobot()
#move all 6 joints with method
robot.driveJoints(0, 0, 90, 0, 45, 180)

#moves 4th joint to 45 degrees via controller
#joint numbering starts at 0, so 4th joint is numbered 3
robot.Controller.moveJoint(3, 45)

#move extra joints, e.g robot connected to track
robot.driveJoints(0, 0, 0, 0, 0, 0, 0, False, [-2000])

Example. Follow a Part with a Robot

from vcScript import *
from vcHelpers.Robot2 import *

#script is located in conveyor with sensor and signal

comp = getComponent()
app = getApplication()
r = getRobot(app.findComponent("Articulated Robot"))

def OnSignal(signal):
global parts

#get part
if signal.Value == True:
path = comp.findBehaviour("MainPath")
node = path.Components[0]
parts.append(node)

def OnRun():
global parts
parts = []
condition(lambda: parts)
p = parts.pop(0)

#move to part
r.linearMoveToMtx_ExternalBase(p, Tz = 100, Ry = 180)

#follow part
r.followNode(p, 1)

#grab part
r.graspComponent(p)
r.moveAway()

Example. Set motion time for movements

robo = getRobot()
robo.MotionTime = 3
robo.jointMoveToComponent('Part')

Example. Record actions as statements in robot program

#pick a component named 'Part'
robo = getRobot()
part = getApplication().findComponent('Part')

#define the location for RSL statements
robo.RecordRoutine = 'MyRecordRoutine'
robo.RecordRSL = True
robo.jointMoveToComponent( part, Tz = 100)
robo.linearMoveToComponent( part, Tz = 0)
robo.graspComponent(part)
robo.moveAway(100)


vcHelpers.Selection

vcHelpers.Selection is a library of useful methods designed to simplify the selection of objects.

Contents ShowHide

Methods

Component Selection

Node Selection

Feature Selection

Geometry Set Selection

Behavior Selection

Robot Program selection

Filter Results

List Trees

Other

Examples

Methods

Component Selection

Name | Return Type | Parameters | Description
getAllComponents | List of vcComponent | None | Returns a list of components in the 3D world.
getSelectedComponents | List of vcComponent | None | Returns a list of selected components in the 3D world.

Node Selection

Name | Return Type | Parameters | Description
getAllComponentsNodes | List of vcNode | None | Returns a list of nodes for all components in the 3D world.
getGivenComponentsNodes | List of vcNode | vcComponent component | Returns a list of nodes for a given component.
getSelectedComponentsNodes | List of vcNode | None | Returns a list of nodes for selected components in the 3D world.
getSelectedNodes | List of vcNode | None | Returns a list of selected nodes in the 3D world.

Feature Selection

Name | Return Type | Parameters | Description
getAllComponentsFeatures | List of vcFeature | None | Returns a list of features for all components in the 3D world.
getGivenComponentsFeatures | List of vcFeature | vcComponent component | Returns a list of features for a given component.
getGivenNodesFeatures | List of vcFeature | vcNode node | Returns a list of features for a given node.
getSelectedComponentsFeatures | List of vcFeature | None | Returns a list of features for selected components in the 3D world.
getSelectedFeatures | List of vcFeature | None | Returns a list of selected features in the 3D world.
getSelectedNodesFeatures | List of vcFeature | None | Returns a list of features for selected nodes in the 3D world.

Geometry Set Selection

Name | Return Type | Parameters | Description
getAllComponentsGeosets | List of vcGeometrySet | None | Returns a list of geometry sets for all components in the 3D world.
getGivenComponentsGeosets | List of vcGeometrySet | vcComponent component | Returns a list of geometry sets for a given component.
getGivenFeaturesGeosets | List of vcGeometrySet | vcFeature feature | Returns a list of geometry sets for a given feature.
getGivenNodesGeosets | List of vcGeometrySet | vcNode node | Returns a list of geometry sets for a given node.
getSelectedComponentsGeosets | List of vcGeometrySet | None | Returns a list of geometry sets for selected components in the 3D world.
getSelectedFeaturesGeosets | List of vcGeometrySet | None | Returns a list of geometry sets for selected features in the 3D world.
getSelectedGeosets | List of vcGeometrySet | None | Returns a list of selected geometry sets in the 3D world.
getSelectedNodesGeosets | List of vcGeometrySet | None | Returns a list of geometry sets for selected nodes in the 3D world.

Behavior Selection

Name | Return Type | Parameters | Description
getAllComponentsBehaviours | List of vcBehaviour | None | Returns a list of behaviors for all components in the 3D world.
getGivenComponentsBehaviours | List of vcBehaviour | vcComponent component | Returns a list of behaviors for a given component.
getGivenNodesBehaviours | List of vcBehaviour | vcNode node | Returns a list of behaviors for a given node.
getSelectedComponentsBehaviours | List of vcBehaviour | None | Returns a list of behaviors for selected components in the 3D world.
getSelectedNodesBehaviours | List of vcBehaviour | None | Returns a list of behaviors for selected nodes in the 3D world.

Robot Program selection

Name | Return Type | Parameters | Description
extendStatements | List of vcStatement | vcStatement statement, List of vcStatement statements | Returns a list of statements which is extended by a given statement and all statements nested in it.
getAllComponentsPrograms | List of vcProgram | None | Returns a list of all robot programs in 3D world.
getAllComponentsStatements | List of vcStatement | None | Returns a list of all statements in all robot programs in 3D world.
getGivenComponentsProgram | List of vcProgram | vcComponent | Returns a list of robot programs in a given component.
getGivenComponentsStatements | List of vcStatement | vcComponent | Returns a list of all statements in the robot programs of a given component.
getGivenProgramsRoutines | List of vcRoutine | vcProgram | Returns a list of routines in a given robot program.
getGivenProgramsStatements | List of vcStatement | vcProgram | Returns a list of all statements in a given robot program.
getGivenRoutinesStatements | List of vcStatement | vcRoutine | Returns a list of all statements in a given routine.
getSelectedComponentsPrograms | List of vcProgram | None | Returns a list of robot programs for currently selected components.
getSelectedComponentsStatements | List of vcStatement | None | Returns a list of all statements in the robot programs of currently selected components.
getSelectedProgram | vcProgram | None | Returns the active program of a robot.
getSelectedProgramsRoutines | List of vcRoutine | None | Returns a list of routines in active program of robot.
getSelectedProgramsStatements | List of vcStatement | None | Returns a list of all statements in the active program of a robot.
getSelectedRoutine | vcRoutine | None | Returns the active routine of a robot.
getSelectedRoutinesStatements | List of vcStatement | None | Returns a list of all statements in the active routine of a robot.
getSelectedStatements | List of vcStatement | None | Returns a list of currently selected statements.

Filter Results

Name | Return Type | Parameters | Description
filterTypes | List of items | List of items, List of types | Returns a filtered list of items matching a given type. See Constants for more information of types.
filterBehaviours | List of vcBehaviour | List of vcBehaviour behaviors, Enumeration type | Returns a new list of behaviors matching a given behavior type. See Behavior Constants for more information.
filterFeatures | List of vcFeature | List of vcFeature features, Enumeration type | Returns a new list of features matching a given feature type. See Feature Constants for more information.
filterGeosets | List of vcGeometrySet | List of vcGeometrySet geosets, Enumeration type | Returns a new list of geometry sets matching a given geometry set type. See Geometry Constants for more information.

List Trees

Name | Return Type | Parameters | Description
traverseFeatureChildren | List of vcFeature | vcFeature parent | Returns a list of child features for a given feature by using traversal.
traverseNodeChildren | List of vcNode | vcNode parent | Returns a list of child nodes for a given node by using traversal.

Other

Name | Return Type | Parameters | Description
getCurrentSelectionType | String | None | Returns the active selection type in the 3D world. See Selection Constants for more information.
getSelectedNodeGeosetMap | 3-tuple (Dictionary of String node_name and vcNode node, Dictionary of String node_name and list of vcGeometrySet node_geosets, List of vcGeometrySet all_geosets) | None | Returns a 3-tuple detailing the geometry sets of a selected node and any other node that may share the same geometry.
rebuildSelectedGeosetNodes | None | None | Rebuilds selected geometry sets of a component and any other component that shares the same geometry.
setCurrentSelectionType | None | Enumeration type | Sets the active selection type in the 3D world. See Selection Constants for more information.

Examples

Example. Print all point coordinates for all lines in the 3D world

from vcScript import *
from vcHelpers.Selection import *

for Is in filterGeosets(getAllComponentsGeosets(), VC_COMPACTLINESET):
for p1,p2 in Is.Lines:
print p1.X, p1.Y, p1.Z, p2.X, p2.Y, p2.Z


vcHelpers.Solver

vcHelpers.Solver provides a method and callback function for finding a local minimum, which is helpful for solving numerical problems.

Methods

Name | Return Type | Parameters | Description
findLocalMinimum | Real | Function evaluator, List of Real values | Calls a given function and modifies a list of values until the evaluator returns a minimum real value.

Examples

Example. Calculate local minimum

from vcScript import *
import vcHelpers.Solver

def calcError(pl):
targetvalues = [1.0,-20.0,45.0]
error = 0.0
for i in range(3):
error += abs(targetvalues[i]-pl[i])
print error, pl
return error

initialguess = [0.0, 0.0, 0.0]
noise = vcHelpers.Solver.findLocalMinimum(calcError,initialguess)
print noise, initialguess


vcHelpers.VcmFile

vcHelpers.VcmFile provides access to the metadata of a local component file.

Contents ShowHide

Constructors

Properties

Methods

Examples

Constructors

The object type for a local component file and its metadata is ComponentData.

Name | Return Type | Parameters | Description
ComponentData | vcHelpers.VcmFile.ComponentData | String filepath | Create a new ComponentData object for a given file.

Properties

Name | Type | Access | Description
Author | String | RW | Defines the author of file.
Description | String | RW | Defines a short description about file and its use.
DetailedRevision | String | RW | Defines the version and change history of file, for example Major.Minor.Batch.Revision numbering.
Email | String | RW | Defines the contact email address of file.
Icon | String | R | Gets the URI of file's icon.
Logo | String | R | Gets the URI of file's logo.
Manufacturer | String | RW | Defines the manufacturer of file's real-world model.
MaxPayLoad | Integer | RW | Defines the maximum payload (in kilograms) of the component, for example a robot gripper.
Name | String | RW | Defines the name of component.
PreviewIcon | String | R | Gets the URI of the image displayed when a user previews file in the eCatalog panel.
Revision | Integer | RW | Defines the revision number of file.
Tags | List of Strings | RW | Defines a list of tokens used to describe application, industry and other information about the component.
Type | String | RW | Classifies the component by type.
Website | String | RW | Defines a web address/link to associate with component. Note: This link is included with the component in a recorded 3D PDF.

Methods

Name | Return Type | Parameters | Description
write | None | None | Saves changes made to the file.

Examples

Example. Access, edit and print component metadata

from vcScript import *
from vcHelpers.VcmFile import *

cd = ComponentData(getComponent().Uri[8:])
cd.Description = 'A high volume feeder'
print cd


vcHelpers.Output

vcHelpers.Output provides different levels of output messages (info/warning/error/debug) for the owner component/command. The messages have the owner's name as a prefix, and they can optionally print the simulation time. The printing of different levels can be toggled on/off with methods or with bounded properties.

Methods

Name | Return Type | Parameters | Description
info() | None | List of arguments, [Boolean simtime] | Prints given positional arguments to output. To print simulation time (as a prefix), set simtime key argument to True, default is False.
warning() | None | List of arguments, [Boolean simtime] | Prints given positional arguments to output. To print simulation time (as a prefix), set simtime key argument to True, default is False.
error() | None | List of arguments, [Boolean simtime] | Prints given positional arguments to output. To print simulation time (as a prefix), set simtime key argument to True, default is False.
debug() | None | List of arguments, [Boolean simtime] | Prints given positional arguments to output. To print simulation time (as a prefix), set simtime key argument to True, default is False.
setInfo() | None | Boolean Value | Enable (True) or disable (False) info messages.
setWarnings() | None | Boolean Value | Enable (True) or disable (False) warnings.
setErrors() | None | Boolean Value | Enable (True) or disable (False) errors.
setDebug() | None | Boolean Value | Enable (True) or disable (False) debug messages.
bindInfoProperty() | Boolean | String or vcProperty | Bind a component/command property as a toggle to enable/disable info messages. Use the name of the property or the property instance as the argument.
bindErrorProperty() | Boolean | String or vcProperty | Bind a component/command property as a toggle to enable/disable errors. Use the name of the property or the property instance as the argument.
bindWarningProperty() | Boolean | String or vcProperty | Bind a component/command property as a toggle to enable/disable warnings. Use the name of the property or the property instance as the argument.
bindDebugProperty() | Boolean | String or vcProperty | Bind a component/command property as a toggle to enable/disable debug messages. Use the name of the property or the property instance as the argument.


vcIfStatement

A vcIfStatement is a robot statement that execute one of two scopes of statements based on a condition. If the condition is true, the statement executes its ThenScope of statements. If the condition is false, the statement executes is ElseScope of statements.

Inherits: vcStatement

Properties

Name | Type | Access | Description
Condition | Expression | RW | Defines an expression that when evaluated returns a True or False value. A True value means the statement will execute its ThenScope of statements. A False value means the statement will execute its ElseScope of statements.
ElseScope | vcScope | R | Gets the scope of statements executed by the statement if Condition is false.
ThenScope | vcScope | R | Gets the scope of statements executed by the statement if Condition is true.


vcIntegerSignal

vcIntegerSignal is a signal that can send an integer value.

Inherits: vcBehaviour, vcSignal

Properties

Name | Type | Access | Description
Value | Integer | RW | Defines the value of signal. Setting this value does not trigger the OnSignal event unless you use the signal() method.

Methods

Name | Return Type | Parameters | Description
signal | None | [Integer value] | Signals the current value of signal to all connected behaviors, thereby triggering the OnSignal event. An optional value argument can be given to set the Value property of the signal.


vcInteractiveCommand

vcInteractiveCommand is an event listener for interactive commands.

Events

Name | Parameters | Description
OnInteraction | vcCommand cmd, Enumeration event_type | Triggered when user interaction occurs for a given command and type of event. See Interactive Constants for more information.


vcIntergerSignalMap

vcIntegerSignalMap

vcIntegerSignalMap allows you to map Integer signals to ports in a continuous IO space.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Listeners | List of vcBehaviour | RW | Defines a list of behaviors using the signal map.
PortCount | Integer | RW | Defines the amount of ports in signal map.

Methods

Name | Return Type | Parameters | Description
getPortName | String | Integer index | Returns the name of a port at a given index in map.
input | Integer | Integer index | Returns the value of a port at a given index in map.
output | None | Integer index, Integer value | Sets the value of a port at a given index to a given value in map.
setPortName | None | Integer index, String name | Sets the name of a port at a given index to a given name in map.

Events

Name | Parameters | Description
OnSignalTrigger | vcIntergerSignalMap signal_map, Integer port | Triggered when the value of a signal mapped to a port has a new value.


vcInterpolatingTransportController

System transport controller that does linear interpolation of product position and orientation in a set amount of time. Supports (practically) unlimited number of parallel transport operations..

Inherits: vcContainer, vcBehaviour, vcFlow

Type constant: VC_INTERPOLATINGTRANSPORTCONTROLLER

Properties

Name | Type | Access | Description
IsSystem | Boolean | R | Always returns True


vcJacobian

vcJacobian allows you to calculate inverse and forward kinematics solutions. For example, you can solve for joint values of a robot at a given position.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
ForwardKin | Function | RW | Defines the function for forward kinematics calculation. If None, uses built-in method.
FractionalStep | Real | RW | Defines the fractional step of calculation. The default value is 0.5.
IgnoreOrientation | RW | Boolean | Turns on/off the calculation of orientation. The default value is False in which orientation is calculated for solution. Generally, a True value would be used when orientation is not important, for example with Cartesian robots.
JacobianJointCount | Integer | RW | Defines the number of joints in calculation.
NumIterationsInner | Integer | RW | Defines the number of iterations for calculating inner product.
NumIterationsOuter | Integer | RW | Defines the number of iterations for calculating outer product.
OrientationMaxStep | Real | RW | Defines the max step for orientation in calculation.
OrientationTolerance | Real | RW | Defines the tolerance for orientation in calculation.
PositionalMaxStep | Real | RW | Defines the max step for position in calculation.
PositionalTolerance | Real | RW | Defines the tolerance for position in calculation.
RotationalJointStepSize | Real | RW | Defines the step for rotational joint values in calculation.

Methods

Name | Return Type | Parameters | Description
inverse | 2-tuple (List of Real joint_values, Enumeration solution) | vcMatrix target, List of Real values, [List of Boolean fixed] | Calculates the joint values of robot for a given target and list of joint values. An optional fixed argument can be given to identify fixed joints in the robot. The returned value will identify joint values of robot and status of solution to target. See Solution Constants for more information.


vcJogInfo

vcJogInfo is an event listener for an interactive object defined by Jog Info behavior.

Inherits: vcBehaviour

Contents ShowHide

Events

Events

Name | Parameters | Description
OnInteract | vcBehaviour type, Enumeration cursor_action, List of jog info (vcCommandEvent type-shiftstate, Boolean mouseclicked, [not used], Integer Xposition, Integer Yposition, vcVector floor, vcVector view, vcVector direction, vcVector hitposition) data | Triggered when user interaction occurs with an object defined by a Jog Info behavior. The type argument is the Jog Info behavior of the object. The cursor_action argument is the type of mouse action that occurs in the jog area. 0 Hover in. 1 Click or drag 2 Hover out The data argument provides a list of jog info that includes command event data and XY coordinates (in pixels) where interaction occurs on the viewport.


vcJoint

vcJoint is a joint that can be defined using kinematics, driven by controllers and affected by physics.

Contents ShowHide

Properties

Examples

Properties

Name | Type | Access | Description
Controller | vcRobotController or vcServoController | R | Gets the controller of joint. If joint is not driven by controller, value is None.
CurrentValue | Real | RW | Defines the joint's value.
Dof | vcDof | R | Gets the Dof object of joint.
ExternalController | vcRobotController or vcServoController | R | Gets the external controller of joint. If joint is not driven by an external controller, value is None.
InitialValue | Real | RW | Defines the initial value of joint. That is, the initial state of the joint.
LagTime | Real | RW | Defines the lag time (in seconds) of joint.
MaxAcceleration | Real | RW | Defines the maximum acceleration (units/degrees per second squared) of joint.
MaxDeceleration | Real | RW | Defines the maximum deceleration (units/degrees per second squared) of joint.
MaxSpeed | Real | RW | Defines the maximum speed (units/degrees per second squared) of joint.
MaxValue | String | RW | Defines an expression that when evaluated returns the maximum value of joint.
MinValue | String | RW | Defines an expression that when evaluated returns the minimum value of joint.
Name | String | RW | Defines the joint's name.
SettleTime | Real | RW | Defines the settle time (in seconds) of joint.
Type | Enumeration | RW | Defines the joint type. See Joint Constants for more information.

Examples

Example. Access and modify joint values

from vcScript import *

#Access joint information via Servo/Robot Controller
comp = getComponent()
contrl = comp.findBehaviour("Controller")

#Example for returning joint values
def exampleJ(joint):
print joint.MinValue
print joint.MaxValue
print joint.CurrentValue
print joint.Type

#Joint values can be also changed in simulation
def OnRun():
j = contrl.getJoint(0)
j.CurrentValue = 90.0
exampleJ(j)

def OnReset():
j = contrl.getJoint(0)
j.CurrentValue = 0.0
exampleJ(j)

Example. Get joint values

from vcScript import *

comp = getComponent()
controller = comp.findBehavioursByType(VC_ROBOTCONTROLLER)[0]
joint1_as_prop = comp.getProperty(controller.Joints[0].Name)
print joint1_as_prop.MaxValue


vcKinObject

vcKinObject stores custom kinematics data implemented by a user in a Python Kinematics behavior.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
CustomData | Object | RW | Defines an instance of a user-defined class, thereby allowing you to implement custom properties and methods for the kinematics object.
JointCount | Integer | R | Gets the joint count of the kinematics object.
JointMaxLimits | List of Real | R | Gets the maximum value for each joint of the kinematics object.
JointMinLimits | List of Real | R | Gets the minimum value for each joint of the kinematics object.
JointsRotational | List of Boolean | R | Gets the joint type for each joint of the kinematics object. A True value indicates a rotational joint.
JointValues | List of Real | RW | Defines the joint values of the kinematics object.
Properties | List of vcProperty | R | Gets the dynamic properties of the kinematics object.
SecondaryJointValues | List of Real | RW | Defines the external joint values of the kinematics object.
Solutions | List of n-tuple | RW | Defines a list of possible solutions for the kinematics object and its Target. Generally, the format of a solution is a configuration warning followed by joint values for the motion target. See Solution Constants for more information.
Target | vcMatrix | RW | Defines the motion target of the kinematics object.

Methods

Name | Return Type | Parameters | Description
createJacobian | vcJacobian | None | Creates a new Jacobian matrix object for calculating inverse and forward kinematics solutions.
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Adds a new property of a given type and name to the kinematics object. An optional constraints argument can be given to define constraints for the new property, which must be defined at the time of creation. See Property Constants for more information.
getJointMoveDist | Real | Integer index, Real value | Returns the distance a joint at a given index must move in order to reach a given value.
getJointMoveTo | 2-tuple (Boolean reachable, Real amount) | Integer index, Real value | Indicates whether a joint at a given index can move to a given value. Returns True and the given value if joint can reach target. Otherwise, returns False and the amount exceeding the joint's limits.
moveJointTo | Boolean | Integer index, Real value | Drives a joint at a given index to a given value. Returns True if joint reached target; otherwise returns False.


vcLayer

vcLayer allows you to group objects in the 3D world into separate layers.

Properties

Name | Type | Access | Description
Name | String | RW | Defines the name of layer.
Visibility | Boolean | RW | Turns on/off the visibility of layer and all of its objects.

Examples

Example. Create layer and assign geometry

from vcScript import *

app = getApplication()
layerDemo = app.findLayer("Example")
if not layerDemo:
layerDemo = app.createLayer("Example")

#this example was used with an articulated robot
comp = getComponent()
for geoset in comp.Geometry.GeometrySets:
geoset.Layer = layerDemo

layerDemo.Visibility = False
app.render()


vcLayoutItem

vcLayoutItem is the basic implementation of all layout items.

Contents ShowHide

Hierarchy

Properties

Methods

Hierarchy

Each type of layout item has its own specific implementation which inherits vcLayoutItem. In order to create a layout item, use the createLayoutItem() method in vcApplication.

vcLayoutItem

vc3DIcon

vcAnnotation

vcCollisionDetector

vcDimension

vcLayoutPackFolder

vcLayoutPropertyList

vcLayoutSchemaPropertyList

vcPathObject

vcReport

vcSweptVolume

vcViewAnimation

Properties

The following properties are common in all layout item types.

Name | Type | Access | Description
IsPersistent | Boolean | RW | Defines if the item is saved with layout.
Name | String | RW | Defines the name of item.
Properties | List of vcProperty | R | Gets a list of all properties for item.
Type | String | RW | Defines the item type. See Layout Item Constants for more information.

Methods

Name | Return Type | Parameters | Description
update | None | None | Updates the item in its layout.


vcLayoutPackFolder

vcLayoutPackFolder is a layout item used for packing files with the current layout of the 3D world.

Inherits: vcLayoutItem

Properties

Name | Type | Access | Description
PackFolder | vcPackFolder | R | Gets the mechanism for attaching files to component.


vcLayoutPropertyList

vcLayoutPropertyList is a layout item used to add and edit a list of properties for a layout.

Inherits: vcLayoutItem

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Adds a new property of a given type and name to the layout item. An optional constraints argument can be given to define constraints for the new property, which must be defined at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property from the item.
getProperty | vcProperty | String name | Returns a property of the item that matches the given name; otherwise returns None.


vcLayoutSchemaPropertyList

vcLayoutSchemaPropertyList is a layout item and data structure used for handling large amounts of data.

Inherits: vcLayoutItem

Contents ShowHide

Usage

Supported Types

Schema Properties

Data Count

Properties

Methods

Examples

Usage

vcLayoutSchemaPropertyList provides an extremely fast way to manipulate load and manipulate data while minimizing memory footprint. For example, you can create, delete, traverse, edit, visualize and pick a tool path and associated data which can be saved and loaded with a layout. One drawback is limited flexibility during usage.

Example. Concept of vcLayoutSchemaPropertyList as a database

 | Schema Item 0 | Schema Item 1 | Schema Item 2
Data Record 0 | Data field (0,0) | Data field (0,1) | Data field (0,2)
Data Record 1 | Data field (1,0) | Data field (1,1) | Data field (1,2)
Data Record 2 | Data field (2,0) | Data field (2,1) | Data field (2,2)

Supported Types

The data structure of a vcLayoutSchemaPropertyList object is a list of predefined data types. The overall assumption is that either the data types or their order do not change in a list. This is why only the following data types, of a fixed size, are supported:

  • Boolean
  • Integer
  • Matrix (4*Vector)
  • Real (float)
  • Vector (4*Real)

Schema Properties

A schema item is a supported type of vcProperty and also known as a schema property. In terms of databases, you can view a schema item as a column.

Data Count

The data count of a schema establishes the number of records for the schema, thereby allowing you to add values to data fields. In terms of databases, you can view data count as defining the number of rows.

Properties

Name | Type | Access | Description
DataCount | Integer | R | Gets the number of records in schema.
FrameColorSchemaIndex | Integer | RW | Defines the index of schema property used for coloring frame. The schema property should be a vector data type.
FrameDataSchemaIndex | Integer | RW | Defines the index of schema property used for positional data of record. Generally, the schema property is a matrix data type. The positional data is used for visualizing record as a Frame feature in 3D world.
FrameNameColorSchemaIndex | Integer | RW | Defines the index of schema property used for coloring the label of frame. The schema property should be a vector data type.
FrameNameSchemaIndex | Integer | RW | Defines the index of schema property used for labeling the Frame feature of record in 3D world. The schema property should be a string data type. The default is -1. This means the Frame feature of record will not be labeled with its custom name rather the number of record in schema.
FrameNameVisibleSchemaIndex | Integer | RW | Defines the index of schema property used for controlling the visibility of label of record in 3D world. The schema property should be a Boolean data type. The default is -1. This means labels are visible.
FrameVisibleSchemaIndex | Integer | RW | Defines the index of schema property used for controlling the visibility of Frame feature of record in 3D world. The schema property should be a Boolean data type. This also affects the visibility of label of record in 3D world.
LineDisplaySchemaIndex | Integer | RW | Define the index of schema property used for the position of record in 3D world. This allows you to connect positions with a line generated in 3D world.
Node | vcNode | RW | Defines a node the Frame features of records are attached to in 3D world. In some cases, this might be the simulation root node/World node. In other cases, this might be the root node of a workpiece.
PositionMatrix | vcMatrix | RW | Defines an offset for position of record in 3D world. The offset is based in coordinate system of Node property. Generally, an offset is applied to compensate for weld torch flares or to adjust position based on Z-axis direction of robot TCP.
SchemaProperties | List of vcProperty | R | Gets a list of all schema properties in the layout item. Note: This does not include data values for each record in the schema.

Methods

Name | Return Type | Parameters | Description
clearSchema | None | None | Empties the schema, thereby removing all schema properties and setting the data count to zero.
cloneSchemaObject Boolean Integer from_dataindex, Integer count, Integer to_dataindex Clones a set of records in a given range.

The from_dataindex argument defines the first record in range. The count argument defines how many records to clone. The to_dataindex argument defines where to insert the copies.

Warning: Currently, you cannot append cloned records to the end of the table. You must insert the copies before an existing record.
createProperty vcProperty Enumeration type, String name, [Enumeration constraints] Adds a new property of a given type and name to the layout item.

An optional constraints argument can be given to define constraints for the new property, which must be defined at the time of creation.

See Property Constants for more information.
createSchemaProperty vcProperty Enumeration type, String name Adds a new schema property of a given type and name to the layout item.

See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property of the layout item.
deleteSchemaObject None Integer from_dataindex, Integer count Deletes a set of records in a given range.

The from_dataindex argument defines the first record in range. The count argument defines how many records to delete.
deleteSchemaProperty | None | vcProperty property | Deletes a given property that is a schema property of the layout item.
getDataValue | <Type> | Integer dataindex, Integer itemindex | Returns the value of a data field at a given dataindex and itemindex.
getDataValues | n-tuple of <Type> | Integer dataindex | Returns the values of a record at a given dataindex.
getProperty | vcProperty | String name | Returns a property of the layout item that matches the given name; otherwise returns None.
getSchemaProperty | vcProperty | String name | Returns a schema property of the layout item that matches the given name; otherwise returns None.
setDataValue None Integer dataindex, Integer itemindex, <Type> value Sets the value of a data field at a given dataindex and itemindex.

The value argument must be a supported data type and match the type of the schema property; otherwise the data field will not reference the new value.

Note: The value argument can be a vcProperty object, thereby the value of that property is passed to the data field.
setDataValues None Integer dataindex, Integer itemindex, n-tuple of <Type> values Sets all values for schema properties of a record at a given dataindex.

The values argument must be a tuple with the same amount of elements as there are schema properties. Each element's value must be a supported data type and match the type of the corresponding schema property; otherwise the data field will not reference the new value.

Note: An element of a tuple given as the values argument can be a vcProperty object, thereby the value of that property is passed to the data field.
updateData None Integer count Allocates the size of the schema to support a potential amount of elements/entries for schema properties based on the given count.

Note: The allocation is optional as size is updated automatically based on number of entries.

Examples

Example. Create schema layout item

from vcScript import *

app = getApplication()

#find schema by name, else create new one
schema = app.findLayoutItem("mySchema")
if not schema:
schema = app.createLayoutItem(VC_LAYOUTITEM_IT_LAYOUTSCHEMAPROPERTYLIST)
schema.Name = "mySchema"

#print schema

Example. Create schema properties

Generally, a schema layout item contains at least one of the following data fields/column attributes:

  • Position vector to define a location in the containing coordinate system.
  • Position vector and Direction vector to define a location and direction in the containing coordinate system.
  • Frame/matrix that defines the location and full orientation in the containing coordinate system.

In all cases, the containing coordinate system is defined by the Node property of the schema layout item. In some cases, a schema may contain any number of additional schema properties, thereby allowing you to store all data needed to execute and manipulate tool paths.

A simple implementation of a schema layout item is to first remove all of its data, add six different schema properties, and then define how to visualize data stored in the schema.

from vcScript import *

app = getApplication()
schema = app.findLayoutItem("mySchema")
if not schema:
schema = app.createLayoutItem(VC_LAYOUTITEM_IT_LAYOUTSCHEMAPROPERTYLIST)
schema.Name = "mySchema"

schema.clearSchema()
schema.createSchemaProperty(VC_MATRIX, "Frame")
schema.createSchemaProperty(VC_VECTOR, "Direction")
schema.createSchemaProperty(VC_REAL, "Speed")
schema.createSchemaProperty(VC_INTEGER, "Mode")
schema.createSchemaProperty(VC_BOOLEAN, "FrameVisible")

schema.LineDisplaySchemaIndex = 0
schema.FrameDataSchemaIndex = 0
schema.FrameVisibleSchemaIndex = 4

Example. Allocate and add data to schema

In order to add data, you must first know the amount of data you want to store in the schema. That is, the number of records or rows to use in the schema.

from vcScript import *
import vcMatrix
import vcVector

app = getApplication()
schema = app.findLayoutItem("mySchema")
if not schema:
schema = app.createLayoutItem(VC_LAYOUTITEM_IT_LAYOUTSCHEMAPROPERTYLIST)
schema.Name = "mySchema"

schema.clearSchema()
schema.createSchemaProperty(VC_MATRIX, "Frame")
schema.createSchemaProperty(VC_VECTOR, "Direction")
schema.createSchemaProperty(VC_REAL, "Speed")
schema.createSchemaProperty(VC_INTEGER, "Mode")
schema.createSchemaProperty(VC_BOOLEAN, "FrameVisible")
schema.LineDisplaySchemaIndex = 0
schema.FrameDataSchemaIndex = 0
schema.FrameVisibleSchemaIndex = 4

#the following creates 5 rows
#each row contains data for 5 schema items/properties
count = 5
schema.updateData(count)
m = vcMatrix.new()
v = vcVector.new()
r = 1.2345
k = 1000000
b = False
for i in range(count):
schema.setDataValue(i,0,m)
schema.setDataValue(i,1,v)
schema.setDataValue(i,2,r)
schema.setDataValue(i,3,k + i)
schema.setDataValue(i,4,b)

Data entry can be processed faster by adding multiple values at a time.

for i in range(count):
schema.setDataValue(i,0,(m,v,r,k+i,b))

Example. Traverse data in schema

count = 5
schema.updateData(count)
m = vcMatrix.new()
v = vcVector.new()
r = 1.2345
k = 1000000
b = False
for i in range(count):
schema.setDataValue(i,0,(m,v,r,k+i,b))

#getting values is similar to setting values
for i in range(count):
m = schema.getDataValue(i,0)
v = schema.getDataValue(i,1)
r = schema.getDataValue(i,2)
k = schema.getDataValue(i,3)
b = schema.getDataValue(i,4)

for i in range(count):
m,v,r,k,b = schema.getDataValues(i)
print m,v,r,k,b

Example. Attach schema to node

Generally, a tool path is associated with a node. If this case is not true, you can locate and set the schema's node and apply an offset for data relative to that node's coordinate system.

#attach schema to World node and apply offset
comp = getComponent()
schema.Node = comp.World
m = vcMatrix.new()
m.translateRel(0,0,100)
schema.PositionMatrix = m

Example. Pick schema data

The simTopologyPick command defined in vcTopologyPickCommand supports the picking of schema data. Once you pick or hover over the top of schema data visualized in the 3D world, the TargetPointIndex property of the command is set in the vcTopologyPickCommand object.

Example. Delete schema

getApplication().deleteLayoutItem(mySchema)

Example. Delete and clone records

from vcScript import *
import vcMatrix
import vcVector

app = getApplication()
schema = app.findLayoutItem("mySchema")
if not schema:
schema = app.createLayoutItem(VC_LAYOUTITEM_IT_LAYOUTSCHEMAPROPERTYLIST)
schema.Name = "mySchema"

schema.clearSchema()
schema.createSchemaProperty(VC_MATRIX, "Frame")
schema.createSchemaProperty(VC_VECTOR, "Direction")
schema.createSchemaProperty(VC_REAL, "Speed")
schema.createSchemaProperty(VC_INTEGER, "Mode")
schema.createSchemaProperty(VC_BOOLEAN, "FrameVisible")
schema.LineDisplaySchemaIndex = 0
schema.FrameDataSchemaIndex = 0
schema.FrameVisibleSchemaIndex = 4

#the following creates 5 rows
#each row contains data for 5 schema items/properties
count = 5
schema.updateData(count)
m = vcMatrix.new()
v = vcVector.new()
r = 1.2345
k = 1000000
b = False

for i in range(count):
schema.setDataValue(i,0,m)
schema.setDataValue(i,1,v)
schema.setDataValue(i,2,r)
schema.setDataValue(i,3,k + i)
if i == 4:
##sets the last value of last record to True
schema.setDataValue(i,4,True)
else:
##all other records will have a last value of False
schema.setDataValue(i,4,b)

##delete the first record
schema.deleteSchemaObject(0,1)

##copy first two records and insert them before last record
schema.cloneSchemaObject(0,2,schema.DataCount-1)

##copy last record and insert it before first record
schema.cloneSchemaObject(schema.DataCount-1,1,0)

for i in range(schema.DataCount):
print schema.getDataValues(i)

'''
prints the following
(<vcMatrix object at 0x000002AE80B1ADF8>, <vcVector object at 0x000002AE80BC1AE8>, 1.2345, 1000004, True)
(<vcMatrix object at 0x000002AE80B1ADF8>, <vcVector object at 0x000002AE80BC1AE8>, 1.2345, 1000001, False)
(<vcMatrix object at 0x000002AE80B1ADF8>, <vcVector object at 0x000002AE80BC1AE8>, 1.2345, 1000002, False)
(<vcMatrix object at 0x000002AE80B1ADF8>, <vcVector object at 0x000002AE80BC1AE8>, 1.2345, 1000003, False)
(<vcMatrix object at 0x000002AE80B1ADF8>, <vcVector object at 0x000002AE80BC1AE8>, 1.2345, 1000001, False)
(<vcMatrix object at 0x000002AE80B1ADF8>, <vcVector object at 0x000002AE80BC1AE8>, 1.2345, 1000002, False)
(<vcMatrix object at 0x000002AE80B1ADF8>, <vcVector object at 0x000002AE80BC1AE8>, 1.2345, 1000004, True)
'''


vcLight

vcLight provides the ability to create and control lights in the 3D world.

Properties

Name | Type | Access | Description
ConstantAttenuation | Real | RW | Defines the constant light attenuation of the light.
Direction | vcVector | RW | Defines the direction of the light by using a vector.
Enabled | Boolean | RW | Turns on/off the use of the light.
Intensity | Integer | RW | Defines the light's intensity.
LinearAttenuation | Real | RW | Defines the linear light attenuation of the light.
Name | String | RW | Defines the name of light.
Position | vcVector | RW | Defines the position of the light in World coordinate system.
QuadraticAttenuation | Real | RW | Defines the quadratic light attenuation of the light.
SpotAngle | Real | RW | Defines the angle of the light if its type is spot.
SpotExponent | Real | RW | Defines the exponent of the light if its type is spot.
Type | Enumeration | RW | Defines the light type. See Light Constants for more information.


vcLine

vcLine is the object type for line and polyline primitives containing one or more points.

Inherits: vcPrimitive

Properties

Name | Type | Access | Description
Points | List of vcPoint | R | Gets a list of all points in the line.
PointCount | Integer | R | Gets the amount of points in the line.

Methods

Name | Return Type | Parameters | Description
getPoint | vcLinePoint | Integer index | Returns a point at a given index in the line.
addPoint | None | vcLinePoint | Adds a new point to the line.
removePoint | None | Integer index | Removes a point at a given index from the line.
update | None | None | Updates the internal structure of the line.


vcLinePoint

vcLinePoint is used to define points in lines.

Inherits: vcPrimitive, vcPoint

Properties

Name | Type | Access | Description
LineCount | Integer | R | Gets the total number of lines using the point.

Methods

Name | Return Type | Parameters | Description
getLine | vcLine | Integer index | Returns a line using the point at a given index since a point may belong to more than one line.


vcLineSet

vcLineSet is a collection of line primitives and their points.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Lines | List of vcLine | R | Gets a list of all lines in the set.
Points | List of vcLinePoint | R | Gets a list of all points in the set.
LineCount | Integer | R | Gets the amount of lines in the set.
LineWidth | Integer | RW | Defines the width (in pixels) of lines in the set.

Methods

Name | Return Type | Parameters | Description
createPoint | vcLinePoint | Real x, Real y, Real z or vcVector vector | Creates a new point in the set at a given vector or XYZ coordinates, and then returns the point; otherwise returns None.
createLine | vcLine | None | Creates a new line in the set, and then returns the new line.
deleteLine | None | Integer index or vcLine line | Deletes a given line from the set or one at a given index.
getLine | vcLine | Integer index | Gets a line in the set at a given index.
update | None | None | Updates the line set, thereby recalculating the bound box of the set.


vcMaterial

vcMaterial is a material used by geometry and solid shapes in the 3D world.

Contents ShowHide

Properties

Examples

Properties

Name | Type | Access | Description
Ambient | vcVector | RW | Defines a vector used for calculating the ambient value of material.
ColorMask | Enumeration | RW | Defines the RGB/RGBA color mask used for rendering material. See Material Constants for more information.
DepthComparison | Enumeration | RW | Controls the visibility of geometry assigned the material based on pixel depth (distance from camera) in comparison to a Z-axis buffer. Depth comparison is important for defining how a material is rendered in terms of elevation and depth and its interference with other materials. See Material Constants for more information.
Diffuse | vcVector | RW | Defines a vector used for calculating diffuse reflection of light hitting material.
LineStippling | Boolean | RW | Turns on/off the use of stippling in the material to create light and dark shades based on point density.
LineWidth | Real | RW | Defines the width of line primitives used for stippling.
Name | String | RW | Defines the name of material.
Opacity | Real | RW | Defines the material's opacity, thereby its transparency.
OpacityType | Enumeration | RW | Defines the opacity type used by material. See Material Constants for more information.
RenderOrder | Enumeration | RW | Defines the order in which geometry using this material is rendered in 3D world. See Material Constants for more information.
Shininess | Real | RW | Defines the intensity of light reflected from material, thereby defining its luster.
Specular | vcVector | RW | Defines a vector used for calculating specular reflection of light hitting material.
StipplingPattern | Integer | RW | Defines the stippling pattern of material based on the bits of an integer.
StipplingScale | Integer | RW | Defines scale factor of the material's stippling pattern which, by default, is 1.
Texture | vcBitMap | RW | Gets a bitmap defining the texture of material.
TextureMapping | Enumeration | RW | Defines how the material's texture is projected or defined using coordinates. See Material Constants for more information.

Examples

Example. Set material opacity

from vcScript import *

app = getApplication()
myMaterial = app.findMaterial("material name")
myMaterial.Opacity = 2.0
myMaterial.OpacityType = VC_MATERIAL_TRANSPARENCY_NONE

Example. Find, edit and create new material

from vcScript import *

def copyMaterial(original_name):
name_of_the_copy = original_name+'_copy'

# find the materialname matching the given name
orig_material = app.findMaterial( original_name )

# create new material or use existing one
new_material = app.findMaterial( name_of_the_copy )
if not new_material: new_material = app.createMaterial( name_of_the_copy )

# copy all properties from the original
new_material.Ambient = orig_material.Ambient
new_material.ColorMask = orig_material.ColorMask
new_material.Diffuse = orig_material.Diffuse
new_material.Specular = orig_material.Specular
new_material.Shininess = orig_material.Shininess
new_material.Opacity = orig_material.Opacity
new_material.OpacityType = orig_material.OpacityType
if orig_material.Texture: new_material.Texture = orig_material.Texture
new_material.TextureMapping = orig_material.TextureMapping
new_material.LineWidth = orig_material.LineWidth
new_material.LineStippling = orig_material.LineStippling
new_material.StipplingPattern = orig_material.StipplingPattern
new_material.StipplingScale = orig_material.StipplingScale
new_material.RenderOrder = orig_material.RenderOrder
new_material.DepthComparison = orig_material.DepthComparison

# adds material into the group of registered materials.
# Returns False if a material with the same name already exists.
app.addMaterial( new_material )
return new_material

app = getApplication()
comp = getComponent()

# copy blue material
new_material = copyMaterial('blue')

# set opacity for the new copied material
# it's rarely a good idea to modify the standard materials)
new_material.Opacity = .75
new_material.OpacityType = VC_MATERIAL_TRANSPARENCY_CONSTANT
comp.Material = new_material

Example. Inherit and render material

from vcScript import *

def setMaterial(part, material_name):
# find the materialname matching the given name
material = app.findMaterial(material_name)

# this will force even feature materials to be over-written
part.MaterialInheritance = VC_MATERIAL_FORCE_INHERIT

# assigning material as node material doesn't force rebuild
# => more efficient coz dynamic components still share geometry representation
part.NodeMaterial = material

app = getApplication()
comp = getComponent()
kids = comp.ChildComponents
for kid in kids:
setMaterial(kid, 'blue') # set a material for all child components
app.render()


vcMatrix

vcMatrix is a 4x4 matrix and is generally used to perform linear transformations and contain the position and orientation of objects.

Contents ShowHide

Constructors

Operators

Properties

Methods

Examples

Constructors

Name | Return Type | Parameters | Description
new | vcMatrix | [vcMatrix matrix] | Creates a new vcMatrix object.

Operators

Name | Description
* | Performs matrix multiplication with another vcMatrix object or transforms a vcVector object. If the multiplier is a vcVector object, the product will be a vcVector object.

Properties

Name | Type | Access | Description
N | vcVector | RW | Defines Normal vector that is unit vector in X-axis direction.
O | vcVector | RW | Defines Orientation vector that is unit vector in Y-axis direction.
A | vcVector | RW | Defines Approach vector that is unit vector in Z-axis direction.
P | vcVector | RW | Defines Position vector.
WPR | vcVector | RW | Defines roll, pitch and yaw angles.

Note: The directional vectors N,O and A should be unit vectors and orthonormal. That is, the length of N,O and A should be 1.0, and they should be normal to one another (orthonormal). Otherwise, the vcMatrix object will be skewed.

Methods

Name | Return Type | Parameters | Description
getAxisAngle | vcVector | None | Returns the orientation of the matrix as a rotation of its identity matrix about the axis defined by the XYZ values of the returned vector. The W property of the returned vector is the rotation angle (in degrees).
getEuler | vcVector | None | Returns the orientation of the matrix as a set of absolute rotations (in fixed coordinate system) around the Z-axis, followed by the Y-axis, and then again the Z-axis, in the form of a vector containing those angles (in degrees).
getQuaternion | vcVector | None | Returns the orientation of the matrix as a quaternion in the form of a vector.
getWPR | vcVector | None | Returns the orientation of the matrix as a set of relative rotations around ZYX axes, in that order, in the form of a vector containing those angles (in degrees).
identity | None | None | Sets matrix to equal its identity.
invert | None | None | Sets the matrix to equal its inverse.
rotateAbsX | None | Real value | Rotates the matrix around X-axis in absolute coordinate system.
rotateAbsY | None | Real value | Rotates the matrix around Y-axis in absolute coordinate system.
rotateAbsZ | None | Real value | Rotates the matrix around Z-axis in absolute coordinate system.
rotateAbsV | None | vcVector v, Real angle | Rotates the matrix around an axis defined by a given vector by a given angle in absolute coordinate system.
rotateRelX | None | Real value | Rotates the matrix around X-axis in coordinate system relative to matrix position.
rotateRelY | None | Real value | Rotate the matrix around Y-axis in coordinate system relative to matrix position.
rotateRelZ | None | Real value | Rotates the matrix around Z-axis in coordinate system relative to matrix position.
rotateRelV | None | vcVector v, Real angle | Rotates the matrix around an axis defined by a given vector by a given angle in coordinate system relative to matrix position.
scaleAbs | None | Real x, Real y, Real z | Scales the matrix in relation to 3D world origin.
scaleRel | None | Real x, Real y, Real z | Scales the matrix in relation to matrix position.
setAxisAngle | None | Real x, Real y, Real z, Real w | Rotates the matrix around an axis. The x, y and z arguments define a unit vector and direction of axis. The w argument defines the rotation (in degrees) around that axis.
setEuler | None | Real x, Real y, Real z | Sets the orientation of the matrix by executing a set of absolute rotations (in degrees) around Z-axis, followed by Y-axis, and then around Z-axis in fixed coordinate system.
setIJK | None | Real i, Real j, Real k | Sets the orientation of the matrix so that its Approach vector (Z-axis) is aligned with a vector defined by i, j and k arguments.
setQuaternion | None | Real q1, Real q2, Real q3, Real q4 | Sets the orientation of the matrix by using a quaternion defined by four given arguments.
setWPR | None | Real yaw, Real pitch, Real roll | Sets the orientation of the matrix by using roll, pitch and yaw arguments.
translateAbs | None | Real x, Real y, Real z | Translates the matrix position by a given offset (XYZ values) in reference (Parent) coordinate system. Parent can be for example the World or a Node.
translateRel | None | Real x, Real y, Real z | Translates the matrix position by a given offset (XYZ values) in Object coordinate system.
uniform | None | None | Modifies the matrix to be orthogonal and contain no scaling.

Examples

Example. Create matrix position for component

from vcScript import *
import vcMatrix

comp = getComponent()
mtx = vcMatrix.new()
mtx.translateRel(1000,500,500)
mtx.rotateRelY(45)
comp.PositionMatrix = mtx
getApplication().render()

Example. Manipulating and printing matrix values

# create a python behaviour replace and compile
import vcMatrix as mat

def printMatrix(mat):
"""Usefull utility function for printing matrix value"""
for Vec in [mat.N,mat.O,mat.A,mat.P]:
print ("%3.3g\t%3.3g\t%3.3g\t%3.3g\n"%(Vec.X,Vec.Y,Vec.Z,Vec.W))

#lets generate a matrix
m=mat.new()

# rotate it in place
m.rotateRelX(12.5)
m.rotateRelZ(20)

# Then move about
m.translateRel(0,0,102)

# please note following will not work
# m.P.X=345
# use instead
vec=m.P
vec.X=345
m.P=vec

# print the resulting matrix
printMatrix(m)

Example. Get object's position matrix in relation to another object's coordinate system

from vcScript import *
import vcMatrix

app = getApplication()
yellow = app.findComponent('Yellow')
orange = app.findComponent('Orange')

mtxOrange = orange.PositionMatrix #green arrow in the picture
mtxYellow = yellow.PositionMatrix # blue arrow in the picture

invMtxYellow = yellow.PositionMatrix

invMtxYellow.invert() # purple arrow in the picture
mtxYellowToOrange = invMtxYellow * mtxOrange # result: black arrow in the picture

print mtxYellowToOrange.P.X,mtxYellowToOrange.P.Y,mtxYellowToOrange.P.Z


vcMatrixSignal

vcMatrixSignal is a signal that can send a 4x4 vcMatrix object.

Inherits: vcBehaviour, vcSignal

Properties

Name | Type | Access | Description
Value | vcMatrix | RW | Defines the value of signal. Setting this value does not trigger the OnSignal event unless you use the signal() method.

Methods

Name | Return Type | Parameters | Description
signal | None | [vcMatrix value] | Signals the current value of signal to all connected behaviors, thereby triggering the OnSignal event. An optional value argument can be given to set the Value property of the signal.


vcMotionInterpolator

vcMotionInterpolator is used by a robot to interpolate motion targets and joint values.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
DefaultTargetMode | Enumeration | RW | Defines the relationship between motion targets and robot. See Motion Target Constants for more information.
Targets | List of vcMotionTarget | RW | Lists all motion targets in the interpolator.

Methods

Name | Return Type | Parameters | Description
createTarget vcMotionTarget [vcMatrix target], [Enumeration motiontype], [Real speed], [Real accuracy] Adds a new motion target to the interpolator using either the robot's current posture or given arguments.

If motiontype argument is VC_MOTIONTARGET_MT_LINEAR, speed argument defines CartesianSpeed (mm/s) property of motion target.

If motiontype argument is VC_MOTIONTARGET_MT_JOINT, speed argument defines JointSpeedFactor (mm/s) property of motion target.

See vcRslMotionStatement and vcMotionTarget for more information.
getCycleTimeAtTarget | Real | Integer index | Returns the cycle time of a motion target at a given index in interpolator's Targets property.
interpolate | vcMotionTarget | Real cycletime | Returns an interpolated motion target based on a given cycletime.


vcMotionPath

vcMotionPath is a wrapper class for One Way Path and Two Way Path behaviors.

Inherits: vcBehaviour, vcFlow, vcContainer

Contents ShowHide

Properties

Events

Properties

Name | Type | Access | Description
Acceleration Real RW Defines rate of acceleration (mm/s^2) for components moving on path.

If zero, acceleration is not calculated.
Accumulate Boolean RW Turns on/off pile-up of components moving on path.

If True, components on the path stop moving when they encounter a blocked component. If False, components on the path stop moving when a component is blocked from exiting the path.
Deceleration Real RW Defines rate of deceleration (mm/s^2) for components moving on path.

If zero, deceleration is not calculated.
DetailCurveMotion Boolean RW Turns on/off detailed movement of components to and from path, for example when moving from linear path to curved path.

If True, bound box of component is used to avoid intersecting with other components. This might create a gap between components, for example components that are cylindrical. This also decreases simulation performance.

You can disable DetailCurveMotion if components are cylindrical or if a slight intersection between components when transferring from linear to curved path is not a concern.
Direction Enumeration RW Defines the direction components move on path, but only if the path supports two or more directions.

See Conveyor Direction Constants for more information.
FastScheduling Boolean RW Turns on/off the optimization of moving components on the path.

If True, the path limits the amount of generated events, thereby improving simulation performance.

If False, the path moves components at shorter increments, thereby increasing the amount of events and decreasing simulation performance.

Interpolation Enumeration RW Defines mode used by path to interpolate its waypoints set in Path property.

See Conveyor Interpolation Mode Constants for more information.
Path List of vcFeature RW Defines an ordered list of Frame features referenced as waypoints of path.

If set, path is calculated based on its interpolation mode.
PathAxis Enumeration RW Defines mode for calculating how much space a component occupies on path, thereby allowing the path to utilize its space and determine if one or more components are blocked if SpaceUtilization property is set to True.

See Path Axis Mode Constants for more information.
PathLength | Real | R | Gets the length of path. That is, the distance from first to last waypoint along the path.
RetainOffset Boolean RW Defines if a component entering, placed or grabbed by the path is snapped to and aligned with path's axis.

If True, a component retains its offset while moving on path. If False, component is snapped to nearest point on path and its origin is aligned with calculated path.
SegmentSize Real RW Defines the size of segments when path uses segmentation to move components to and from different sections of the path.

If value is greater than zero, the number of path segments is calculated in order to determine the capacity of each segment based on total capacity of path. Therefore, components move on path based on the capacity of a proceeding segment.
Sensors | List of vcBehaviour | RW | List of sensors connected to path, which must be either component path or process point type sensors.
SpaceUtilization Boolean RW Defines if components accumulating on path are kept separate from one another and how new components enter path.

If False, components may overlap one another and/or pile up side by side, which might be useful if RetainOffset is set to True.
Speed | Real | RW | Defines the speed (mm/s) of path.

Notes:

  • Speed, Acceleration and Deceleration properties can be overridden if component properties PathVelocity, PathAcceleration and PathDeceleration have values greater than zero. In those cases, component property values will be used instead to calculate component movement on a path. See vcComponent for more information.
  • Accumulation mode only determines what happens when a component is blocked from exiting the end of the path. If a component is explicitly blocked using stopMovement() method, preceding components are accumulated regardless of set value for Accumulate property.

Events

The following events can be assigned callback functions to handle the flow of components moving in and out of containers as well as changes to a component's motion along a path.

Name Parameters Description
OnMotionChanged vcComponent Component, Enumeration integer State Triggered when the state of a component's motion changes on a path.

If the state of a path is changed so that it affects the motion of all components on that path, this event is called for each of those components.

See Path Motion State Constants for more information.
OnPhysicalTransition vcContainer Container, vcComponent Component, Boolean arrive_leave Triggered when either a) the leading edge of a component enters path or b) the trailing edge of a component exits path.

The Container argument is the current container of the component given in the Component argument, which may not be the container of component at the time of the call since the component may have transitioned elsewhere.

The arrive_leave argument is True if component is entering path; otherwise False means a component is exiting path.


vcMotionStatement

vcMotionStatement is an abstract class used for implementing motion type statements.

Inherits: vcStatement, vcPositionStatement

Contents ShowHide

Common Properties

Statement Specific Properties

Methods

Common Properties

The following properties are common in all motion type statements.

Name | Type | Access | Description
AccuracyMethod | Enumeration | RW | Defines the zone of accuracy type to use for the target, for example distance, time or velocity. See Motion Target Constants for more information.
AccuracyValue | Real | RW | Defines the limit used in AccuracyMethod.
Base | vcBaseFrame | RW | Defines the base frame used by robot for the statement.
CycleTime | Real | RW | Defines the total elapsed time (in seconds) for executing motion statement, which may scale speed and acceleration of joints. If zero, CycleTime is ignored.
ExternalTCP | Boolean | RW | Defines the interpolation mode for targeting motion. 0 = False Default setting that uses Base to Tool configuration; position created at tool frame. 1 = True Interpolation from Tool to Base; position created at base frame.
Tool | vcToolFrame | RW | Defines the tool frame used by robot for the statement.

Statement Specific Properties

Linear Motion

A Linear Motion statement is a motion in which a robot uses its current configuration to reach a position in the shortest distance possible.

Name | Type | Access | Description
Acceleration | Real | RW | Defines the maximum Cartesian acceleration of motion (units/s^2) used to calculate target trajectory.
AngularAcceleration | Real | RW | Defines the maximum angular acceleration of motion (degrees/s^2) used to calculate target trajectory.
AngularDeceleration | Real | RW | Defines the maximum angular deceleration of motion (degrees/s^2) used to calculate target trajectory.
ConfigurationMode | Enumeration | RW | Defines the configuration mode for joints driven by robot controller during linear motion interpolation. 0 = Fixed No change. That is, current configuration is used and does not change. 1 = Follow frame Configuration closest to previous joint values is used. 2 = Interpolate joint values Configuration is determined by point-to-point interpolation of joint values. See Motion Target Constants for more information.
Deceleration | Real | RW | Defines the maximum Cartesian deceleration of motion (units/s^2) used to calculate target trajectory.
MaxAngularSpeed | Real | RW | Defines the maximum angular speed (degrees/s^2) used to calculate target trajectory.
MaxSpeed | Real | RW | Defines the maximum Cartesian speed (units/s) used to calculate target trajectory.
OrientationInterpolationMode | Enumeration | RW | Defines the orientation interpolation mode for linear movement. See Orientation Interpolation Mode Constants for more information.

Point-to-Point Motion

A Point-to-Point Motion statement is a motion in which a robot interpolates its joint values to reach a position.

Name | Type | Access | Description
JointForce | Real | RW | Defines the percentage of joint acceleration and deceleration values to use in statement.
JointSpeed | Real | RW | Defines the maximum speed for joints driven by robot controller as a percentage of nominal joint speed.

Methods

Name Return Type Parameters Description
readIn None None Initializes a declared motion statement to current state of controller.

For example, a robot arm is moved to a location, the location is recorded as a motion statement in the robot's program, and then the motion statement is defined by the current pose of robot.

In some cases, you would import positional data and record them as motion statements by driving robot to each position (target), creating a motion statement and calling readIn().
writeToTarget None vcMotionTarget target Updates a given target to match the motion of the statement.

For example, you adjust a robot motion, and then update its corresponding target that is known to the controller.


vcMotionTarget

vcMotionTarget is a motion target for a robot, which may include joint and tool behavior as well as speed and configuration settings for orientation solutions.

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
AccuracyMethod | Enumeration | RW | Defines the zone of accuracy type to use for the target, for example distance, time or velocity. See Motion Target Constants for more information.
AccuracyValue | Real | RW | Defines the limit used in AccuracyMethod.
AngularSpeed | Real | RW | Defines the rate of target rotation (degrees/s), which is only used for non-joint motions.
BaseMatrix | vcMatrix | RW | Defines a matrix referenced by the target as robot base frame. If set, this property overrides BaseName.
BaseName | String | RW | Defines base frame in robot controller referenced by the target.
CartesianAcceleration | Real | RW | Defines the maximum Cartesian acceleration (units/s^2) of linear motion to target.
CartesianDeceleration | Real | RW | Defines the maximum Cartesian deceleration (units/s^2) of linear motion to target.
CartesianSpeed | Real | RW | Defines the maximum Cartesian speed (units/s) of linear motion to target.
ConfigCount | Integer | R | Gets the number of available configurations in robot.
ConfigurationMode | Enumeration | RW | Defines the robot's joint configuration during linear interpolation, which can be fixed, an attempt to maintain current configuration or one interpolated using joint values. See Motion Target Constants for more information.
JointSpeedFactor | Real | RW | Defines the joint speed at the target, as a factor of maximum speed determined in robot controller.
JointTurnMode | Enumeration | RW | Defines the turn mode for joints in the target. The default mode is for joints to turn nearest within their set limits. See Motion Target Constants for more information.
JointValues | List of Real | RW | Defines joints values of target if using joint interpolation. To read and write joint values, first get a handle for this property, edit the values of that handle, and then assign that handle as the value of this property. See Example. Edit joint values in motion target for more information.
MotionType | Enumeration | RW | Defines the motion type of the target, which is either linear or point-to-point/joint. See Motion Target Constants for more information.
OrientationInterpolationMode | Enumeration | RW | Defines the orientation interpolation mode for linear movement. See Orientation Interpolation Mode Constants for more information.
PositionerIndex | Integer | RW | Defines current positioner used by robot to reach target.
RobotConfig | Integer | RW | Defines robot configuration at target, which is dependent on the kinematic structure.
Target | vcMatrix | RW | Defines position matrix of target relative to its base frame or matrix.
TargetMode | Enumeration | RW | Defines how position matrix of target relates to robot. See Motion Target Constants for more information.
ToolMatrix | vcMatrix | RW | Defines a matrix referenced by the target as the robot tool frame. If set, this property overrides ToolName.
ToolName | String | RW | Defines tool frame in robot referenced by target.
UseJoints | Boolean | RW | Defines if JointValues property is used to define target or its Target property. That is, whether the target is defined using joint values or a position matrix that is used to calculate joint values. If you set JointValues, this property is automaticaly set to True. If you set Target, this property is automatically set to False.

Methods

Name | Return Type | Parameters | Description
getConfigWarning | Enumeration integer | Integer configuration | Tests a robot configuration for any potential issues associated with target. The returned value indicates singularity (S), joint limits (J) and unreachable (U) errors using a format of SJU. 0 = 000 No errors. 1 = 001 Reachability error in robot. 2 = 010 One or more joints exceeding limits. 3 = 011 Reachability and joint limit errors. 4 = 100 Singularity detected, for example in articulated robot wrist. 5 = 101 Singularity and reachability errors. 6 = 110 Singularity and joint limit errors. 7 = 111 Singularity, joint limit and reachability errors. See Motion Target Constants for more information.
getConfigWarnings | List of Enumeration integers | None | Tests all configurations in kinematic structure for potentials errors related to target. See getConfigWarning() method for more information on possible returned values.
getPositionerRootToPositionerFlange | vcMatrix | None | Returns the offset from robot positioner root node to its flange node.
getRootNodeToPositionerRoot | vcMatrix | None | Returns the offset from root node to robot positioner root node.
getRootNodeToRobotRoot | vcMatrix | None | Returns the offset from root node to robot root node.
getRobotRootToRobotFlange | vcMatrix | None | Returns the offset from robot root node to robot flange node.
getSimWorldToRootNode | vcMatrix | None | Returns the offset from 3D world origin to root node.
getSimWorldToRobotTool | vcMatrix | None | Returns the offset from 3D world origin to tool frame active in robot.
getSimWorldToRobotWorld | vcMatrix | None | Returns the offset from 3D world origin to Robot World Frame.
getWorldToRootNode | vcMatrix | None | Returns the offset from 3D world origin to root node. (Deprecated)
getWorldToRobotTool | vcMatrix | None | Returns the offset from 3D world origin to tool frame active in robot. (Deprecated)

Examples

Example. Edit joint values in motion target

from vcScript import *

#this example uses a generic articulated robot from webcat
def OnRun():
comp = getComponent()
rc = comp.findBehaviour("Controller")
mt = rc.createTarget()
mt.MotionType = VC_MOTIONTARGET_MT_JOINT
mt.UseJoints = True

#one way to adjust joint values
jv = mt.JointValues
for i in xrange(len(jv)):
jv[i] = 0
mt.JointValues = jv
rc.addTarget(mt)

#another way
jv[2] = 90.0
mt.JointValues = jv
rc.addTarget(mt)

rc.move()


vcNode

vcNode is the object type for nodes, which are used by components and other objects to form simple and complex tree structures.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Behaviours | List of vcBehaviour | R | Gets a list of all behaviors in node.
BoundCenter | vcVector | R | Gets a vector from node origin to center of its geometry bound box.
BoundDiagonal | vcVector | R | Gets a vector from center of node's geometry bound box to its upper corner using positive axis directions.
ChildComponents | List of vcComponent | R | Gets a list of all components attached to the node at any depth in structure.
Children | List of vcNode | R | Gets a list of nodes attached to the node at first level. That is, the node is parent to those nodes.
Component | vcComponent | R | Gets the component of node.
ComponentChildren | List of vcComponent | R | Gets a list of components attached to the node at first level. That is, the node is parent to those component root nodes.
Dof | vcDof | R | Gets the degree-of-freedom (DOF) object that defines the joint properties of the node and its mechanism of movement. If JointType is fixed, Dof will be assigned None.
Geometry | vcGeometryContainer | R | Gets the container of geometry in node. Geometry in container is result of evaluating node's feature tree, but can be manually set.
IgnoreEvents | Boolean | RW | Defines if node ignores event passing in order to avoid the creation of cyclic calls.
InverseWorldPositionMatrix | vcMatrix | R | Gets inverse of node's position matrix in World coordinate system. Note: Using World matrix requires scene updating.
JointExpression | String | RW | Defines an expression that when evaluated returns the joint definition of the node. (Deprecated) Use vcNode.Dof.Joint if joint type is custom.
JointType | Enumeration | RW | Defines the joint type of the node. See Joint Constants for more information.
MaterialInheritance | Enumeration | RW | Defines the mode for managing NodeMaterial property. For example, node material could override feature materials and child nodes. See Node Constants for more information.
Name | String | RW | Defines the node's name.
NodeMaterial | vcMaterial | RW | Defines the node's material. This property is used with MaterialInheritance to define how the node's material is assigned to its features and child nodes.
NodeVisible | Boolean | RW | Turns on/off the visibility of the node but not its child nodes.
Offset | String | RW | Defines an expression that when evaluated returns the offset of node.
OffsetExpression | String | RW | Defines an expression that when evaluated returns node offset. (Deprecated) Use Offset property.
Parent | vcNode | R | Gets the parent node of this node.
PivotExpression | String | RW | Defines an expression that when evaluated returns the pivot point definition of node. (Deprecated) Use vcNode.Dof.Pivot if joint type is custom.
PositionMatrix | vcMatrix | RW | Defines position matrix of node in parent coordinate system.
RootFeature | vcFeature | R | Gets the root feature of node.
Type | Enumeration | R | Gets the node's type, which identifies the node as either a simulation root node, component root node or a link in a component. See Node Constants for more information.
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 | Turns on/off the visibility of the node and its child nodes.
World | vcNode | R | Gets the 3D world/simulation root node.
WorldPositionMatrix | vcMatrix | R | Gets the position matrix of node in World coordinate system. Note: Using World matrix requires scene updating.

Methods

Name | Return Type | Parameters | Description
attach | None | vcNode node, [Boolean permanent] | Attaches a given node. An optional permanent argument can be given to define the attachment as permanent or temporary. If True, node will not detach itself. If False, node is will detach itself once the simulation is reset. See Example. Attach a node to another node during a simulation for more information.
createNode | vcNode | Enumeration type, String name | Creates a new child node of a given type and name for this node. This cannot be used to create a new 3D world root node. See Node Constants for more information.
createBehaviour | vcBehaviour | Enumeration type, String name | Creates a new behavior of a given type and name in node. See Behavior Constants for more information.
delete | None | None | Deletes the node. Deletion will fail if method is called in Python Script contained in the node.
findBehaviour | vcBehaviour | String name | Returns the first behavior matching a given name in node or in one of its child nodes; otherwise returns None.
findBehavioursByType | List of vcBehaviour | Enumeration type | Returns a list of all behaviors matching a given type in node and all of its child nodes; otherwise returns an empty list. See Behavior Constants for more information.
findFeature | vcFeature | String name | Returns the first feature matching a given name in node or in one of its child nodes; otherwise returns None.
findNode | vcNode | String name | Returns the first child node matching a given name; otherwise returns None.
getBehaviour | vcBehaviour | String name | Returns the first behavior matching a given name in node; otherwise returns None.
getBehavioursByType | List of vcBehaviour | Enumeration type | Returns a list of all behaviors matching a given type in the node; otherwise returns an empty list. See Behavior Constants for more information.
getFeature | vcFeature | String name | Returns the first feature matching a given name in node; otherwise returns None.
localToWorld | vcMatrix or vcVector | vcMatrix matrix or vcVector vector | Transforms the given matrix or vector from node’s coordinate system to the world coordinate system and returns that with a new instance.
measureDistance | 4-tuple (Real distance, vcVector point1, vcVector point2, vcVector direction) | List of vcNode or n-tuple of vcNode | Returns the minimum distance between the geometry of this node and a node or a given list of nodes. Additional values returned are position vectors for the two closest points, point1 and point2, as well as a direction vector indicating the distance and direction from those points. If no minimum distance found, returns None. Note: The returned vector is based in the coordinate system of the node calling this method.
rebuild | None | [Integer rebuild_tree] | Rebuilds the geometry of node and its hierarchy by re-evaluating their feature trees. The hierarchy contains child components. Note: Try avoid using this method during a simulation.
update | None | [Integer update_tree] | Updates the node and its hierarchy. The hierarchy contains child components.
worldToLocal | vcMatrix or vcVector | vcMatrix matrix or vcVector vector | Transforms the given matrix or vector from world coordinate system to the node’s local coordinate system and returns with a new instance.

Events

Name | Parameters | Description
OnNodeTransform | vcNode node | Triggered when a node is transformed in 3D world.

Examples

Example. Access parent and child nodes

from vcScript import *

app = getApplication()
comp = app.findComponent("Articulated Robot")

# find a component node
node = comp.findNode("Axis 1")
childNode = node.Children

# get the child nodes
for i in childNode:
print i.Name

Example. Attach a node to another node during a simulation

from vcScript import *

def OnRun():
comp = getComponent()
comp2 = getApplication().findComponent("example")
delay(1)

#retain the position of attached node in 3D world
m = comp.InverseWorldPositionMatrix * comp2.WorldPositionMatrix
comp.attach(comp2, True)
comp2.PositionMatrix = m
print comp.ComponentChildren

Example. Toggle visibility of node and/or child nodes

from vcScript import *

##tested with KR 16-2 robot
comp = getComponent()
node = comp.findNode("A2")
node.NodeVisible = False

from vcScript import *

##tested with KR 16-2 robot
comp = getComponent()
node = comp.findNode("A2")
node.Visible = False

Example. Measure the minimum distance between geometries in given nodes

from vcScript import *
# measures the distance between nodes
# prints the distance in millimeters
# and visualizes the shortest distance with a line in 3D
app = getApplication()
conveyor1 = app.findComponent('Conveyor')
conveyor2 = app.findComponent('Conveyor #2')
conveyor3 = app.findComponent('Conveyor #3')

##3 alternatives for using measureDistance()-method
return_tuple = conveyor1.measureDistance([conveyor2, conveyor3]) # List of vcNodes as argument
#return_tuple = conveyor1.measureDistance((conveyor2, conveyor3)) # 2-Tuple of vcNodes as argument
#return_tuple = conveyor1.measureDistance(conveyor2, conveyor3) # 2 vcNodes as arguments

distance, point1, point2, direction = return_tuple
print distance

geo_container = app.Simulation.World.UserGeometry
geo_container.clear()
line_set = geo_container.createGeometrySet(VC_COMPACTLINESET)
mtx = conveyor1.WorldPositionMatrix
line_set.addLine([mtx*point1, mtx*point2])
line_set.update()
app.render()


vcNodeList

vcNodeList is a behavior type used to generate a filtered list of nodes.

Inherits: vcBehaviour

Properties

Name | Type | Access | Description
Nodes | List of 3-tuple (vcNode, Enumeration inclusion type, Enumeration inclusion scope) | RW | Defines a node and filters used to generate the list's content. See Collision Detector Constants for information about inclusion type and scope arguments.
PureNodes | List of vcNode | R | Gets a list of unfiltered nodes in the list.

Methods

Name | Return Type | Parameters | Description
getFilteredNodes | List of vcNode | [vcNode node] | Returns a list of filtered nodes in the list.


vcPackFolder

vcPackFolder allows you to pack files with a VCMX file and extract them. Files are contained in a folder that is mapped to a layout or component. Generally, you would map a temporary folder that you want to save with a VCMX file, and then extract the folder and its contents when you open the VCMX file. This allows you to share a layout or component that contains other files, for example a CSV file of robot position data.

Contents ShowHide

How It Works

Step 1. Get the packing mechanism

Step 2. Map a folder

Step 3. Extract files

Properties

Methods

How It Works

You can pack any type of file but the file must be stored in a folder. The folder along with its files are packaged and saved with a VCMX file. When you open the VCMX file, the packed folder and files can be extracted to an existing or temporary folder. Extracted files are deleted when you clear the layout or delete the component from the 3D world.

Step 1. Get the packing mechanism

The packing mechanism is a vcPackFolder object.

Case 1. Components

To pack files with a component, get the PackFolder property of a vcComponent object.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

Case 2. Layouts

To pack files with a layout, use the vcApplication object to find or create a vcLayoutPackFolder object, and then get its PackFolder property.

from vcScript import *

app = getApplication()

pf_layout = None
for item in app.LayoutItems:
if item.Type == VC_LAYOUTITEM_IT_LAYOUTPACKFOLDER:
pf_layout = item
break

if not pf_layout:
pf_layout = app.createLayoutItem(VC_LAYOUTITEM_IT_LAYOUTPACKFOLDER)
pf = pf_layout.PackFolder

Step 2. Map a folder

The packing mechanism allows you to pack files in a mapped folder, including its subfolders. Generally, you would map a folder that is temporary or not directly accessed by a user. After you map a folder, save the layout or component.

Case 1. Map a temporary folder

In this case, a temporary folder is selected by the application. This is a safe option if you want to avoid mapping a folder that you want to keep on your computer. The application will also handle any conflicts with other instances of the component or layout.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

pf.mapFolder()

print pf.PackFolderLocalPath

Notes:

  • The temporary folder is created in AppData\Local\Temp.
  • The name of the folder in Temp is a unique id for your session.
  • The subfolder is the name of the component or layout.
  • Example file path of temporary folder C:\Users\%username%\AppData\Local\Temp\Instance_5952\NewComponent

Case 2. Map an existing folder

In this case, you are mapping an existing folder. You have two options: pack folder at the time of call, or wait until you to save the VCMX file.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

uri = r"C:\Users\Public\Pictures\Screenshots"

#packs at time of call
#pf.mapFolder(uri)

#packs when you save component
#pf.remapFolder(uri)

print pf.PackFolderLocalPath

Case 3. Map a different folder

In this case, you want to map a different folder. You should use caution to avoid deleting a mapped folder and its files.

One option is to remap a different folder and not affect the other folder.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

#mapped to wrong folder
uri = r"C:\Users\Public\Pictures\Screenshots"
pf.mapFolder(uri)

uri = r"C:\Users\Public\Pictures\Test"

#does not delete Screenshots folder nor override packed files at time of call
#mapped folder is changed to Test
#files from Test will not be packed until you save the component
pf.remapFolder(uri)

print pf.PackFolderLocalPath

Another option is to move files to a temporary folder and delete the other folder.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

#mapped to wrong folder
uri = r"C:\Users\Public\Pictures\Screenshots"
pf.mapFolder(uri)

#deletes Screenshots folder and moves files to temporary folder
pf.rollbackFolder()
pf.mapFolder()

print pf.PackFolderLocalPath

Another option is to delete a temporary folder and its files and remap a different folder.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

#mapped to wrong folder
uri = r"C:\Users\Public\Pictures\Screenshots"
pf.mapFolder(uri)

#delete folder and move files to temporary folder
pf.rollbackFolder()
pf.mapFolder()

uri = r"C:\Users\Public\Pictures\Test"

#deletes the temporary folder and its files
#mapped folder is changed to Test
pf.remapFolder(uri)

print pf.PackFolderLocalPath

Step 3. Extract files

After you have mapped a folder, you should modify your code to define how you want the files to be extracted when you open the VCMX file.

Case 1. Do not extract any files

In this case, the packed files are available but not extracted from the opened VCMX file. You would need to call the mapFolder() method to extract the files. In this case, it is good to know the state of the vcPackFolder object.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

#2 means folder is mapped
if pf.State == 2:
print "A folder is mapped to component. Unpack the folder to extract its files."

#pf.mapFolder()

Case 2. Automatically extract files

In this case, the packed files are extracted when you open the VCMX file. Generally, you would extract the files to a temporary folder.

from vcScript import *

comp = getComponent()
pf = comp.PackFolder

#2 means folder is mapped
if pf.State == 2:
print "A folder is mapped to component. Unpack the folder to extract its files."

#pf.mapFolder()

Properties

Name | Type | Access | Description
PackFolderLocalPath | String | R | Gets the file path of mapped folder.
State | Enumeration | R | Gets the state of mapped folder. 0 Undefined, no folder is mapped. 1 Defined, but folder is not mapped. 2 Folder is mapped.

Methods

Name | Return Type | Parameters | Description
mapFolder | None | [String uri] | Maps a temporary folder generated by the application or an existing folder at the given uri which must be a file path. Files will be packed/extracted at the time of call.
remapFolder | None | String uri | Remaps a different folder. This will not override the other folder until you save the VCMX file. Files in the other folder will also not be deleted unless they were contained in a temporary folder generated by the application.
rollbackFolder | None | None | Removes mapping to folder. Generally, this is used before you map a different folder.


vcPathObject

vcPathObject is a layout item used for creating and storing path object nodes and segments.

Inherits: vcLayoutItem

Contents ShowHide

Path Objects

Properties

Methods

Examples

Path Objects

A path object can contain one or more types of nodes and segments used for special purposes.

  • vcPathObjectActionNode is an action related to a motion node.
  • vcPathObjectMotionNode defines the trajectory of a motion.
  • vcPathObjectParameterNode contains generic parametric information, for example calibration status.
  • vcPathObjectReferenceNode references another node, which may include component nodes.
  • vcPathObjectSegment is a section of path with its own visualization properties and can include several segments.

Properties

Name | Type | Access | Description
ActionNodeCount | Integer | R | Gets the number of action nodes in path object.
ActionNodeVisualization | vcFrameSetVisualization | R | Gets the object controlling the visualization of action nodes in path object.
MotionNodeCount | Integer | R | Gets the number of motion nodes in path object.
MotionNodeVisualization | vcFrameSetVisualization | R | Gets the object controlling the visualization of motion nodes in path object.
Name | String | RW | Defines the name of path object.
ParameterNodeCount | Integer | R | Gets the number of parameter nodes in path object.
ParameterNodeVisualization | vcFrameSetVisualization | R | Gets the object controlling the visualization of parameter nodes in path object.
Persistent | Integer | RW | Defines if the path object is saved with a layout. If 0, path object is not saved with layout. If 1, path object is saved with layout.
ReferenceNodeCount | Integer | R | Gets the number of reference nodes in path object.
ReferenceNodeVisualization | vcFrameSetVisualization | R | Gets the object controlling the visualization of reference nodes in the path object.
SegmentCount | Integer | R | Gets the number of segments in the path object.

Methods

Name | Return Type | Parameters | Description
clear | None | None | Removes all nodes and segments from path object.
clearNodes | None | Enumeration type | Removes all nodes of a given type from path object. See Path Object Constants for more information.
clearSegments | None | None | Removes all segments from path object.
createNode | <Type> | Enumeration type, [Integer index] | Adds a new node of a given type to the path object, and then returns the new node. See Path Object Constants for more information.
createSegment | vcPathObjectSegment | Integer index | Adds a new segment to the path object at a given index, and then returns the new segment.
deleteNode | None | vcPathObjectNode node | Deletes a given node from path object.
deleteSegment | None | vcPathObjectSegment segment or Integer index | Deletes a given segment or one at a given index from the path object.
findNode | <Type> | String name | Returns a node matching a given name in path object.
findSegment | vcPathObjectSegment | Real logical_distance | Returns a segment at a given logical_distance in path object.
getNode | <Type> | Enumeration type, Integer index | Returns a node of a given type at a given index in path object.
getNodes | List of <Type> | Enumeration type | Returns a list of nodes of a given type in path object.
getSegment | vcPathObjectSegment | Integer index | Returns a segment at a given index in path object.

Examples

Example. Create a path of motion nodes

from vcScript import *
import random

app = getApplication()
for i in app.LayoutItems:
if i.Type == VC_LAYOUTITEM_IT_PATHOBJECT:
app.deleteLayoutItem(i)

po = app.createLayoutItem(VC_LAYOUTITEM_IT_PATHOBJECT)
vis = po.MotionNodeVisualization
vis.ConnectingLinesVisible = True
vis.LineDisplayMode = VC_LINEDISPLAY_LINE
vis.FramesVisible = True
vis.FrameDisplayMode = VC_FRAMEDISPLAY_COLOR_AXIS

# Note: pathobjects are only visible in the Teach tab

for i in range(5):
point = po.createNode(VC_PATHOBJECT_NT_MOTION)
m = point.PositionMatrix
m.translateRel(100*i, random.random()*20, random.random()*20)
point.PositionMatrix = m
prop = point.createProperty(VC_STRING, 'ExtraData')
prop.Value = str(i)+'_example'

po.update()


vcPathObjectActionNode

vcPathObjectActionNode is a node describing an action and relevant data in path object.

Inherits: vcPathObjectNode

Properties

Name | Type | Access | Description
LogicalPosition | Real | RW | Defines the distance of motion node in relation to length of its path object container.
MotionNode | vcPathObjectMotionNode | RW | Defines motion node associated with the action node.
Offset | Real | RW | Defines offset of action node from its referenced motion node.


vcPathObjectMotionNode

vcPathObjectMotionNode is a node used to define the trajectory of a motion in path object.

Inherits: vcPathObjectNode

Properties

Name | Type | Access | Description
LogicalPosition | Real | RW | Defines the distance of motion node in relation to length of its path object container.
PositionMatrix | vcMatrix | RW | Defines the position matrix of the node in World coordinate system or in relation to a defined reference node.
ReferenceNode | vcPathObjectReferenceNode | Rw | Defines a reference node in path object used for defining location of parameter node.


vcPathObjectNode

vcPathObjectNode is the basic implementation for path object nodes.

Contents ShowHide

Hierarchy

Properties

Methods

Hierarchy

vcPathObjectNode

vcPathObjectActionNode

vcPathObjectMotionNode

vcPathObjectParameterNode

vcPathObjectReferenceNode

Properties

Name | Type | Access | Description
Name | String | RW | Defines the name of node.
PathObject | vcPathObject | R | Gets the path object container of the node.
Properties | List of vcProperty | R | Gets a list of all properties of the node.
Type | Enumeration integer | R | Gets the node type. See Path Object Constants for more information.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Adds a new property of a given type and name to the node. An optional constraints argument can be given to define the new property's constraints, which must be done at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property from node.
getProperty | vcProperty | String name | Returns the first property matching a given name in the node; otherwise returns None.


vcPathObjectParameterNode

vcPathObjectParameterNode is a node used to store any kind of data related to a location, for example calibration data, and is not part of a path object's trajectory.

Inherits: vcPathObjectNode

Properties

Name | Type | Access | Description
PositionMatrix | vcMatrix | RW | Defines the position matrix of parameter node in World coordinate system or in relation to a reference node.
ReferenceNode | vcPathObjectReferenceNode | Rw | Defines a reference node in path object used for defining location of parameter node.


vcPathObjectReferenceNode

vcPathObjectReferenceNode is a node for defining the location of its path object relative to a node in 3D world or in reference to World coordinate system.

Inherits: vcPathObjectNode

Properties

Name | Type | Access | Description
Node | vcNode | RW | Defines a node the reference node is attached to in 3D world.
PositionMatrix | vcMatrix | RW | Defines the position matrix of reference node. If Node has a set value, the position matrix will reference that node's coordinate system or else the World coordinate system.


vcPathObjectSegment

vcPathObjectSegment is used for customizing the visualization of object trajectories between motion nodes.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
BeginLogicalDistance | Real | RW | Defines where the segment starts in relation to length of its path object container.
EndLogicalDistance | Real | RW | Defines where the segment ends in relation to its beginning distance in path object container.
PatObject | vcPathObject | R | Gets the path object container of segment.
Properties | List of vcProperty | R | Gets a list of all properties in segment.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Adds a new property of a given type and name to the segment. An optional constraints argument can be given to define the new property's constraints, which must be done at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property from segment.
getProperty | vcProperty | String name | Returns the first property matching a given name in segment; otherwise returns None.


vcPathStatement

A vcPathStatement is a type of robot statement that can execute a set of positions. It allows you to manage a large amount of data used for robot motion planning.

Inherits: vcStatement

Contents ShowHide

Path Properties

Schema Properties

Methods

Examples

Path Properties

Name | Type | Access | Description
Base | vcBaseFrame | RW | Defines the base frame of the path statement.
FrameNameField | Integer | RW | Defines the index of schema property used for labeling position in 3D world. The schema property should be a string data type. The default is -1. This means the position will not be labeled with its custom name rather the number of position in path.
FrameNameVisibleField | Integer | RW | Defines the index of schema property used for controlling the visibility of position label in 3D world. The schema property should be a Boolean data type. The default is -1. This means the labels are visible.
ExternalTCP | Boolean | RW | Defines if external tcp mode is used for the path statement.
Positions | vcPositionFrameIterator | R | Gets an iterator for positions in the path statement. Each position is of type vcSchemaPositionFrame.
ProcessHandler | vcPythonProcessHandler | RW | Defines the process handler used by robot to execute path statement.
SchemaProperties | List of vcProperty | R | Gets a list of schema properties for path statement. See "Schema Properties" section for more information.
ShowReferenceFrames | Boolean | RW | Turns on/off visibility of positions marked as reference points.
Tool | vcBaseFrame | RW | Defines the tool frame of the path statement.

Schema Properties

The positions of a vcPathStatement are linear motions and defined using schema properties, which are fields in a schema database (table) unique to each vcPathStatement object.

Default

By default, each path position (record) is defined by seven, built-in schema properties as well additional properties for any external joint values. Each built-in property is mapped to an internal Field property, for example Position is mapped to PositionField. The mapping is done by referencing the index of a schema property. For example, PositionField has a default value of 0 since Position is the first property/field in schema of path position. We recommend that you do not modify any internal Field properties for built-in schema properties.

Name | Type | Access | Description
FrameVisible | Boolean | RW | Turns on/off the visibility of the position in 3D world.
IsContinuous | Boolean | RW | Defines if robot motion to and from position should be one continuous motion.
IsReference | Boolean | RW | Indicates if position is used as reference for calculating adjustments to path positions.
LineColor vcVector
RW Defines the color of line to position.
LineVisible | Boolean | RW | Defines if line to position is visible in 3D world.
Position | vcMatrix | RW | Defines the position matrix of position.
PositionStatus Integer RW Indicates the status of position, for example whether or not it is unreachable.

Status is determined by three flags.

1
Reachable

2
Within joint limits of robot

4
No singularity

The default is 7. The status is not updated automatically by application. You would need to manually test the position as a vcMotionTarget object and evaluate configuration warnings. The configuration warning and position status values are flipped, so a configuration warning of 0 would be a status of 7.

If you do not modify LineColor, the color of position in 3D world will automatically be updated based on PositionStatus. For example, green is reachable and red is unreachable.

See Configuration Warnings constants for more information or review the example in vcSchemaPositionFrame.
E1 ... EN | Real | RW | Defines one or more external joint values for the position.

Optional

If you add any of the following schema properties by name, the property will automatically be mapped to an internal Field property and affect a robot motioning to positions. The same recommendation applies to not modify the internal Field property.

Note: If you create a Path statement using the GUI, MaxSpeed, Acceleration, Deceleration, AccuracyMethod and AccuracyValue will automatically be added as schema properties.

Name | Type | Access | Description
Acceleration | Real | RW | Defines the maximum Cartesian acceleration of motion (units/s^2) used to calculate target trajectory.
AccuracyMethod | Enumeration | RW | Defines the zone of accuracy type to use for the position, for example distance, time or velocity. See Motion Target Constants for more information.
AccuracyValue | Real | RW | Defines the limit used in AccuracyMethod.
AngularAcceleration | Real | RW | Defines the maximum angular acceleration of motion (degrees/s^2) used to calculate target trajectory.
AngularDeceleration | Real | RW | Defines the maximum angular deceleration of motion (degrees/s^2) used to calculate target trajectory.
Deceleration | Real | RW | Defines the maximum Cartesian deceleration of motion (units/s^2) used to calculate target trajectory.
MaxAngularSpeed | Real | RW | Defines the maximum angular speed (degrees/s^2) used to calculate target trajectory.
MaxSpeed | Real | RW | Defines the maximum Cartesian speed (units/s) used to calculate target trajectory.

Methods

Name | Return Type | Parameters | Description
addSchemaProperties List of Integer List of Enumeration type and String name Adds a list of custom properties for each position in path statement, and then returns a list of indices for the added properties in SchemaProperties.

The format for each new property is its type followed a given name.
beginBatchUpdate None Integer schema_size Sets the initial amount of schema database entries, for example 100 entries for 100 path positions. This is done to allocate enough memory for storing schema property values for each path position.

Note: This method is required if there is no existing schema database. If the database exists, this is optional.

Note: Using size value -1 doesn't allocate space for new schema items and doesn't reset current data. It only blocks notify events when items are updated between this call and EndBatchUpdate.
clearPositions | None | None | Removes all positions from path statement, thereby removing all schema database entries.
endBatchUpdate | None | Integer schema_size | Sets the final amount of schema database entries, for example 96 entries for 96 path positions. This is done to not allocate more memory than is needed to store schema property values for each path position.
getSchemaSize | Integer | None | Returns the total amount of entries for schema database of path statement.
getSchemaValue | <Type> | Integer position_index, String property_name | Returns the value of schema property for path position.
setSchemaValues None Integer position_index, String property_name, <Type> value

or

Integer position_index, List of Integer property_indices, List of <Type> values

 Sets one or more schema properties for path position.

Note: The method should not be called when there are no rows in the schema database or if the row's index value does not exist.
removeSchemaProperties None List of String property_names

or

List of vcProperty properties

 Removes properties referenced by property_names list or properties list arguments

Examples

Example. Add path statement and populate position table

from vcScript import *
import vcMatrix

comp = getComponent()
executor = comp.findBehaviour("Executor")
routine = executor.Program.MainRoutine

#add path statement
path_statement = routine.addStatement('Path', 0)

#clear path table
path_statement.clearPositions()

#add schema properties/fields for table
my_props = [VC_MATRIX, "Position",\
VC_INTEGER, "MotionType",\
VC_INTEGER, "OriginalIndex",\
VC_REAL, "Speed"]
prop_indices = path_statement.addSchemaProperties(my_props)

#add data to path table
path_statement.beginBatchUpdate(100)
for point_index in range(100):
position = vcMatrix.new()
motion_type = 1
speed = 200.0
position_values = (position, motion_type, point_index, speed)
path_statement.setSchemaValues(point_index, prop_indices, position_values)
path_statement.setSchemaValues(0, "IsReference", True)
path_statement.setSchemaValues(99, "IsReference", True)
path_statement.endBatchUpdate(100)

path_handler = comp.getBehaviour("MyHandler")
path_statement.ProcessHandler = path_handler

app = getApplication()
app.SelectionManager.clear()
app.SelectionManager.setSelection(path_statement)
app.render()

Example. Customize name of positions

from vcScript import *
import vcMatrix

comp = getComponent()
rx = comp.findBehaviour("Executor")
mr = rx.Program.MainRoutine

mr.clear()
path = mr.addStatement("Path")

#add schema property for custom name
#assign the index of that property to FrameNameField
index = path.addSchemaProperties([VC_STRING,"ExampleName"])[0]
path.FrameNameField = index

#this will label positions P1...P10 i.e. default labeling of positions
#path.FrameNameField = -1

path.beginBatchUpdate(10)
for i in range(10):
#define position
position = vcMatrix.new()
position.translateAbs(1000,i*100,1000)
path.setSchemaValues(i,"Position",position)

#frame of position must be visible, otherwise name is also hidden
path.setSchemaValues(i,"FrameVisible",True)

#will label positions T1...T10
path.setSchemaValues(i,"ExampleName","T"+str(i+1))
path.endBatchUpdate(10)

app = getApplication()
app.render()

Example. Toggle visibility of position labels

from vcScript import *
import vcMatrix

comp = getComponent()
rx = comp.findBehaviour("Executor")
mr = rx.Program.MainRoutine

mr.clear()
path = mr.addStatement("Path")

index = path.addSchemaProperties([VC_BOOLEAN,"ExampleNameVisible"])[0]
path.FrameNameVisibleField = index

path.beginBatchUpdate(10)
for i in range(10):
#define position
position = vcMatrix.new()
position.translateAbs(1000,i*100,1000)
path.setSchemaValues(i,"Position",position)

#frame of position must be visible, otherwise name is also hidden
path.setSchemaValues(i,"FrameVisible",True)

#frames are visible but not the labels
path.setSchemaValues(i,"ExampleNameVisible",False)
path.endBatchUpdate(10)
app = getApplication()
app.render()


vcPatternContainer

vcPatternContainer is a static container used for storing components in a defined pattern.

Inherits: vcBehaviour, vcFlow, vcContainer

Contents ShowHide

Methods

Methods

Name | Return Type | Parameters | Description
fill | None | vcComponent component | Fills the container with a given component.


vcPoint

vcPoint is an abstract base class for all primitive types of points in the 3D world.

Inherits: vcPrimitive

Properties

Name | Type | Access | Description
Position | vcVector | RW | Defines the position of point in 3D world.

Methods

Name | Return Type | Parameters | Description
update | None | None | Updates the primitive object containing the point, which includes any polygons and lines sharing the point.


vcPointSet

vcPointSet is a type of geometry set used for creating and rendering point clouds and/or data points.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
ColorConfiguration | Enumeration | RW | Defines the color format for points. By default, the color format is RGBA. See Color Format Constants for more information. Gets or sets the current color configuration. There are 2 VC_COLOR_CONFIGURATION_RGBA and VC_COLOR_CONFIGURATION_BGRA
IncrementalBoundUpdate | Boolean | RW | Defines if the bound box should be updated on every added point or not.
PointCount | Real | R | Total amount of points in the point set.
PointSize | Real | RW | Defines the size (in pixels) of points in set.
Scale | Real | RW | Defines a factor for scaling rendered points in set.

Methods

Name | Return Type | Parameters | Description
addPoint | Integer | Real x, Real y, Real z or Real x, Real y, Real z, Real r, Real g, Real b or Real x, Real y, Real z, Real r, Real g, Real b, Real a | Adds a point to set, and then returns the index of point in the set. One option is to give XYZ coordinates for point in World coordinate system, thereby the point is assigned default color. A second option is to give XYZ coordinates and RGB color for the point. A third option is to give XYZ coordinates and RGB color with alpha channel for the point. If you are assigning a color, the RGB values must be normalized XYZ values for RGB color space.
clearPoints | None | None | Removes all points from set.
getPointColor | vcVector | Integer Index | Gets a point color given an index.
getPointPosition | vcVector | Integer Index | Gets a point position given an index.
update | None | None | Updates the bound box of set.
updatePointColor | None | integer Index, Real r, Real g, Real b | Updates the color of the point defined by the index.
updatePointPosition | None | integer Index, Real x, Real y, Real z | Updates a point position given an index.

Examples

Example. Render point cloud in 3D world

from vcScript import *
from random import *

cloudsize = 1000.0
pointamount = 100000

comp = getComponent()
pc = comp.findFeature('pc')
if not pc:
pc = comp.RootFeature.createFeature(VC_GEOMETRY,'pc')
if pc.Geometry.GeometrySetCount == 0:
pcs = pc.Geometry.createGeometrySet(VC_POINTSET)
else:
pcs = pc.Geometry.getGeometrySet(0)
pcs.clearPoints()

for i in range(pointamount):
x = cloudsize * random()
y = cloudsize * random()
z = cloudsize * random()
r = random()
g = random()
b = random()
pcs.addPoint(x,y,z,r,g,b)

pcs.update()
comp.rebuild()
getApplication().render()


vcPolygon

vcPolygon represents an n-sided face in the 3D world.

Inherits: vcPrimitive

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Edges | List of vcEdge | R | Gets a list of all edges in polygon.
Normal | vcVector | R | Gets the Normal vector of polygon.
PointCount | Integer | R | Get the number of points in polygon.
Points | List of vcPolygonPoint | R | Gets a list of all points in polygon.

Methods

Name | Return Type | Parameters | Description
addPoint | None | vcPolygonPoint point | Adds a given point to the polygon. Note: Points can be shared by different polygons.
getNeighbors | List of vcPolygon | Integer point_index | Returns a list of polygons sharing an edge with the polygon based on a given point_index.
getPoint | vcPolygonPoint | Integer index | Returns a point of the polygon at a given index.
getPointNormal | vcVector | Integer index | Returns the Normal vector of a point in the polygon at a given index.
removePoint | None | vcPolygonPoint point or Integer index | Removes a given point or one at a given index from the polygon.
reverse | None | None | Inverts the face of polygon.
update | None | None | Updates the structure of polygon, which is required when changing point count and point properties.


vcPolygonPoint

vcPolygonPoint is a point/vertex used to define polygons.

Inherits: vcPrimitive, vcPoint

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Color | vcVector | RW | Defines the color of the point by using a vector containing RGBA values. Note: The geometry set of point and its polygon must support a VertexColor property; otherwise point will not have color.
Edges | List of vcEdge | R | Gets a list of all edges using the point.
PolygonCount | Integer | R | Gets the number of polygons using the point.
U | Real | RW | Defines a U texture coordinate for point.
V | Real | RW | Defines a V texture coordinate for point.

Methods

Name | Return Type | Parameters | Description
getAverageNormal | vcVector | None | Returns the Normal vector of point, which is an average of all polygons using that point.
getPolygon | vcPolygon | Integer index | Returns a polygon using the point at a given index; otherwise returns None.


vcPolygonSet

vcPolygonSet is a collection of n-sided polygons, which are either manually created or the result of tessellation.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
CreaseAngle | Real | RW | Defines an angle (in degrees) between polygons and edges considered hard, thereby rendering uses polygon normals instead of point normals.
Edges | List of vcEdge | R | Gets a list of all edges in the set.
Points | List of vcPolygonPoint | R | Gets a list of all points in the set.
PolygonCount | Integer | R | Gets the number of polygons in the set.
Polygons | List of vcPolygon | R | Gets a list of polygons in the set.

Methods

Name | Return Type | Parameters | Description
createPoint | vcPolygonPoint | vcVector vec or Real x, Real y, Real z | Adds a new point to the set using either a given vector or XYZ coordinates, and then returns the new point.
createPolygon | vcPolygon | None | Adds a new empty polygon to the set, and then returns the new polygon.
deletePolygon | None | vcPolygon polygon or Integer index | Deletes a given polygon from the set or a polygon at a given index in the set.
filterDuplicatePolygons | None | None | Traverses through set and removes all duplicate polygons, thereby reducing data count.
getPolygon | vcPolygon | Integer index | Returns a polygon at a given index in the set.
smoothGroupProcessing | None | None | Performs a cleanup operation for grouped polygon sets in order to render smooth surfaces.
triangulate | None | None | Performs a cleanup operation for polygons in the set to have three sides, thereby possibly increasing data count.
update | None | None | Updates the set, thereby recalculating all polygons in the set and its bound box.
updatePointSurrounding | None | vcPolygonPoint point | Updates points in the set neighboring a given point.


vcPositionFrame

vcPositionFrame is a motion target for a robot that can be referenced by a statement.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Name | String | RW | Defines the name of the position.
ReferencePoint | Boolean | RW | Turns on or off the use of a reference point to define the location of the position.
Configuration | String | RW | Defines the configuration of the robot for the position.
Properties | List of vcProperty | R | Gets a list of properties in the position.
Statement | vcStatement | R | Gets the statement referencing the position.
JointValues | List of Real | R | Gets a list of all the robot joint values (internal and external) for the position.
InternalJointValues | List of Real | R | Gets a list of internal robot joint values for the position.
ExternalJointValues | List of Real | R | Gets a list of external robot joint values for the position.
PositionInReference | vcMatrix | RW | Defines the position matrix in reference to its base/parent coordinate system.
PositionInWorld | vcMatrix | RW | Defines the position matrix in reference to World coordinate system.

Methods

Name | Return Type | Parameters | Description
setJoints | None | List of Real values | Sets the joint values of the position using a given list of values that must be equal or smaller in length than the total robot joint count (including external joints).
setExternalJoints | None | List of Real values | Sets the external joint values of the position.
createProperty | vcProperty | Enumeration type, String name | Creates a new property of a given type and name in the position, and then returns the new property. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property in the position.
getProperty | vcProperty | String name | Returns a property matching a given name in the position; otherwise returns None.


vcPositionFrameIterator

vcPositionFrameIterator is an iterator for positions of a motion statement. Generally, this is used with a vcPathStatement object which has schema properties for handling a large amount of positional data.

Examples

Example. Get path of positions as list

from vcScript import *

comp = getComponent()
rx = comp.findBehaviour("Executor")
mr = rx.Program.MainRoutine

path = None
for s in mr.Statements:
if s.Type == "Path":
path = s
break

if path:
positions = list(path.Positions)
print positions

Example. Iterate positions of path statement

from vcScript import *

comp = getComponent()
rx = comp.findBehaviour("Executor")
mr = rx.Program.MainRoutine

path = None
for s in mr.Statements:
if s.Type == "Path":
path = s
break

if path:
for p in path.Positions:
print p


vcPositionStatement

vcPositionStatement is an abstract class used for creating robot positions executed by motion type statements. For example, you can create a custom statement by implementing a vcPositionStatement as a process handler.

Inherits: vcStatement

Contents ShowHide

Hierarchy

Properties

Methods

Hierarchy

vcPositionStatement

vcMotionStatement

Properties

Name | Type | Access | Description
Base | vcBaseFrame | RW | Defines the base frame of the statement.
ExternalTCP | Boolean | RW | Defines if external tcp mode is used for the statement.
Positions | List of vcPositionFrame | R | Gets the list of positions in the statement.
Tool | vcBaseFrame | RW | Defines the tool frame of the statement.

Methods

Name | Return Type | Parameters | Description
createPosition | vcPositionFrame | String name | Creates a new position with a given name.
deletePosition | None | vcPositionFrame position | Deletes a given position.


vcPrimitive

vcPrimitive is an abstract base class for all geometry primitives, for examples polygons and lines.

Hierarchy

vcPrimitive

vcEdge

vcLine

vcPoint

vcPolygon

Properties

Name | Type | Access | Description
GeometrySet | vcGeometrySet | R | Gets the geometry set of primitive.
Id | Integer | RW | Defines a number identifying the primitive.


vcProcessContext

vcProcessContext is the context of the application for process modeling.

Inherits: vcContext


vcProcessController

Process controller is a root access point for all Process Modeling data and APIs. It provides several services as separate classes. A global instance of vcProcessController can be always accessed from vcSimulation.

Inherits: vcBehaviour

Type constant: VC_PROCESSCONTROLLER

Properties

Name | Type | Access | Description
FlowTable | vcProcessFlowTable | R | Gets this controller’s process flow table service for managing process sequences.
TransportSystem | vcTransportSystem | R | Gets this controller’s transport system service for managing transport nodes, transport links and transport controllers and querying the transport graph.
FlowGroupManager | vcProcessFlowGroupManager | R | Gets this controller’s manager service for process flow groups.
ProductTypeManager | vcProductTypeManager | R | Gets this controller’s manager service for product types.
ProcessManager | vcProcessManager | R | Gets this controller’s process group manager service.
ProcessData | vcProcessControllerData | R | Gets the “database” of this process controller that stores all associated layout-level information.


vcProcessControllerData

Process controller data is a layout item that stores all layout-level information for a Process controller including product types, process flow sequences, transport links etc. The data should be accessed and manipulated only through the service classes accessible from vcProcessController.

Inherits: vcLayoutItem


vcProcessExecutor

Process executor is a behavior that holds and runs process routines (vcProcessRoutine). Each process routine is an implementation of a process. The execution order of the process routines is controlled by the parent process controller (vcProcessController).

Inherits: vcExecutor, vcBehaviour

Type constant: VC_PROCESSEXECUTOR

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
ProcessController | vcProcessController | R | Gets the associated process controller.
Processes List of vcProcessRoutine R

Gets all process routines in this executor.

Returns None if the executor does not have a program.
TransportNode vcTransportNode RW

Gets the associated transport node that this executor’s processes use to receive and send product instances.

Setting this property also sets the ProcessExecutor property on the new transport node, and clears the property from the old transport node, if there was one.

Methods

Name | Return Type | Parameters | Description
addProcess | vcProcessRoutine | String name | Creates a new process routine and adds it to this executor’s program. The routine name has to be unique within this executor’s program. Returns None if the executor doesn’t have a program.
deleteProcess | None | vcProcessRoutine routine | Removes the given routine from this executor’s program and deletes it.

Examples

Example. Changing process statement properties dynamically (runtime) based on connected flow groups

# a script in "Process Node" component
from vcScript import *
# get the first process executor (vcProcessExecutor) in the component
proc_executor = getComponent().findBehavioursByType(VC_PROCESSEXECUTOR)[0]
def OnStart():
global group_index_iter
global first_process_name
global groups
# use this iterator as the index for selecting flow group
group_index_iter = 0
# get the name of the first process (vcProcessRoutine)
first_process_name = proc_executor.Processes[0].Name
# collect all flow groups (vcProcessFlowGroup) that have an incoming link to the process
# to a global list
groups = []
transport_node = proc_executor.TransportNode
for link in transport_node.TransportLinks:
if link.Destination == transport_node:
groups.append(link.SupportedGroup)
def statement_changed(stmt, is_immediate):
global group_index_iter
if stmt.Type == VC_STATEMENT_TRANSPORTIN and stmt.ParentRoutine.Name == first_process_name:
# set statement properties: accept only from the connected flow groups, one-by-one
stmt.AcceptAllProductTypes = False
flow_group = groups[group_index_iter] # select next flow group from the list
stmt.AcceptedFlowGroups = [flow_group]
group_index_iter += 1
if group_index_iter == len(groups):
group_index_iter = 0 # reset iterator
# this event is raised just before executing any statement in any process belonging to the executor
proc_executor.OnPreExecuteStatement = statement_changed


vcProcessFlowGroup

Process flow group is a grouping of product types that share same process flow sequence and can navigate through the same transport links. Every product type (vcProductType) belongs to exactly one flow group, with the only exception being the system “Any” product type that doesn’t belong to a flow group.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Name | String | RW | Name of the group. Must be unique within the process controller.
FlowGroupManager | vcProcessFlowGroupManager | R | Gets the manager this flow group belongs to.
Properties | List of vcProperty | R | Gets the properties of this flow group. All properties might not have a vcProperty implementation.
ProductTypes | List of vcProductType | R | The list of product types that belong to this group.
IsVisible | Boolean | RW | Whether this group is visible in certain areas of the user interface.

Methods

Name | Return Type | Parameters | Description
getProperty | vcProperty | String Name | Returns a property matching a given name in the group; otherwise returns None. All properties might not have a vcProperty implementation.

Events

Name | Parameters | Description
OnProductTypeAdded | vcProcessFlowGroup flowGroup, vcProductType productType | Triggered when a product type has been added to this flow group.
OnProductTypeRemoving | vcProcessFlowGroup flowGroup, vcProductType productType | Triggered when a product type is being removed from this flow group.

Examples

Example. List the product types of this Flow Group.

from vcScript import *
sim = getSimulation()
process_controller = sim.ProcessController
flow_grp_mgr = process_controller.FlowGroupManager
flow_group1 = flow_grp_mgr.findGroup('Flow Group #1')
# Check if the Flow Group exists
if flow_group1:
# List the product types of this Flow Group
print flow_group1.Name, 'has the following product types:'
product_types = flow_group1.ProductTypes
for p in product_types:
print p.Name
# Here you can define custom logic for when a Product Type is removed
def product_type_deletion_handler(flow_group, product_type):
print product_type.Name, 'removed from', flow_group.Name
if flow_group1:
flow_group1.OnProductTypeRemoving = product_type_deletion_handler


vcProcessFlowGroupManager

The flow group manager is used to create, access and delete the process flow groups (vcProcessFlowGroup objects) within its owner vcProcessController.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Controller | vcProcessController | R | Gets the process controller owner.
Groups | List of vcProcessFlowGroup | R | The list of all registered flow groups.

Methods

Name | Return Type | Parameters | Description
createGroup | vcProcessFlowGroup | String groupName | Tries to create a new group with the given name. The name must be unique within the process controller.
findGroup | vcProcessFlowGroup | String groupName | Gets a flow group with the given name.
deleteGroup | None | vcProcessFlowGroup group | Tries to delete the given group. Can not delete groups from different process controller. Note: Deleting a flow group also causes deletion of any contained product types and other tied data such as process flow sequence.
deleteGroup | None | String groupName | Tries to find and delete a group with given name.
clearGroups | None | - | Deletes all groups.
moveProductType | None | vcProductType typeToMove, vcProcessFlowGroup destination | Tries to move the given product type to the given target group.

Events

Name | Parameters | Description
OnGroupAdded | vcProcessFlowGroup group | Triggered when a new flow group has been added to this process controller.
OnGroupRemoving | vcProcessFlowGroup group | Triggered when a flow group is being removed from this process controller.

Examples

Example. Delete and define Flow Groups.

from vcScript import *
sim = getSimulation()
process_controller = sim.ProcessController
# Get the handle for product flow groups
flow_grp_mgr = process_controller.FlowGroupManager
flow_groups = flow_grp_mgr.Groups
# Search for a given Flow Group
# If Flow Group is found it is deleted
flow_group1 = flow_grp_mgr.findGroup('Flow Group #1')
if flow_group1:
flow_grp_mgr.deleteGroup(flow_group1)
# Define custom logic for when a new Flow Group is created
def flow_group_created_handler(flow_group):
print flow_group.Name, 'has been created.'

flow_grp_mgr.OnGroupAdded = flow_group_created_handler


vcProcessFlowTable

The process flow table holds the sequences of processes (vcProcessSequence) that each product (vcProduct) belonging to a certain flow group (vcProcessFlowGroup) shall follow as it travels in the simulation under this process controller (vcProcessController).

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Controller | vcProcessController | R | The controller that owns this object.
Sequences | List of vcProcessSequence | R | All sequences in this table.

Methods

Name | Return Type | Parameters | Description
createSequence | vcProcessSequence | String groupName OR vcProcessFlowGroup group | Creates a new sequence for the given group.
deleteSequence | None | String groupName OR vcProcessFlowGroup group | Deletes the sequence for a given group.
getSequence | vcProcessSequence | String groupName OR vcProcessFlowGroup group | Returns a sequence for the given group, if found.
copySequenceFrom | vcProcessSequence | vcProcessFlowGroup source, vcProcessFlowGroup target | Copies the sequence defined for the given source flow group and adds it to this flow table, for the target flow group. There should not already be a sequence registered for the target flow group.

Events

Name | Parameters | Description
OnSequenceAdded | vcProcessSequence sequence | Triggered when a new sequence has been added.
OnSequenceRemoving | vcProcessSequence sequence | Triggered when a sequence is about to be removed.


vcProcessGroup

Process group is an automatic grouping of all process implementations that have the same process id (identifier). The process implementations are not owned but only referenced by this object. The parent vcProcessManager provides events for tracking the changes.

Note: vcProcessGroup is automatically deleted when it becomes empty.

Properties

Name | Type | Access | Description
Implementations | List of vcProcessRoutine | R | Gets all process implementations.
Manager | vcProcessManager | R | The process manager that owns this group object.
ProcessId | String | R | The process identifier (name) all these implementations share.


vcProcessIfStatement

A vcProcessIfStatement is a process statement that execute one of two scopes of statements based on a condition. If the condition is true, the statement executes its ThenScope of statements. If the condition is false, the statement executes is ElseScope of statements. If condition is invalid neither ThenScope nor ElseScope are executed.

Inherits: vcStatement

Properties

Name | Type | Access | Description
Condition | Expression (boolean) | RW | Condition expression to evaluate when the statement is executed. See also Process Statement Expressions.
ElseScope | vcScope | R | Scope to execute when Condition evaluates to False.
ThenScope | vcScope | R | Scope to execute when Condition evaluates to True.


vcProcessManager

The process manager service automatically creates, updates and removes process groups (vcProcessGroup) when process implementations (vcProcessRoutine) are added, renamed or removed within its parent process controller. The process groups can be used to easily find all implementations of a process.

Process implementations are owned by vcProcessExecutor instances.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Controller | vcProcessController | R | Gets the process controller owner.
ProcessGroups | List of vcProcessGroup | R | Gets a list of all current processes in this process controller.

Methods

Name Return Type Parameters Description
findProcessGroup vcProcessGroup

String processId

Tries to find a process group that contains all processes with the given id.

Returns None if no such processes exist.
changeGroupId

None

vcProcessGroup group,

String newId

Tries to rename a process i.e. change id of all process implementations in a process group. This can fail non-trivially if some process executor already contains a process with the new id.

Either the rename succeeds fully or no changes are made, throws an exception if the operation didn’t succeed.

Events

Name | Parameters | Description
OnProcessAdded | vcProcessRoutine process, vcProcessGroup group | Triggered when a new process implementation has been added.
OnProcessRemoving | vcProcessRoutine process, vcProcessGroup group | Triggered when a process implementation is about to be removed.
OnGroupIdChanged | vcProcessGroup group, String previousId | Triggered when all processes within a group changed their id. The usual case is when the group only contains a single process implementation and its id gets changed.

Examples

Example. Get the event when adding/removing/changing name of a process routine from the process manager

from vcScript import *
#Get process manager in the component
comp = getComponent()
process_executor = comp.findBehavioursByType('rProcessExecutor')[0]
process_controller = process_executor.ProcessController
process_manager = process_controller.ProcessManager
#Get the list of all process groups that belongs to this process manager
process_groups = process_manager.ProcessGroups
#print process_groups
'''
#Find the process group and change the name
process_old = process_manager.findProcessGroup("Process #1")
process_manager.changeGroupId(process_old, "Process New")
'''
#Get event when adding a process routine to the process manager
def ProcessAdded(routine, group):
print "Process Group - {} is added to {}::{}".format(routine.Name, comp.Name, process_executor.Name)
#Get event when removing a process routine to the process manager
def ProcessRemoved(routine, group):
print "Process Group - {} is removed from, {}::{}".format(routine.Name, comp.Name, process_executor.Name)
process_manager.OnProcessAdded = ProcessAdded
process_manager.OnProcessRemoving = ProcessRemoved


vcProcessRoutine

Process routine is a routine in the executor’s program that implements a Process Modeling process. It has an additional internal routine for the special process requirement statements that control when this process’s execution starts.

Inherits: vcRoutine, vcScope

Properties

Name | Type | Access | Description
Requirements | vcRoutine | R | Gets the process requirements routine of this process implementation.
Description | String | RW | Can be used to give a description for the process implementation.


vcProcessSequence

Defines the sequence of process steps (vcProcessGroup) that any product type (vcProductType) belonging to a particular flow group (vcProcessFlowGroup) shall follow in the Process Modeling system.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
FlowTable | vcProcessFlowTable | R | The flow table that owns this sequence.
TargetGroup | vcProcessFlowGroup | R | The flow group that this sequence is defined for.
ProcessGroups | List of vcProcessGroup | R | The ordered list of processes that the products belonging to the target flow group should go through.

Methods

Name | Return Type | Parameters | Description
addProcessGroup | None | vcProcessGroup processGroup | Adds the given process group to this sequence.
removeProcessGroup | None | vcProcessGroup processGroup | Removes the given process group from this sequence.
insertProcessGroup | None | Integer index, vcProcessGroup processGroup | Inserts the given process group into the given index in this sequence.
setProcessGroup | None | Integer index, vcProcessGroup processGroup | Sets the process group in the given index in this sequence.
getProcessGroup | vcProcessGroup | Integer index | Returns the process group in the given index in this sequence.


vcProcessWhileStatement

While statement executes Scope in a loop as long as Condition evaluates to True.

Inherits: vcStatement

Properties

Name | Type | Access | Description
Condition | Expression (boolean) | RW | Condition expression to evaluate on each loop iteration. See also Process Statement Expressions.
Scope | vcScope | R | Scope to keep executing while Condition evaluates to True.


vcProduct

A product instance is a data object corresponding to a specific vcProductType and associated to a dynamic vcComponent that gives it a physical presence in the 3D world. The product type of vcProduct instance can change during its lifetime, but is always explicitly defined. Every vcProduct is always linked to exactly one dynamic vcComponent, and this linking doesn’t change during the product’s lifetime.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Properties | List of vcProperty | R | Gets the properties that have vcProperty implementation.
ProductType | vcProductType | R | The type of this product.
Component | vcComponent | R | The component associated with this product instance.
TransportSolution | vcTransportSolution | RW | Latest transport solution assigned to this product instance. Note that the product may already have reached the destination node and continued further by other means.
LastEnteredNode | vcTransportNode | R | Gets the transport node this product instance has last arrived in. Can be used to determine the product’s position along its transport solution.
WorldPositionMatrix | vcMatrix | RW | Gets (as a copy) or sets the product instance position in world coordinates. This takes into account the defined offset between the product’s component and the product itself.

Methods

Name | Return Type | Parameters | Description
changeType | Boolean | vcProductType newType, [Boolean deleteAttachedComponents] | Recreates this product instance and its visualization component to match the new product type defined by newType. An optional argument deleteAttachedComponents can be used to delete any other components attached to the component of this product instance. Returns True if successful, False otherwise. Any errors messages are concatenated into a Python error message.
deleteProperty | None | vcProperty property | Deletes a property from this product instance.
getProperty | vcProperty | String propertyName | Returns a property from this product instance.
createProperty | vcProperty | vcProperty property | Creates a new property to this product instance.


vcProductCreator

vcProductCreator acts as a feeder and creates one or more types of products for use in a Process Modeling.

Inherits: vcFlow

Contents ShowHide

How it Works

Properties

Events

Examples

How it Works

The product creator is a behaviour that creates product instances (vcProduct) to a container during simulation according to specified configuration. Different Rules of what and when to create can be configured independently using the feed modes, but only one feed mode can be active at a time. The feed mode to use is defined by the FeedMode property.

Note: The product creation can be blocked or delayed if the connected container doesn’t have free capacity.

Inherits from vcBehaviour, vcFlow

Type constant: VC_PRODUCTCREATOR

Properties

Name | Type | Access | Description
ApplyProductTypeOrigin Boolean RW

Defines whether origin offset defined in the Product Type is taking into account or not. See vcProductType.OriginFrame
BatchFeed | vcProductCreatorBatchMode | R | Gets the configuration for batch feed mode.
DistributionFeed | vcProductCreatorDistributionMode | R | Gets the configuration for distribution feed mode.
FeedMode Integer enumeration RW Defines the mode for feeding products. That is, when and what type of product to create during a simulation.

See Feed Mode Constants for more information.
PartPooling

Boolean

 RW

Turns on/off the reuse of components made by the creator, thereby improving simulation performance.

If True, dynamic components removed during simulation are recirculated to make new components, thereby reducing memory allocation.

Note: Be careful when recirculating components that were modified during simulation, for example a change in node material.
SingleFeed

vcProductCreatorSingleMode

 R Gets the configuration for single feed mode.

TableFeed | vcProductCreatorTableMode | R | Gets the configuration for table feed mode.

Events

Name | Parameters | Description
OnProductCreated | vcProduct product | Triggered when a new product instance has been created by this creator.

Examples

Example. Create products variants

from vcScript import *

#creating product properties that not supported in UI
# 1. create a distribution property to a product type
# 2. during simulation, take a sample of the distribution
# 3. use that sample value to a Real type property in the Product instance.


vcProductCreatorBatchMode

Configuration for batch feed mode in vcProductCreator. Creates batches of vcProductType instances in a sequence. Each batch defines the type of vcProduct to create, interval between instances and the maximum number of products to be created.

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
BatchInterval | Real | RW | Amount to delay between batches in seconds. Should be zero or greater.
Loop | Boolean | RW | Turns on/off the looping of the sequence.
ProductBatches | List of vcProductCreatorFeedBatch | R | List of all currently defined batches.

Methods

Name | Return Type | Parameters | Description
createBatch | vcProductCreatorFeedBatch | None | Creates a new batch with default values and adds to the end.
deleteBatch | None | vcProductCreatorFeedBatch batch | Deletes the given batch from this configuration.
getProperty | vcProperty | String name | Returns a property matching a given name; otherwise returns None.
moveBatch | None | vcProductCreatorFeedBatch batch, Integer index | Moves the given batch to the given index. The index must be greater than or equal to 0.

Events

Name | Parameters | Description
OnBatchesChanged | vcProductCreatorBatchMode source | Triggered when the ProductBatches collection content has changed.


vcProductCreatorDistributionMode

vcProductCreatorDistributionMode allows you to define the probability of feeding one or more types of products when a vcProductCreator object uses a FeedMode of Distribution. A distribution feed mode uses entries. Each entry is a vcDistributionModeProductLineEntry object that defines a product type and weighted probability.

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Interval Distribution expression RW

Time to wait in seconds between creating products.

Note: Pseudo-random real number generated by an expression that defines a distribution.

normal([stream], u, s)
Normal distribution for mean value u and standard deviation s with an optional stream for seeding a random value to generator.

exponential([stream], lambda)
Exponential distribution where mean value is 1/lambda and variance is 1/lambda^2 with an optional stream for seeding a random value to generator.

gamma([stream], k, theta)
Gamma distribution with shape k and scale theta with an optional stream for seeding a random value to generator.

lognormal([stream], u, s)
Log normal distribution for mean value u and standard deviation s with an optional stream for seeding a random value to generator.

triangular([stream], min, mode, max)
Triangular distribution for given min, mode and max values with an optional stream for seeding a random value to generator.

uniform([stream], a, b)
Uniform distribution in range a <= x < b with an optional stream for seeding a random value to generator.

weibull([stream], k, lambda)
Weibull distribution with shape k and scale lambda with an optional stream for seeding a random value to generator.
Limit

Integer

 RW

Number of products to create. Must be 0 or greater.
ProductEntries List of vcDistributionModeProductLineEntry R

List of all currently defined entries.
RandomStream | Integer | RW | Index of the pseudo-random number generator to use when picking the next product type to instantiate. Must be in inclusive range 0-63.

Methods

Name Return Type Parameters Description
addProductEntry vcDistributionModeProductLineEntry vcProductType productType, Real probability Adds a new entry to the distribution mode configuration based on the given productType and probability.

Notes:
  • The productType must not be None.
  • The probability must be greater than or equal to zero.
  • Having more than one entry with same vcProductType is allowed but not recommended.

getProperty

vcProperty String name Returns a property matching a given name; otherwise returns None.
removeProductEntry None vcDistributionModeProductLineEntry entry Deletes the given entry from this configuration.

Events

Name | Parameters | Description
OnProductEntriesChanged | vcProductCreatorDistributionMode source | Triggered when the ProductEntries collection content has changed.


vcProductCreatorFeedBatch

Configuration of a single batch in vcProductCreatorBatchMode. A batch creates a set number of product instances from the same vcProductType one after another with interval delay in between.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description

Part

 vcProductType RW

The product type to create instances of.
Limit | Integer | RW | Number of products to create. Must be 0 or greater.
Interval Distribution RW

Time to wait in seconds between creating products.

Note: Pseudo-random real number generated by an expression that defines a distribution.

normal([stream], u, s)
Normal distribution for mean value u and standard deviation s with an optional stream for seeding a random value to generator.

exponential([stream], lambda)
Exponential distribution where mean value is 1/lambda and variance is 1/lambda^2 with an optional stream for seeding a random value to generator.

gamma([stream], k, theta)
Gamma distribution with shape k and scale theta with an optional stream for seeding a random value to generator.

lognormal([stream], u, s)
Log normal distribution for mean value u and standard deviation s with an optional stream for seeding a random value to generator.

triangular([stream], min, mode, max)
Triangular distribution for given min, mode and max values with an optional stream for seeding a random value to generator.

uniform([stream], a, b)
Uniform distribution in range a <= x < b with an optional stream for seeding a random value to generator.

weibull([stream], k, lambda)
Weibull distribution with shape k and scale lambda with an optional stream for seeding a random value to generator.

Methods

Name | Return Type | Parameters | Description
getProperty | vcProperty | String name | Returns a property matching a given name; otherwise returns None.


vcProductCreatorSingleMode

Configuration for single feed mode in vcProductCreator. Creates instances of a single vcProductType at a given time interval until the limit is reached.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Part | vcProductType | RW | The product type to create instances of.
Limit | Integer | RW | Number of products to create. Must be 0 or greater.
Interval | Distribution expression | RW | Time to wait in seconds between creating products. Note: Real-valued distribution property.

Methods

Name | Return Type | Parameters | Description
getProperty | vcProperty | String name | Returns a property matching a given name; otherwise returns None.


vcProductCreatorTableMode

Configuration for table feed mode in vcProductCreator. Holds a list of rows, each defining which vcProductType to instantiate and at what simulation time. The rows are automatically sorted in ascending order by the product creation time. The rows can be loaded from a file or defined using methods of this class. Modifying the rows during simulation is allowed but may result in e.g. inaccurate timing of when the products are created.

To add new rows use vcProductCreatorTableRow.new(), configure the row and then call the addRow method.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
File | String | RW | Uri pointing to an xls file where to load the rows. Changing the value will cause an immediate attempt to read the file and replace all ProductRows if successful. Any errors are printed to output. (Deprecated) Use the ReadRowsFromFile and ReplaceAllRows methods.
RowCount | Integer | R | Gets the current product row count.
ProductRows | List of vcProductCreatorTableRow | R | List of all currently defined product rows. The rows are returned as copies.

Methods

Name | Return Type | Parameters | Description
addRow | index | vcProductCreatorTableRow newRow | Adds a new row as a copy. The row gets inserted immediately after all existing rows with the same or smaller product creation time. Returns index of the new row. Throws an exception if the new row contains invalid values.
clearRows | None | None | Deletes all product rows.
deleteRow | None | Integer index | Deletes the product row at given index. The index must be in inclusive range 0 to RowCount – 1
getProperty | vcProperty | String name | Returns a property matching a given name; otherwise returns None.
getRow | vcProductCreatorTableRow | Integer index | Returns a copy of a product row at the given index. The index must be in inclusive range 0 to RowCount – 1
readRowsFromFile | List of vcProductCreatorTableRow | String fileUri, Boolean showErrorMessages | Attempts to load rows from an xls file and returns them as a list if successful. Does not modify this table mode configuration. Returns None if reading or parsing the file failed. If showErrorMessages is True, any errors are printed to the output.
replaceAllRows | None | List of vcProductCreatorTableRow | Deletes all rows and then adds the new rows as copies. The rows are sorted by the creation time using a stable sort algorithm. Throws an exception if any of the new rows contains invalid values.


vcProductCreatorTableRow

Configuration for creating a single product instance at a specified simulation time in vcProductCreatorTableMode. Note that instances of this class are stand-alone objects, not wrappers for internal native objects, which means that modifying them will not change anything in vcProductCreatorTableMode.

Contents ShowHide

Constructors

Properties

Constructors

vcRobot is the object type used for programming a robot, its controller and executor with this library.

Name | Return Type | Parameters | Description
new | vcProductCreatorTableRow | None | Creates a new vcProductCreatorTableRow object. The ProductType property must be set to make it valid.

Properties

Name | Type | Access | Description
ProductType | vcProductType | RW | The product type to instantiate. Value should not be None.
CreationTime | Real | RW | Simulation time in seconds when to create the product instance. Value must be greater than or equal to zero.


vcProductType

Product type is a product definition that is used to create vcProduct instances.

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Name | String | RW | Name of this product type. Must be unique within the owning process controller.
UniqueId | String | R | Unique identifier for this product type used internally.
FlowGroup vcProcessFlowGroup R

The flow group that this product type belongs to. Use methods in vcProcessFlowGroup to associate the type to another flow group.
IsSystem Boolean R

Whether this product type is a special internal type.
ParentProduct | vcProductType | RW | The product type this type is derived from.
OriginFrame | vcMatrix | RW | Defines relative position of product and its component as offset from component origin to origin of product instance.
ComponentUri String RW

Simulation component type used to visualize product instances created from this product type. Setting this Uri causes the product type to immediately attempt to load and make an internal copy of the component.

Note: Special “component” Uri scheme (component:componentName) can be used to point to an existing static component in the simulation layout.
Properties List of vcProperty R

Gets the properties of this product type itself. All properties might not have a vcProperty implementation.
ComponentProperties | List of vcProperty | R | Gets the properties that are applied to components of product instances created from this product type.
ProductProperties | List of vcProperty | R | Gets the properties that are applied to product instances created from this product type.

Methods

Name | Return Type | Parameters | Description
deleteProperty | None | vcProperty property | Deletes a property of the product type itself.
getProperty | vcProperty | String propertyName | Returns a property of the product type itself.
createProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Creates a new property to the product type itself.
createComponentProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Creates a new component instance property to this product type.
deleteComponentProperty | None | vcProperty property | Deletes a component instance property from this product type.
getComponentProperty | vcProperty | String propertyName | Returns a component instance property defined in this product type.
createProductProperty | vcProperty | Enumeration type, String name, [Enumeration constraints] | Creates a new product instance property to this product type.
deleteProductProperty | None | vcProperty property | Deletes a product instance property from this product type.
getProductProperty | vcProperty | String propertyName | Returns a product instance property defined in this product type.
resetUniqueId | None | - | Assigns a new unique id for this product type.

Examples

Example. Get the vcProductType from vcProductTypeManager or vcProcessFlowGroup

from vcScript import *
'''
You can get the vcProductType from vcProductTypeManager or vcProcessFlowGroup
To use this snippet, load a ProductFeeder component to 3D world
ProductFeeder component have already a ptoduct type defined
You can also create new product types using vcProductTypeManager
'''
#Access the vcProductTypeManager from the ProcessController
process_controller = getSimulation().ProcessController
product_type_manager = process_controller.ProductTypeManager
#By defaut vcProductTypeManager have 'Any' ProductType object. To filter that we can use the IsSystem property
product_type_cylinder = [x for x in product_type_manager.ProductTypes if x.IsSystem == False][0]
'''
#You can also find a specific ProductType
#access the vcProductType object from product manager
product_type_cylinder = product_type_manager.findProductType('VC_Cylinder')
'''
#change the component uri assigned to product_type_cylinder
#If the component is on 3D world,eg: Cube from Products and Containers, you can assign the component to the product type like this,
product_type_cylinder.ComponentUri = "component:Cube"
'''
#get the list of this product type property
for prop in product_type_cylinder.Properties:
print prop.Name, prop.Value
'''
'''
#get the list of all ComponentProperties for this product type
if product_type_cylinder.ComponentProperties:
for compProp in product_type_cylinder.ComponentProperties:
print compProp.Name, compProp.Value
'''
'''
#get the list of all ProductProperties for this product type
if product_type_cylinder.ProductProperties:
for prodProp in product_type_cylinder.prodProp:
print prodProp.Name, prodProp.Value
'''
'''
There are 3 different collections of properties in vcProductType. ProductType Property, ProductType Product property and ProductType Component property
Note that adding properties to the vcProductType is different from adding them as Product properties or Component properties in the vcProductType
'''
if product_type_cylinder:
#add boolean property for product type.
bool_prop = product_type_cylinder.getProperty('Boolean')
if not bool_prop:
product_type_cylinder.createProperty(VC_BOOLEAN, 'Boolean')

#add real property for product property
real_prop = product_type_cylinder.getProductProperty('RealProperty')
if not real_prop:
product_type_cylinder.createProductProperty(VC_REAL, 'RealProperty')
#add integer property for component property
prod_id = product_type_cylinder.getProductProperty('ProdID')
if not prod_id:
prod_id = product_type_cylinder.createComponentProperty (VC_INTEGER, 'ProdID')


vcProductTypeManager

The product type manager is used to create, modify and delete vcProductType objects. It is owned by a vcProcessController.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Controller | vcProcessController | R | Gets the owner process controller.
ProductTypes | List of vcProductType | R | Gets a list of all product types in this process controller.

Methods

Name Return Type Parameters Description
createProductType vcProductType

String name, vcProcessFlowGroup groupToPlaceObject

Creates new product type and assigns it to the given flow group. The name must be unique.
deleteProductType None vcProductType typeToDelete

or

String typeName

Tries to delete the given product type. Cannot delete system product types or product types from a different process controller.

Tries to delete product type with given name. Cannot delete system product types or product types from a different process controller.
findProductType vcProductType

String name

Tries to find a product type with the given name. Returns None if not found.

Events

Name | Parameters | Description
OnProductTypeAdded | vcProductType productType | Triggered when a new product type has been added to this process controller.
OnProductTypeRemoving | vcProductType productType | Triggered when a product type is being removed from this process controller.

Examples

Example. Access the vcProductTypeManager from the ProcessController

from vcScript import *

process_controller = getSimulation().ProcessController
product_type_manager = process_controller.ProductTypeManager

Example. Check to which process controller the manager belongs to.

#print product_type_manager.Controller
Get the list of ProductTypes
##To get the list of ProductTypes
#print product_type_manager.ProductTypes

Example. Find and Create a new product type

#You need to get the flow group to add product types
flow_group_manager = process_controller.FlowGroupManager
flow_group = flow_group_manager.findGroup('Flow Group #1')
my_productType = product_type_manager.findProductType('MyProduct')
if not my_productType:
my_productType = product_type_manager.createProductType('MyProduct', flow_group)

Example. Delete a given product type

#if my_productType:
# product_type_manager.deleteProductType('MyProduct')

Example. Get event when you add and remove product type from UI

def productAdded(prod):
print 'New ProductType added. Product name is "{}".'.format(prod.Name)
def productRemoved(prod):
print 'ProductType "{}" is removed.'.format(prod.Name)

product_type_manager.OnProductTypeAdded = productAdded #trigger when a new product type is added
product_type_manager.OnProductTypeRemoving = productRemoved #trigger when a an existing product type is removed


vcProgram

vcProgram is an executable program that can be run by vcExecutor objects. Every executor, by default, has its own a built-in program.

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Executor | vcExecutor | R | Gets the executor of the program.
MainRoutine | vcRoutine | R | Gets the main routine of the program.
Name | String | RW | Defines the name of the program.
Properties | List of vcProperty | R | Gets a list of properties in the program.
Routines | List of vcRoutine | R | Gets a list of all routines in the program other than the main routine.

Methods

Name | Return Type | Parameters | Description
addRoutine | vcRoutine | String name | Creates a new routine of a given name in the program, and then returns the new routine.
createProperty | vcProperty | Enumeration type, String name | Creates a new property of a given type and name in the program, and then returns the new property. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property in the program.
deleteRoutine | None | vcRoutine routine | Deletes a given routine from the program.
findRoutine | vcRoutine | String name | Returns a routine matching a given name in the program; otherwise returns None.
getProperty | vcProperty | String name | Returns a property matching a given name in the program; otherwise returns None.

Events

Name | Parameters | Description
OnRoutineAdded | vcRoutine routine | Triggered when a new routine is added to the program.
OnRoutineRemoving | vcRoutine routine | Triggered when a routine is being deleted from the program.
OnStatementAdded | vcStatement statement | Triggered when a statement is added to the program.
OnStatementRemoving | vcStatement statement | Triggered when a statement is removed from the program.


vcProcessPointSensor

vcProcessPointSensor is the object type for Process Point Sensor behaviors.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Frame | vcFeature | RW | Defines a Frame feature referenced as the location of sensor in 3D world.
BoolSignal | vcBoolSignal | RW | Defines a Boolean Signal used to send a True value when processing starts and a False value when processing ends.
ProcessAt | Enumeration | RW | Defines the trigger used to initialize processing in sensor. See Path Constants for more information.
RuleComponent | Enumeration | RW | Defines the processing rule of sensor. See Process Point Constants for more information.
TriggerAt | Enumeration | RW | Defines whether a path connected to sensor or component triggering sensor is stopped during processing. See Process Point Constants for more information.

Methods

Name | Return Type | Parameters | Description
processValue | Real | Real from_connector_index, vcComponent component, [vcBehaviour behavior] | Calculates the processing time of a given component entering from an input port of a path connected to sensor, and then returns the total time from start to finish.
setValue | None | Real value | Sets the processing time of sensor. Generally, this method is used with OnValue event to define multiple processing times and handle issues, for example bottlenecks and simulated failures.
startFailure | None | None | Sets the state of sensor to Failure, thereby stopping all tasks performed by sensor. Sensor will stay in failure state until either simulation is reset or sensor calls stopFailure() method.
stopFailure | None | None | Brings sensor out of failure state, for example to simulate a repair.

Events

Name | Parameters | Description
OnValue | Integer ignore, vcComponent component, vcBehaviour behavior | Triggered when sensor starts processing a component. To override default processing time, use setValue() method.

Examples

Example. Use OnValue event to manipulate sensor

from vcScript import *

def my_event(ignore, component, behaviour):
print '-'*99
print component.Name
print behaviour.Name
sensor.setValue(10)

comp = getComponent()
sensor = comp.findBehaviour('ProcessPointSensor')
sensor.OnValue = my_event


vcProperty

vcProperty is a property object with its own set of properties, methods and event handlers.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
CalculatedValue <Type> R Gets the calculated value of property.

Generally, this is used to get the result of an Expression type property whose Value is an expression passed as a string. All other types, except Distribution, would return the same as Value.
ChangeOnRebuild | Boolean | RW | Defines if component geometry is rebuilt when property value is changed.
ChangeOnReconfigure | Boolean | RW | Defines if component structure is reconfigured when property value is changed.
ChangeOnUpdate | Boolean | RW | Defines if simulation world is updated when property value is changed.
Distribution String RW If Distribution type property, defines an expression to use for calculating values.

Available functions include:

normal( u, s )
Normal distribution for mean value u, and the standard deviation s.

lognormal( u, s )
Log normal distribution for mean u, and the standard deviation s.

uniform( a, b )
Uniform distribution in range a <= x < b.

exponential( lambda )
Exponential distribution where the mean is 1/lambda and the variance is 1/lambda^2.

gamma( k, theta )
Gamma distribution with shape k and scale theta.

triangular( min, mode, max )
Triangular distribution with the specified minimum, mode and maximum values.

weibull( k, lambda )
Weibull distribution with shape k and scale lambda.

Tip: Use RandomStream to have the distribution use a stream for seeding a value and generating the same set of random numbers during a simulation. That is, if you reset and run a simulation you should expect the same values given in the previous simulation.
Group Integer RW Defines the group assignment of property.

Properties are ordered by groups, and a group number is automatically assigned at the time of creation. This order can be overridden to have properties come before or after one another when listed in the GUI.
IgnoreEvents | Boolean | RW | Defines if event passing is ignored by property, for example to avoid cyclic calls.
IsVisible | Boolean | RW | Turns on/off the visibility of property in Properties panel.
IsVisibleDesignTime | Boolean | RW | Turns on/off the visibility of property in Component Cell Graph panel.
IsDesignTime | Boolean | RW | Defines if property is used for component authoring.
IsPersistent | Boolean | RW | Defines if property value is saved with component or layout.
ListValueCount | Integer | R | Gets the number of values listed in property.
ListValues | List of vcPropertyListValue | R | Gets a list of values for property.
Magnitude Real R Gets the conversion factor of unit assigned to property.

The conversion factor is used to convert the value of property to and from its canonical unit. For example, if the property has a Quantity of Distance with a Unit of millimeters (mm), the magnitude is 1. If Unit is meters (m), the magnitude is 1000.0.

Note: You can use setUnitMagnitude() to change the unit of property based on the current unit group of its quantity. For example, a magnitude of 10 would most likely change the unit to centimeters (cm) if the quantity of property was Distance.
MaxValue | <Type> | W | If property supports a limit constraint, defines maximum value of property.
MinValue | <Type> | W | If property supports a limit constraint, defines the minimum value of property.
Name | String | RW | Defines the name of property.
Quantity vcScalarQuantity

or

vcVectorQuantity

 RW Defines the quantity of property.

Tip: You assign the quantity by name using a string, for example Distance, thereby the application will search for and assign a quantity matching that name.
RandomStream Integer RW If Distribution type property, defines a stream used for generating pseudo-random values.

Every layout has a RandomStreams layout item, which has a set of RandomSeedN properties where N is 0 to 63, which contain the seed values for each stream.

A random stream can be used in distribution function, for example l(stnormaream,u,s) in which stream is the index of stream in the layout to use, u is mean value and s is standard deviation.
StepValues | List of <Type> | RW | If property has a step constraint, defines a list of step values for property.
SupportsTemplate | Boolean | R | Indicates if property supports the use of a templates.
Templates | List of template | R | Gets a list of templates in property.
Type Enumeration R Gets the property type.

See Property Constants for more information.
Unit vcUnit R Gets the unit of property.

Note: Use setUnitMagnitude() to change the unit of property. The magnitude should be the conversion factor of unit in the current unit group of quantity assigned to property.
Value | <Type> | RW | Gets/Sets property value.
WritableWhenConnected | Boolean | RW | Defines if property value can be set when component of property is connected to another component via interface.
WritableWhenDisconnected | Boolean | RW | Defines if property value can be set when component of property is not connected to another component via interface.
WritableWhenSimulating | Boolean | RW | Defines if property value can be set when a simulation is running.

Methods

Name | Return Type | Parameters | Description
addValueFromTemplate | vcPropertyListValue | String prop | Adds value from template to property.
deleteValue | None | Integer index | If property has step constraint, deletes a value at a given index from property.
getValue | vcPropertyListValue | Integer index | If property has step constraint, gets value at a given index from property.
setUnitMagnitude | None | Real magnitude | Sets the unit of property based on the given magnitude. The magnitude is the conversion factor of unit you want to assign to property. The unit should belong to the current unit group of quantity assigned to property.

Events

Name | Parameters | Description
OnChanged | vcProperty property | Triggered when value of property is changed.

Examples

Example. Define min and max values of properties

from vcScript import *

comp = getComponent()

##Real property - supports limit constraint, thereby min and max range values
p = comp.getProperty("Test_Real")
if not p:
p = comp.createProperty(VC_REAL, "Test_Real", VC_PROPERTY_LIMIT)

p.MinValue = 0x00000A
p.MaxValue = 0144
p.Value = 0b00110010
print p.MinValue, p.MaxValue, p.Value
#prints 10.0 100.0 50.0

##Integer property - supports limit constraint, must pass integer values
p = comp.getProperty("Test_Integer")
if not p:
p = comp.createProperty(VC_INTEGER, "Test_Integer", VC_PROPERTY_LIMIT)

p.MinValue = int(45.5)
p.MaxValue = int(940.457)
p.Value = int(468.319)
print p.MinValue, p.MaxValue, p.Value
#prints 45 940 468

Example. Get calculated value of properties

from vcScript import *

comp = getComponent()

##Expression property - Value is the expression to be evaluated; CalculatedValue is result of expression
p = comp.getProperty("Test_Expression")
if not p:
p = comp.createProperty(VC_EXPRESSION, "Test_Expression")

p.Value = "2+2"
print p.Value, " = ", p.CalculatedValue
#prints 2 + 2 = 4

##Real property - CalculatedValue and Value return same values
p = comp.getProperty("Test_Real")
if not p:
p = comp.createProperty(VC_REAL, "Test_Real")

p.Value = 2+2
print p.Value, " = ", p.CalculatedValue
#prints 4.0 = 4.0

##Distribution property - CalculatedValue and Value return different values
p = comp.getProperty("Test_Distribution")
if not p:
p = comp.createProperty(VC_DISTRIBUTION, "Test_Distribution")

p.Distribution = "normal(100.0,5.0)"
print p.Value
print p.CalculatedValue
print p.Value
#each call returns, most likely, different pseudo-random value; so printed results will vary

Example. Using a real distribution with a random stream

from vcScript import *

comp = getComponent()

prop = comp.getProperty("Test_Distribution")
if not prop:
prop = comp.createProperty(VC_DISTRIBUTION, "Test_Distribution")

#prop.Distribution = "normal(100.0, 5.0)"
#prop.RandomStream = 4
prop.Distribution = "normal(4, 100.0, 5.0)"

def OnRun():
count = 0
while count < 5:
delay(1)
count += 1
print prop.Value

Example. Using OnChange event

from vcScript import *

def myActionFunction(arg): #function arguments need to match with event parameters
print arg.Value

comp = getComponent()

# get handle to a property (in this example a component property)
myprop = comp.getProperty('MyParameter')
# this property needs to be a global so events registered to this stay alive
# for example -- > global myprop

myprop.OnChanged = myActionFunction #register a custom function to an event

Example. Add different types of properties to a component

from vcScript import *
comp = getComponent()

# create a new property, this returns None if property with same name already exists
prop1 = comp.createProperty(VC_REAL, 'Fever')
prop1.Value = 36.8

# another new property with step values
prop2 = comp.createProperty(VC_STRING, 'MyLocationParam', VC_PROPERTY_STEP)

# polulate drop-down menu with pre-defined values
prop2.StepValues = ['Europe', 'America', 'Asia', 'Africa', 'Australia']
# set value: option1
comp.MyLocationParam = 'Asia'
# set value: option2 --> prop2.Value = 'Asia'


vcPropertyListValue

vcPropertyListValue is a list of possible values defined in a vcProperty object.

Properties

Name | Type | Access | Description
Properties | List of vcProperty | R | Gets a list of properties specific to list value.
Template | String | R | Gets the name of template for list value.


vcPythonActionPanel

The action panel can be opened when executing a python command. To open the panel, import vcCommand * and use the executeInActionPanel() method

Events

Name | Parameters | Description
OnPanelClosed | None | Triggered when a close button on an action panel is clicked.

Examples

Example. Trigger a function when the action panel is closed. Write this to into your python command.

from vcCommand import *
from vcScript import *

cmd = getCommand()
app = cmd.Application
panel = app.PythonActionPanel

def first_state():
executeInActionPanel()

addState(first_state)

def OnCloseMethodCalled():
print "Python action panel closed!"

panel.OnPanelClosed = OnCloseMethodCalled


vcPythonKinematics

vcPythonKinematics allows you to create custom kinematics, which can be used by robot controllers to drive and manage robot movements.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | RW | Description
Name | String | RW | Defines the name of the kinematics object.
Application | vcApplication | R | Gets the application object.
Simulation | vcSimulation | R | Gets the simulation object.
Script | String | RW | Defines the executable Python code of kinematics object, thereby the custom kinematics of a vcKinObject object. See Python Kinematics for more information.

Methods

Name | Return Type | Parameters | Description
forwardKin | vcMatrix | List of Real values | Returns a forward kinematics matrix calculated for given joint values.
getApplication | vcApplication | None | Returns the application object.
getComponent | vcComponent | None | Returns the component of the kinematics object.
getNode | vcNode | None | Returns the node containing the kinematics object.
getSimulation | vcSimulation | None | Returns the simulation object.
sasa | Real | Real side, Real angle, Real side | Returns the angle (in radians) of a triangle based on two given sides and the angle between them. In this case, the third side of a triangle is calculated, and then used to calculate the angle between that side and the second side argument.
sass | Real | Real side, Real angle, Real side | Returns the side of a triangle based on two given sides and the angle between them.
sssa | Real | Real side, Real side, Real side | Returns the angle (in radians) of a triangle based on three given sides. In this case, returned angle is the angle opposite the first side argument.

Events

The following event handlers are functions that can be defined and used for customizing the kinematics of a vcKinObject type object. In some cases, event handlers need to output values which are automatically passed as arguments in other related functions.

Name | Parameters | Description
OnCalculateTarget vcMatrix fullTarget, vcMatrix baseFrame, vcMatrix toolFrame, Boolean targetInverted Triggered when a motion target is being calculated, thereby allowing you to edit the motion target that will be passed to OnInverse event.

The fullTarget argument is the target matrix calculated from either World origin or Robot World Frame to TCP.

The baseFrame and toolFrame arguments define the base and tool frames used for motion target.

The targetInverted argument can be used to reverse the target's calculation, for example from TCP to base frame.

Generally, you should use OnCalculateTarget for robots that have less than six degrees of freedom to remove potential effects caused by a tool offset.
OnConstrainParams vcKinObject kin_object Triggered when the joint configuration of a robot or motion target is being interpolated and requires joint limits to determine valid kinematic solutions.

Generally, you use OnConstrainParams to avoid potential joint limit errors and narrow possible solutions for a joint motion target. For example, you can specify the limits of a joint for certain types of movements.

The return value should be a Boolean.
OnFinalize None Triggered when layout or component is being loaded in 3D world.

The event occurs, for example, when copying a component, or loading a layout of components. The event is triggered before the needed components are attached to the 3D world.

Generally, you use OnFinalize to set the joint initial position of a robot or any necessary implementation that uses kinematics.
OnForward vcKinObject kin_object Triggered when a motion target is calculated using joint values.

Return a Boolean value to enable or disable forward kinematics.
OnGetConfigurationCount None Triggered when the configuration count of a robot is requested by the kinematics solver.

If configuration properties are dynamically changing, this event must be implemented and return a constant integer value, which overrides the default count defined in the OnInitKinObject event.

Important: If OnGetConfigurationCount is used, you need to implement the OnGetCurrentConfiguration and OnSetCurrentConfiguration events.
OnGetCurrentConfiguration None Triggered when the current configuration of a robot is requested by its kinematics solver.

If this event is implemented, you should read the robot's configurations property list, and then return the currently selected index position (integer). That value must be greater than or equal to 0 and less than the value returned by the OnGetConfigurationCount event.

Important: If OnGetCurrentConfiguration is used, you need to implement the OnGetConfigurationCount and OnSetCurrentConfiguration events.
OnGetJointCount None Triggered when the joint count of a robot is requested by the kinematics solver.

In most cases, you should the total joint count as an integer.
OnGetJointName Integer index Triggered when the name of a joint at a given index is requested by kinematics solver.

The return value should be a string.
OnGetKinematicJointCount None Triggered when the actual number of kinematic joints used in forward kinematics is requested by kinematics solver.

Generally, additional helper joints are needed for interpolating redundant solutions.

The return value should be an integer.
OnGetSecondaryJointCount None Triggered when the external joint count of a robot is requested by kinematics solver.

In most cases, you should return the total joint count as an integer value.
OnGetSecondaryJointName Integer index Triggered when the name of an external joint at a given index is requested by kinematics solver.

The return value should be a string.
OnInitKinObject vcKinObject kin_object Triggered when a new instance of vcKinObject is created, thereby allowing you to access and edit the kinematics object of a component.

Generally, you use OnInitKinObject to add new properties and define initial values for a kinematics object.
OnInverse vcKinObject kin_object Triggered when the joint values of a motion target need to be calculated and given as a solution for the kinematics object.

Return a Boolean value to enable or disable inverse kinematics.
OnRebuild | None | Triggered when the kinematics object is rebuilt, thereby updating changes made to its properties.
OnRelaxParams vcKinObject kin_object Triggered when possible solutions for a motion target are being calculated by kinematics solver.

Generally, you use OnRelaxParams to allow for all possible solutions, even those which exceed joint limits. For example, you might want to force a robot motion with potential risks such as singularity or Gimbal lock.
OnSetCurrentConfiguration Integer configurationIndex Triggered when the configuration of a robot is needed for a kinematic solution.

If this event is implemented, you should set the robot's configurations property list based on the given configurationIndex.

Important: If OnSetCurrentConfiguration is used, you need to implement the OnGetConfigurationCount and OnGetCurrentConfiguration events.
OnUpdateSecondaryJoints vcKinObject kin_object Triggered when external joint values need to be recalculated for motion target updates.

The return value should be a Boolean.

Examples

Example. Define custom Cartesian kinematics

from vcPythonKinematics import *
import vcMatrix
import vcVector

# Define the amount of joints and their names what this kinematics supports
JOINT_COUNT = 6
JOINT_NAMES = [ "Joint_1", "Joint_2", "Joint_3", "Joint_4", "Joint_5", "Joint_6" ]

# Base offset is the distance from robot component origin to flange nodes toolpoint
BASE_OFFSET = vcVector.new(234.542, 203.301, 1134.46)

# Returns the amount of joints this kinematics handles
def OnGetJointCount():
return JOINT_COUNT

# Returns the indexed joint names
def OnGetJointName(index):
return JOINT_NAMES[index]

# Returns Kinematic chain target (matrix) value based on joint values
def OnForward(kinobj):
m = vcMatrix.new()
p = vcVector.new()
p.X = kinobj.JointValues[0]
p.Y = kinobj.JointValues[1]
p.Z = kinobj.JointValues[2]
p += BASE_OFFSET
m.P = p
e = vcVector.new()
e.X = kinobj.JointValues[3]
e.Y = kinobj.JointValues[4]
e.Z = kinobj.JointValues[5]
m.WPR = e
kinobj.Target = m
return True

# Returns Kinematic chain joint values based on the target (matrix)
def OnInverse(kinobj):
m = kinobj.Target
p = m.P
e = m.WPR
kinobj.JointValues = [ p.X-BASE_OFFSET.X, p.Y-BASE_OFFSET.Y, p.Z-BASE_OFFSET.Z, e.X, e.Y, e.Z ]
return True

Example. Define custom Scara kinematics

from vcPythonKinematics import *
import vcMatrix
import vcVector
from math import *

# Define some helpers
DEBUG = False
EPSILON = 0.000001
MAX_DOUBLE = 1e39
PI = atan2(0,-1)
RAD_TO_DEG = 180.0/PI
DEG_TO_RAD = PI/180.0

JOINT_COUNT = 4
JOINT_NAMES = ["J1","J2","J3","J4"]

CONFIG_COUNT = 2
CONFIG_NAMES = ["LEFTY","RIGHTY"]

JS = [1,1,1,1]
JZO = [0.0,0.0,0.0,0.0]

LL1 = 0.0
LL2 = 0.0
ZeroHeight = 0.0

FirstCall = True

def OnRebuild():
OnFinalize()

def OnFinalize():
global JS, JZO, CONFIG_NAMES, LL1, LL2, ZeroHeight, FirstCall
FirstCall = False
comp = getComponent()
JS[0] = comp.JointSign1
JS[1] = comp.JointSign2
JS[2] = comp.JointSign3
JS[3] = comp.JointSign4
JZO[0] = comp.JointZeroOffset1
JZO[1] = comp.JointZeroOffset2
JZO[2] = comp.JointZeroOffset3
JZO[3] = comp.JointZeroOffset4
CONFIG_NAMES[0] = comp.ConfigName1
CONFIG_NAMES[1] = comp.ConfigName2
LL1 = comp.L12.X
LL2 = comp.L23.X
ZeroHeight = comp.L01.Z+comp.L12.Z+comp.L23.Z+comp.L34.Z

# Returns the indexed configuration names
def GetConfigName(index):
return CONFIG_NAMES[index]

def ANGLE(a):
remainder = fmod((a)+180, 360)
if remainder < 0:
remainder += 360
return remainder - 180

def GetNominalJoints(mappedjoints):
nominal = [0.0,0.0,0.0,0.0]
for i in range(JOINT_COUNT):
if i == 2: # translational joint
nominal[i] = JS[i]*mappedjoints[i]-JZO[i]
else: # rotational joint
nominal[i] = ANGLE(JS[i]*mappedjoints[i]-JZO[i])
return nominal

def GetMappedJoints(nominaljoints):
mapped = [0.0,0.0,0.0,0.0]
for i in range(JOINT_COUNT):
if i == 2: # translational joint
mapped[i] = JS[i]*(nominaljoints[i] + JZO[i])
else: # rotational joint
mapped[i] = ANGLE(JS[i]*(nominaljoints[i] + JZO[i]))
return mapped

def OnInitKinObject( kinobj ):
prop = kinobj.createProperty(VC_STRING, "Configuration", VC_PROPERTY_STEP)
prop.Value = CONFIG_NAMES[0]
prop.StepValues = CONFIG_NAMES

def OnGetJointCount():
return JOINT_COUNT

def OnGetJointName(index):
return JOINT_NAMES[index]

def OnInverse(kinobj):
if FirstCall:
OnFinalize()
solutions = []
warning = VC_SOLUTION_REACHABLE
px = kinobj.Target.P.X
py = kinobj.Target.P.Y
pz = kinobj.Target.P.Z
ox = kinobj.Target.O.X
oy = kinobj.Target.O.Y
# First we calculate the direction to the wrist center
a13= atan2( py, px )*RAD_TO_DEG
d13 = sqrt( px*px + py*py )
if( d13 > LL1 + LL2 ):
t1 = 0.0
t2 = 180.0
warning = VC_SOLUTION_UNREACHABLE
else:
if( d13 < abs(LL1 - LL2) ):
t1 = 180.0
t2 = 0.0
warning = VC_SOLUTION_UNREACHABLE
else:
t1 = sssa( LL2, LL1, d13 )*RAD_TO_DEG
t2 = sssa( d13, LL1, LL2 )*RAD_TO_DEG
#end if
#endif
j3 = pz - ZeroHeight
t4 = atan2(-ox, oy)*RAD_TO_DEG
for iconf in range(CONFIG_COUNT):
if iconf == 1:
sgn1 = -1
else:
sgn1 = 1
#endif
j1 = a13 + sgn1*t1
j2 = sgn1*(t2-180.0)
j4 = t4 - j1 - j2
solutions.append( [ warning, GetMappedJoints( [j1,j2,j3,j4] ) ] )
# end for NUM_CONFIGS
kinobj.Solutions = solutions
return True

def OnForward(kinobj):
if FirstCall:
OnFinalize()
nominal = GetNominalJoints( kinobj.JointValues )
m04 = vcMatrix.new()
m04.rotateRelZ( nominal[0] )
m04.translateRel( LL1, 0.0, 0.0 )
m04.rotateRelZ( nominal[1] )
m04.translateRel( LL2, 0.0, nominal[2]+ZeroHeight )
m04.rotateRelZ( nominal[3] )
#m04.rotateRelY( 180.0 )
kinobj.Target = m04
if kinobj.JointValues[1] <= 0.0:
kinobj.Configuration = GetConfigName(0)
else:
kinobj.Configuration = GetConfigName(1)
return True


vcPythonProcessHandler

vcPythonProcessHandler is a behavior that allows you to define a custom robot statement written in Python. You can also use this behavior as a handler for overriding the default execution of statements in a robot program.

Inherits: vcBehaviour

Contents ShowHide

Setup

Properties

Methods

Events

Examples

Setup

The script of a process handler defines its logic. In most cases, the event OnStatementExecute is used to get a handle for the executor of a robot program and the vcPositionStatement calling the process. A vcPositionStatement must be implemented as a process statement in order to call a process by referencing its handler.

Example. Adding a process statement

from vcScript import *

comp = getComponent()
for b in comp.Behaviours:
if b.Type == VC_ROBOTEXECUTOR:
rx = b
break

rp = rx.Program
main = rp.MainRoutine
ps = main.addStatement(VC_STATEMENT_PROCESS)

for b in comp.Behaviours:
if b.Type == VC_PYTHONPROCESSHANDLER:
ph = b
break

ps.Process = ph
ps.Name = "Example"

After a process statement has been to added to a routine, you can use the GUI to select the process statement and edit its properties. For example, you can change what process is called by the statement.

In most cases, you would use the event OnStatementAdd to initialize a statement calling the process and to add any positions or nested statements. By default, the positions of a process statement are not executed and need to be manually called when the statement is executed in its routine. When a new position is created, its position matrix is defined in World coordinates as well as the Parent coordinate system of the position. The position itself is a vcPositionFrame object, so you can use the PositionInWorld and PositionInReference properties to access different versions of the position matrix.

Example. Adding positions to a statement

from vcPythonProcessHandler import *

def OnStatementAdd(statement):
for i in range(5):
pos = statement.createPosition("PP")
mtx = pos.PositionInWorld
mtx.translateAbs(1400,0,1000)
mtx.rotateAbsZ(i*90)
pos.PositionInWorld = mtx

def OnStatementExecute(executor, statement):
for pos in statement.Positions:
executor.Controller.moveTo(pos.PositionInWorld)

You can develop a Python command that adds a new process statement to the program of a selected robot. Generally, the command is executed by a button that you add to the Program Editor panel, Statements toolbar. The command itself would need to be registered by storing its configuration and command files in the My Commands folder of your Visual Components documents.

Source files of example process statement

Properties

Name | Type | Access | Description
Icon | vcBitMap | RW | Defines an icon for the process when referenced by a process statement in the GUI.
Process | String | RW | Defines the name and id of process.
Script | String | RW | Defines the executable Python code of process.

Methods

Name | Return Type | Parameters | Description
condition | None | Function condition [Real timeout] | Runs a conditional test that stops process execution until a given function returns a True value. The given function can either be a lambda function or one defined in Script. Evaluation of condition is done continuously.
delay | None | Real time | Executes timed delay during process execution.
getApplication | vcApplication | None | Returns the application object.
getComponent | vcComponent | None | Returns the component containing the process handler.
getSimulation | vcSimulation | None | Returns the simulation object.
getTrigger | vcBehaviour | None | Returns the object triggering an event in Script; otherwise returns None. This method is only useful in a condition function passed to condition() and triggerCondition() methods. Note: A trigger, for example, is a signal or action connected to process handler.
resumeRun | None | None | Resumes the execution of a suspended OnRun() function.
suspendRun | None | None | Stops the execution of an OnRun() function.
triggerCondition | None | Function condition, [Real timeout] | Runs a conditional test, triggered during a simulation, that stops process execution until a given function returns a True value. The given function can either be a lambda function or one defined in Script. Evaluation of condition is done each time a trigger of process handler occurs during a simulation.

Events

Name | Parameters | Description
OnContinue | None | Triggered when a simulation resumes running after being stopped.
OnDestroy | None | Triggered when an object is destroyed in 3D world.
OnEvaluate | None | Triggered when component feature tree of process handler is rebuilt.
OnFinalize None Triggered when layout or component is being loaded in 3D world.

The event occurs, for example, when copying a component, or loading a layout of components. The event is triggered before the needed components are attached to the 3D world.
OnReset | None | Triggered when simulation is reset.
OnSignal | vcSignal signal | Triggered when the value of a signal connected to process handler is changing.
OnStart | None | Triggered at the start of a running simulation.
OnStatementAdd

vcPositionStatement statement

 Triggered when a process statement referring to this process handler is created in robot program.

Generally, this is used to initialize a vcPositionStatement object referring to this process handler with new properties and initial values.
OnStatementDialog vcPositionStatement statement Triggered when there is an attempt to access properties dialog of process statement referring to this process handler.

In this case, you need to return True to use standard properties dialog; otherwise return False.
OnStatementExecute vcExecutor executor, vcPositionStatement process_statement Triggered when process statement referring to this process handler is executed during a simulation.

Time consuming methods, for example delay() and condition(), may only be executed in this event handler or in functions called from this event handler.

Note: A process handler can only be executed at one given time, so multiple calls to the same process will return immediately.
OnStatementModified | vcPositionStatement statement | Triggered after properties dialog of process statement referring to this process handler is closed.
OnStatementRemove | vcPositionStatement statement | Triggered when reference to process handler in a process statement is removed.
OnStop | None | Triggered when simulation is stopped.

Notes:

  • OnStatementRemove is allowed to change the process name of a statement, but doing so will not cause any further calls to either event handler.
  • OnStatementRemove must not destroy a given statement.

Examples

Example. Modify the execution of point-to-point motion statements

from vcRslProcessHandler import *
from vcBehaviour import *
import vcMatrix, vcVector, math

app = getApplication()
comp = getComponent()
RAD_TO_DEG = math.pi/180.0

# Modifies the execution of PTP motions
# Uses default execution for other statements
def OnStatementExecute(executor, stat):
if stat.Type == VC_STATEMENT_PTPMOTION:
controller = executor.Controller
controller.clearTargets()
target = controller.createTarget()
target.JointTurnMode = VC_MOTIONTARGET_TURN_NEAREST
target.TargetMode = VC_MOTIONTARGET_TM_NORMAL
target.MotionType = VC_MOTIONTARGET_MT_JOINT
if stat.Base == None:
target.BaseName = ""
else:
target.BaseName = stat.Base.Name
if stat.Tool == None:
target.ToolName = ""
else:
target.ToolName = stat.Tool.Name
start_pos = vcMatrix.new(target.Target)
positions = stat.Positions
controller.addTarget(target)
M = positions[0].PositionInReference
op = M.P
p = vcVector.new(op.X - 50, op.Y, op.Z)
M.P = p
target.Target = M
controller.addTarget(target)
controller.move()
executor.callStatement(stat)
else:
executor.callStatement(stat)


vcPythonTransportController

This is a transport controller behavior that delegates the concrete implementation to user-made Python script(s), which allows creating specialized and custom transport controllers. The behaviour provides events and methods required to handle transport and work tasks. Python transport controller behaviours can be added to static components.

The script implementation should subscribe to the OnBeginTransport and OnBeginWorkEx events. When these events are triggered, the script is expected to create tasks to some internal queue and process them asynchronously. Transport controllers must accept and handle all “assigned” transport and work tasks to completion, there is no task rejection or cancellation mechanism. If and how a transport controller uses separate resources for completing the tasks is entirely up to the specific implementation to decide.

A transport task is considered done when the product instance is placed into the target component container. The target container and position should be queried from the target transport node using the method vcTransportNode.getTransportTarget(vcProduct product).

Work tasks need to be completed by calling the workDone method using the RequestId that was received in the OnBeginWorkEx event.

Transport controllers get an event when the controller is assigned as an implementer of a transport link, and similarly when a link is assigned some other controller. These events (OnLinkAssociated and OnLinkDisassociated) allow the controller to create any custom properties into all transport links it implements.

Inherits: vcTransportController, vcBehaviour

Type constant: VC_PYTHONTRANSPORTCONTROLLER

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Icon | String | RW | The icon file used to represent this transport controller in UI. Defines either filesystem path to the SVG image file or an SVG path data. Both relative and absolute paths with/without .svg extension are allowed. Relative paths are relative to the Icons or Icons. Additional folder under VC installation folder. Example: “UPM/pDroneTransportController”
IconColor | String | RW | Fill color applied to the of the Icon in ARGB, RGB or unqualified-color-name format. (e.g. #FFFF0000 or #FF0000 or Red)
IsSystem | Boolean | R | Always returns False.

Methods

Name | Return Type | Parameters | Description
workDone | None | Integer workId | Notifies the Work statement that work has been done so the process can continue executing.

Events

Name | Parameters | Description
LinkAssociated

vcTransportLink link

(Deprecated) Use OnLinkAssociated.
LinkDisassociated

vcTransportLink link

(Deprecated) Use OnLinkDisassociated.
OnBeginTransport

List of 2-tuple (vcTransportLink link, vcProduct product)

Triggered when the transport controller is asked to transport one or more products. Each product should be transported to the Destination node of the respective transport link.

OnBeginWork

Integer workId,

vcProperty processTime,

vcMatrix resourcePosition,

vcMatrix workPosition

(DEPRECATED) Use the extended version OnBeginWorkEx instead.

Triggered when a Work statement gets executed. workDone with correct workId must be called at some point for Work statement to continue execution. If a handler is not registered, Work statement might wait indefinitely.

workId is a unique (within this transport controller) identifier of this work assignment.

processTime is a property that defines how long the work itself should take in seconds.

resourcePosition defines a position hint in world coordinates where the working resource is expected to be while doing the work.

workPosition defines a position hint in world coordinates where the actual work is expected to happen.

OnBeginWorkEx

vcDataContainer arguments

Triggered when a Work statement gets executed. workDone with correct request id must be called at some point for Work statement to continue execution. If a handler is not registered, Work statement might wait indefinitely.

The arguments object has the following attributes:

Name | Type | Access | Description
RequestId | Integer | R | Unique (within this transport controller) identifier of this work assignment.
RequestingProcess | vcProcessRoutine | R | The process implementation that requested this work.
ProcessTime | Real | R | A value that defines how long the work itself should take in seconds.
ResourcePositionMatrix | vcMatrix | R | Position hint in world coordinates where the actual work is expected to happen.
WorkPositionMatrix | vcMatrix | R | Position hint in world coordinates where the working resource is expected to be while doing the work.
OnLinkAssociated | vcTransportLink link | Raised when a transport link is associated with this controller. If a handler is not registered, the default internal implementation is called.
OnLinkDisassociated

vcTransportLink link

 Raised when a transport link is disassociated from this controller. If a handler is not registered, the default internal implementation is called.

Examples

Example. Defining Custom-Made Transport Controller

from vcScript import *

# Minimal transport controller script.
# Product simply jumps to the target container and position
# transportation time is defined in transport link property MyTime

def transport_request_event(request_list):
# Event executed when transportation is requested from this controller
for transport_link, product in request_list:
queue.append([transport_link, product])
trigger.signal(True) # dummy boolean signal connected to the script to trigger condition in onrun

def OnStart():
global queue
queue = []

def OnRun():
while True:
condition(lambda: queue)
transport_link, product = queue.pop(0)
destination = transport_link.Destination # additional info can be accessed via trasportlink
target_container = destination.ComponentContainer
target_matrix = destination.getTransportTarget(product).ProductPosition
part = product.Component
delay(transport_link.MyTime)
sim.World.attach(part) # attach to world as matrix is given in world coords
part.PositionMatrix = target_matrix
target_container.grab(part)
def link_associated_event(transport_link):
prop = transport_link.createProperty(VC_REAL, 'MyTime')
def link_disassociated_event(transport_link):
prop = transport_link.getProperty('MyTime')
if prop:
transport_link.deleteProperty(prop)

comp = getComponent()
sim = getSimulation()
trigger = comp.findBehaviour('TriggerSignal')
transport_controller = comp.findBehaviour('PythonTransportController')
transport_controller.OnBeginTransport = transport_request_event
transport_controller.LinkAssociated = link_associated_event
transport_controller.LinkDisassociated = link_disassociated_event

#creating product properties that not supported in UI
# 1. create a distribution property to a product type
# 2. during simulation, take a sample of the distribution
# 3. use that sample value to a Real type property in the Product instance.


vcRealSignal

vcRealSignal is a signal that can send a real number value.

Inherits: vcBehaviour, vcSignal

Properties

Name | Type | Access | Description
Value | Real | RW | Defines the value of signal. Setting this value does not trigger the OnSignal event unless you use the signal() method.

Methods

Name | Return Type | Parameters | Description
signal | None | [Real value] | Signals the current value of signal to all connected behaviors, thereby triggering the OnSignal event. An optional value argument can be given to set the Value property of the signal.


vcReport

vcReport is a layout item used for generating reports of statistics gathered during a simulation.

Inherits: vcLayoutItem

Methods

Name | Return Type | Parameters | Description
getProperty | vcProperty | String property | Returns the first property matching a given name in report; otherwise returns None.
publish | None | String Type, String Name | Saves the report as either an image, csv, Excel sheet or PDF.
show | None | None | Shows the report.


vcRobotController

vcRobotController allows you control a robot and drive its joints.

Inherits: vcBehaviour, vcServoController

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
ApproachAxis | Enumeration | RW | Defines how to orient the robot based on the orientation of the active tool frame. See Approach Axis Constants for more information.
Bases | List of vcBaseFrame | R | Gets a list of all base frames available in controller.
ConfigurationMode | Enumeration | RW | Defines the configuration mode for joints driven by robot controller during linear motion interpolation. 0 = Fixed No change. That is, current configuration is used and does not change. 1 = Follow frame Configuration closest to previous joint values is used. 2 = Interpolate joint values Configuration is determined by point-to-point interpolation of joint values. See Motion Target Constants for more information.
FlangeOffset | String | RW | Defines an offset from flange node origin. Generally, this is used when flange node origin is not the exact place where to mount a tool or kinematics structure to end of robot arm.
InitialBase | String | RW | Defines the initial base frame by name of the controller.
InitialTool | String | RW | Defines the initial tool frame by name of the controller.
Kinematics | vcBehaviour | RW | Defines the kinematics object used by the controller which describes the robot's kinematic structure.
LagTime | Real | RW | If linear motion, defines default lag time.
MaxAngularAccel | Real | RW | If linear motion, defines maximum acceleration for angular movement (degrees/s^2).
MaxAngularSpeed | Real | RW | If linear motion, defines maximum speed for angular movement (degrees/s).
MaxCartesianAccel | Real | RW | If linear motion, defines maximum acceleration for linear movement (mm/s^2).
MaxCartesianSpeed | Real | RW | If linear motion, defines maximum speed for linear movement (mm/s).
OrientationInterpolationMode | Enumeration | RW | Defines the orientation interpolation mode for linear movement.
RootOffset | String | RW | Defines an offset from root node origin, thereby defining the start of kinematics structure.
SettleTime | Real | RW | If linear motion, defines default settle time.
Tools | List of vcBaseFrame | R | Gets a list of all tool frames available in controller.
TrackWorldFrameMode | Enumeration | RW | Defines Robot World Frame (RWF) of robot when mounted on track. 0 Track origin is used as RWF. 1 RWF of robot is used as RWF. See Track World Frame Modes for more information.
WorldTransformMatrix | vcMatrix | RW | Defines Robot World Frame of robot.

Methods

Name | Return Type | Parameters | Description
addBase | vcBaseFrame | None | Adds a new base frame to controller.
addTarget None vcMotionTarget target

or

vcMatrix matrix, [Enumeration target_mode]

 Adds a given motion target or target matrix to robot target list.

If target matrix, current settings of robot controller are used and an optional target_mode can be given to define how target relates to robot. This is similar to moveTo() method.

Generally, you use addTarget() when you are creating a batch of targets and the robot will use non-zero accuracy limits.

See Motion Target Constants for more information.
addTool | vcBaseFrame | None | Adds a new tool frame to controller.
clearTargets | None | None | Removes all motion targets and target matrices from robot target list.
createMotionInterpolator | vcMotionInterpolator | None | Creates a new motion interpolator for robot.
createTarget vcMotionTarget [vcMatrix matrix] Create a new motion target using current controller settings, and then returns the new motion target.

An optional matrix argument can be given to define target matrix of target.
move None None Moves robot to all targets in robot target list.

Python execution will wait until robot has motioned to all previously added targets.
moveImmediate None vcMotionTarget target, [Enumeration target_mode] Moves robot to a given target immediately.

An optional target_mode argument can be given to define how target relates to robot.

See Motion Target Constants for more information.
moveTo None vcMotionTarget target

or

vcMatrix matrix, [Enumeration target_mode]

 Moves robot to a given target or matrix, thereby clearing any previously added targets.

An optional target_mode argument can be given to define how target relates to robot.

See Motion Target Constants for more information.
moveRelTo None vcVector offset, [Enumeration target_mode]

or

Real x, Real y, Real z, [Enumeration target_mode]

 Moves robot to a position relative to current robot pose using current controller settings.

An optional target_mode argument can be given to define how target relates to robot.

See Motion Target Constants for more information.
removeBase | None | vcBaseFrame Base | Removes a given Base from controller.
removeTool | None | vcBaseFrame Tool | Removes a given Tool from controller.

Events

Name | Parameters | Description
OnPosition | vcRobotController robot | Triggered when robot reaches a motion target in its robot target list.


vcRoutine

vcRoutine contains a collection of statements that can be executed in a robot program.

Inherits: vcScope

Properties

Name | Type | Access | Description
IsPersistent | Boolean | RW | Defines if the routine is saved with the program. The default value is True.
Name | String | RW | Defines the name of the routine.
Program | vcProgram | R | Gets the program associated with the routine.
Properties | List of vcProperty | R | Gets a list of properties in the routine.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | Enumeration type, String name | Creates a new property of a given type and name in the routine, and then returns the new property. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property in the routine.
getProperty | vcProperty | String name | Returns a property matching a given name in the routine; otherwise returns None.


vcRoutingRule

vcRoutingRule allows you to define rules for transferring components to different connectors, thereby simulating routing rules for material flow.

Inherits: vcBehaviour, vcFlow, vcContainer

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
FlowProxy | vcComponentFlowProxy | RW | Defines if a proxy is used to check capacity of selected connector before routing a component. If None, this property is ignored.
RuleComponent | Enumeration | RW | Defines the component used for rule processing. See Routing Constants for more information.

Methods

Name | Return Type | Parameters | Description
createConnector | Integer | None | Adds a new connector in routing rule, and then returns the index of new connector.
deleteConnector | None | Integer index | Deletes a connector from routing rule at a given index.
processRoute | Integer | Integer from_connector, vcComponent component, vcBehaviour behavior | Returns the result of a routing test to verify if a given component arriving from a given connector would be routed based on a capacity test performed by a given behaviour or FlowProxy. Returns -1 if no valid targets are found.
setTarget | None | Integer index | Sets the connector by index for routing a component, which should be executed in OnRoute event.

Events

Name | Parameters | Description
OnRoute | Integer connector, vcComponent component, vcBehaviour behaviour | Triggered when a component is transferred into routing rule and being processed. Use the processRoute() method to test a viable option, and then use setTarget() method to override default routing logic.


vcRslMotionStatement

vcRslMotionStatement is a statement used for robot motions.

Inherits: vcRslStatement

Contents ShowHide

Common Properties

Statement Specific Properties

Methods

Examples

Common Properties

The following properties are common to all motion type statements.

Name | Type | Access | Descriptions
Base | String | RW | Defines the name of a base frame used by statement.
CycleTime | Real | RW | Defines the total elapsed time for executing motion statement, which may scale speed and acceleration of joints. If zero, this property is ignored.
ExternalTCP | Enumeration | RW | Defines the interpolation mode for targeting motion. 0 = False Default setting that uses Base to Tool configuration; position created at tool frame. 1 = True Interpolation from Tool to Base; position created at base frame.
Joint1 to JointN | Real | RW | Defines the value of each joint driven by robot controller in statement.
JointForce | Real | RW | Defines the percentage of joint acceleration and deceleration values to use in statement.
JointSpeed | Real | RW | Defines the maximum speed for joints driven by robot controller as a percentage of nominal joint speed.
MotionType | Enumeration | RW | Defines the motion type of statement. 0 = Joint 1 = Linear See Motion Constants for more information.
Synchronize | Boolean | RW | Defines if joints driven by robot controller are synchronized to reach Target at CycleTime. If False, robot might reach Target, and then wait for CycleTime to elapse until executing next statement.
Target | vcMatrix | RW | Defines the position matrix of statement.
Tool | String | RW | Defines the name of tool frame used by statement.

Statement Specific Properties

Linear Motion

Name | Type | Access | Description
Acceleration | Real | RW | Defines the maximum Cartesian acceleration of motion (units/s^2) used to calculate target trajectory.
AngularAcceleration | Real | RW | Defines the maximum angular acceleration of motion (degrees/s^2) used to calculate target trajectory.
AngularDeceleration | Real | RW | Defines the maximum angular deceleration of motion (degrees/s^2) used to calculate target trajectory.
ConfigurationMode | Enumeration | RW | Defines the configuration mode for joints driven by robot controller during linear motion interpolation. 0 = Fixed No change. That is, current configuration is used and does not change. 1 = Follow frame Configuration closest to previous joint values is used. 2 = Interpolate joint values Configuration is determined by point-to-point interpolation of joint values.
Deceleration | Real | RW | Defines the maximum Cartesian deceleration of motion (units/s^2) used to calculate target trajectory.
MaxAngularSpeed | Real | RW | Defines the maximum angular speed (degrees/s^2) used to calculate target trajectory.
MaxSpeed | Real | RW | Defines the maximum Cartesian speed (units/s) used to calculate target trajectory.
OrientationInterpolationMode | Enumeration | RW | Defines the orientation interpolation mode for linear movement.

Point to Point (Joint) Motion

Name | Type | Access | Description
Configuration | String | RW | Defines the joint configuration by name of robot at target. Configuration names are defined in robot's kinematics behavior and can be manufacturer specific.
JointTurns1 to JointTurnsN | Integer | RW | Defines joint turn mode for robot based on joint count (1...4...6) and type, for example articulated and scara robots. -1 Angle < minus 180 degrees 0 Angle plus/minus 180 degrees 1 Angle > 180 degrees

Methods

Name | Return Type | Parameters | Description
readFromTarget | None | vcMotionTarget target | Sets the Target property of statement to equal Target property of a given target.
writeToTarget | None | vcMotionTarget target | Sets the Target property of a given target to equal Target property of statement.

Examples

Example. Access and edit statements in robot program

from vcScript import *

#Access main program via Executor
comp = getComponent().findBehaviour('Executor')
mainroutine = comp.MainRoutine

#Access statements and return type and order
def exampleRsl():
for i in mainroutine.Statements:
print i.Name, i.Type, i.Index

#Create and delete statement via events
def OnRun():
my_statement = mainroutine.createStatement(VC_STATEMENT_COMMENT)
my_statement.Comment = "Example Comment"
exampleRsl()

#deletes the last statement when user hits reset button
def OnReset():
mainroutine.deleteStatement(len(foo.Statements)-1)
exampleRsl()


vcRslProcessHandler

vcPythonProcessHandler is a behavior that allows you to define a custom robot statement written in Python. The process handler must to be connected to a robot's executor in order to be called using a vcRslProcessStatement object.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Icon | vcBitMap | RW | Defines an icon for the process when referenced by a process statement in the GUI.
Process | String | RW | Defines the name and id of process.
Script | String | RW | Defines the executable Python code of process.

Methods

Name | Return Type | Parameters | Description
condition | None | Function condition [Real timeout] | Runs a conditional test that stops process execution until a given function returns a True value. The given function can either be a lambda function or one defined in Script. Evaluation of condition is done continuously.
delay | None | Real time | Executes timed delay during process execution.
getApplication | vcApplication | None | Returns the application object.
getComponent | vcComponent | None | Returns the component containing the process handler.
getSimulation | vcSimulation | None | Returns the simulation object.
getTrigger | vcBehaviour | None | Returns the object triggering an event in Script; otherwise returns None. This method is only useful in a condition function passed to condition() and triggerCondition() methods. Note: A trigger, for example, is a signal or action connected to process handler.
resumeRun | None | None | Resumes the execution of a suspended OnRun() function.
suspendRun | None | None | Stops the execution of an OnRun() function.
triggerCondition | None | Function condition, [Real timeout] | Runs a conditional test, triggered during a simulation, that stops process execution until a given function returns a True value. The given function can either be a lambda function or one defined in Script. Evaluation of condition is done each time a trigger of process handler occurs during a simulation.

Events

Name | Parameters | Description
OnContinue | None | Triggered when a simulation resumes running after being stopped.
OnDestroy | None | Triggered when an object is destroyed in 3D world.
OnEvaluate | None | Triggered when component feature tree of process handler is rebuilt.
OnStatementExecute vcRslProgramExecutor executor, vcRslProcessStatement process_statement Triggered when process statement referring to this process handler is executed during a simulation.

Time consuming methods, for example delay() and condition(), may only be executed in this event handler or in functions called from this event handler.

Note: A process handler can only be executed at one given time, so multiple calls to the same process will return immediately.
OnFinalize None Triggered when layout or component is being loaded in 3D world.

The event occurs, for example, when copying a component, or loading a layout of components. The event is triggered before the needed components are attached to the 3D world.
OnReset | None | Triggered when simulation is reset.
OnSignal | vcSignal signal | Triggered when the value of a signal connected to process handler is changing.
OnStart | None | Triggered at the start of a running simulation.
OnStatementAdd

vcRslProcessStatement statement

 Triggered when a process statement referring to this process handler is created in robot program.

Generally, this is used to initialize a vcRslProcessStatement object referring to this process handler with new properties and initial values.
OnStatementDialog vcRslProcessStatement statement Triggered when there is an attempt to access properties dialog of process statement referring to this process handler.

In this case, you need to return True to use standard properties dialog; otherwise return False.
OnStatementModified | vcRslProcessStatement statement | Triggered after properties dialog of process statement referring to this process handler is closed.
OnStatementRemove | vcRslProcessStatement statement | Triggered when reference to process handler in a process statement is removed.
OnStop | None | Triggered when simulation is stopped.

Notes:

  • OnStatementAdd and OnStatementRemove are allowed to change the process name of a statement, but doing so will not cause any further calls to either event handler.
  • OnStatementAdd and OnStatementRemove must not destroy a given statement.


vcRslProcessStatement

vcRslProcessStatement is a statement that can execute a defined RSL Process Handler behavior.

Inherits: vcRslStatement

Properties

Name | Type | Access | Description
Process | String | RW | Defines the name of process to be executed by statement.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | String type, String name, [Enumeration constraints] | Adds a new property of a given type and name to statement. An optional constraints argument can be given to defines constraints for the new property, which must be done at the time of creation.
deleteProperty | None | vcProperty property | Deletes a given property from statement.
getProperty | vcProperty | String name | Returns the first property matching the given name in statement; otherwise returns None.


vcRslProgramExecutor

vcRslProgramExecutor is an executor for robot programs, thereby allowing you to program and simulate robot actions. In this context, a robot program consists of a Main routine, subroutines and statements.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
ActionMode | Boolean | RW | Defines if the execution of robot program is performed automatically or by a logic controller, for example a pedestal. If False, MainRoutine is executed automatically at start of simulation.
Colour | vcMaterial | RW | Defines the color of robot program.
Controller | vcRobotController or vcServoController | RW | Defines the controller referenced by executor, which is either a controller for robot or servo.
CurrentRoutine | vcRslRoutine | R | Gets the current routine in robot program being handled by executor.
DigitalMapIn | vcBooleanSignalMap | RW | Defines the input device used for reading digital signal values.
DigitalMapOut | vcBooleanSignalMap | RW | Defines the output device used for sending digital signal values.
ExecutionMode | Boolean | RW | Defines if a robot is controlled by an external executor, for example a virtual robot controller.
IntegerMapIn | vcIntergerSignalMap | RW | Defines the input device used for reading integer values.
IntegerMapOut | vcIntergerSignalMap | RW | Defines the output device used for sending integer values.
Looping | Boolean | RW | Defines if the executor loops a robot program during a simulation.
MainRoutine | vcRslRoutine | R | Gets the main routine of robot program.
ProcessHandlers | List of vcRslProcessHandler | RW | Gets a list of all process statement handlers connected to executor.
Program | String | RW | Defines the URI of robot program being handled by executor.
RealMapIn | vcBehaviour | RW | Defines the device used for reading real number values.
RealMapOut | vcBehaviour | RW | Defines the device used for sending real number values.
StringMapIn | vcStringSignalMap | RW | Defines the device used for reading string values.
StringMapOut | vcStringSignalMap | RW | Defines the device used for sending string values.
SubRoutines | List of vcRslRoutine | R | Gets a list of all subroutines in current robot program being handled by executor.

Methods

Name | Return Type | Parameters | Description
callRemoteAction | None | String routine | Schedules a remote routine by name in a connected robot to be executed at first opportunity. Note: Python execution continues immediately.
callRoutine | None | String routine, [Boolean suspend] | Executes a routine by name in robot program, and then waits for completion of that routine. An optional suspend argument can be used to wait or not wait for completion of routine. If False, Python execution continues immediately.
createSubRoutine | vcRslRoutine | String routine_name | Adds a new routine of a given routine_name to robot program.
delay | None | Real time | Schedules a delay in the execution of robot program for a given amount of time. Note: Python execution continues immediately.
deleteProgram | Boolean | None | Deletes the robot program being handled by executor, thereby removing all routines and statements. If deletion is successful, returns True; otherwise returns False.
deleteSubRoutine | Boolean | String routine | Deletes a routine by name from robot program. If deletion is successful, returns True; otherwise returns False.
newProgram | Boolean | String name | Creates a new robot program of a given name to be handled by executor.
setOutput | None | Integer output_index, Boolean value | Sets the value of a signal connected to a port at a given output_index in robot.
waitInput | None | Integer input_index, Boolean value | Schedules the executor to wait until a signal connected to a port at a given input_index in robot has a given value. Note: Python execution continues immediately.
waitRemoteAction | None | String routine | Schedules the executor to wait for completion of a routine by name in a connected robot. Note: Python execution continues immediately.

Events

Name | Parameters | Description
OnProgramChange | vcRslRoutine routine, vcRslStatement statement | Triggered when a change occurs in robot program, for example when you add/delete a statement from a routine.


vcRslRoutine

vcRslRoutine is a collection of statements in a robot program.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Name | String | R | Gets the name routine.
Program | vcRslProgramExecutor | R | Gets the robot executor of routine and its program.
StatementCount | Integer | R | Gets the number of statements in routine.
Statements | List of vcRslStatement | R | Gets a list of all statements in routine.

Methods

Name | Return Type | Parameters | Description
beginBatch | None | None | Disables the application's GUI to speed up the creation or edits for a batch of statements in routine.
createStatement | vcRslStatement | Enumeration type | Adds a new statement of a given type to routine. See Motion Constants for more information.
deleteStatement | Boolean | Integer index | Removes a statement at a given index from routine.
endBatch | None | None | Enables the application's GUI. In most cases, this method is called after beginBatch().
getStatement | vcRslStatement | Integer index | Returns a statement at a given index in routine.


vcRslStatement

vcRslStatement is the basic implementation for statements in a robot program.

Contents ShowHide

Hierarchy

Common Properties

Statement Specific Properties

Methods

Examples

Hierarchy

Most statements can be manipulated directly as vcRslStatement type objects, while others have their own implementations that inherit vcRslStatement.

vcRslStatement

vcRslMotionStatement

vcRslProcessStatement

Common Properties

The following properties are common in all RSL statements.

Name | Type | Access | Description
GridColor | vcVector | RW | Defines the color associated with the statement, for example when robot program is listed in a panel. Color is defined in RGB color space by using a vector containing normalized XYZ values.
Index | Integer | RW | Defines the location (index) of statement in routine.
Name | String | RW | Defines the name of statement.
Properties | List of vcProperty | R | Gets a list of all properties in statement.
Routine | vcRslRoutine | R | Gets the routine the statement belongs to in robot program.
Type | Enumeration | R | Gets the statement type. See Motion Constants for more information.

Statement Specific Properties

Call

A statement that calls a subroutine in robot program.

Name | Type | Access | Description
RoutineName | String | RW | Defines the subroutine to call by name.

Comment

A statement that prints a comment to Output panel.

Name | Type | Access | Description
Comment | String | RW | Defines the message to be printed to user.

Define Base

A statement that temporarily modifies a base frame during a simulation.

Name | Type | Access | Description
Base | String or vcBaseFrame | RW | Gets/Sets the base frame used by statement. To set, give the name of a base frame listed in robot controller, vcRobotController, which is referenced by robot executor of this statement.
Node | String | RW | Defines the parent node of Base.
Position | vcMatrix | RW | Defines the location of Base. If Relative is set to True, this property references Base coordinate system, thereby changing base frame relative to its current position.
Relative | Boolean | RW | Defines if Position provides absolute or relative values for Base location.

Define Tool

A statement that temporarily modifies a tool frame during a simulation.

Name | Type | Access | Description
Node | String | RW | Defines the parent node of Tool.
Position | vcMatrix | RW | Defines the location of Tool. If Relative is set to True, this property references Tool coordinate system, thereby changing tool frame relative to its current position.
Relative | Boolean | RW | Defines if Position provides absolute or relative values for Tool location.
Tool | String or vcBaseFrame | RW | Gets/Sets the tool frame used by statement. To set, give the name of a tool frame listed in robot controller, vcRobotController, which is referenced by robot executor of this statement.

Delay

A statement that executes a timed delay.

Name | Type | Access | Description
Delay | Real | RW | Defines the amount of time (in seconds) to delay program execution.

Grasp

A deprecated statement for executing a robot grasp action. No additional properties.

Halt

A statement for halting and/or resetting a simulation.

Name | Type | Access | Description
Reset | Boolean | RW | Defines if a simulation is reset.

Program Sync

A statement that can synchronize two or more robots.

Name | Type | Access | Description
SyncComponents | List of vcComponent | RW | List of components in the sync program.
SyncMsg | String | RW | Defines the sync message to trigger synchronization.
WaitSync | Boolean | RW | Defines if a robot in sync program waits for all SyncComponents to send SyncMsg. If False, robot sends SyncMsg and continues the execution of its program.

Release

A deprecated statement for executing a robot release action. No additional properties.

remote Call

A statement that remotely calls a routine in another robot's program.

Name | Type | Access | Description
RemoteRoutine | String | RW | Defines the name of routine to remotely call in a robot. The format is [component_name]::[routine_name] and the target robot should be connected to calling robot via an abstract interface.

Remote Wait

A statement that waits for a routine to be completed by another robot.

Name | Type | Access | Description
RemoteRoutine | String | RW | Defines the name of routine to wait for in a robot. The format is [component_name]::[routine_name] and the target robot should be connected to calling robot via an abstract interface.

Set Binary Output

A statement that sets the value of a signal mapped to an output port of robot.

Name | Type | Access | Description
Output | Integer | RW | Defines the output port.
Value | Boolean | RW | Defines the output value.

Wait Binary Output

A statement that waits for an input port of robot mapped to a signal to have a specific value.

Name | Type | Access | Description
Input | Integer | RW | Defines the input port.
Value | Boolean | RW | Defines the input value.
WaitTrigger | Boolean | RW | Defines if Value is evaluated continuously or when a signal event occurs during a simulation.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | String type, String name, [Enumeration constraints] | Adds a new property of a given type and name to statement. An optional constraints argument can be given to define constraints for property, which must be given at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Removes a given property from statement.
getProperty | vcProperty | String name | Returns the first matching property of a given name in the statement; otherwise returns None.

Examples

Example. Manipulate statements in robot routine

from vcScript import *

#Access main program via Executor
comp = getComponent()
rx = comp.findBehaviour('Executor')
mainroutine = rx.MainRoutine

#Access statements and return type and order
def exampleRsl():
for i in mainroutine.Statements:
print i.Name, i.Type, i.Index

#Create and delete statement via events
def OnRun():
my_statement = mainroutine.createStatement(VC_STATEMENT_COMMENT)
my_statement.Comment = "Example Comment"
exampleRsl()

def OnReset():
mainroutine.deleteStatement(len(foo.Statements)-1)
#deletes the last statement when user hits reset button
exampleRsl()


vcScalarQuantity

vcScalarQuantity is the basic implementation for quantities used in the application and provides access to units.

Contents ShowHide

Usage

Properties

Methods

Usage

Each quantity represents a unit of measurement and magnitude (size). A quantity can be classified as either a scalar or vector value depending on its spatial nature. That is, a direction or force is required to fully describe vector quantity. For example, time and mass are scalar quantities while acceleration and weight are vector quantities.

vcScalarQuantity

vcVectorQuantity

When a vcProperty object references a quantity the property must define a unit group, which is a group of units that apply to the quantity and belong to the same unit family. The actual unit of the quantity is then defined by the quantity's magnitude, which is a value, expressed in canonical units, that specifies the size of the unit.

vcUnitFamily

vcUnitGroup

vcUnit

In terms of hierarchy, a quantity may belong to a subset of quantities that have the same parent quantity. For example, Volume is a built-in parent quality that has a Liquid child quantity. Liquid measures liquid volumes, whereas Volume can describe any spatial volume.

In terms of categorization, a quantity may belong to a category which is an informative string/label describing the type or context of quantity.

Properties

Name | Type | Access | Description
AvailableGroups | List of vcUnitGroup | R | Gets a list of all unit groups that include the quantity, thereby any one of those groups can be used to access and select quantity.
Category | String | RW/R | If built-in quantity, gets category of quantity; otherwise defines the category of a quantity.
Children | List of vcScalarQuantity | R | Gets a list of all child quantities for the quantity. If no child quantities, value is empty list.
CurrentGroup | vcUnitGroup | RW | Defines the current unit group used for listing the quantity's properties. To set, give either a vcUnitGroup object or name of unit group. If value is None and quantity has a parent quality, uses the current group of parent.
EffectiveGroup | vcUnitGroup | R | Gets the actual unit group used for listing the quantity's properties. If CurrentGroup is None, uses unit group of parent quantity.
FullName | String | R | Gets the full name of quantity, which is the concatenation of parent quantity names with a dot (.) separator and Name. You can refer to a quantity by referencing its full name.
IsBuiltIn | Boolean | R | Indicates if quantity is a built-in quantity which cannot be edited nor destroyed.
Name | String | RW/R | If quantity is built-in, gets name of quantity; otherwise defines the quantity's name.
Parent | vcScalarQuantity | RW/R | If quantity is built-in, gets parent quantity; otherwise defines the parent of quantity. To set, give either a vcScalarQuantity object or full name of quantity.
Type | String | R | Gets the quantity type. See Quantity Constants for more information.

Methods

Name | Return Type | Parameters | Description
createChildQuantity | vcScalarQuantity | String name, Enumeration type | Adds a new child quantity of a given name and type to the quantity. See Quantity Constants for more information.
destroy | None | None | If quantity is not built-in, destroys the quantity; otherwise throws an exception.
getEffectiveUnit | vcUnit | Real magnitude | Returns a unit from effective unit group of quantity that closely matches a given magnitude.


vcSchemaPositionFrame

vcSchemaPositionFrame is a position defined by schema properties. Generally, this is a position of a path statement. One case is to extract data from the position, and then export or use the data elsewhere.

Properties

The properties are the schema properties associated with the position. For example, the position of a vcPathStatement object would have at least seven, built-in properties.

Examples

Example. Get configuration warnings of path positions

from vcScript import *
import vcMatrix

comp = getComponent()
rx = comp.findBehaviour("Executor")
mr = rx.Program.MainRoutine

mr.clear()
path = mr.addStatement("Path")

path.beginBatchUpdate(10)
for i in range(10):
position = vcMatrix.new()
position.translateAbs(1000,i*100,1000)
path.setSchemaValues(i,"Position",position)
path.endBatchUpdate(10)

#use iterator to make list of positions
positions = list(path.Positions)
rc = rx.Controller
for p in positions:
target = rc.createTarget(p.Position)

#simple test with Generic Articulated Robot
#warning and status numbering are flipped
config_warning = target.getConfigWarning(target.RobotConfig)
status = 7 - config_warning
p_index = positions.index(p)
path.setSchemaValues(p_index, "PositionStatus", status)

app = getApplication()
app.render()


vcScope

vcScope is a collection of statements in a robot program.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
ParentStatement | vcStatement | R | Gets the statement that owns the scope, for example a conditional If or While statement that has a nested block of statements; otherwise the value is None for routines.
Statements | List of vcStatement | R | Gets a list of statements belonging to the scope.

Methods

Name | Return Type | Parameters | Description
addStatement vcStatement Enumeration type, [Integer index]

or

Enumeration type, Integer index, [String icon] 		Creates a new statement of a given type in the scope, and then returns that statement.

The default index value is -1 which adds the new statement to the end of the scope.

An optional icon argument can be given to define the path of an icon used by the statement; otherwise the statement is given a default icon.

See Statement Constants for more information.

Note: If you want to add a custom statement, implement a vcPositionStatement as a process statement by passing a type of VC_STATEMENT_PROCESS or create an add-on.
clear | None | None | Deletes all statements in the scope.
deleteStatement | None | vcStatement statement | Deletes a given statement in the scope.
getStatement | vcStatement | Integer index | Returns a statement at a given index in the scope.

Events

Name | Parameters | Description
OnScopeExecuted | vcScope scope, Boolean isImmediate | Triggered when a scope is executed. The isImmediate argument defines whether the scope was executed in immediate mode (non time-consuming mode) or not.
OnStatementAdded | vcStatement | Triggered when a new statement is added to the scope.
OnStatementRemoving | vcStatement | Triggered when a statement is being deleted from the scope.

Examples

Example. Add statement with custom icon

from vcScript import *

#Main routine of robot used in this case
comp = getComponent()
rx = comp.findBehavioursByType(VC_ROBOTEXECUTOR)[0]
routine = rx.Program.MainRoutine

#add with default index and icon
statement1 = routine.addStatement("Process")

#add to start of routine and use a default icon
statement2 = routine.addStatement(VC_STATEMENT_HALT, 0)

#add after first statement in routine and use custom icon
statement3 = routine.addStatement("Process", 1, "rDetach")


vcScopeStatement

vcScopeStatement is a robot statement that can execute its own scope of statements.

Inherits: vcStatement

Statement Specific Properties

While

A While statement is a vcScopeStatement that can execute a scope of statements in a loop as long as its condition is true.

Name | Type | Access | Description
Condition

Expression

 RW Defines an expression that when evaluated returns a True or False value.

A True value means the statement will execute its scope of statements and loop back, evaluating its condition before each iteration.

A False value means the statement has been completed and will not execute its scope of statements.

Note: In order to avoid an endless loop, use a condition that references a robot variable, port in robot, Break statement or a controller property.
Scope | vcScope | R | Gets the scope of statements executed by the statement.


vcScript

vcScript allows you to publish and execute a Python script.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Application | vcApplication | R | Gets the application object.
Component | vcComponent | R | Gets the component of script.
IsRunning | Boolean | R | Indicates if code of script is being executed.
Node | vcNode | R | Gets the node containing script.
Script | String | RW | Defines the executable Python code of script.
Simulation | vcSimulation | R | Gets the simulation object.

Methods

Name | Return Type | Parameters | Description
condition | Boolean | Function expression_function, [Real timeout] | Delays the execution of script until a given function returns a True value or timeout period. The first evaluation of the function is immediate, and then each subsequent test is triggered, for example, by signal connected to script. The default timeout period is zero. Returns a True value if condition is True before timeout, otherwise returns a False value.
convertToByteCode | None | None | Converts the code of script to bytecode. Generally, this method is used to encrypt the code of script.
delay | None | Real time | Delays the execution of script for a given amount of time.
getApplication | vcApplication | None | Returns the application object.
getComponent | vcComponent | None | Returns the component of script.
getNode | vcNode | None | Returns the node containing script.
getSimulation | vcSimulation | None | Returns the simulation object.
getTrigger | vcBehaviour | None | Returns an object that acts as a trigger in script, for example a signal connected to script. Generally, this method is called in a condition() or triggerCondition() expression to evaluate a trigger.
resumeRun | None | [Real timeout] | Resumes the execution of OnRun, the main program of script, that was placed in suspended state.
suspendRun | None | None | Suspends the execution of OnRun, the main program of script.
triggerCondition | Boolean | Function expression_function, [Real timeout] | Delays the execution of script until a given function returns a True value or timeout period. The evaluation of the function is triggered, for example, by signal connected to script. The default timeout period is zero. Returns a True value if condition is True before timeout, otherwise returns a False value.

Events

The following event handlers are functions that can be defined and used in a script. In most cases, you use the OnRun event to define the main program/loop of script which is executed while a simulation is running.

Name | Parameters | Description
OnAction | vcAction action | Triggered when an Action Container connected to script handles an action.
OnContinue | None | Triggered when a simulation resumes after being halted.
OnDestroy | None | Triggered when an object is destroyed, for example a node.
OnFinalize | None | Triggered when layout or component is being loaded in 3D world. The event occurs, for example, when copying a component, or loading a layout of components. The event is triggered before the needed components are attached to the 3D world.
OnRebuild | None | Triggered when component geometry is rebuilt.
OnReset | None | Triggered when simulation is reset to its initial state and simulation clock is set at zero.
OnRun | None | Triggered at the start of a simulation and is used as the main function/loop of script.
OnSignal | vcSignal signal | Triggered when a signal connected to script signals its value.
OnSimulationUpdate | Real time | Triggered when simulation and scene are updated.
OnStart | None | Triggered at the immediate start of simulation.
OnStop | None | Triggered when a simulation is halted.

Examples

Example. Use condition() and triggerCondition() methods

#A condition calls the function test_func() immediately w/o waiting for a trigger
#A triggerCondition calls the function when a trigger is received
#Use this script as an example for executing a condition and/or a triggerCondition

from vcScript import *
import vcMatrix

finalizing = True
comp = getComponent()
pathxx = comp.findBehaviour("One-WayPath__HIDE__")
pathxx.Enabled = True
preSensorSgnl = comp.findBehaviour("PreSignal")
postSensorSgnl = comp.findBehaviour("BooleanSignal")

def test_func():
triggerer = getTrigger()
print '-'*99 # print a line
print '- triggerer:',triggerer
print '- postSensorSgnl value:',postSensorSgnl.Value
if triggerer == postSensorSgnl:
if postSensorSgnl.Value == False:
print 'TEST PASSED'
return True # return true which makes condition test to pass
else:
print 'TEST FAILED because postSensorSgnl.Value is not False'
return False # return false which makes condition test to fail
else:
print 'TEST FAILED because triggerer is not postSensorSgnl'
return False # return false which makes condition test to fail

def OnRun():
## condition
#condition(lambda: test_func() ) # case1

## triggerCondition
#triggerCondition(lambda: test_func() ) # case2

pathxx.Enabled = False
print '< test passed and path disabled >'
print ''


vcScriptStatement

Properties

Methods

Properties

Name | Type | Access | Description
Application | vcApplication | R | Gets the application object.
Component | vcComponent | R | Gets the component of script statement.
Executor | vcRslProgramExecutor | R | Gets the robot executor of script statement.
Node | vcNode | R | Gets the node of script statement.
Simulation | vcSimulation | R | Gets the simulation object.

Methods

Name | Return Type | Parameters | Description
getApplication | vcApplication | None | Returns the application object.
getComponent | vcComponent | None | Returns the component of script statement.
getExecutor | vcRslProgramExecutor | None | Returns the robot executor of script statement.
getNode | vcNode | None | Returns the node of script statement.
getSimulation | vcSimulation | None | Returns the simulation object.
signalOut | None | Integer Port, Integer Value | Sets the value of a signal mapped to a given port in robot of script statement.


vcSelectCommand

vcSelectCommand provides options for handling selections made using the interactiveComponentSelect command.

Inherits: vcCommand

Properties

Name | Type | Access | Description
PickedNode | vcNode | R | Gets the node containing an object picked using startPick() method.
PickedObject | vcNode | R | Gets the object picked by command.
PickedPrimitive | vcPrimitive | R | Gets the geometry primitive of an object picked using startPick() method.

Methods

Name | Return Type | Parameters | Description
cancelPick | None | None | Cancels an active pick process.
startPick | None | None | Starts picking process, thereby allowing an interactive selection to occur. Process ends after first pick or by calling cancelPick() method.


vcSelection

vcSelection allows you to access and manipulate selections in the application.

Contents ShowHide

Properties

Methods

Events

Properties

Name | Type | Access | Description
Count | Integer | R | Gets the number of items in selection.
IgnoreEvents | Boolean | RW | Defines if selection ignores event passing in order to avoid cyclic calls.
Name | String | R | Gets the name of selection.
Objects | List of <Type> | R | Gets a list of all objects in selection.
Type | Enumeration | R | Gets the selection type. See Selection Constants for more information.

Methods

Name | Return Type | Parameters | Description
addItem None <Type> item

or

vcNode node, <Type> item

 Adds a given item or an item in a given node to selection if item is a supported selection type.

See Selection Constants for more information.
beginUpdate None None Blocks the application from doing update procedures while an item is being added to selection, thereby improving system performance.

This method should be called before selecting any items.
clear | None | None | Removes all items from selection.
endUpdate None None Unblocks the application and sends a notification to update selection in scene.

This method should be called after the last item is added to selection.
getCommand vcCommand String name Returns a registered command matching a given name.

The command should support the selection of an item, for example, Select, Translate, Rotate, Delete, Cut, Copy, and Paste.
getItem | <Type> | Integer index | Returns an item at a given index in selection.
getItemNode | vcNode | Integer index | Returns the node containing an item at a given index in selection.
getItemWorldMatrix | vcMatrix | Integer index | Returns the position matrix of an item at a given index in selection.
registerCommand None String name, vcCommand command, [Enumeration options] Registers a given command with selection and creates a command shortcut/menu item.

The name argument defines the name of command displayed in shortcut menu.

An optional options argument can be given to enable command based on selection : when no objects are selected; a single object is selected; or multiple objects are selected.

See Selection Constants of command type for more information or Examples section of this topic.
removeItem None <Type> item

or

vcNode node, <Type> item

 Removes a given item or an item in a given node from selection.

Events

Name | Parameters | Description
OnPostChange | vcSelection selection | Triggered when selection has been changed.
OnPreChange | vcSelection selection | Triggered when current selection is about to be changed.


vcSelectionManager

vcSelectionManager is responsible for handling the types of selections used by the application.

Contents ShowHide

Methods

Events

Methods

Name | Return Type | Parameters | Description
clear | None | None | Removes all objects from selection.
getSelection | List of <Type> | Enumeration type | Returns a list of objects of a given type that are in selection. See Selection Constants for more information.
setSelection | None | <Type> object, [Boolean append] or List of <Type> objects, [Boolean append] | Creates a new selection for a given object or list of objects of a supported selection type. An optional append argument can be used to retain current selection, thereby appending the given object(s) to that selection. See Selection Constants for more information.

Events

Name | Parameters | Description
OnSelectionChanged | None | Triggered when a selection has changed in application.


vcServoController

vcServoController is a controller for driving independent joints. The controller itself only supports forward kinematics and cannot be used in robots rather with them. For example, a servo controller can be used for external axis systems, grippers, fixtures, weld guns, and other simple mechanical structures.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
FlangeNode | vcNode | RW | Defines the flange node of servo, for example the mount plate or carriage for other kinematic structures.
HeartbeatTime | Real | RW | If UseHeartbeat is set to True, defines the interval or pulse for updating joints.
JointCount | Integer | R | Gets the number of joints in servo.
Joints | List of vcJoint | R | Gets a list of all joints referenced by servo.
RootNode | vcNode | RW | Defines the root node of servo, thereby the fixed base of kinematic structure.
Speed | Real | RW | Defines joint speed as a percentage of maximum speed for driving joints in range 0 to 100.
UseHeartbeat | Boolean | RW | Turns on/off the use of a heartbeat or pulse to drive and update joints.

Methods

Name | Return Type | Parameters | Description
calcMotionTime | Real | None | Returns the calculated motion time of servo using current joint values and listed targets.
createJoint | vcJoint | None | Adds a new joint in servo. (Deprecated)
deleteJoint | None | vcJoint joint or Integer joint_index | Removes a given joint or one at a given index from servo. (Deprecated)
findJoint | vcJoint | String joint_name | Returns the first joint matching a given name in servo; otherwise returns None.
getJoint | vcJoint | Integer joint_index | Returns a joint at a given index in servo.
getJointTarget | Real | Integer joint_index | Returns the target value of a joint at a given index in servo.
getJointValue | Real | Integer joint_index | Returns the current value of a joint at a given index in servo.
move | Real | [Real joint_0, ... Real joint_n] | Drives all joints in servo to target values, and then returns the actual motion time. Target values for each joint in servo can be given as separate, optional arguments.
moveImmediate | None | [Real joint_0, ... Real joint_n] | Drives all joints in servo to target values in zero simulation time. Target values for each joint in servo can be given as separate, optional arguments.
moveJoint | Real | Integer joint_index, Real joint_value | Moves a joint at a given index in servo to a given value, and then returns the actual motion time.
setJointTarget | None | Integer joint_index, Real joint_value | Sets the target value of a joint at a given index in servo to a given value.
setMotionTime | None | Real time | Forces the servo to execute joint movements at a given motion time.

Events

Name | Parameters | Description
OnHeartbeat | vcServoController servo, Enumeration event_type | Triggered when a pulse or heartbeat is generated by servo. See Controller Constants for more information. Note: This event handler can be used by a vcRobotController object executing a vcRslProcessStatement object in robot program.

Examples

Example. Create joint and assign it to servo

from vcScript import *

comp = getComponent()
node = comp.findNode("Link_1")
node.JointType = VC_JOINTTYPE_CUSTOM

servo = comp.findBehaviour("ServoController")
node.Dof.Controller = servo

Example. Calculate motion time and targets for motion

from vcScript import *

def OnRun():
comp = getComponent()
servo = comp.findBehaviour('ServoController')
# moves j1 to 200 and j2 to 350
servo.move(200, 350)

# moves j2 to 100 (index 0 = j1, index 1 = j2, ...)
servo.moveJoint(1, 100)

# J1: sets the target for next move but doesn't move yet
servo.setJointTarget(0,1200)
servo.setJointTarget(1,1400)

# calculate motion time according to given joint targets and joint speeds
# and accelerations
predicted_motion_time = servo.calcMotionTime()
print predicted_motion_time
if predicted_motion_time > 6:
# override given accelerations and speeds forcing the motion time to given value
servo.setMotionTime( 6.0 )

# call motion to set targets
servo.move()


vcSignal

vcSignal is the basic implementation for signal type behaviors which can simulate wiring, send a value to other signals and trigger events.

Inherits: vcBehaviour

Contents ShowHide

Hierarchy

Common Properties

Methods

Events

Hierarchy

vcSignal

vcBoolSignal

vcComponentSignal

vcIntegerSignal

vcMatrixSignal

vcRealSignal

vcStringSignal

Common Properties

The following properties are common in all signal type behaviors.

Name | Type | Access | Description
AutomaticReset | Boolean | RW | Turns on/off the reset of signal to initial value when simulation is reset.
Connections | List of vcBehaviour | RW | Defines a list of behaviors connected to signal.

Methods

Name | Return Type | Parameters | Description
connect | Boolean | vcSignal signal, [Boolean connect_in_gui] | Connects signals. The default value of the connect_in_gui is True, which means the created connection will be visible in GUI. If a False value is given, the created connection won't be visible in GUI. Because of this, use the False value only when necessary!
disconnect | Boolean | vcSignal signal, [Boolean disconnect_in_gui] | Disconnects signals. The default value of the disconnect_in_gui is True, which means the signal is disconnected also in GUI. If the signals were connected using the connect method with a False argument in the connect_in_gui, they should be disconnected using a False argument in the disconnect_in_gui

Events

Name | Parameters | Description
OnValueChange | vcSignal signal | Triggered when the value of signal is changed, thereby signaling all Connections of new value.


vcSimInterface

vcSimInterface is an interface used for connecting components physically or remotely to one another and exchanging data.

Inherits: vcBehaviour

vcSimInterface can support one-to-one and one-to-many connections and is the object type for One to One Interface and One to Many Interface behaviors.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
AngleTolerance | Real | RW | Defines an angle tolerance for allowing interfaces to connect to the interface when not aligned on same axis.
ConnectedComponent | vcComponent | R | Gets the component connected to interface. If no connection, value is None.
ConnectedComponents | List of vcComponent | R | If one-to-many interface, gets a list of all components connected to interface. If no connection, value is an empty list.
ConnectedFromSections | List of vcSimInterfaceSection | R | If one-to-many interface, gets a list of all sections in interface that have an active connection. If no connection, value is an empty list.
ConnectedSection | vcSimInterfaceSection | R | If one-to-one interface, gets a section of interface that have an active connection. (Deprecated)
ConnectedSections | List of vcSimInterfaceSection | R | If one-to-many interface, gets a list of all sections in interface that have an active connection. (Deprecated)
ConnectedToSections | List of vcSimInterfaceSection | R | Gets a list of sections connected to interface. If no connection, value is an empty list.
ConnectionEditName | String | RW | Defines the name of a Button property to temporarily create in component for connecting the interface. If an empty string, button is not created and/or removed from GUI. The string can use format [tab name]::[button name] to list button in a specific tab. If tab does not exist, it will be automatically created to contain button as long as string refers to that tab. If tab name is not given, button is listed as a default property.
IsAbstract | Boolean | RW | Defines if interface supports remote connections.
IsConnected | Boolean | R | If True, interface is connected; otherwise interface is not connected.
Sections | List of vcSimInterfaceSection | R | Gets a list of all sections in interface. If no sections, value is an empty list.

Methods

Name | Return Type | Parameters | Description
canConnect | Boolean | vcSimInterface interface | Returns True if a given interface can connect to the interface; otherwise, returns False.
connect | Boolean | vcSimInterface interface, [Boolean retain_offset] | Connects a given interface to the interface. An optional retain_offset argument can be used to retain the offset when attaching component to another using Hierarchy field. If connection is successful, returns True; otherwise returns False.
createSection | vcSimInterfaceSection | String section_name | Adds a new section of a given name to interface, and then returns the new section.
deleteSection | Boolean | Integer index | If one-to-one interface, deletes a section at a given index from interface. Returns True is deletion is successful; otherwise returns False.
disconnect | Boolean | [vcSimInterface other_interface] | Removes all connections in interface. An optional other_interface argument can be used to disconnect a specific interface from the interface, for example when interface is one-to-many. Returns True if disconnection is successful; otherwise returns None.
overrideEventResult | None | 1, Integer result | Overrides event result to have a given result.
unConnect | Boolean | [vcSimInterface other_interface] | (Deprecated) Use disconnect().

Events

Name | Parameters | Description
OnConnect | vcSimInterface other_interface, Boolean retain_offset | Triggered when interface is connected to another interface.
OnDisconnect | vcSimInterface other_interface | Triggered when interface is disconnected from another interface.
OnMatch | vcSimInterface other_interface | Triggered when interfaces are tested as being able to connect to one another.
OnUnConnect | vcSimInterface other_interface | (Deprecated) Use OnDisconnect.

Examples

Example. Manipulate a conveyor line

from vcScript import *
comp = getComponent()

iface = comp.findBehaviour('OutInterface')
# name of the interface need to match with this one
other_component = iface.ConnectedComponent
# this returns a component which is connected to this interface,
# return None if nothing is connected

all_conveyors = [comp] # create a python list where all conveyors will be added

while iface.ConnectedComponent:
# traverse thru a chain of connected conveyors
other_component = iface.ConnectedComponent
all_conveyors.append( other_component )
iface = other_component.findBehaviour('OutInterface')
#name of the interface need to match with this one

print [x.Name for x in all_conveyors]
# prints a list of names of the conveyors in the chain

# connect a component at the end of the conveyor chain
app = getApplication()
myConv = app.findComponent('MyConveyor')
inIface = myConv.findBehaviour('InInterface')
lastConvInChain = all_conveyors[-1] # take the last item from the list
outIface = lastConvInChain.findBehaviour('OutInterface')
if outIface.canConnect(inIface):
outIface.connect(inIface) #OPTION 1: this will not move the connected component
#app.connectComponents(lastConvInChain, myConv) # OPTION 2: this will move them
app.render()


vcSimInterfaceField

vcSimInterfaceField is a connector for allowing a certain type of data to be transferred in an interface section.

Contents ShowHide

Common Properties

Field Specific Properties

Common Properties

The following properties are common to all field types.

Name | Type | Access | Description
Index | Integer | RW | Defines the index of field in section. Important: The order of fields in a section is evaluated when establishing a connection between sections. For example, sections may have compatible fields but cannot connect because the order of fields differ in each section.
Name | String | RW | Defines the name of field.
Properties | List of vcProperty | R | Gets a list of all properties in the field.
Section | vcSimInterfaceSection | R | Gets the section of field.
Type | Enumeration | R | Gets the field type. See Interface Constants for more information.

Field Specific Properties

Action Field

An Action field allows you to send, receive and queue pending actions between Action Containers.

Name | Type | Access | Description
Actions | String | RW | Defines the name of Action Container in component used by field.
Connection | Integer | RW | Defines the role of field. 1 Client requesting actions. 2 Provider accepting action requests. 3 Broker acting as an intermediary for relaying actions between clients and providers.

Base Export

A Base Export field allows you to import or export base frames.

Name | Type | Access | Description
BaseList | vcBehaviour | RW | Defines the behavior in component used by field. The behavior must have the ability to store base frames, for example a Base Container or Robot Controller behavior.
Export | Boolean | RW | If True, exports base frames of BaseList; otherwise imports base frames to BaseList.

Flow Field

A Flow field allows you to transfer components.

Name | Type | Access | Description
Container | vcContainer | RW | Defines the vcFlow type behavior in component used by the field.
Port | Integer | RW | Defines which connector of Container is used by field, thereby defining if field transfers components into or out of Container.

Hierarchy Field

A Hierarchy field allows you to connect and attach nodes, thereby forming parent-child relationships.

Name | Type | Access | Description
Frame | vcFeature | RW | Defines an offset for attaching Node. If None, Node origin is used by field.
Node | vcNode | RW | If Parent is set to True, defines node in component that will become parent of an attached node; otherwise must be root node of component.
Parent | Boolean | RW | Defines if Node is to be parent of an attached node or will be attached as a child node.

Integer Compatibility Field

An Integer Compatibility field allows you to limit connections to fields with matching integer values.

Name | Type | Access | Description
Value | Integer | RW | Defines the value of field.

Joint Export Field

A Joint Export field allows you to import or export joints.

Name | Type | Access | Description
Controller | vcRobotController or vcServoController | RW | Defines either a Robot or Servo Controller in component used by field.
Export | Boolean | RW | If True, field exports joint data of Controller; otherwise imports joint data to Controller.

Processor Field

A Processor field allows you to connect a component with a Component Path or Process Point Sensor behavior to a component with a vcContainer type behavior or vice versa.

Name | Type | Access | Description
Parent | Boolean | RW | If True, field uses Path to connect sensors; otherwise field uses Sensor to connect to paths and other types of containers.
Path | vcContainer | RW | If Parent is set to True, defines the path or container in component used by field.
Sensor | vcBehaviour | RW | If Parent is set to False, defines the sensor in component used by field.

RSL Field

A RSL field allows you to publish or subscribe to robot programs, thereby enabling remote routine call and wait type statements.

Name | Type | Access | Description
Publish | Boolean | RW | Turns on/off the publishing of Publisher robot program to a connected section.
Publisher | vcRslProgramExecutor | RW | Defines the robot executor in component used by field.
Subscribe | Boolean | RW | Turns on/off the ability of Publisher to access robot program of a connected section.

signal Field

A Signal field allows you to connect and send signals.

Name | Type | Access | Description
Connection | Integer | RW | Defines the connection type of Signal. 0 Normal signal. 1 Beginning signal of a network. 2 End signal of a network.
Signal | vcSignal | RW | Defines the signal in component used by field.

Tool Export Field

A Tool Export field allows you to import or export tool frames.

Name | Type | Access | Description
Export | Boolean | RW | If True, exports tool frames of ToolList; otherwise imports tool frames to ToolList.
ToolList | vcBehaviour | RW | Defines the behavior in component used by field. The behavior must have the ability to store tool frames, for example a Tool Container or Robot Controller behavior.

Transport field

A Transport field allows you to send, receive and queue pending transportation tasks between Transport Protocols.

Name | Type | Access | Description
Connection | Integer | RW | Defines the role of field. 1 Client requesting transport requests. 2 Provider accepting transport requests. 3 Broker acting as an intermediary for relaying transport tasks between clients and providers.
Transport | vcTransport | RW | Defines the Transport Protocol in component used by field.


vcSimInterfaceSection

vcSimInterfaceSection is a collection of connector fields in an interface.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
ConnectedToSection | vcSimInterfaceSection | R | Gets a section connected to the section. If section is not connected, value is None.
Fields | List of vcSimInterfaceField | R | Gets a list of all fields in section.
Frame | vcFeature | RW | If belonging to physical interface, defines the Frame feature referenced as the location of section.
Index | Integer | RW | Defines the index of section in interface.
Interface | vcSimInterface | R | Gets the interface of section.
Name | String | RW | Defines the name of section.

Methods

Name | Return Type | Parameters | Description
createField | vcSimInterfaceField | Enumeration field, String name | Creates a new field of a given type and name in section, and then returns the new field. See Interface Constants for more information.
deleteField | Boolean | Integer field_index | Deletes a field at a given index from the section. If deletion is successful, returns True; otherwise returns False.


vcSimulation

vcSimulation is the object type for simulation engine and scene graph, thereby providing access to simulation controls. This is not the same as the simulation root node which represents 3D world in global node tree.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
IgnoreEvents | Boolean | RW | Defines if simulation object ignores event passing in order to avoid cyclic calls.
IsRunning | Boolean | R | Indicates if simulation is running in 3D world.
Name | String | R | Gets the name of simulation object.
ProcessController | vcProcessController | R | Gets the global process controller.
SimSpeed | Real | RW | Defines the step size or speed of simulation.
SimTime | Real | R | Gets the current time (in seconds) of simulation.
SimulationRunTime | Real | RW | Defines a time (in seconds) when simulation should stop running. Note: Changing the SimulationRunTime is only allowed in the OnRun event.
Statistics | vcStatisticsManager | R | Gets the statistics manager of simulation used for defining intervals.
World | vcNode | R | Gets the simulation root node (3D world node).

Methods

Name | Return Type | Parameters | Description
autoHalt | Boolean | None | Stops a simulation if there is no active component running a script that generates simulation events, and then returns True.
continueRun | None | [Real time] | Continues running a simulation with a 10 day runtime or a given amount of time.
halt | None | None | Stops a simulation immediately.
newCollisionDetector | vcCollisionDetector | None | Creates a new collision detector in 3D world, and then returns the new detector.
newVolumeDetector | vcVolumeDetector | None | Creates a new volume detector in 3D world, and then returns the new detector.
reset | None | None | Resets simulation and static components to initial state and sets simulation clock at zero.
restoreInitialState | None | None | Restores simulation and static components to initial state.
run | None | [Real time] | Runs simulation with a 10 day runtime or a given amount of time.
setInitialState | None | None | Saves the current state of simulation and static components.
update | None | None | Updates simulation and 3D world to reflect current state of components.

Events

Name | Parameters | Description
OnCollision | vcCollisionDetector detector | Triggered when a collision is detected using active tests.
OnReset | vcSimulation simulation | Triggered when simulation is reset.
OnStartStop | vcSimulation simulation, Boolean start_stop | Triggered when simulation is started or stopped.

Examples

Example. Get simulation object and its properties

from vcScript import *

app = getApplication()
sim = app.getSimulation() #OPTION 1: get handle to vcSimulation-object
sim = app.Simulation #OPTION 2: get handle to vcSimulation-object
sim = getSimulation() #OPTION 3: get handle to vcSimulation-object
sim.SimSpeed = 1.1
print 'IsRunning',sim.IsRunning, sim.SimTime

#when you compile the script, sim is not running
def OnRun():
while True:
print 'IsRunning',sim.IsRunning, sim.SimTime # here sim is running
delay(1)


vcSimVehicle

vcSimVehicle allows you to simulate a component as a moving vehicle.

Inherits: vcBehaviour

A vcSimVehicle object should be located in the root node of a component. When speed, acceleration and deceleration factors are set, the vcSimVehicle object will automatically handle the movement and orientation of a component to reach a given target.

As a vehicle, a component can be made to rotate in place, attach and detach wagons, lead or follow other vehicles, and alter its course.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Acceleration | Real | RW | Defines the maximum acceleration (mm/s^2) of vehicle. That is, how fast vehicle can speed up.
Deceleration | Real | RW | Defines the maximum deceleration (mm/s^2) of vehicle. That is, how fast vehicle can slow down.
DecisionTime | Real | R | Gets the amount of time it will take vehicle to execute a movement and reach decision point of calculated motion path. A decision point is the point at which vehicle will decelerate to stop at target. In some cases, a decision point is used to evaluate a vehicle and target location. For example, you may want to simulate vehicle routing and intersection crossing as well as evaluate if another vehicle is at target location.
Interpolation | Real | W | Sets the tension (0 - n) of calculated motion path for vehicle to reach target. (Optional) Default value is 0, which will result in straight lines from each waypoint of path. The bigger the value, the longer the vehicle will navigate along the tangents of waypoints.
LengthIterations | Integer | W | Sets the number of iterations for each path segment when calculating Bezier path length. (Optional) Default value is 10. More iterations take longer to compute but give more precise results.
MaxSpeed | Real | RW | Defines the maximum speed (mm/s) of vehicle. That is, the top speed of vehicle.
OffsetMatrix | vcMatrix | W | Sets an offset for vehicle origin and orientation. (Optional) Default is containing node's origin. In some cases, you may want to retain orientation of vehicle when moving in reverse or along an elevated path.
PathLength | Real | R | Gets the length of motion path vehicle will use to reach a target.
TotalTime | Real | R | Gets the total travel time of vehicle to reach a target using calculated path.

Note:

  • Last added control point of vehicle is target, thereby vehicle requires only one control point to calculate path.
  • Control points need to be added in sequence, for example using a while or for loop, in order to belong to the same path. Otherwise, you may need to replan vehicle to reach final target.

Methods

Name | Return Type | Parameters | Description
addControlPoint | None | vcVector point | Adds a given point to end of vehicle path.
addOrientationPoint None vcVector vector If Interpolation is not zero, adds a given vector to vehicle in order to calculate vehicle orientation at its last control point.

This method should be called immediately after adding control points to vehicle path. A given vector is not added to path.
attachWagonAtTheEnd None vcComponent component, [Real distance] Attaches a given component to vehicle as a wagon.

If no previous wagons, component is added as lead wagon. Otherwise, component is attached to last wagon added to vehicle.

An optional distance argument can be given to offset distance component is attached to vehicle. By default, the method will use distance of component to vehicle at time of call.
calculateDecisionTimeToStopAt | Real | Real distance | Returns the total simulation time at which vehicle would need to decelerate (decision point) to stop at a given distance in calculated motion path.
calculateEnterExitBox 2-tuple (Real entry_distance, Real exit_distance) vcVector Center, vcVector P1, vcVector P2, Real distStartAt, Real precision Returns the distance at which vehicle would enter and exit a box based on calculated path, starting distance of vehicle and a given precision.

The Center, P1 and P2 arguments define box.

The returned distances will be within one-half of precision to the theoretical intersection.
calculateFinishedTimeToStopAt | Real | Real distance | Returns the calculated total simulation time that vehicle will stop at a given distance based on calculated path.
calculateOffsetPathLength | Real | vcVector offset | Returns the length of calculated path for vehicle based on a given offset.
calculatePositionAt 2-tuple (vcVector position, vcVector direction) Real time, Integer isElapsedTime Returns the position and direction of vehicle at a given time based on calculated path.

If isElapsedTime argument is 0 (default), a given time is the elapsed time since start of vehicle movement. Otherwise, given time is elapsed time since start of simulation.
calculatePositionWithDistance 1-tuple (vcVector position) Real distance Returns the position of vehicle at a given distance in calculated path.

The returned value is a tuple in which first element is position vector.
calculateSpeedAt Real Real time, Integer isElapsedTime Returns the speed of vehicle on calculated path at a given time.

If isElapsedTime argument is 0 (default), a given time is the elapsed time since start of vehicle movement. Otherwise, given time is elapsed time since start of simulation.
calculateTravelWithTime Real Real time, Integer isElapsedTime Returns the distance traveled by vehicle on calculated path at a given time.

If isElapsedTime argument is 0 (default), a given time is the elapsed time since start of vehicle movement. Otherwise, given time is elapsed time since start of simulation.
clearMove None None Removes all points from calculated path of vehicle, thereby stopping vehicle movement.

This method should be called at start of simulation before any control points are added to vehicle.
clearPassedPoints | None | None | Removes points from calculated path that have been reached by vehicle, thereby resetting the origin of calculated path and its length.
detachAllWagons None None Detaches all wagons from vehicle and one another.

This method should be called when simulation is reset; otherwise components will remain attached to one another.
getControlPointDistance Real Integer controlPointIndex Returns the distance of a control point at a given index in vehicle based on calculated path.

Note: If wagons are attached to vehicle, there will be control points with negative distances.
offsetPath none vcVector offset Offsets the calculated path of vehicle parametrically (X-axis is tangent, Y-axis is radial, Z-axis is up).

This method should be called after adding points to vehicle.
rePlan | None | None | Clears all points from vehicle except those between vehicle and its wagons, thereby allowing you to replan route of vehicle using current speed, position and orientation. That is, the vehicle will not stop rather reroute itself to newly added control points.
resetStopAtDistance None Real distance Instructs vehicle to stop at a given distance on calculated path.

This method allows you stop vehicle and recalculated route using same or different control points.
rotateInPlace None Real angle, Real angularSpeed, Real angularAcceleration, Real angularDeceleration Rotates vehicle by a given angle using given angularSpeed, angularAcceleration and angularDeceleration arguments.

Rotation will trigger OnMovementChanged and OnMovementFinished events. To ensure rotation is completed, use a delay, event or trigger before adding new control points to vehicle.
update | None | Real time | Updates the position of objects controlled by vehicle.

Events

Name | Parameters | Description
OnDecisionPointReached | vcComponent component, Real time | Triggered when vehicle starts to decelerate in order to stop at target. That is, vehicle reaches decision point. The component of vehicle and time of occurrence are passed to event.
OnFinalDestinationReached | vcComponent component, Real time | Triggered when vehicle reaches last target. That is, vehicle reaches last control point, and then stops with no more targets in queue. The component of vehicle and time of occurrence are passed to event.
OnMovementChanged | vcComponent component, Real time | Triggered when vehicle route is modified, for example points cleared or added to vehicle or change in stop distance. The component of vehicle and time of occurrence are passed to event.
OnMovementFinished | vcComponent component, Real time | Triggered when vehicle reaches target. The component of vehicle and time of occurrence are passed to event.

Examples

Example. Control vehicle speed and set control points

from vcScript import *
import vcVector

#define the vehicle's properties either at the start or execution of the simulation
#properties like PathLength should be called after adding points or rotating an object
#add points during the OnRun event directly or by calling a function or event

def OnRun():
comp = getComponent()
app = getApplication()
vehicle = comp.findBehaviour("Vehicle")
vehicle.clearMove() #clears all previously added control points

vehicle.Acceleration = 2000
vehicle.Deceleration = 2000
vehicle.MaxSpeed = 1200
vehicle.Interpolation = .35 # this affects how sharp the curve is in corners

#wagons (uncomment next 3 lines if needed)
#vehicle.detachAllWagons()
#vehicle.attachWagonAtTheEnd(wagon, 1600)
#wagon = app.findComponent('wagon')

#preferred method is to reference the positions of different components
#another way is to create a component with Frame features
v1 = vcVector.new(5000,2000,0)
v2 = vcVector.new(-2000,-2000,0)
v3 = vcVector.new(-5000,4000,0)
for vec in [v1,v2,v3]:
vehicle.addControlPoint( vec )


vcSnapCommand

vcSnapCommand provides options for handling the position and orientation of 3D world points selected using the interactiveSnap command.

Inherits: vcCommand

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Snap | Boolean | RW | Turns on or off the ability to snap to a target.
SnapOnCircleCenter | Boolean | RW | Turns on or off the center of circles as potential targets.
SnapOnCurve | Boolean | RW | Turns on or off curves as potential targets.
SnapOnEdge | Boolean | RW | Turns on or off edges as potential targets.
SnapOnEdgeCenter | Boolean | RW | Turns on or off the midpoint of edges as potential targets.
SnapOnFaceCenter | Boolean | RW | Turns on or off the center of faces as potential targets.
SnapOnFrame | Boolean | RW | Turns on or off frames as potential targets.
SnapOnNodeCenter | Boolean | RW | Turns on or off the center of nodes as potential targets.
SnapOnNodeOrigin | Boolean | RW | Turns on or off the origin of nodes as potential targets.
SnapOnPoint | Boolean | RW | Turns on or off points on lines and polygons, for example corner points, as potential targets.
SnapOnPolygon | Boolean | RW | Turns on or off polygons as potential targets.
SnapOnSurface | Boolean | RW | Turns on or off faces as potential targets.
TargetAvailable | Boolean | R | Indicates if pointing at an available target in the 3D world.
TargetCircleCenterAvailable | Boolean | R | Indicates if center of a circle is available as a target.
TargetCurve | List of vcVector | R | Provides a list of positions for a target curve in World coordinate system.
TargetCurveAvailable | Boolean | R | Indicates if a curve is available as a target.
TargetCurveIndex | Integer | R | Indicates the index position of a target curve in a geometry set.
TargetFaceCenterAvailable | Boolean | R | Indicates if the center of a face is available as a target.
TargetGeoset | vcGeometrySet | R | Indicates the geometry set of a target.
TargetLocked | Boolean | R | Indicates if a target has been selected in the 3D world.
TargetMatrix | vcMatrix | R | Indicates the position and orientation matrix for target in World coordinates.
TargetMatrixAvailable | Boolean | R | Indicates if the position and orientation matrix for a target is available. (only valid for frame type targets)
TargetNode | vcNode | R | Indicates the node containing a target.
TargetNormal | vcVector | R | Indicates the normal vector of a target in World coordinates.
TargetNormalAvailable | Boolean | R | Indicates if the normal vector of a target is available. (only valid for polygon and frame type targets).
TargetPosition | vcVector | R | Indicates the position of a target in World coordinates.
TargetPrimitive | vcPrimitive | R | Indicates the geometry primitive object of a target.
TargetSurfaceAvailable | Boolean | R | Indicates if the surface of a target is available.
TargetSurfaceIndex | Integer | R | Indicates the index position of a target surface in a component, for example the faces of a cube.

Methods

Name | Return Type | Parameters | Description
clear | None | None | Resets the command and clears its target data.

Events

Name | Parameters | Description
OnTargetAvailable | vcSnapCommand command | Triggered when pointer is hovering over a valid target in 3D world. The command itself as passed as an argument, thereby allowing you to access its updated properties.
OnTargetSet | vcSnapCommand command | Triggered when a valid target has been selected in 3D world. The command itself as passed as an argument, thereby allowing you to access its updated properties.

Examples

Example. Execute snap command and use event handlers

from vcScript import *

app = getApplication()
snap = app.findCommand('interactiveSnap')

def TargetPicked(args):
global snap
pos = snap.TargetPosition
print 'Picked: %.2f %.2f %.2f' % (pos.X, pos.Y, pos.Z)
if snap.TargetAvailable:
print 'Starting picking!'
snap.execute()
else:
print "Finished snapping!"

def StartPicking():
global snap
snap.clear()
snap.SnapOnPoint = True
snap.SnapOnEdge = True
snap.SnapOnPolygon = True
snap.SnapOnSurface = True
snap.SnapOnNodeCenter = False
snap.SnapOnNodeOrigin = False
snap.OnTargetSet = TargetPicked
print 'Starting picking!'
snap.execute()

def StopPicking():
global snap
snap.clear()

StartPicking()
#StopPicking()


vcStatement

vcStatement is the basic implementation for statements in a robot program and a process routine.

Contents ShowHide

Hierarchy

Scope

Robot Motions

Common Properties

Robot Statement Specific Properties

Process Statement Specific Properties

Methods

Hierarchy

Most statements can be manipulated directly as vcStatement type objects, while others have their own implementations that inherit vcStatement.

vcStatement

vcIfStatement

vcPathStatement

vcPositionStatement

vcMotionStatement

vcScopeStatement

Scope

Statements are created and contained in a vcScope object. The scope of a statement can be manipulated to change the order in which statements are executed and nest statements to form conditional loops and paths in a routine.

Robot Motions

Positions for motion type statements are frames implemented as vcPositionFrame objects. New positions can created using methods in vcPositionStatement. A position can be referenced by more than one statement, thereby allowing statements to call set positions in a robot program.

For information on types of statements, go to Statement Constants.

Common Properties

The following properties are common to all statements.

Name | Type | Access | Description
Name | String | RW | Defines the name of the statement.
ParentScope | vcScope | R | Gets the scope of the statement.
Properties | List of vcProperty | R | Gets a list of properties of the statement.
ParentRoutine | vcRoutine | R | Gets the routine of the statement.
Type | Enumeration | R | Gets the statement's type. See Statement Constants for more information.

Robot Statement Specific Properties

Assign Variable

An Assign Variable statement sets the value of a variable in a routine. The statement and variable must belong to the same routine in a robot program.

Name | Type | Access | Description
TargetProperty | String | RW | Defines the name of variable to assign a value.
ValueExpression | String | RW | Defines an expression that when evaluated returns the value to assign TargetProperty.

Break

A Break statement immediately ends the execution of a While statement. This statement has no other specific properties.

Call Sequence

A Call Sequence statement allows a routine to branch out and execute another subroutine in a robot program.

Name | Type | Access | Description
Routine | vcRoutine | RW | Defines a subroutine in robot program called by the statement.

Notes:

  • In some cases, you may want to use a Return statement in a called subroutine in order to end that branch of execution and complete a Call Sequence statement.

Comment

A Comment statement is a non-executable statement in a robot program that is used to leave comments about the program.

Name | Type | Access | Description
Comment | String | RW | Defines the text of the comment.

Continue

A Continue statement is used to loop back the execution of a While statement to its beginning. This, of course, would skip over all other remaining statements in the scope and reevaluate the condition of the loop. This statement has no other specific properties.

Define Base

A Define Base statement changes the position of a base frame in robot during a simulation. When you reset a simulation, the base frame returns to its initial position.

Name | Type | Access | Description
IPOMode Enumeration RW Defines the interpolation mode of the frame and the external configuration of a referencing robot controller.

0
Default setting, so no effect on robot's external configuration.

1
Robot position inherits orientation of base frame.

2
Robot position inherits orientation of base frame.

Interpolation constants can be used with this property.

Note: A conflict can occur if a base-tool pair in a referencing robot have the same IPOMode property value or cannot be used with the robot's current configuration.
IsRelative Boolean RW Defines if Position is based in base frame coordinate system or its parent coordinate system.

A True value uses base frame coordinate system, so frame will be moved relative to its location at the time of statement execution.

A False value uses the parent coordinate system of base frame defined in Node, so frame will be moved to an absolute location.
Node | vcNode | RW | Defines the parent node of base frame.
Position | vcMatrix | RW | Defines the position matrix of referenced base frame.
Base | vcToolFrame | RW | Defines the base frame in robot affected by the statement.

Define Tool

A Define Tool statement changes the position of a tool frame in robot during a simulation. When you reset a simulation, the tool frame returns to its initial position.

Name | Type | Access | Description
IPOMode Enumeration RW Defines the interpolation mode of the frame and the external configuration of a referencing robot controller.

0
Default setting, so no effect on robot's external configuration.

1
Robot position inherits orientation of tool frame.

2
Robot position inherits orientation of tool frame.

Interpolation constants can be used with this property.

Note: A conflict can occur if a base-tool pair in a referencing robot have the same IPOMode property value or cannot be used with the robot's current configuration.
IsRelative Boolean RW Defines if Position is based in tool frame coordinate system or its parent coordinate system.

A True value uses tool frame coordinate system, so frame will be moved relative to its location at the time of statement execution.

A False value uses the parent coordinate system of tool frame defined in Node, so frame will be moved to an absolute location.
Node | vcNode | RW | Defines the parent node of tool frame.
Position | vcMatrix | RW | Defines the position matrix of referenced tool frame.
Tool | vcToolFrame | RW | Defines the tool frame in robot affected by the statement.

Delay

A Delay statement delays the execution of a robot program by a given amount of time.

Name | Type | Access | Description
Delay | Real | RW | Defines the amount of time in seconds of the delay.

Halt

A Halt statement can stop a simulation.

Name | Type | Access | Description
HaltSimulation | Boolean | RW | Defines if the statement stops a simulation. A True value stops a simulation, whereas a False value has no effect on a simulation.
ResetSimulation | Boolean | RW | Defines if the statement stops and then resets a simulation. A True value resets a simulation, whereas a False value has no effect on a simulation.

Print Message

A Print Message statement allows you to print feedback in the Output panel.

Name | Type | Access | Description
Message | String | RW | Defines the text of the message.

Program Synchronize

A Program Synchronize statement allows the execution of a robot program to be synced with programs in other robots.

Name | Type | Access | Description
SyncComponents | List of vcComponent | RW | Defines a list of components to sync with the statement. This means each component is also executing its own Program Synchronize statement.
SyncMessage | String | RW | Defines the message to trigger synchronization. All components in SyncComponents must use the same message.
WaitSync | Boolean | RW | Defines if the statement sends its message and waits to receive the same message from all other components in SyncComponents. A True value waits, whereas a False value sends a message and ends the execution of the statement.

Return

A Return statement ends the execution of a routine. In most cases, you would use a Return statement to end the execution of a called subroutine in a robot program. This statement has no other specific properties.

Set Binary Output

A Set Binary Output statement sets the value of a signal mapped to an output port of a robot.

Name | Type | Access | Description
OutputPort | Integer | RW | Defines the port of robot set by the statement.
OutputValue | Boolean | RW | Defines the value of the port set by the statement.

View

A View statement is used with vcViewAnimation to set the view of the 3D world. Generally, this statement is used for animating camera movements during a simulation.

Name | Type | Access | Description
Delay | RW | RW | Defines the amount of time in seconds it takes camera to move to view in 3D world.
View | String | RW | Defines the name of view to move camera to in 3D world. If the view does not exist in layout, the statement will still execute its Delay.

Wait for Binary Input

A Wait for Binary Input statement delays the execution of a robot program until the value of a signal mapped to an input port in a robot has a specific value. The evaluation of the port can be cyclic or triggered by a signal event.

Name | Type | Access | Description
InputPort | Integer | RW | Defines the port of robot evaluated by the statement.
InputValue | Boolean | RW | Defines if InputPort value needs to be True or False to complete the statement.
WaitTrigger Boolean RW Defines if InputValue is evaluated when a signal mapped to InputPort has an event, for example a change in its value.

A True value waits for a signal event or trigger, whereas a False value will not wait to check the value of InputPort.

Note: A signal event or trigger must occur while the robot is executing the statement, otherwise the robot wil miss the event.

Process Statement Specific Properties

Append To List

Append To List statement joins content of source variable to end of the target variable.

Type constant: VC_STATEMENT_APPENDTOLIST

Name | Type | Access | Description
AllowDuplicates | Boolean | RW | If already existing values should be added to the target variable.
SourceVariableName | String | RW | Name of the variable from which values are copied. Can be a list or a single variable.
TargetVariableName | String | RW | Name of the variable where values are appended. A new list variable is created if necessary.

Assign Variable

An Assign Variable statement sets the value of a variable in a routine. The statement and variable must belong to the same routine in a robot program.

Name | Type | Access | Description
TargetProperty | String | RW | Defines the name of variable to assign a value.
ValueExpression | Expression | RW | Defines an expression that when evaluated returns the value to assign TargetProperty. The value is casted automatically to the target property type. See also Process Statement Expressions.

Attach

This statement attaches components of one or more child products to component of a parent product.

Type constant: VC_STATEMENT_ATTACHPRODUCT

Name | Type | Access | Description
Child | String | RW | Name of the variable that holds one or more references to the vcProduct that are to be attached to the Parent. Can be a list or a single variable.
Parent | String | RW | Name of the variable that holds reference to a single vcProduct where to attach.

Break

A Break statement immediately ends the execution of a While statement. This statement has no other specific properties.

Buffer

Buffer statement creates a temporary storage for products in a grid pattern. Multiple products can be coming in and leaving the buffer in parallel. Transport of products is handled similarly to the Transport statements. The statement continues execution until the break condition is met and the buffer has emptied.

Type constant: VC_STATEMENT_BUFFERPRODUCTS

Name Type Access Description
AcceptAllProductTypes

Boolean

 RW When True, any product is accepted, ignoring AcceptedFlowGroups and AcceptedProductTypes.
AcceptedFlowGroups

List of vcProcessFlowGroup

 RW Allows only the selected flow groups.
AcceptedProductTypes

List of vcProductType

 RW Allows only the selected product types.
BreakCondition

Expression (boolean)

RW

When this expression evaluates to True (at least once), the buffer stops accepting products. This allows the buffer to empty and then the statement execution to end.

Note: The expression is evaluated at the start of the statement execution and every time a product arrives to or leaves the buffer.

Note: Must be from the same component.

See also Process Statement Expressions.
BufferMode

BufferMode enumeration

 RW Defines the product access order of the buffer.
Destination

TransportOutType enumeration

 RW Defines the destination to where products leave the buffer.
DestinationContainer

vcContainer

 RW Component container whose output connection is used to place the outgoing products. Only used when Destination is set to VC_TRANSPORTOUTTYPE_CONTAINER.
InputResourcePositionFrame

vcFrameFeature

 RW Defines resource position offset from product position and XY plane on which resource position is projected to while emptying the buffer.

This allows the resource position to move along with the product position but still remain on a certain plane.

Note: Must be from the same component.
ParallelInputLimit

Integer

 RW Defines how many products can be arriving to the buffer in parallel.
Note: Must be greater than zero.
ParallelOutputLimit

Integer

 RW Defines how many products can be leaving the buffer in parallel.
Note: Must be greater than zero.
PatternCount

vcVector

 RW Number of buffer slots per X,Y,Z axis. The Real values of the vector are rounded to nearest Integer values. Each dimension should in inclusive range 0 to 1289.
PatternStep

vcVector

 RW Step between products in pattern per X,Y,Z axis.
ProductPositionFrame

vcFrameFeature

 RW

Frame defining the position and orientation of the product pattern in combination with the Offset property.

Note: Must be from the same component.
ReservedProductVariableName

String

 RW

Name of variable containing products already reserved using Reserve Product statement. The buffer will be first filled using these products and then will continue to receive further products as defined by the Source property.

Note: The product filtering defined by properties AcceptAllProductTypes, AcceptedFlowGroups and AcceptedProductTypes is not applied to the pre-reserved products.
Source

TransportInType enumeration

 RW Defines how products get into the buffer.

Change Type

Change Type statement changes one or more product instances to be of another product type both logically and visually.

Type constant: VC_STATEMENT_CHANGEPRODUCTTYPE

Name | Type | Access | Description
DeleteAttached | Boolean | RW | When True, any components attached to the changed product’s component are deleted. When False, any attached components are reattached to new nodes in the rebuilt parent component based on the parent node names.
NewType | vcProductType | RW | The product type to change the products to.
ProductVariableName | String | RW | Name of variable containing the products (vcProduct) to change. Can be a list of products.

Comment

A Comment statement is a non-executable statement in a robot program that is used to leave comments about the program.

Type constant: VC_STATEMENT_COMMENT

Name | Type | Access | Description
Comment | String | RW | Defines the text of the comment.

Continue

A Continue statement is used to loop back the execution of a While statement to its beginning. This, of course, would skip over all other remaining statements in the scope and reevaluate the condition of the loop. This statement has no other specific properties.

Type constant: VC_STATEMENT_CONTINUE

Create

Create statement waits for free capacity at the target Container and then creates a new product instance (vcProduct). The product is created at the position of the Container.

Type constant: VC_STATEMENT_CREATEPRODUCT

Name | Type | Access | Description
Container | vcContainer | RW | Component container where to place the created product’s component. If set to None, the associated transport node’s (vcTransportNode) container is used.
ProductType | vcProductType | RW | The product type to instantiate.
ProductVariableName | String | RW | Name of a variable where to store a reference to the created product instance. A runtime variable is created if one doesn’t exist. Can be a list of products.

Delay

Delay statement waits for a specified amount of simulation time.

Type constant: VC_STATEMENT_PROCESSDELAY

Name Type Access Description
Distribution String RW

Defines an expression to calculate a value for the amount of seconds to wait for. A sample is taken when the statement execution begins.

Available functions include:

normal( u, s )
Normal distribution for mean value u, and the standard deviation s.

lognormal( u, s )
Log normal distribution for mean u, and the standard deviation s.

uniform( a, b )
Uniform distribution in range a <= x < b.

exponential( lambda )
Exponential distribution where the mean is 1/lambda and the variance is 1/lambda^2.

gamma( k, theta )
Gamma distribution with shape k and scale theta.

triangular( min, mode, max )
Triangular distribution with the specified minimum, mode and maximum values.

weibull( k, lambda )
Weibull distribution with shape k and scale lambda.

Tip: Use RandomStream to have the distribution use a stream for seeding a value and generating the same set of random numbers during a simulation. That is, if you reset and run a simulation you should expect the same values given in the previous simulation.
Expression Expression (real) RW

Amount to wait for defined as an expression that must evaluate to a Real value at the start of the statement execution.

Unit is seconds of simulation time.

See also Process Statement Expressions.
TimeSource Enumeration RW

Defines whether to evaluate the Distribution or Expression property to get the amount of time to wait for.

See Time Source Constants for more information.

Detach

Detach statement detaches the component(s) (vcComponent) of one or more products (vcProduct) from the component of a common parent product (vcProduct). The products to detach can be filtered by type (vcProductType).

Type constant: VC_STATEMENT_DETACHPRODUCT

Name | Type | Access | Description
AcceptAllProductTypes | Boolean | RW | When True any product is accepted, ignoring AcceptedFlowGroups and AcceptedProductTypes
AcceptedFlowGroups | List of vcProcessFlowGroup | RW | Allows only the selected flow groups.
AcceptedProductTypes | List of vcProductType | RW | Allows only the selected product types.
DetachedVariableName | String | RW | Name of output variable where to store references to the detached products (vcProduct).
DetachMany | Boolean | RW | When True, detaches all products that match the filter, otherwise only the first one.
ProductVariableName | String | RW | Name of input variable from which to get the parent product instance (vcProduct).

Flow

Flow statement updates statistics behavior (vcStatistics) and it records one or more products’ (vcProduct) components (vcComponent) transferring in or out. If more than one product is given as input, they are all recorded at once.

Type constant: VC_STATEMENT_SETSTATISTICSFLOW

Name | Type | Access | Description
FlowDirection | StatisticsFlowDirection enumeration | RW | Whether the product transferred into the process or left it.
ProductVariableName | String | RW | Name of input variable from which to get the product instances to record (vcProduct). Note: Can be a list of products.
Statistics | vcStatistics | RW | The statistics behavior to change the state of. Note: Must be from the same component.

Get Property

Get Property statement creates a runtime variable that acts as a proxy to a property (vcProperty). The proxy variable’s value and the targeted property’s value are tied together such that changing one means changing the other as well. The targeted property can be a static component’s (vcComponent) property or a static component’s behavior’s (vcBehaviour) property.

Note: The target property is specified using 3 properties (SelectedComponent, SelectedBehavior, SelectedProperty) for UI reasons. They have to be set in correct order.

Type constant: VC_STATEMENT_GETPROPERTY

Name | Type | Access | Description
PropertyVariableName | String | RW | Name of the proxy runtime variable to create.
SelectedComponent | vcComponent | RW | The static component that owns the target property. None value means parent component of the statement.
SelectedBehavior | vcBehaviour | RW | Behaviour that owns the target property. Must be owned by the SelectedComponent. None value means SelectedProperty is a component property of SelectedComponent. Must be set after SelectedComponent has been set.
SelectedProperty | vcProperty | RW | The target property to get. Note: Must be a property of either SelectedComponent or SelectedBehavior depending on the value of SelectedBehavior. Note: Must be set after SelectedComponent and SelectedBehavior. Note: Value type of the property must be Integer, Real, vcVector, vcMatrix or String.

Halt

A Halt statement can stop a simulation.

Name | Type | Access | Description
HaltSimulation | Boolean | RW | Defines if the statement stops a simulation. A True value stops a simulation, whereas a False value has no effect on a simulation.
ResetSimulation | Boolean | RW | Defines if the statement stops and then resets a simulation. A True value resets a simulation, whereas a False value has no effect on a simulation.

If

If statement executes ThenScope when Condition evaluates to True or ElseScope when it evaluates to False. If Condition is invalid neither ThenScope nor ElseScope are executed.

Type constant: VC_STATEMENT_PROCESSIF

Name | Type | Access | Description
Condition | Expression (boolean) | RW | Condition expression to evaluate when the statement is executed. See also Process Statement Expressions.
Message | vcScope | R | Scope to execute when Condition evaluates to False.
ThenScope | vcScope | R | Scope to execute when Condition evaluates to True.

Move Joint

Move Joint statement uses a servo controller behavior (vcServoController) to move a joint to given value and waits until the motion completes.

Type constant: VC_STATEMENT_MOVEJOINT

Name | Type | Access | Description
Controller | vcServoController | RW | The controller that owns the joint. This can be a servo controller or a derived controller, e.g. a vcRobotController. Note: Must be from the same component.
Joint | vcJoint | RW | The joint to move. Note: Must be set after Controller has been set.
MotionTime | Expression (real) | RW | An expression for motion time. This can be left empty to let the controller plan the motion. If not left empty, this expression must evaluate to a Real or Integer result. See also Process Statement Expressions.
TargetValue | Expression (real) | RW | An expression for the target value. Note: Must evaluate to a Real or Integer result. See also Process Statement Expressions.

Print

A Print statement allows you to print feedback in the Output panel.

Type constant: VC_STATEMENT_PRINT

Name | Type | Access | Description
Message | Expression | RW | Expression that is evaluated to create the message. The expression can evaluate to any value type, not just a String. See also Process Statement Expressions.
PrependHeader | Boolean | RW | When True, the message is printed along with a prefix indicating its owner. ComponentName::ProcessExecutorName::ProcessRoutineName: YourMessage Otherwise prints only result of the Message expression.

Property Condition

Property Condition statement creates a process requirement based on a property value. The targeted property can be a static component’s property or a static component’s behavior’s (vcBehaviour) property.

This is a requirement statement and thus can be only added to the Requirements routine of a process routine (vcProcessRoutine).

Note: The target property is specified using 3 properties (SelectedComponent, SelectedBehavior, SelectedProperty) for UI reasons. They have to be set in correct order.

Type constant: VC_STATEMENT_PROPERTYCONDITION

Name | Type | Access | Description
Condition | Expression | RW | The condition expression to evaluate against the SelectedProperty. Note: The condition can reference process variables but the condition is re-evaluated only when the SelectedProperty changes value. See also Process Statement Expressions.
SelectedComponent | vcComponent | RW | The static component that owns the target property. None value means parent component of the statement.
SelectedBehavior | vcBehaviour | RW | Behavior that owns the target property. Note: Must be owned by the SelectedComponent. Note: None value means SelectedProperty is a component property of SelectedComponent. Note: Must be set after SelectedComponent has been set.
SelectedProperty | vcProperty | RW | The target property to get. Note: Must be a property of either SelectedComponent or SelectedBehavior depending on the value of SelectedBehavior. Note: Must be set after SelectedComponent and SelectedBehavior. Note: Value type of the property must be Integer, Real, vcVector, vcMatrix or String.

Release Product Reservation

Release Product Reservation statement releases reserved product instances which are reserved by ReserveProduct statement(s). Reservation cannot be released after a product’s transport has started.

Type constant: VC_STATEMENT_RELEASEPRODUCTRESERVATION

Name | Type | Access | Description
ProductVariableName | String | RW | Name of the variable that holds the reserved products (vcProduct).

Remove

Remove statement deletes one or more product instances and resets value of the variable.

Type constant: VC_STATEMENT_REMOVEPRODUCT

Name | Type | Access | Description
ProductVariableName | String | RW | Name of the variable that holds the products to delete (vcProduct).

Reserve Product

Reserve Product statement creates a process requirement for a matching product (vcProduct) to be available and reserves it for this process.

This is a requirement statement and thus can be only added to the Requirements routine of a process routine (vcProcessRoutine).

Type constant: VC_STATEMENT_RESERVEPRODUCT

Wrapper type: vcReserveProductStatement, inherits vcStatement

Name | Type | Access | Description
AcceptAllProductTypes | Boolean | RW | When True any product is accepted, ignoring AcceptedFlowGroups and AcceptedProductTypes
AcceptedFlowGroups | List of vcProcessFlowGroup | RW | Allows only the selected flow groups.
AcceptedProductTypes | List of vcProductType | RW | Allows only the selected product types.
ProductVariableName | String | RW | Name of the process variable where to store the reserved product instance (vcProduct).

Run Robot Routine

Waits until the robot is idle, then evaluates the given RoutineName expression and tries to find the routine, then start the routine, and waits until the routine has been executed to completion.

Type constant: VC_STATEMENT_RUNROBOTROUTINE

Name Type Access Description
Component vcComponent RW

The component from which to search for a robot executor.

Note: If the component has multiple robot executors, the first one of the these will be selected.

Note: None can be used to select the component that owns the process executor that is running this statement.
RoutineName Expression RW

An expression that must evaluate to a string value.

During execution, the statement will attempt to find a routine from the selected robot executor with that name. This expression evaluation and routine search will be performed again each time the robot becomes idle.

See also Process Statement Expressions.

Select Products

Copies product instance (vcProduct) references from one list to another variable. Product type filtering can be applied to only copy some product references.

Type constant: VC_STATEMENT_SELECTPRODUCTS

Name | Type | Access | Description
AcceptAllProductTypes | Boolean | RW | When True any product is accepted, ignoring AcceptedFlowGroups and AcceptedProductTypes
AcceptedFlowGroups | List of vcProcessFlowGroup | RW | Allows only the selected flow groups.
AcceptedProductTypes | List of vcProductType | RW | Allows only the selected product types.
ProductVariableName | String | RW | Name of the input list variable to copy product instance (vcProduct) references from.
SplitVariableName | String | RW | Name of the variable where to copy the product instance (vcProduct) references to. Note: The variable is created if it does not exist already. The variable is always made into a list of products regardless of if any products got copied from the input.

Send Signal

Send Signal statement sends a simulation signal, i.e. triggers a vcSignal behavior, with a given value.

Type constant: VC_STATEMENT_SENDSIGNAL

Name | Type | Access | Description
Component | vcComponent | RW | The component that owns the signal. Note: Must be a static component. Note: None means the parent component of this statement.
Signal | vcSignal | RW | The signal behavior to trigger. Note: Must be either Boolean, Integer, Real or String signal. Note: Must be from the component assigned to the Component property. Note: Must be set after the Component property has been set.
Value | Expression | RW | An expression to generate the value for the signal. This can reference e.g. static properties or properties in dynamic products. See also Process Statement Expressions.

Set Node Material

Set Node Material statement changes the material of a node in one or more product instances’ components.

Type constant: VC_STATEMENT_SETNODEMATERIAL

Name | Type | Access | Description
Force | Boolean | RW | When True, sets the vcNode.MaterialInheritance to VC_MATERIAL_FORCE_INHERIT_NODE. When False, material inheritance setting in the target node is not changed.
Material | vcMaterial | RW | The material to set to the node.
NodeName | String | RW | Name of the target node (vcNode). Note: Empty string means the root node of the target product (vcProduct).
ProductVariableName | String | RW | Name of the input variable where to get the Product instances.

Set Node Visibility

Changes the visibility of a node in one or more product instances’ components.

Type constant: VC_STATEMENT_SETNODEVISIBILITY

Name | Type | Access | Description
NodeName | String | RW | Name of the target node (vcNode). Empty string means the root node of the target product (vcProduct).
ProductVariableName | String | RW | Name of the input variable where to get the Product instances.
Visibility | NodeVisibilityState enumeration | RW | Target visibility state to set.

Set State

Sets the current state of a statistics behavior (vcStatistics).

Type constant: VC_STATEMENT_SETSTATISTICSSTATE

Name | Type | Access | Description
State | String | RW | Name of the state to set. Note: Must be set after the Statistics property has been set.
Statistics | vcStatistics | RW | The statistics behavior to change the state of. Note: Must be from the same component.

Start Transport In

Start Transport In statement transports product(s) into the process. More than one pre-reserved product can be transported in, otherwise transports only a single product.

The statement execution is asynchronous, meaning that next statements may execute before the transport is finished. Must be used in combination with the Wait Transport statement.

Type constant: VC_STATEMENT_STARTTRANSPORTIN

Name | Type | Access | Description
AcceptAllProductTypes | Boolean | RW | When True any product is accepted, ignoring AcceptedFlowGroups and AcceptedProductTypes.
AcceptedFlowGroups | List of vcProcessFlowGroup | RW | Allows only the selected flow groups.
AcceptedProductTypes | List of vcProductType | RW | Allows only the selected product types.
ProductPositionFrame vcFrameFeature RW

Defines the position and orientation where the product instance should be placed.

Note: Must be from the same component.
ProductVariableName | String | RW | Name of output variable where to store the transported product(s) (vcProduct).
ReservedProductVariableName String RW

Name of a variable containing products (vcProduct) already reserved using Reserve Product statement. If defined, the statement will transport in those specific products.

Note: The product filtering defined by properties AcceptAllProductTypes, AcceptedFlowGroups and AcceptedProductTypes is not applied to the pre-reserved products.
ResourcePositionFrame vcFrameFeature RW

Defines a position hint where a transport resource should be when placing the product.

Must be from the same component.

Start Transport Out

Transports one or more products (vcProduct) out from the process in parallel. The statement execution is asynchronous, meaning that next statements may execute before the transport is finished. Must be used in combination with the Wait Transport statement.

Type constant: VC_STATEMENT_STARTTRANSPORTOUT

Name | Type | Access | Description
Container | vcContainer | RW | Defines a component container where to place the products (vcProduct). Must be from the same component. Only used when Destination is VC_TRANSPORTOUTTYPE_CONTAINER
Destination | TransportOutType enumeration | RW | Defines where the products should go.
DestinationNode | vcTransportNode | RW | Defines a transport node where to send the products using the transport system (vcProduct). Note: Only used when Destination is VC_TRANSPORTOUTTYPE_TRANSPORTNODE
ProductVariableName | String | RW | Name of input variable where to get the products (vcProduct).
ResourcePositionFrame | vcFrameFeature | RW | Defines a position hint where a transport resource should be when picking the products. Note: Must be from the same component.

Switch Case

Switch Case statement executes the first vcCaseScope for which the value of its CaseCondition property matches that of statement’s Condition property.

Type constant: VC_STATEMENT_SWITCHCASE

Properties

Name | Type | Access | Description
Condition | Expression | RW | Expression that defines the value against which the case conditions are evaluated. See also Process Statement Expressions.
Cases | List of vcCaseScope | RO | All case scopes in this statement. Each scope has an RW property CaseCondition of type String which will be evaluated against statement’s Condition.

Methods

Name | Return value | Parameters | Description
addCase

vcCaseScope

or

vcCaseScope

or

None

None

or

Integer index

or

Integer index,

vcCaseScope scope

Creates a new case and appends it to the end.

or

Creates a new case and inserts it to the given index. If index is less than zero or greater than the current case count, the case will be appended to the end.

or

Inserts an existing case to the given index. If index is less than zero or greater than the current case count, the case will be appended to the end.
moveCase None

vcCaseScope scope,

Integer newIndex

 Moves an existing case to the new position. If the given index is less than zero or greater than the current case count, the case will be moved to the end.
deleteCase None vcCaseScope scope

Removes an existing case and deletes it.
releaseCase | None | vcCaseScope scope | Removes an existing case.
getCase | vcCaseScope | Integer index | Gets an existing case.

Events

Name | Parameters | Description
OnCaseAdded | vcCaseScope scope, Integer index | Event that occurs when a case has been added. Provides an index where case was inserted.
OnCaseMoved | vcCaseScope scope, Integer oldIndex, Integer newIndex | Event that occurs when a case has been moved to a new index. Provides both old and new indices.
OnCaseRemoved | vcCaseScope scope, Integer index | Event that occurs when a case has been removed. Provides an index case was removed from.

Transport In

Transport In statement sequentially transports product(s) (vcProduct) into the process and waits until they have arrived. More than one pre-reserved product can be transported in, otherwise transports only a single product.

Type constant: VC_STATEMENT_TRANSPORTIN

Name | Type | Access | Description
AcceptAllProductTypes | Boolean | RW | When True any product is accepted, ignoring AcceptedFlowGroups and AcceptedProductTypes
AcceptedFlowGroups | List of vcProcessFlowGroup | RW | Allows only the selected flow groups.
AcceptedProductTypes | List of vcProductType | RW | Allows only the selected product types.
ProductPositionFrame vcFrameFeature RW

Defines the position and orientation where the product instance should be placed.

Note: Must be from the same component.
ProductVariableName | String | RW | Name of output variable where to store the transported product(s) (vcProduct).
ReservedProductVariableName String RW

Name of a variable containing products (vcProduct) already reserved using Reserve Product statement. If defined, the statement will transport in those specific products.

Note: The product filtering defined by properties AcceptAllProductTypes, AcceptedFlowGroups and AcceptedProductTypes is not applied to the pre-reserved products.
ResourcePositionFrame vcFrameFeature RW

Defines a position hint where a transport resource should be when placing the product.

Must be from the same component.
Source | TransportInType enumeration | RW | Defines how to get the product (vcProduct).

Transport Out

Transport Out statement sequentially transports one or more products (vcProduct) out from the process and waits until the last one has left.

Type constant: VC_STATEMENT_TRANSPORTOUT

Name | Type | Access | Description
Container | vcContainer | RW | Defines a component container where to place the products (vcProduct). Note: Must be from the same component. Only used when Destination is VC_TRANSPORTOUTTYPE_CONTAINER
Destination | TransportOutType enumeration | RW | Defines where the products should go.
DestinationNode | vcTransportNode | RW | Defines a transport node where to send the products using the transport system (vcProduct). Only used when Destination is VC_TRANSPORTOUTTYPE_TRANSPORTNODE
ProductVariableName | String | RW | Name of input variable where to get the products (vcProduct).
ResourcePositionFrame | vcFrameFeature | RW | Defines a position hint where a transport resource should be when picking the products. Note: Must be from the same component.

Transport Pattern In

Sequentially transports products (vcProduct) into a regular grid pattern and waits until they have arrived.

Type constant: VC_STATEMENT_TRANSPORTPATTERNIN

Name | Type | Access | Description
AcceptAllProductTypes | Boolean | RW | When True any product is accepted, ignoring AcceptedFlowGroups and AcceptedProductTypes
AcceptedFlowGroups | List of vcProcessFlowGroup | RW | Allows only the selected flow groups.
AcceptedProductTypes | List of vcProductType | RW | Allows only the selected product types.
Offset | vcMatrix | RW | Offset of the first product position from ProductPositionFrame.
PatternCount | vcVector | RW | Number of pattern slots per X,Y,Z axis. The Real values of the vector are rounded to nearest Integer values. Each dimension should in inclusive range 0 to 1289.
PatternStep | vcVector | RW | Step between products in pattern per X,Y,Z axis.
ProductPositionFrame vcFrameFeature RW

Frame defining the position and orientation of the product pattern in combination with the Offset property.

Must be from the same component.
ReservedProductVariableName String RW

Name of variable containing products (vcProduct) already reserved using Reserve Product statement. The pattern will be first filled using these products and then will continue to receive further products if needed.

Note: The product filtering defined by properties AcceptAllProductTypes, AcceptedFlowGroups and AcceptedProductTypes is not applied to the pre-reserved products.
ResourcePositionFrame vcFrameFeature RW

Defines a position hint where a transport resource should be when placing the products.

Note: Must be from the same component.

Wait Property Condition

Waits for a variable’s value to pass a specified condition. VariableName and Condition property values form a single expression that is evaluated every time the value of the variable defined by VariableName changes. Variable name property can refer to process variables or component properties of the owner component.

Type constant: VC_STATEMENT_WAITPROPERTYCONDITION

Name | Type | Access | Description
Condition | Expression (boolean) | RW | Expression to evaluate the variable value. Needs to form a Boolean expression together with the variable value. See also Process Statement Expressions.
VariableName | String | RW | Name of the variable or component property to monitor.

Wait Signal

Wait Signal statement waits for signal to be triggered with a value that matches a given condition or until an optional timeout is reached.

Type constant: VC_STATEMENT_WAITSIGNAL

Name | Type | Access | Description
Component | vcComponent | RW | Component that owns the signal. None means the parent component of the statement.
Condition | Expression | RW | Condition expression that the signal's value has to pass. Leave empty to accept any value. See also Process Statement Expressions.
Signal | vcSignal | RW | Signal behavior to listen for. Must be from the component specified by the Component property. Must be set after the Component property has been set.
Timeout | Real | RW | Maximum amount of simulation time in seconds to wait for a value that matches the condition. 0 means no time limit.
TimedOutVariableName | String | RW | Name of a process variable where to store a Boolean value whether the timeout was reached or not. Can be left empty.
ValueOutputVariableName | String | RW | Name of a process variable where to store the signal value that passed the condition. Can be left empty.
WaitTrigger | Boolean | RW | Whether to always wait for a new signal value. When False, also considers the current value of the signal when this statement's execution starts.

Wait Transport

Wait Transport statement waits for one or more transport operations started with StartTransportIn or StartTransportOut statements to complete.

Type constant: VC_STATEMENT_WAITTRANSPORT

Name | Type | Access | Description
ProductVariableName | String | RW | Name of the variable that identifies the transport operations to wait for.

While

While statement executes Scope in a loop as long as Condition evaluates to True.

Type constant: VC_STATEMENT_PROCESSWHILE

Name | Type | Access | Description
Condition | Expression (boolean) | RW | Condition expression to evaluate on each loop iteration. See also Process Statement Expressions.
Scope | vcScope | R | Scope to keep executing while Condition evaluates to True.

Work

Sends a work request to a transport controller (vcPythonTransportController) and waits until the work is complete.

Type constant: VC_STATEMENT_WORK

Name | Type | Access | Description
Controller | vcPythonTransportController | RW | Defines the transport controller delegating the work to a resource.
ProcessTime Distribution (real) RW

Defines an expression to calculate a value for the work duration in seconds. A sample is taken when the statement execution begins.

Available functions include:

normal( u, s )
Normal distribution for mean value u, and the standard deviation s.

lognormal( u, s )
Log normal distribution for mean u, and the standard deviation s.

uniform( a, b )
Uniform distribution in range a <= x < b.

exponential( lambda )
Exponential distribution where the mean is 1/lambda and the variance is 1/lambda^2.

gamma( k, theta )
Gamma distribution with shape k and scale theta.

triangular( min, mode, max )
Triangular distribution with the specified minimum, mode and maximum values.

weibull( k, lambda )
Weibull distribution with shape k and scale lambda.

Tip: Use RandomStream to have the distribution use a stream for seeding a value and generating the same set of random numbers during a simulation. That is, if you reset and run a simulation you should expect the same values given in the previous simulation.
ProcessTimeExpression Expression (real) RW

Work duration defined as an expression that must evaluate to a Real value at the start of the statement execution.

Unit is seconds of simulation time.

See also Process Statement Expressions.
ResourcePositionFrame vcFrameFeature RW

Defines a position hint where a resource should be when doing the work.

Note: Must be from the same component.
TimeSource Enumeration RW

Defines whether to evaluate the ProcessTime or ProcessTimeExpression property to get the work duration.

See Time Source Constants for more information.
WorkPositionFrame | vcFrameFeature | RW | Defines a position hint where the actual work happens.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | Enumeration type, String name | Creates a new property of a given type and name in the statement, and then returns the new property. An optional constraints argument can be used to define constraints for new property, which must be defined at the time of creation. See Property Constants for more information.
deleteProperty | None | vcProperty property | Deletes a given property in the statement.
getProperty | vcProperty | String name | Returns a property matching a given name in the statement; otherwise returns None.


vcStatistics

vcStatistics allows you to create flow type and state based statistics as well as access the properties of a Statistics behavior and related simulation statistics.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Events

Examples

Properties

The values of a Statistics behavior's properties depend on the amount of behaviors referencing the Statistics behavior. That is, a Statistics behavior is capable of collecting data from more than one container, path or executor to result in cumulative data. In some cases, a component may use more than one Statistics behavior, thereby the data of those objects are compared to yield results. Generally, a component has only one Statistics behavior, so collected data represents the whole component.

Name | Type | Access | Description
ComponentMaxCount | Integer | R | Gets the maximum number of components that have been contained in a component at any given time.
ComponentMaxTime | Real | R | Gets the maximum amount of time a component spent contained in a component.
ComponentMinCount | Integer | R | Gets the minimum number of components that been contained in a component at any given time.
ComponentMinTime | Real | R | Gets the minimum amount of time a component spent contained in a component.
ComponentsArrived | Integer | R | Gets the total number of components that have been transferred into a component.
ComponentsAverageTime | Real | R | Gets the average amount of time components have spent in a component.
ComponentsCurrent | Integer | R | Gets the total number of components currently contained in a component.
ComponentsDeparted | Integer | R | Gets the total amount of components that have been transferred out of a component.
Name | String | RW | Defines the name of Statistics behavior.
States | List of n-tuple (String state_name, Enumeration system_state_type) | RW | Defines a list of defined states mapped to system states. A state must be mapped to a system state. See Statistics for more information.
SystemStates | List of n-tuple (String system_state_description, Enumeration system_state_type) | R | Gets a list of available system states, which provides system state description and type. See Statistics Constants for more information.

Flow type properties

During a simulation, a vcFlow object can update flow type statistics automatically if that object's Statistics property references a vcStatistics object. Flow type statistics can be controlled manually by using flowEnter() and flowLeave() methods.

The following properties are cumulative and based on total simulation runtime.

Name | Type | Access | Description
PartsAverageCount | Real | R | Gets the average amount of components that have been contained in a component.
PartsAverageTime | Real | R | Gets the average amount of time components spent in a component.
PartsCurrent | Integer | R | Gets the current amount of components contained in a component.
PartsEntered | Integer | RW | Gets/Sets the number of components that have been transferred into a component. Generally, this property is set to reset a count or collect from the start of a new process.
PartsExited | Integer | RW | Gets/Sets the number of components that have been transferred out of a component. Generally, this property is set to reset a count or collect from the start of a new process.
PartsMaxCount | Integer | R | Gets the maximum number of components that have been contained in a component at any given time.
PartsMaxTime | Real | R | Gets the maximum amount of time a component has spent in a component.
PartsMinCount | Integer | R | Gets the minimum number of components that have been contained in a component at any given time.
PartsMinTime | Real | R | Gets the minimum amount of time a component has spent in a component.
PartsTotalTime | Real | R | Gets sum total of the amount of time each component had spent in a component, for example the duration of each component on a conveyor added together.
PartsUtilization | Real | R | Gets the percentage of a component's capacity being utilized: number of parts divided by component's capacity.

The following properties are based on the last recorded interval of a simulation.

Name | Type | Access | Description
PartsIntervalAverageCount | Real | R | Same as other flow type properties, yet each value reflects the last recorded interval during a simulation, which by default is every 60.0 seconds. See vcStatisticsManager for more information on how to change interval.
PartsIntervalAverageTime | Real | R
PartsIntervalCurrent | Integer | R
PartsIntervalEntered | Integer | R
PartsIntervalExited | Integer | R
PartsIntervalMaxCount | Integer | R
PartsIntervalMaxTime | Real | R
PartsIntervalMinCount | Integer | R
PartsIntervalMinTime | Real | R
PartsIntervalTotalTime | Real | R
PartsIntervalUtilization | Real | R

State based properties

State based statistics are controlled by setting an object's State property to a different state. Therefore, a Statistics behavior would need to have defined states.

The following properties are cumulative and based on total simulation runtime.

Name | Type | Access | Properties
AverageActivePeriodTime | Real | R | Gets the average amount of time a component was in one of its defined states.
BlockedPercentage | Real | R | Gets the amount of time a component spent in a blocked state, for example capacity issue, as a percentage of total time.
BreakPercentage | Real | R | Gets the amount of time a component spent in a broken state as a percentage of total time.
BusyPercentage | Real | R | Gets the amount of time a component spent in a busy state or was being used as a percentage of total time.
FailedPercentage | Real | R | Gets the amount of time a component spent in a failed state as a percentage of total time.
IdlePercentage | Real | R | Gets the amount of time a component spent in an idle state as a percentage of total time.
RepairPercentage | Real | R | Gets the amount of time a component spent in a repair state as a percentage of total time. Scripting can be used to set repair time and include time waiting for a repair.
SetupPercentage | Real | R | Gets the amount of time a component spent in a setup state, for example warm up time, as a percentage of total time.
State | String | RW | Defines the current state of component. Use the States property to get an indication of available states in component.
State<name>Percentage | Real | R | Gets the amount of time a component spent in a user-defined state as a percentage of total time. For example, StateExamplePercentage would refer to defined state called Example.
TotalStateTime | Real | R | Gets the total amount of time a component was in one of its defined states based on total time.
Utilization | Real | R | Gets the amount of time a component was busy during a simulation as a percentage (busy state/100 * 100%).

The following properties are based on the last recorded interval of a simulation.

Name | Type | Access | Description
IntervalBlockedPercentage | Real | R | Same as other state based properties, yet each value reflects the last recorded interval during a simulation, which by default is every 60.0 seconds. See vcStatisticsManager for more information on how to change interval.
IntervalBreakPercentage | Real | R
IntervalBusyPercentage | Real | R
IntervalFailedPercentage | Real | R
IntervalIdlePercentage | Real | R
IntervalRepairPercentage | Real | R
IntervalSetupPercentage | Real | R
IntervalTotalStateTime | Real | R
IntervalUtilization | Real | R
State<name>IntervalPercentage | Real | R

Methods

Name | Return Type | Parameters | Description
flowEnter | None | vcComponent component | Manually records a given component transferring into component.
flowLeave | None | vcComponent component | Manually records a given component transferring out of component.
getIntervalPercentage | Real | String state | Returns the accumulated time of a given state as a percentage of the last recorded interval during a simulation.
getPercentage | Real | String state | Returns the accumulated time of a given state as a percentage of total time at the time of call.
getSystemIntervalPercentage | Real | Enumeration system_state | Returns the accumulated time of a given system_state as a percentage of the last recorded interval during a simulation.
getSystemPercentage | Real | Enumeration system_state | Returns the accumulated time of a given system_state as a percentage of total time at the time of call.
getSystemTime | Real | Enumeration system_state | Returns the accumulated time of a given system_state at the time of call.
getTime | Real | String state | Returns the accumulated time of a given state at the time of call.
warmupCompleted | None | None | Marks the completion/end of a component's warm up period, thereby setting all statistics to zero at the time of call. For example, a component can be configured to run a delay or a certain number of time consuming tasks at the start of a simulation. When this method is called, warm up time is calculated from simulation start to time of call.

Events

Name | Parameters | Description
OnFlowChange | vcStatistics statistics, Real time, Boolean incoming, vcNode component | Triggered when a component is transferred into or out of a component. The statistics argument is the Statistics behavior that recorded the event. The time argument is simulation time when flow change occurred. The incoming argument is True when component transfers in and False when component transfers out of component.
OnStateChange | vcStatistics statistics, Real time, Integer state, vcNode component | Triggered when the state change occurs in a component. The statistics argument is the Statistics behavior that recorded the event. The time argument is simulation time when state change occurred. The state argument is the new state or system state of component. Refer to States or SystemStates property values as needed.

Examples

Example. Print statistical properties and values

from vcScript import *

comp = getComponent()
statistics = comp.findBehaviour('Statistics')

#create loop

for i in statistics.Properties:
print i.Name, i.Value


vcStatisticsChart

vcStatisticsChart allows you to plot and graph the data of reported items in a chart.

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
AllSources | List of List (vcProperty property, String expression, vcComponent component, vcVector color, Real thickness) | R | Gets all sources of reported items, including their components. A reported item is a vcProperty object associated with a component. For example, a reported item could be a component property or a property of a component behavior. A vcVector object is used to define the display color of reported item in chart.
ChartTileType | Integer | RW | Defines the location type of chart, thereby indicating whether the tile is an empty or filled with a chart. Generally, you would use ChartTileType to parse through several charts in a dashboard to collect data from charts that report items. For example, you could ignore or skip empty tiles.
ChartType | Enumeration | RW | Defines the chart type. For more information, see Statistics Constants.
DataRows | List of List (Real simulation_time, Real value1, ... Real valueN) | R | Gets the data collected during a simulation from reported items.
DataType | Enumeration | RW | Defines the data type of chart. For more information, see Statistics Constants.
FieldCountPerProperty | Integer | RW | Defines the field count of items reported by chart.
LegendVisibility | Boolean | RW | Turns on/off the display of chart legend.
Name | String | RW | Defines the title of chart.
Position | List of String name, Integer column, Integer row, Integer column_span, Integer row_span | RW | Defines the position chart in tab grid.
RecordAccumulatedValues | Boolean | RW | Turns on/off the collection of data reported by chart.
SamplingInterval | Real | RW | Defines how often (in seconds) the chart updates to show recorded data during a simulation. If -1, the chart uses the sampling interval of its dashboard.
Series | List of vcStatisticsSeries | R | Gets a list of data series used by chart to report items.
TileType | Enumeration | RW | Same as ChartTileType. For more information, see Statistics Constants.
TitleVisibility | Boolean | RW | Turns on/off the display of chart title.

Methods

Name | Return Type | Parameters | Description
addSeries | vcStatisticsSeries | None | Adds a new data series to chart.
clearData | None | None | Removes all data reported by chart, thereby emptying DataRows.
clearSeries | None | None | Resets all data series in chart, thereby emptying AllSources.
deleteSeries | None | vcStatisticsSeries data_series | Deletes a given data_series from chart.
updateChart | None | None | Refreshes the chart.

Examples

Example. Add, remove and reset data series in chart

from vcScript import *

app = getApplication()
dashboard = app.Dashboard
tab = dashboard.SelectedTab
tab.clearLayout()

#insert new chart in free tile
for chart in tab.Charts:
if chart.TileType == VC_TILETYPE_PLACEHOLDER:
chart = tab.createChart(tab.Charts[0],VC_CHARTTYPE_BAR,True)

#empty the chart, create new series, (optional) remove any existing series
if chart != None:
if chart.Series:
for i in chart.Series:
chart.deleteSeries(i)
x = chart.addSeries()
y = chart.addSeries()

#instead of deleting series
#you may want to reset series and clear reported items of chart
chart.clearSeries()


vcStatisticsDashboard

vcStatisticsDashboard is a dashboard used for visualizing and reporting statistics collected during a simulation.

Contents ShowHide

Structure

Properties

Methods

Examples

Structure

The Statistics dashboard consists of tabs, which are of type vcStatisticsTab. Each tab contains a layout of one or more charts, which are of type vcStatisticsChart. Each chart uses a sampling interval to report one or more data series, which are of type vcStatisticsSeries.

Tips:

  • Use vcStatisticsDashboard to create, select or delete tabs.
  • Use vcStatisticsTab to create, select or delete charts and define how charts are organized in a tab.
  • Use vcStatisticsChart to add, select, delete, clear or update data series as well as edit the position and attributes of a chart.
  • Use vcStatisticsSeries to define which property and from what components is reported in a chart.

Properties

Name | Type | Access | Description
SelectedTab | vcStatisticsTab | RW | Defines the active tab in dashboard.
StatisticsInterval | Real | RW | Defines the global sampling interval for reporting data. This will affect data series referencing vcStatistics properties as well as any chart with a sampling interval of -1.
Tabs | List of vcStatisticsTab | R | Gets a list of all tabs in dashboard.

Methods

Name | Return Type | Parameters | Description
createTab | vcStatisticsTab | String name, Boolean activate | Adds a new tab of a given name to the dashboard. The activate argument can be used to make the new tab the selected tab in dashboard.
deleteTab | None | vcStatisticsTab | Removes a given tab from the dashboard.

Examples

Example. Create new tab in dashboard

from vcScript import *

app = getApplication()
dashboard = app.Dashboard
tab = dashboard.createTab("Example", True)


vcStatisticsManager

vcStatisticsManager is used by a vcSimulation object for defining the sampling rate at which interval based statistics are recorded during a simulation.

Properties

Name | Type | Access | Description
SamplingInterval | Real | RW | Defines the sampling interval used by simulation for recording interval based statistics. The default rate is 60.0 seconds, so an interval is recorded every 60 seconds in simulation.

Examples

Example. Define global interval for interval based statistics in a simulation

from vcScript import *

sim = getSimulation()
stats = sim.Statistics

#Define global interval statistics sampling interval
stats.SamplingInterval = 10.0


vcStatisticsSeries

vcStatisticsSeries is a source of data reported in a chart.

Contents ShowHide

Properties

Examples

Properties

Name | Type | Access | Description
Colors | List of vcVector | RW | Defines the colors of series, which is displayed in chart. For example, data collected from different components should be color-coded to differentiate their data in chart.
Components | List of vcComponent | RW | Defines the components the series collects data from during a simulation. In order to collect data, a listed component must have Property.
Expression | String | RW | Defines the expression of series.
Name | String | RW | Defines the name of series object.
ParentChart | vcStatisticsChart | R | Gets the chart of series.
Property | vcProperty | RW | Defines the reported item (source) of series.
SeriesName | String | RW | Defines the name of series, which is displayed in chart legend.
Sources | List of List (vcProperty property, String expression, vcComponent component, vcVector color, Real thickness) | R | Gets a list of sources for series data. This information includes the reported item (vcProperty) and its component.
Thickness | List of Real | RW | Defines the display thickness of series, for example the line thickness of data collected from different components.

Examples

Example. Define source of data series

from vcScript import *
import vcVector

app = getApplication()
dashboard = app.Dashboard
tab = dashboard.SelectedTab
chart = tab.Charts[0]
chart.LegendVisibility = True
data_series = chart.Series[0]

conveyor = app.findComponent("Conveyor")
data_series.Components = [conveyor]

stats = conveyor.findBehaviour("Statistics")
data_series.Property = stats.getProperty("PartsExited")
color = vcVector.new(0,1,0)
data_series.Colors = [color]


vcStatisticsTab

vcStatisticsTab is a tab listed in a Statistics dashboard and contains one or more charts which are organized in a grid.

Contents ShowHide

Layout

Properties

Methods

Examples

Layout

The layout of a grid is defined by rows and columns. Each grid location is a tile that is either an empty chart used as a placeholder or filled with chart reporting data.

Properties

Name | Type | Access | Description
Charts | List of vcStatisticsChart | RW | Defines the charts of tab.
Layouts | List of List (String layout_name, List (String placeholder_name, Integer column, Integer row, Integer column_span, Integer row_span))) | RW | Defines the available layouts for tab grid.
MaxColumns | Integer | RW | Defines the maximum number of columns in tab grid.
MaxRows | Integer | RW | Defines the maximum number of rows in tab grid.
Name | String | RW | Defines the name of tab.
SelectedChart | vcStatisticsChart | RW | Defines the active chart of tab.
SelectedLayout | Integer | RW | Defines the current layout of tab grid.
SelectedLayoutItem | List of String layout_name, List (String placeholder_name, Integer column, Integer row, Integer column_span, Integer row_span) | RW | Defines the attributes of SelectedLayout. Note: A layout has a name and a list for each of its placeholders/tiles. A placeholder defines the grid column and row size of a chart.

Methods

Name | Return Type | Parameters | Description
clearLayout | None | None | Deletes all charts from tab grid.
createChart | vcStatisticsChart | vcStatisticsChart location, Enumeration chart_type, Boolean activate | Adds a new chart of a given type to tab grid. The location argument specifies where in grid to insert the new chart. In this context, the vcStatisticsChart object is a grid location. It can be a chart with existing data or an empty chart used as a placeholder. In either case, a call will remove the existing chart and exchange it with a new one in the grid. The activate argument can be used to make the new chart the active chart in tab. For more information on the chart_type argument, see Statistics Constants.
createLayout | None | None | Creates a new layout for tab grid.
deleteChart | None | Integer index or vcStatisticsChart chart | Removes a chart from tab grid, thereby replacing the old chart with a new empty chart used as a placeholder in grid.
selectChart | vcStatisticsChart | Integer index or vcStatisticsChart chart | Selects a chart in tab, thereby making it the active chart in tab.

Examples

Example. Add a new bar chart

from vcScript import *

app = getApplication()
dashboard = app.Dashboard
tab = dashboard.SelectedTab

#deletes all charts from tab grid
tab.clearLayout()

#selects the first chart in grid, which is placeholder P1/tile
tile = tab.selectChart(0)

#inserts new bar chart in P1 and selects the new chart
chart = tab.createChart(tile,VC_CHARTTYPE_BAR,True)


vcStringSignal

vcStringSignal is a signal that can send a string value.

Inherits: vcBehaviour, vcSignal

Properties

Name | Type | Access | Description
Value | String | RW | Defines the value of signal. Setting this value does not trigger the OnSignal event unless you use the signal() method.

Methods

Name | Return Type | Parameters | Description
signal | None | [String value] | Signals the current value of signal to all connected behaviors, thereby triggering the OnSignal event. An optional value argument can be given to set the Value property of the signal.


vcStringSignalMap

vcStringSignalMap allows you to map String signals to ports in a continuous IO space.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
Listeners | List of vcBehaviour | RW | Defines a list of behaviors using the signal map.
PortCount | Integer | RW | Defines the amount of ports in the signal map.

Methods

Name | Return Type | Parameters | Description
input | String | Integer index | Returns the value of a port at a given index.
output | None | Integer index, String value | Sets the value of a port at a given index to a given value.


vcSweptVolume

vcSweptVolume is a layout item used to measure and simulate volume displacement of moving objects and detect collisions.

Inherits: vcLayoutItem

A swept volume requires at least two vcNode objects: one designated as the object being swept (InputNodeList) and one designated as the container of swept geometry (TargetNode). In all cases, the target container should remain static and not move during a simulation.

When an object is swept, it is transformed into one or more convex hulls upon movement, an iterative process ensures, and then the swept volume from convex hulls is rendered in 3D world. Swept geometry can be cleared from 3D world or stored in target container, thereby allowing you to save generated swept geometry in a component or layout.

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Decomposition Integer RW Defines the number of convex hulls created for included nodes, for example one conveyor hull encompassing all nodes or several convex hulls based on geometry of each node.

0
One convex hull.

1
One or more convex hulls using convex decomposition.

2
One convex hull for each triangle mesh in input nodes.

See Decomposition Modes for more information.
DecompositionDecimationTarget Integer W If Decomposition set to 1, sets the number of triangle sets remaining after decimation process of input nodes with fewer triangle sets than decimation target, thereby allowing you to expedite/speed up the process.

Set to zero to have no effect.
DecompositionQuality Real W If Decomposition set to 1, sets the quality of decomposition in range 0 to 100, thereby affecting the approximation of convex hulls to the shape of input node geometry.

A higher value produces better approximation and convex-shaped triangle sets at the cost of increasing a component's data count and simulation performance.
InputNodeList List of 3-tuple (vcNode, Enumeration inclusion, Enumeration scope) RW Defines which nodes will be swept during a simulation.

The value type is similar to Nodes property of a vcNodeList object in which a given node and its scope is either included or excluded from swept volume.
Method Integer W Sets the method used for generating convex hulls as swept geometry, for example hollow or filled convex hulls.

0
Uses lofting. Good for movements requiring small changes, for example small rotational and directional changes in linear motions and bending of curves.

1
Uses hull from hulls generation. Creates internal faces and more points, thereby a higher data count but supports all types of movement.

2
Uses hull from silhouettes generation. Balance of methods 0 and 1 to support small and complex movements.

Note: Each method type has about the same performance level.

See Swept Generation for more information.
TargetNode | vcNode | W | Sets the node used for containing swept geometry, which should be static and not move during simulation.

Methods

Name | Return Type | Parameters | Description
begin | None | [vcVector vector] | Starts swept volume process, thereby initiating decomposition. An optional vector argument can be given to define a frame of reference or center point in input node. If not, process uses center point of input node bound box.
clear | None | None | Removes all swept geometry of layout item from 3D world.
end | None | None | Stops swept volume process. After swept volume process has ended, you can perform capping of swept geometry.
next | None | [vcVector vector] | Executes an iterative process that renders swept geometry based on positions of input nodes. That is, you should call this method each time you want to render swept volume in 3D world during swept process. An optional vector argument can be given to define a frame of reference or center point in input node as it moves during a simulation. If not, process uses center point of input node bound box. Generally, this is used to offset swept geometry.
store | vcFeature | None | Stores swept geometry in TargetNode, thereby allowing you to save swept geometry in component and/or layout. Returns the Geometry feature where swept volume is stored in TargetNode. The naming convention for feature is VC_SweptVolumeResult, and the feature is an immediate child of TargetNode root feature. If no swept geometry is generated during simulation, returns None. Generally, you should call store() method after calling end() method and before clear() method.

Examples

Example. Decomposition and Method results

Decomposition = 0 | Method = 0 (lofting)

Decomposition = 1 | Method = 0 (lofting)

Decomposition = 0 | Method = 1

Decomposition = 1 | Method = 1

Example. Basic implementation of swept volume

from vcScript import*

#create swept volume object
app = getApplication()
sv = app.findLayoutItem('swept')
if sv == None:
sv = app.createLayoutItem(VC_LAYOUTITEM_IT_SWEPTVOLUME)
sv.Name = 'swept'

#setup nodes to include/exclude in node list and scope
comp = getComponent()
nodes = comp.findNode('Enter Node Name')
sv.InputNodeList = [( nodes, VC_NODELIST_INCLUDE, VC_NODELIST_NODE )]

#define if decomposition is done and what method to sweep
sv.Decomposition = 1
sv.Method = 1

#define container of swept volume geometry (must be static/not move)
sv.TargetNode = getNode()

#define when to begin, update and end swept volume during simulation
def OnRun():
sv.begin()
while True:
sv.next()
delay(0.05)
#how often the swept volume is updated affects visualization of node's location

def OnStop():
sv.end()

#remove swept volume as needed
#remember generated swept volume is parented to target node
def OnReset():
sv.clear()

Example. Generate swept volume for robot and gripper

#The following code should be inserted as an Python Script of the component where the #swept volume is stored

from vcScript import*

app = getApplication()
comp = getComponent()
sim = getSimulation()
finalized = False
sweptdefinition = None

def OnFinalize():
global follownode, boundcenter, sweptdefinition, finalized, sweptnode
if finalized:
return

# Change the name of the node according to your model
follownode = app.findComponent("Press Gripper")
boundcenter = follownode.BoundCenter

# You may also want to change the name of the layout item.
# Keep it specific in case you have multiple items
sweptdefinition = app.findLayoutItem("PressGripperSweptDefintion")

if(sweptdefinition):
app.deleteLayoutItem(sweptdefinition)
sweptdefinition = app.createLayoutItem(VC_LAYOUTITEM_IT_SWEPTVOLUME)
sweptdefinition.Name = "PressGripperSweptDefintion"

# The following includes the node only
sweptdefinition.InputNodeList =\
[(follownode,VC_NODELIST_INCLUDE,VC_NODELIST_NODE)]

# Create a node in component to consist of the swept volume only.
# This is handy when defining collision queues
sweptnode = comp.findNode('Swept')
if not sweptnode:
sweptnode = comp.createNode(VC_NODE,'Swept')
sweptdefinition.TargetNode = sweptnode

# This is the fastest combination of method and decomposition
# to generate swept volume
sweptdefinition.method = VC_SWEPT_HULL_FROM_HULLS
sweptdefinition.decomposition = VC_CONVEXHULL
finalized = True

def OnReset():
global sweptdefinition
if sweptdefinition:

# Tell the Swept Definition to clear all recording
sweptdefinition.clear()

def OnStart():
global sweptdefinition, finalized, follownode, boundcenter

OnFinalize()

# Tell the Swept Definition to start recording
sweptdefinition.begin(follownode.WorldPositionMatrix * boundcenter)

def OnSimulationUpdate(time):
global sweptdefinition, finalized, follownode, boundcenter
if finalized and sim.IsRunning:

# Tell the Swept Definition to record one step
sweptdefinition.next(follownode.WorldPositionMatrix * boundcenter)

def OnStop():
global sweptdefinition
if sweptdefinition:

# Tell the Swept Definition to stop recording
sweptdefinition.end()


vcSwitchCaseStatement

A vcSwitchCaseStatement executes the first vcCaseScope for which the value of its CaseCondition property matches that of statement’s Condition property.

Inherits: vcStatement

Properties

Name | Type | Access | Description
Condition | Expression | RW | Expression that defines the value against which the case conditions are evaluated. See also Process Statement Expressions.
Cases | List of vcCaseScope | RO | All case scopes in this statement. Each scope has an RW property CaseCondition of type String which will be evaluated against statement’s Condition.

Methods

Name | Return value | Parameters | Description
addCase

vcCaseScope

or

vcCaseScope

or

None

None

or

Integer index

or

Integer index,

vcCaseScope scope

Creates a new case and appends it to the end.

or

Creates a new case and inserts it to the given index. If index is less than zero or greater than the current case count, the case will be appended to the end.

or

Inserts an existing case to the given index. If index is less than zero or greater than the current case count, the case will be appended to the end.
moveCase None

vcCaseScope scope,

Integer newIndex

 Moves an existing case to the new position. If the given index is less than zero or greater than the current case count, the case will be moved to the end.
deleteCase None vcCaseScope scope

Removes an existing case and deletes it.
releaseCase | None | vcCaseScope scope | Removes an existing case.
getCase | vcCaseScope | Integer index | Gets an existing case.

Events

Name | Parameters | Description
OnCaseAdded | vcCaseScope scope, Integer index | Event that occurs when a case has been added. Provides an index where case was inserted.
OnCaseMoved | vcCaseScope scope, Integer oldIndex, Integer newIndex | Event that occurs when a case has been moved to a new index. Provides both old and new indices.
OnCaseRemoved | vcCaseScope scope, Integer index | Event that occurs when a case has been removed. Provides an index case was removed from.


vcTeachContext

vcTeachContext is the context of the application for robot programming.

Inherits: vcContext

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
ActiveRobot | vcComponent | RW | Defines the active robot in context.
ActiveRoutine | vcRoutine | R | Gets the active routine in the ActiveRobot program.
ActiveScope | vcScope | R | Gets the active routine or scope of statement in ActiveRobot program.
ActiveStatement | <Type> | R | Gets the active statement in ActiveRobot program.
ActiveStatementIndex | Integer | R | Gets the index of active statement in ActiveRobot program.

Methods

Name | Return Type | Parameters | Description
setActiveStatement | None | vcScope scope, Integer index | Sets the statement at the given index in the given scope to be ActiveStatement.

Events

Name | Parameters | Description
ActiveRobotChanged | None | Triggered when a different robot becomes the active robot in context.

Examples

Example. Get active robot and routine in 3D world

from vcScript import *

##Option 1
def getActiveRoutine():
routine = getApplication().TeachContext.ActiveScope
if routine:
if routine.ParentStatement:
routine = routine.ParentStatement.Routine
return routine

##Option 2
app = getApplication()
teach = app.TeachContext
robot = teach.ActiveRobot
if robot:
executor = robot.findBehavioursByType( VC_ROBOTEXECUTOR )[0]
main = executor.Program.MainRoutine
scope = teach.ActiveScope
if teach.ActiveStatementIndex < 0:
print "No statements exist within the scope"
else:
print "Index of the currently selected statement in the scope is : ", teach.ActiveStatementIndex
if type(scope) == type(main):
print "Current Routine is: ", scope
else:
print "Current Routine is (read from scope statement): ", scope.ParentStatement.Routine


vcText2DSet

vcText2DSet is a geometry set used for generating 2D text. Unlike 3D text, 2D text is rendered directly on screen by converting a position vector to screen coordinates. Furthermore, 2D text supports an inherited Billboard property, thereby text can always face camera and be right-side up in 3D world.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
DepthBuffered | Boolean | RW | Turns on/off the obstruction of text by other objects that are in front of it on screen. If False, text is always set to front of foreground.
OffsetX | Integer | RW | Defines an offset (in pixels) for horizontal axis when text is projected on screen.
OffsetY | Integer | RW | Defines an offset (in pixels) for vertical axis when text is projected on screen.
Position | vcVector | RW | Defines the position vector of text in 3D world. Text is rendered in which left end of its baseline coincides with Position on screen. If OffsetX or OffsetY are non-zero values, position is shifted by those values.
Text | String | RW | Defines a string of characters to render as one line of text.

Methods

Name | Return Type | Parameters | Description
getTextHeight | Integer | None | Returns the calculated height of text in pixels.
getTextWidth | Integer | None | Returns the calculated width of text in pixels.
update | None | None | Updates the geometry of text in 3D world.

Examples

Example. Create 2D text in component

from vcScript import *

app = getApplication()
comp = getComponent()
comp.Name = "Example"

#simple demo that clears geometry sets in root node
comp.Geometry.clear()
gs = comp.Geometry.createGeometrySet(VC_TEXT2DSET)

#display component name
offset = 30
gs.FixedSize = True
gs.BillBoard = True
gs.OffsetX = 5
gs.OffsetY = offset
gs.Text = "Name: " + comp.Name
gs.update()
app.render()


vcText3DSet

vcText3DSet is a geometry set used for generating 3D text. Unlike 2D text, 3D text is generated using geometry and has both a position and orientation in 3D world.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Matrix | vcMatrix | RW | Defines the position matrix of text.
OffsetX | Integer | RW | Defines an offset (in pixels) for horizontal axis when text is projected on screen.
OffsetY | Integer | RW | Defines an offset (in pixels) for vertical axis when text is projected on screen.
Text | String | RW | Defines a string of characters to render as a one line of 3D text.

Methods

Name | Return Type | Parameters | Description
getTextHeight | Integer | None | Returns the calculated height of text in pixels.
getTextWidth | Integer | None | Returns the calculated width of text in pixels.
update | None | None | Updates the geometry of text in 3D world.

Examples

Example. Create 3D text in component

from vcScript import *

app = getApplication()
comp = getComponent()
comp.Name = "Example"

gs = comp.Geometry.createGeometrySet(VC_TEXT3DSET)

#assign material to 3D text
mat = app.findMaterial("red")
gs.Material = mat

#display component name in 3D world
gs.Text = "Name: " + comp.Name

#scale 3D text
mtx = gs.Matrix
mtx.scaleAbs(30.0, 30.0, 0)
gs.Matrix = mtx
gs.update()
app.render()


vcToolContainer

vcToolContainer is a container of vcBaseFrame objects which are used as tool frames/tool center points.

Inherits: vcBehaviour

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Tools | List of vcBaseFrame | R | Gets a list of all tool frames referenced by container.

Methods

Name | Return Type | Parameters | Description
addTool | vcBaseFrame | None | Adds a new tool frame to container, and then returns the new tool frame.
removeTool | None | vcBaseFrame tool | Removes a given tool frame from container.

Examples

Example. Set up tool container and tool center points

from vcScript import *

comp = getComponent()
tools = comp.createBehaviour(VC_TOOLCONTAINER, 'MyTools')
tcp1 = tools.addTool()
tcp1.PositionExpression = 'Rx(180).Tz(200)'
tcp1.Name = 'MyTCP'
# re-select the component in 3D world in order to see changes


vcTopology

vcTopology represents the topology data of tessellated geometry and can be used to generate simple and complex geometry, for example NURBS, meshes and splines.

Contents ShowHide

Usage

Properties

Methods

Usage

When a CAD file is loaded in 3D world, any topology data for tessellated geometry grouped in a vcTriangleSet object can be accessed from the object's Topology property. This differs from curve data, which is stored in a CurveData property of a vcCompactLineSet object.

Generally, topology data stored in a Geometry feature never duplicated unless contained triangle sets are updated using scripts. Any edits or modifying operations performed on tessellated geometry will automatically update topology data as needed.

Properties

Name | Type | Access | Description
CurveCount | Integer | R | Gets the total number of curves in set.
CurveLoopCount | Integer | R | Gets the total number of curve loops in set.
FaceCount | Integer | R | Gets the total number of faces in set.
PointCount | Integer | R | Gets the total number of points considered boundary-corners in mesh, for example curve ends. If set is not a mesh, gives zero. Note: To get the total number of points in set, use PointCount in vcTriangleSet.

Methods

Name | Return Type | Parameters | Description
brepAvailable | Boolean | None | Returns True if set contains boundary representation; otherwise returns False.
createCurveLoop | Integer | Integer face | Adds a new curve loop to a face at a given index in set, and then returns the index of new curve loop in set.
createNurbsFace | None | Integer udegree, Integer vdegree, List of vcVector ctrl_pts, List of Integer umultiply, List of Integer vmultiply, List of Real uknots, List of Real vknots, List of Real uknots, List of Real ctrl_weights | Adds a new non-uniform b-spline surface (NURBS) to set, and then returns the index of new surface in set.
createPlanarFace | Integer | vcVector pos, vcVector normal | Adds a new planar (unlimited) face using given position and surface normal vectors, and then returns the index of new face in set.
createOffsetSurface Integer Integer face, Real offset, vcTriangleSet target Creates a copy of face at a given index in set, and then returns the index of new face in a given geometry set.

New face is offset from original face. If offset argument is positive value, new face is offset in surface normal direction; otherwise offset is the opposite direction of surface normal.
createTrimPolyLine Integer Integer loop Creates a new polyline using a curve loop at a given index in set, which can then be used for trimming and extending operations, and polyline is surface domain (XY coordinates only).

The returned value is the index of trim polyline in set.
createTrimSpline | Integer | Integer loop, Integer degree, List of vcVector ctrl_pts, List of Integer knotmultiply, List of real knots, List of Real weights | Create a new spline in set used for trimming and extending operations, and spline is surface domain (XY coordinates only).
deleteNurbFace None Integer face Deletes a NURBS face at a given index in set.

If NURBS surface contains more than one face, geometry is tessellated after deletion.
getCurveCurveLoop | Integer | Integer curveindex | Returns the index of curve loop that a curve belongs to in set.
getCurveFace | Integer | Integer curveindex | Returns the index of face that a curve belongs to in set.
getCurveIntersections | List of 4-tuple (vcVector pos, real curve_dist, Real face_u, Real face_v) | Integer face, vcCompactLineSet curveset, Integer curve | Returns a list of curve intersection points based on given arguments.
getCurveLength | Real | Integer curve_index | Returns the length of a curve at a given index in set. That is, the total distance along the curve.
getCurveLoopCurve | Integer | Integer curveloopindex, Integer relcurveindex | Returns the absolute index of an inner curve loop relative to its curve loop in set.
getCurveLoopCurveCount | Integer | Integer curveloopindex | Returns the total number of inner curve loops for a curve loop of face in set.
getCurveNeighbor | Integer | Integer curve_index | Returns the index of a curve neighboring another curve in set.
getCurvePointCount | Integer | Integer curveindex | Returns the total number of points for a curve at a given index in set.
getCurvePointIndex | Integer | Integer curveindex, Integer relpointindex | Returns the absolute index of point relative to its curve in set.
getCurvePosition vcMatrix Integer curve_index, Real position Returns the position matrix of a point on a curve at a given distance along curve.

Details about the position matrix:

Position vector
Actual position of point on curve.

Normal vector
Direction of curve at the given point (derivative of curve position).

Orientation vector
Aligned to face inwards of curve's face.

Approach vector
Surface normal of face at curve position.

See table footnotes for more information.
getCurvePositions List of vcMatrix Integer curve_index, [Real minstep], [Real maxstep], [Real maxerror], [Real maxangle] Returns a list of position matrices for points along a curve using different criteria.

The minstep and maxstep arguments define the step values along distance of curve for generating new points.

The maxerror argument defines a maximum distance error along length of curve for generating a new point.

The maxangle argument defines a angle tolerance along curve for generating new points.

See table footnotes for more information.
getCurveType Enumeration Integer curve Returns a trim curve's type, which is either a polyline or spline.

See Topology Constants for more information.
getFaceBound 2-tuple (vcMatrix bbox_center, vcVector bbox_diagonal) Integer face_index Returns bound box data for a face as an ordered pair (position matrix of bound box center, vector of bound box half-diagonal).

See table footnotes for more information.
getFaceCurveLoop | Integer | Integer faceindex, Integer relcurveloopindex | Returns the absolute index of a curve loop relative to its face in set.
getFaceCurveLoopCount | Integer | Integer faceindex | Returns the total number of curve loops in a face.
getFaceMinPointDistance | 3-tuple (vcVector uv, vcVector pos, Real distance) | Integer face, vcVector point | Returns UV coordinates, position vector and distance of a given point to a face.
getFaceNormal | vcVector | Integer face, vcVector uv | Returns surface normal of a face at parametric UV coordinates.
getFacePlaneIntersections List of (List of vcMatrix) Integer face_index, vcMatrix plane, Real minstep, Real maxstep, Real maxerror, Real maxangle Returns a list containing lists of position matrices for points where a defined plane intersects a face.

Each time a plane goes through hole in face a new list is added, thereby allowing you to infer hole points on face-plane intersection.

Details about the position matrix:

Position vector
Actual position of point intersection.

Normal vector
Direction along plane intersecting face.

Orientation vector
Projected from normal of plane to surface of face using face derivate for projected direction.

Approach vector
Surface normal of face.

See table footnotes for more information.
getFacePoint | vcVector | Integer face, vcVector uv | Returns the position vector of a point on a face at given UV coordinates.
getFacePointAndDerivate | 3-tuple (vcVector pos, vcVector udir, vcVector vdir) | Integer face, vcVector uv | Returns the position vector and UV direction first derivates of a face at given UV coordinates.
getFaceStartTriangle | Integer | Integer face_index | Returns the absolute index of first triangle of a face in set.
getFaceTriangleCount | Integer | Integer face_index | Returns the total number of triangles of a face.
getFaceType Enumeration Integer face Returns the type of a face, which is either a tessellated, planar or NURBS.

See Topology Constants for more information.
getNurbsFaceControlPoints | List of vcVector | Integer face | Returns a list of control points for a NURBS face.
getNurbsFaceControlWeights | List of Real | Integer face | Returns a list of control weights for a NURBS face.
getNurbsFaceDegree | 2-tuple (Integer udegree, Integer vdegree) | Integer face | Returns UV degree values for a NURBS face.
getNurbsFaceUKnots | 2-tuple (List of Real uknots, List of Integer umultiply) | Integer face | Returns U direction knot weight values and knot multiplicities.
getNurbsFaceVKnots | 2-tuple (List of Real vknots, List of Integer vmultiply) | Integer face | Returns V direction knot weight values and knot multiplicities.
getPlanarFacePositionAndNormal | 2-tuple (vcVector position, vcVector normal), vcVector | Integer face | Returns a planar face position and normal vectors.
getPolyLineCurvePoints | List of vcVector | Integer curve | Returns a list of position vectors for all points in a polyline.
getPoint | vcVector | Integer pointindex | Returns the position vector of a curve end (corner point) at a given index relative to either its curve or face.
getSplineCurveDegree | Integer | Integer curve | Returns the degree of a spline.
getSplineCurveControlPoints | List of vcVector | Integer curve | Returns a list of control points for a face trimming spline.
getSplineCurveControlWeights | List of Real | Integer curve | Returns a list of control weight values for a face trimming spline.
getSplineCurveKnots | 2-tuple (List of Real knots, List of Integer multiplicities) | Integer curve | Returns a list of knot weights and multiplicities for a face trimming spline as an ordered pair.
getSurfaceIntersections | 2-tuple (Integer curve_count, Integer curves_start) | Integer face, vcTriangleSet other_set, Integer other_face, Real approxtol, Real angletol, vcCompactLineSet target | Returns the amount of intersecting curves between two faces in the same vcGeometryContainer object.
isCurveCircular | Boolean | Integer curve_index | Returns True if a curve at a given index in set is circular where start and end points are same; otherwise returns False.
isFaceLinear | 2-tuple (Boolean udir, Boolean vdir) | Integer face | Returns True if a face at a given index in set is linear in parametric UV directions; otherwise returns False.
projectCurve | 2-tuple (Integer curve_count, Integer curves_start) | Integer face, vcCompactLineSet curve, Real approxtol, Real maxdist, Real deviation, vcCompactLineSet targetlineset | Projects a given curve along the shape of a given face based on direction vector of curve.
trimFace Integer Integer face Trims a face at a given index in set using trimming polylines and/or splines.

Returns 1/True if trimming is successful; otherwise returns 0/False.

Notes:

  • Position matrix for curve point.
  • Position matrices for curve points based on step values and min/max limits.
  • Bound box data for face.
  • Face-plane intersection points.


vcTopologyPickCommand

vcTopologyPickCommand provides options for handling the selection and creation of points, lines and curves using the interactiveTopologyPick command.

Inherits: vcCommand

Contents ShowHide

Properties

Events

Examples

Properties

Name | Type | Access | Description
ContinuousMode | Boolean | RW | Turns on/off the use of continuous curve selection in 3D world.
SnapOnCurve | Boolean | RW | Turns on/off the ability to select a curve.
SnapOnCurveLoop | Boolean | RW | Turns on/off the ability to select a curve loop.
SnapOnSurface | Boolean | RW | Turns on/off the ability to select a point on a face.
TargetAvailable | Boolean | R | Indicates if pointing at a valid target.
TargetCurveAvailable | Boolean | R | Indicates if pointing at an available curve.
TargetCurveIndex | Integer | R | Gets the index of an available curve.
TargetCurveLoopAvailable | Boolean | R | Indicates if pointing at an available curve loop.
TargetCurveLoopIndex | Integer | R | Gets the index of an available curve loop.
TargetCurves | List of (vcNode, vcGeometrySet, Integer curveIndex, Boolean curve_direction) | R | Gets a list of curve data for target.
TargetGeoset | vcGeometrySet | R | Gets geometry set of a target.
TargetLocked | Boolean | R | Indicates if target has been selected in 3D world.
TargetNode | vcNode | R | Gets the node containing target.
TargetNormal | vcVector | R | If available, gets surface normal of target.
TargetNormalAvailable | Boolean | R | Indicates if surface normal is available for target.
TargetPosition | vcVector | R | Gets the position vector of target in World coordinate system.
TargetSurfaceAvailable | Boolean | R | Indicates if pointing at an available point on surface.
TargetSurfaceIndex | Integer | R | Gets the index of an available surface.

Events

Name | Parameters | Description
OnTargetAvailable | vcTopologyPickCommand command | Triggered when pointing at an available target. The command itself is passed as an event argument, thereby providing access to updated property values.
OnTargetSet | vcTopologyPickCommand command | Triggered when a valid target has been selected in 3D world. The command itself is passed as an event argument, thereby providing access to updated property values.

Examples

Example. Implement command and continuous selection

from vcScript import *

app = getApplication()
cmd = app.findCommand('interactiveTopologyPick')
cmd.ContinousMode = True
cmd.execute()


vcTranslateCommand

vcTranslateCommand provides options for managing the interactive movement and rotation of selected objects using the interactiveTranslate command.

Inherits: vcCommand, vcInteractiveCommand

Contents ShowHide

Properties

Events

Properties

Name | Type | Access | Description
ParentMatrix | vcMatrix | RW | Defines the origin of command's local coordinate system in 3D world. Generally, this would be the position matrix of a selected object or an desired offset.
UseAbsoluteCoordSystem | Boolean | RW | Turns on/off the use of World coordinate system as opposed to command's local coordinate system.
UseHandles | Boolean | RW | Turns on/off the use of a manipulator.
WorldMatrix | vcMatrix | RW | Defines position matrix of command's origin in 3D world, which can be used to set an initial position and orientation for command execution.
WorldPosition | vcVector | RW | Defines the position vector of command in World coordinate system.

Events

Name | Parameters | Description
OnTranslate | vcCommand command, Enumeration event_type | Triggered when translating an object. (Deprecated) Use OnInteraction event in vcInteractiveCommand.


vcTransport

vcTransport is a protocol for handling transport actions, which usually involves the use of Action Container and Python Script behaviors.

Inherits: vcBehaviour, vcFlow, vcContainer

Contents ShowHide

Methods

Events

Methods

Name Return Type Parameters Description
setTargetInfo None Enumeration availability, vcNode node, vcContainer container, vcMatrix location Sets target information for a transportation action.

The availability argument is used to notify resource of target/pick up container status. See Transportation Constants for more information.

The node or container argument should be used to specify a buffer area.

The location argument is used to specify the location of a delivered component in either node or container.

Events

Name | Parameters | Description
OnTransportInfo | vcComponent component | Triggered when protocol requests transport details about a component.


vcTransportController

vcTransportController is a base class for transport controllers, which implement transport of product instances over transport links. The system conveyor transport controller uses the generic vcTransportController.

Note: When implementing your own transport controller, use vcPythonTransportController.

Inherits: vcBehaviour

Type constants: VC_TRANSPORTCONTROLLER, VC_CONVEYORTRANSPORTCONTROLLER

Properties

Name | Type | Access | Description
IsSystem | Boolean | R | True if this controller is part of the application.


vcTransportLink

Transport link is a single-directional logical connection between two transport nodes that defines navigability and transportation parameters for a specific flow group of products. Each link has to be associated with a vcTransportController that implements the link and can add its own custom properties to it.

Transport links are owned by a vcTransportSystem and thus are created and deleted through its methods.

For easier tracking of transport graph navigability changes, only the Implementer can be changed after the link has been created. To change the other properties of a transport link user needs to create a copy and delete the original instead. Any dynamically created properties can be edited at will, but adding and removing properties is usually only done by the implementing transport controller.

Properties

Name | Type | Access | Description
Source | vcTransportNode | R | The transport node to start moving from.
Destination | vcTransportNode | R | The destination transport node.
Implementer | vcTransportController | RW | The controller that will take care of moving the product through this link. Note that when reassigning the implementer, the transport controllers usually modify the link’s properties immediately in event handlers.
SupportedGroup | vcProcessFlowGroup | R | Only product types belonging to this flow group can travel through this link.
Properties | List of vcProperty | R | Gets the properties that have vcProperty implementation.

Methods

Name | Return Type | Parameters | Description
createProperty | vcProperty | vcProperty property | Creates a new dynamic property to this transport link.
getProperty | vcProperty | String propertyName | Returns a property from this transport link.
deleteProperty | None | vcProperty property | Deletes a property from this transport link.

Examples

Example. Reset transport time to 10s for all.

# transport links using interpolation.
from vcScript import *
sim = getSimulation()
tsystem = sim.ProcessController.TransportSystem
# Get interpolating controller
icontroller = None
for controller in tsystem.Controllers:
if controller.Type == VC_INTERPOLATINGTRANSPORTCONTROLLER:
icontroller = controller
break
# Change links
for link in tsystem.Links:
prop = link.getProperty('TransportTime')
if link.Implementer == icontroller and prop:
prop.Value = 10.0


vcTransportNode

Defines a logical place where product instances can be transported to and from. Each transport node has to be assigned a component container, but can also be connected to a vcMotionPath as a sensor. When connected as a sensor, the node will grab arriving products from the path to its component container and can similarly place leaving components to the connected path.

Inherits: vcBehaviour

Type constant: VC_TRANSPORTNODE

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
TransportSystem | vcTransportSystem | R | The associated transport system.
TransportLinks | List of vcTransportLink | R | The transportLinks coming into, and going out from, this node.
ProcessExecutor vcProcessExecutor R

The associated process executor.

This property is read only; it’s value can be changed by setting the TransportNode property on a ProcessExecutor.

(Deprecated) Should not assume 1 to 1 mapping between process executors and transport nodes and thus this property may get removed.
ComponentContainer vcContainer RW

The component container this node monitors for arriving products.

Using other than vcComponentContainer may cause issues.
VisualPositionFrame | vcFrameFeature | RW | Defines visualization position of the node. The frame feature must be in the same component as this transport node behavior.
VisualPosition | vcMatrix | R | Visualization position of this node in world coordinates.
DefaultProductPositionFrame | vcFrameFeature | RW | The default position for products.
DefaultResourcePositionFrame | vcFrameFeature | RW | The default position for resources.
Frame vcFrameFeature RW

Only used when connected to a path as sensor.

Defines the Frame feature referenced as the sensor's physical location.
ResetAt Enumeration integer RW

Only used when connected to a path as sensor.

Defines the mode for resetting the sensor.

See Path Constants for more information.
TriggerAt Enumeration integer RW

Only used when connected to a path as sensor.

Defines the mode for triggering the sensor.

See Path Constants for more information.

Methods

Name | Return Type | Parameters | Description
createTransportTarget | vcTransportTarget | vcProduct product | Creates a new transport target object for this node and assigns it for the given product instance. The target is created with the default values of this transport node. Replaces any existing transport target assigned to the given product in this node. Note that the node automatically deletes any transport targets when they are no longer needed.
getTransportTarget | vcTransportTarget | vcProduct product | Gets transport target in this node assigned for a given product instance. Returns None if a target is not defined. Note that the node automatically deletes any transport targets when they are no longer needed.
deleteTransportTarget | None | vcProduct product | Deletes a transport target assigned for a given product instance. Note that the default transport target is used if a product instance doesn’t have a specific target defined.
beginTransportOut | None | vcProduct product | Begin the process of transporting the given product through its transport solution. Note that transport is asynchronous i.e. the product won’t leave immediately.

Events

Name Parameters Description
OnProductArriving vcProduct product, vcTransportLink link, vcEventReturnData eventData

This event is raised when a product instance arrives to this node.

Link is the link that the product arrived to this node from.

The listener should check that eventData.Handled is False before performing any operations on this product, and should set eventData.Handled to True (it was False originally) if the listener accepted this product and handled it.

If no Python listeners set Handled to True, the product will be handled by internal logic, which includes allowing process statements to receive it.
OnProductLeaving vcProduct product, vcTransportLink link

This event is raised when the product leaves in this transport node.

Link is the link that the product left towards and can be None if the product doesn’t have a transport solution or the solution doesn’t have a transport link going out from this transport node.

Examples

Example. Change machine's material to red when it gets a product.

# When product leaves change material back to white.
from vcScript import *
app = getApplication()
mat_red = app.findMaterial('red')
mat_white = app.findMaterial('white')
comp = getComponent()
process = comp.findBehavioursByType(VC_PROCESSEXECUTOR)[0]
tnode = process.TransportNode
def OnReset():
comp.Material = mat_white
def product_in(product, link, event_data):
comp.Material = mat_red
def product_out(product, link):
comp.Material = mat_white
tnode.OnProductArriving = product_in
tnode.OnProductLeaving = product_out


vcTransportTarget

A transport target defines where a product instance is to be physically placed when it arrives to a transport node (vcTransportNode). This information is used by the transport controllers.

Properties

Name | Type | Access | Description
ProductPosition | vcMatrix | RW | Target position where a product should be placed to. This matrix is in world coordinates and denotes the target position and orientation of the product, not its component. The difference between these is the offset defined in corresponding vcProductType.
ResourcePosition | vcMatrix | RW | Hint for a desired resource location while it is placing the product instance to the ProductPosition. Expressed in world coordinates.


vcTransportSolution

Transport solution is a single route from one transport node (vcTransportNode) to another transport node without any branches or loops. The transport solutions are enforced to be valid when they are created or modified. The solution consists of an ordered list of transport link references (vcTransportLink), starting from the Source node and ending to the Destination node.

Note: A valid transport solution conforms to these rules:

• Transport solution can be empty i.e. contain no links. Using empty solutions is not recommended. Set the vcProduct.TransportSolution to None instead.

• Each transport link’s Source node is the same as the previous link’s Destination node (must form a continuous one-directional path)

• No two links have the same Source node (cannot contain branches)

• No two links have the same Destination node (cannot contain joins or loops)

• The Source and Destination nodes of the whole solution cannot be the same (cannot be a loop).

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
Source | vcTransportNode | R | The transport node this route starts from. Returns None if the solution is empty.
Destination | vcTransportNode | R | The transport node this route ends to. Returns None if the solution is empty.
Links | List of vcTransportLink | R | The list of transport links that need to be travelled to get from the Source node to the Destination node, starting from Source.

Methods

Name | Return Type | Parameters | Description
getNextLink vcTransportLink vcTransportNode

Returns the transport link (there can be only one) that has the given transport node as its Source.

Returns None if such link doesn’t exist in the solution i.e. the route doesn’t start from or pass through that transport node.
replaceLinks | None | List of vcTransportLink | Replaces the route with given links. If the given links do not form a valid transport solution, an error is raised and the previous route is preserved.

Events

Name Parameters Description
OnSolutionInvalidated

vcTransportSolution solution

Triggered when any of the transport links in this solution has been deleted from the transport system, which would make the solution either invalid or change its ends.

Note: All transport links are removed from the solution before this event is triggered. The solution parameter is always this transport solution instance.

Examples

Example. Event handler when a product arrives to node.

from vcScript import *
sim = getSimulation()
process_controller = sim.ProcessController
transport_system = process_controller.TransportSystem
nodes = transport_system.Nodes
node = nodes[1]
# Event handler when a product arrives to node
def product_arrived_handler(product, link, event_data):
print product.ProductType.Name, 'arrived to', link.Destination.Parent.Name

source_name = product.TransportSolution.Source.Parent.Name
destination_name = product.TransportSolution.Destination.Parent.Name
print 'The products current Transport Solution is from', source_name, 'to', destination_name

next_link = product.TransportSolution.getNextLink(node)
if next_link:
print 'The next Transport Link for this Transport Solution is', next_link
else:
print 'This Transport Solution does not have any more links'
node.OnProductArriving = product_arrived_handler


vcTransportSystem

Transport system is a management and query service for vcTransportNode and vcTransportLink objects that form a transportation graph. It is owned by a vcProcessController.

Contents ShowHide

Properties

Methods

Events

Examples

Properties

Name | Type | Access | Description
ProcessController | vcProcessController | R | Parent controller that owns this system.
Nodes | List of vcTransportNode | R | Gets all transport nodes associated with this system.
Links | List of vcTransportLink | R | Gets all transport links owned by this system.
Controllers | List of vcTransportController | R | Gets all available transport controllers. Includes both system and user-implemented controllers.

Methods

Name | Return Type | Parameters | Description
createTransportLink | vcTransportLink | vcTransportNode source, vcTransportNode destination, vcTransportController implementer, vcProcessFlowGroup group | Creates a new transport link from source to destination node and registers it to the system. Source and destination have to be in this transport system and cannot be the same.
deleteTransportLink | None | vcTransportLink link | Removes the given link from this system and deletes it.
createTransportSolution | vcTransportSolution | - | Creates an empty transport solution.
findSolution | vcTransportSolution | vcTransportNode source, vcTransportNode destination, vcProcessFlowGroup flowGroup | Tries to find a valid route from source to destination, only considers links that support the given flow group. The route isn’t optimized. Returns None if a valid route doesn’t exist.
findAllLinksBetweenNodeSets | List of vcTransportLink | vcTransportNode[] sourceNodes, vcTransportNode[] destinationNodes, vcProcessFlowGroup group | Finds a set containing all links that are part of any valid path from any node in sourceNodes set to any node in the destinationNodes set. This can be used to e.g. check navigability between all implementations of two processes. The source and destination node sets can overlap. Only considers transport links that support the given flow group.

Events

Name | Parameters | Description
OnTransportControllerAdded | vcTransportController controller | Event that occurs when a new transport controller has become available.
OnTransportControllerRemoving | vcTransportController controller | Event that occurs when a transport controller is being removed.
OnTransportNodeAdded | vcTransportNode node | Event that occurs when a new transport node has been added to this system.
OnTransportNodeRemoving | vcTransportNode node | Event that occurs when the transport node is being removed from this system.
OnTransportLinkAdded | vcTransportLink link | Event that occurs when a new transport link has been created to this system.
OnTransportLinkRemoving | vcTransportLink link | Event that occurs when a transport link is being deleted.
OnTransportLinkRemoved | vcProcessFlowGroup group, vcTransportNode source, vcTransportNode destination | Event that occurs when a transport link has been deleted.

Examples

Example. Create a new Transport Link.

from vcScript import *
app = getApplication()
sim = getSimulation()
process_controller = sim.ProcessController
transport_system = process_controller.TransportSystem
nodes = transport_system.Nodes
for n in nodes:
print n.Parent.Name
# Get the handle for human transport controller
human_transport_controller = app.findComponent('Human Transport Controller')
human_tc = human_transport_controller.findBehavioursByType(VC_PYTHONTRANSPORTCONTROLLER)[0]
# Get the handle for product flow groups
flow_grp_mgr = process_controller.FlowGroupManager
flow_groups = flow_grp_mgr.Groups
flow_group1 = flow_groups[0]
# Create a new Transport Link
new_link = transport_system.createTransportLink(nodes[0], nodes[-1], human_tc, flow_group1)
# Event handler when a Transport Link is removed
def link_removed_handler(link):
print 'Transport link removed between', link.Source.Parent.Name, 'and', link.Destination.Parent.Name
transport_system.OnTransportLinkRemoving = link_removed_handler


vcTriangleSet

vcTriangleSet is a geometry set used for creating and storing a collection of triangles and tessellated surface data.

Inherits: vcGeometrySet

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
CreaseAngle | Real | RW | Defines angle tolerance for triangle edge shading in which edge angles less than tolerance are rendered as smooth surfaces during light calculations.
DynamicTextureCoordinates1 | Boolean | RW | Defines if texture coordinates of set can be updated during simulation.
DynamicUpdate | Boolean | RW | Defines if geometry of set can be updated during simulation.
Name | String | RW | Defines the name of set.
PointCount | Integer | R | Gets the total number of points in set.
PolygonCount | Integer | R | Gets the total number of triangles in set.
PolygonTable List of Integer RW Defines a polygon table in the form of an ordered list used for generating triangles of set.

In order to generate triangles, the vertex count of polygon is given first followed by the index for each vertex and so on for each subsequent polygon. For example, [3,0,1,2,3,0,2,3] would define two polygons with each having three vertices in which two are shared. Any polygon with four or more vertices will be tessellated.

The actual positions of vertices are defined in PositionTable.

See Example. Use polygon table to generate triangles for more information.
PositionTable List of Real RW Defines a position table in the form of an ordered list used for generating triangles of set.

In order to generate triangles, position values should have a known index and be in XYZ order. For example, [123.0,45.0,4.5,15.0,45.0,90.0] would define the position of two points which are aligned on Y-axis.

If the number of entries is not enough for all points in set, those points will be deleted from set as a clean up operation.

If number is more than is needed for points, additional points are created in set.
TextureCoordinateTable List of Real RW Gets/Sets texture coordinates for points in set.

f the number of entries is not enough for all points in set, those points will be deleted from set as a clean up operation.

If number is more than is needed for points, additional points are created in set.
Topology | vcTopology | R | Gets the container of topology data for points in set.
TriangleCount | Integer | R | Gets the total number of triangles in set.
TriangleTable | List of Integer | RW | Gets/Sets the triangle table of set, which is an ordered list of vertex indices for each triangle.
UseTextureCoordinates1 | Boolean | RW | Turns on/off the use of texture coordinates in set.

Methods

Name | Return Type | Parameters | Description
addPoint Integer vcVector vector

or

Real x, Real y, Real z

 Adds a point to set, and then returns index of point in set.
addTriangle Integer Integer vertex1, Integer vertex2, Integer vertex3 Adds a triangle to set, and then returns new triangle count of set.

See Example. Create sphere with triangle sets for more information.
collapsePoint None Integer indexPoint1, Integer indexPoint2 Collapses a point at a given index into another point at a given index in set, thereby updating triangles referencing first point to now reference second point.

Generally, this is used to clean up redundant vertices, reduce data count or simplify geometry.
convexHull vcTriangleSet Boolean value Creates a convex hull from geometry of set.

If value is True, returns a new triangle set containing the resultant geometry.

If value is False, modifies the current geometry of set and returns the same set.
decimate | Real | Real quality, Real maxError | Simplifies triangles of set by merging points within a given maxError tolerance until a given quality level is achieved or tolerance is exceeded.
decompose | None | None | Regroups triangles in set into different sets based on the connection of each triangle to one another.
deleteTriangle None Integer index Deletes a triangle at a given index in set.

You should call the update() method after deleting one or more triangles from set.
getClosestPointAndNormal | 2-tuple (vcVector point, vcVector normal) | vcVector referencePoint | Returns the closest point to a given referencePoint in the set. The object coordinate system of the set is used to find the point, which is returned along with its surface normal.
getTexCoord1 | 2-tuple (Real u, Real v) | Integer index | Returns the texture coordinates of a point at a given index in set.
getTextureCoordinates | List of 2-tuple (Real u, Real v) | List of Integer indices | Returns a list containing an ordered pair of UV coordinates for points at given indices in set.
getPoint | vcVector | Integer index | Returns the position vector of point at a given index in set.
getPointIndexesWithin List of Integer vcVector position, Real side_length

or

vcVector position, Real side_length, vcVector normal

 Returns a list of indices for points in set within an area defined by a given position and side_length.

A normal argument can be given to filter points with the same surface normal.

See Example. Get position of points for more information.
getPointNormals List of vcVector List of Integer indices

or

List of Integer indices, vcMatrix convert

 Returns a list of surface normal vectors for points at a given list of indices in set.

A convert argument can be used to transform each vector by a given matrix.
getPointPositions List of vcVector List of Integer indices

or

List of Integer indices, vcMatrix convert

 Returns a list of position vectors for points at a given list of indices in set.

A convert argument can be used to transform each vector by a given matrix.
getTriangle | 3-tuple (Integer vertex1, Integer vertex2, Integer vertex3) | Integer index | Returns the indices of vertices for a triangle at a given index in set.

getTriangleEdgeNeighbor

2-tuple (Integer triangle_index, Integer vertex_index)

Integer index, Integer vertex

Returns the index of a triangle neighboring another triangle at a given index and vertex in set.

The vertex argument should be either 0, 1 or 2.

The returned value is an ordered pair identifying neighboring triangle and shared vertex in set.

getTriangleEdgeType

Enumeration

Integer index, Integer vertex

Returns the type of edge for a triangle at a given index and vertex in set.

The vertex argument should be either 0, 1 or 2.

The returned type is one of seven possibilities:

0 = UNKOWN
Type is unknown.

1 = LINE
No triangle attached to edge.

2 = CO_PLANAR
Two triangles attached to edge and their surface normals are parallel.

3 = SOFT
Two triangles attached to edge and angle between surface normals is within angle tolerance of set, that is smooth surface.

4 = HARD
Two triangles attached to edge and angle between surface normals is outside angle tolerance of set, that is coarse surface.

5 = BOUNDARY
One triangle attached to edge.

6 = NON_MANIFOLD
More than two triangles attached to edge.

getTriangleNormal

vcVector

Integer index

Returns the surface normal of a triangle at a given index in set.

mergePoints

None

Real tolerance

or

Real tolerance, Boolean onlyBoundaryPoints

Merges points of triangles within a given tolerance that are not connected to one another by adding lines.

A onlyBoundaryPoints argument can be used to only merge points that border one another and that are within the given tolerance.

setPoint

None

Integer index, vcVector vector

Sets the position vector of a point at a given index in set.

setTexCoord1

None

Integer index, Real u, Real v

Sets the texture coordinates of a point at a given index in set.
setTextureCoordinates | None | List of Integer indices, List of 2-tuple (Real u, Real v) | Sets the texture coordinates of points at a given list of indices in set.

setTriangle

None

Integer index, Integer vertex1, Integer vertex2, Integer vertex3

Sets the vertex indices of a triangle at a given index in set.

subdivide

None

Real max_edge_length

or

Real max_edge_length, Integer max_triangles

Modifies triangles in set into smaller triangles with edge lengths smaller or equal to a given max_edge_length.

A max_triangles argument can be given to stop subdivision when triangle count reaches a maximum limit.

update

None

None

Updates the set and its bound box.

Examples

Example. Use a polygon table to generate triangles

from vcCommand import *

def first_state():
app = getApplication()
comp = app.createComponent()
feat = comp.RootFeature.createFeature(VC_GEOMETRY,'Geometry')
tset = feat.Geometry.createGeometrySet(VC_TRIANGLESET)
tset.PositionTable = [0.0,0.0,0.0,100.0,0.0,0.0,100.0,100.0,0.0,0.0,100.0,0.0]

#Uncomment any of the three following lines to product the same result

#tset.TriangleTable = [0,1,2,0,2,3]
#tset.PolygonTable = [3,0,1,2,3,0,2,3]
#tset.PolygonTable = [4,0,1,2,3]
tset.update()
feat.rebuild()
comp.rebuild()
app.render()

#------------------------------------------------------------------------------
addState( first_state )
#------------------------------------------------------------------------------

Example. Get position of points within an area filtered by direction

Clear cube and position frame are used to represent the area defined in getPointIndexesWithin() method with position and radius.

from vcScript import *
import vcVector

#create block and collapse to quickly create triangle set
comp = getComponent()
gf = comp.findFeature('Geometry')
if gf == None:
gf = comp.RootFeature.createFeature(VC_BLOCK, 'Geometry')
gf.collapse()

#get triangle set
gc = gf.Geometry
tset = gc.GeometrySets[0]

#use PositionTable to get position of every point in TriangleSet
tset_points = tset.PositionTable

#use position and radius to get position of points within area
position = vcVector.new(50,100,100)
point_index = tset.getPointIndexesWithin(position, 50.0)
point_positions = tset.getPointPositions(point_index)
print point_index

#get point normals to filter
point_normals = tset.getPointNormals(tset.TriangleTable)
for i in range(len(point_normals)):
for filter in point_normals:
point_index = tset.getPointIndexesWithin(position, 50.0, filter)
print point_index

Example. Create sphere with triangle sets

from vcScript import *
import vcVector
import vcMatrix

r = vcVector.new(100.0,0.0,0.0) # Radius of the sphere is 100.0
m = vcMatrix.new()

geofeat = getComponent().RootFeature.createFeature(VC_GEOMETRY,'MyGeometry')
tset = geofeat.Geometry.createGeometrySet(VC_TRIANGLESET)

for i in range(0,361,15): # Step every 15 degrees around Z (first and last coincident)
for j in range(90,-91,-15): # Half circle in 12 sections around Y,
# starting from south pole
m.identity() # always reset the origin before rotate
m.rotateRelZ(i)
m.rotateRelY(j)
p = m * r # transform the radius vector with reoriented origin
tset.addPoint(p)

for i in range(26): # i is the section around Z (12 in each)
for j in range(12): # is around the rotating y axis
tset.addTriangle(i*12+j,(i+1)*12+j,(i+1)*12+j+1)
tset.addTriangle(i*12+j+1,i*12+j,(i+1)*12+j+1)

geofeat.rebuild()
getApplication().render()

Example. Access geometry and polygon data

from vcScript import *

comp = getComponent()
geoFea = comp.findFeature("Geometry")
geoCont = geoFea.Geometry
for i in geoCont.GeometrySets:
print i.PolygonTable
print i.PolygonCount
print i.PointCount


vcUnit

vcUnit represents a single unit of measurement complete with a name, suffix and properties for describing linear mapping between canonical and unit values.

Contents ShowHide

Unit Conversion

Properties

Methods

Examples

Unit Conversion

The conversion between canonical and unit values is as follows:

  • Canonical value to Unit value
    UnitValue := (Canonical - Offset) / Factor
  • Unit value to Canonical value
    CanonicalValue := UnitValue * Factor + Offset

Properties

Name | Type | Access | Description
Factor | Real | RW/R | If unit is built-in, gets conversion factor; otherwise defines conversion factor. That is, the size of unit in canonical units which must be larger than zero.
Group | vcUnitGroup | R | Gets the unit group of unit, which is defined at the time of unit creation.
IsBuiltIn | Boolean | R | Indicates if unit is built-in.
Name | String | RW/R | If unit is built-in, gets the unit's name; otherwise defines the name of unit.
Offset | Real | RW/R | If unit is built-in, gets zero-point offset; otherwise defines the canonical value at which the unit value is zero.
Suffix | String | RW/R | If built-in, gets unit's suffix; otherwise defines the suffix of unit , which is displayed in GUI with property values.

Methods

Name | Return Type | Parameters | Description
convertFromCanonical | Real | Real value | Converts a given canonical value to a unit value, and then returns the unit value.
convertToCanonical | Real | Real value | Converts a given unit value to a canonical value, and then returns the canonical value.
getConstantExpression | String | Real value | Converts a given canonical value to a unit value, and then returns an expression of unit value with an appended unit specification.
getRelativeMagnitude | Real | Real magnitude | Returns the size of unit in relation to a given magnitude using a logarithm of unit factor and a given magnitude which must be greater than zero.

Examples

Example. Convert unit values

from vcScript import *

def OnRun():
comp = getComponent()
prop = comp.getProperty("Temperature")
unit = prop.Unit

#convert to unit value
unit_value = (prop.Value - unit.Offset)*unit.Factor

#convert unit to canonical value
canonical_value = unit_value * unit.Factor + unit.Offset
print canonical_value


vcUnitFamily

vcUnitFamily is a collection of units that belong to the same system of measurements. This unit family concept is not a strict definition rather a way to simplify unit selection

Contents ShowHide

Usage

Properties

Methods

Usage

A unit family contains any number of unit groups, which are collections of related units. When a unit family is selected, each of its unit groups become the current groups for quantities. This eliminates the need to manually change each quantity when changing the active unit family of application as well as preserving selected units in quantities.

Properties

Name | Type | Access | Description
Groups | List of vcUnitGroup | R | Gets a list of all unit groups in unit family.
IsBuiltIn | Boolean | R | Indicates if unit family is a built-in type. If True, adding and removing custom unit groups from unit family is allowed but not for built-in unit groups.
Name | String | RW/R | If unit family is built-in, gets the unit family's name; otherwise defines the name of unit family which cannot contain any dot (.) characters.

Methods

Name | Return Type | Parameters | Description
addGroup | Integer | vcUnitGroup group or String groupName | Adds a given unit group or one matching a given name to unit family, and then returns the index of unit group in unit family.
containsGroup | Boolean | vcUnitGroup group or String groupName | Returns True if a given unit group or one matching a given name is in the unit family; otherwise returns False.
removeGroup | Boolean | vcUnitGroup group or String groupName | Removes a given unit group or one matching a given name from unit family. Returns True if removal is successful; otherwise returns False if name does not match a unit group or throws an exception if unit group is built-in.
removeGroupAt | None | Integer index | Removes a unit group at a given index from unit family. This method throws an exception if unit group is built-in.


vcUnitGroup

vcUnitGroup represents a group of units that apply to the same quantity and belong to the same unit family, thereby allowing you to create and delete vcUnit objects.

Contents ShowHide

Properties

Methods

Properties

Name | Type | Access | Description
IsBuiltIn | Boolean | R | Indicates if unit group is a built-in group.
Name | String | RW/R | If unit group is built-in, gets the unit group's name; otherwise defines the name of unit group which cannot contain any dot (.) characters.
Quantity | vcScalarQuantity | R | Gets the quantity referencing unit group.
Units | List of vcUnit | R | Gets a list of all units in unit group.

Methods

Name | Return Type | Parameters | Description
createUnit | Integer | String name, String suffix | If not a built-in unit group, adds a new unit of a given name and suffix to unit group, and then returns the index of new unit in unit group. If built-in unit group, throws an exception.
deleteUnitAt | None | Integer index | If not a built-in unit group, removes a unit at a given index in unit group. If built-in unit group, throws an exception.
getUnitWithMagnitude | vcUnit | Real magnitude | Returns a unit in unit group that best matches a given magnitude.


vcVector

vcVector is a 4x1 column vector and is generally used to define joint lengths in robots, offsets and directions, and angles of rotation.

Contents ShowHide

Constructors

Operators

Properties

Methods

Examples

Constructors

Name | Return Type | Parameters | Description
new | vcVector | vcVector vector or Real x, Real y, Real z or Real x, Real y, Real z, Real w or [no argument] | Creates a new vcVector object. One option allows you to give an existing vector, thereby creating a copy. A second option allows you to give three components for new vector. A third option allows you to give four components for new vector. A fourth option allows you to give no arguments, thereby creating a zero vector.

Operators

Name | Description
* | Allows you to get the dot product of vectors.
^ | Allows you to get the cross product of vectors.
+ | Allows you to add vectors.
- | Allows you to subtract vectors.

Properties

Name | Type | Access | Description
W | Real | RW | Defines w-component (fourth element) of vector.
X | Real | RW | Defines x-component (first element) of vector.
Y | Real | RW | Defines y-component (second element) of vector.
Z | Real | RW | Defines z-component (third element) of vector.

Methods

Name | Return Type | Parameters | Description
angle | Real | vcVector vector | Returns the angle (in radians) between vector and a given vector.
getQuaternionAngle | vcVector | vcVector vector | Returns the quaternion angle between vector and a given vector.
length | Real | None | Returns the magnitude (length) of vector.
normalize | None | None | Normalizes vector.
square | Real | None | Returns the square of vector.

Examples

Example. Relocate component using position vector

from vcScript import *
import vcVector

comp = getComponent()
vec = vcVector.new(100.0,200.0,300.0) # creates a new vcVector object
m = comp.PositionMatrix

m.P = vec # assign the vector to position vector for matrix
comp.PositionMatrix = m
getApplication().render()


vcVectorQuantity

vcVectorQuantity extends vcScalarQuantity to support vector quantities.

Inherits: vcScalarQuantity

Usage

A vector quantity can be one of two types: Cartesian and angular vector. Velocity and displacement are Cartesian vector quantities, whereas angular momentum and torque are angular vector quantities. Some Cartesian types can be paired with their corresponding angular equivalents, and then used in matrices. For example, distance and angle values can be formed into a position matrix in which distance units define position and angle units define orientation.

Properties

Name | Type | Access | Description
IsAngular | Boolean | RW/R | Defines if vector quantity is angular or Cartesian type. If quantity is built-in, you can only get value.
Pair | vcVectorQuantity | RW/R | Defines a vector quantity paired with the quantity in order to be used as matrix properties. If IsAngular is set to True, pair must be a Cartesian vector quantity; otherwise the pair must be an angular vector quantity. If quantity is built-in, you can only get value.
VectorName | String | RW | Defines an alternative name for quantity instead of its inherited Name property. If value is None or empty string, quantity uses its inherited Name property.


vcView

vcView provides access to 3D views created in application.

Properties

Name | Type | Access | Description
CameraFar | Real | RW | Defines the distance of far clipping plane from camera location.
CameraFovy | Real | RW | Defines the field of view (in degrees) for camera.
CameraIsOrtho | Boolean | RW | Turns on/off orthographic mode in camera.
CameraMatrix | vcMatrix | RW | Defines the location of camera in World coordinate system.
CameraNear | Real | RW | Defines the distance of near clipping plane from camera location.
Flags | Integer | RW | Defines if camera, light and shading settings are stored in view. 0 Include none. 1 Include camera. 2 Include lights. 3 Include camera and lights. 4 Include shading. 5 Include camera and shading. 6 Include lights and shading. 7 Include camera, lights and shading.
Properties | List of vcProperty | R | Gets a list of all properties for view.
ShadingEdge | Integer | RW | Defines the shading mode of view. 0 No edges. 1 All edges. 2 Hard edges. 3 Silhouette edges (Currently not implemented). 4 Edge analysis.
ShadingRender | Integer | RW | Defines rendering mode of view. 0 No rendering. 1 Bounding boxes. 2 No filling. 3 Background. 4 Constant filling (Currently not implemented). 5 Flat shaded. 6 Smooth shaded.


vcViewAnimation

vcViewAnimation is a layout item used for animating camera movements during a simulation.

Inherits: vcLayoutItem

Contents ShowHide

How It Works

Properties

Methods

Examples

How It Works

vcViewAnimation executes a program of camera movements. The structure of the program is similar to a robot program, containing routines with each routine containing a scope of statements.

vcProgram

vcScope

vcRoutine

vcStatement

By default, the Main routine of the program is executed at the start of simulation. A simple program would contain View and Delay statements.

A View statement specifies a 3D world view and transition. The 3D world view refers to a view available in the scene by name. If the view does not exist, the statement will still execute its transition as a delay. The transition defines how long it takes the 3D world camera to reach a view. For example, a transition of 0 seconds would snap the 3D world camera to a view.

Generally, a Delay statement is used to keep the 3D world camera stationary until the camera transitions to the next view.

Properties

Name | Type | Access | Description
Program | vcProgram | R | Gets the program of animator.

Methods

Name | Return Type | Parameters | Description
getProgram | vcProgram | None | Returns the program of animator.

Examples

Example. Create program for animating 3D world camera

from vcScript import *

def createViewAnimation():
app = getApplication()

#get the view animator
item = app.findLayoutItem("ViewAnimation")
if not item:
item = app.createLayoutItem("ViewAnimation")

#get the program executed by animator and clear its Main routine
prog = item.Program
routine = prog.MainRoutine
routine.clear()

#add view statements
#the view must exist in layout
#otherwise you will need to create it using either View Editor in GUI or API
#get vcApplication.Views to handle a list of user views

vs = routine.addStatement(VC_STATEMENT_VIEW)
vs.Delay = 4.0
vs.View = "View1"

#add delay to wait until next camera movement
vs = routine.addStatement(VC_STATEMENT_DELAY)
vs.Delay = 4.0
vs = routine.addStatement(VC_STATEMENT_VIEW)
vs.Delay = 4.0
vs.View = "View2"

createViewAnimation()


vcVREvents

vcVREvents is used together with Visual Components Experience for interactive Virtual Reality (VR) applications.

Contents ShowHide

How It Works

Properties

Methods

Events

Examples

How It Works

VRStreaming must be enabled in the configuration file.

Properties

Name | Type | Access | Description
Buttons List of Integer R

- Index 0: a bitmask for pressed buttons, first 32 bits (see ulButtonPressed )

- Index 1: see above, last 32 bits

- Index 2: a bitmask for touched buttons, first 32 bits (see ulButtonTouched )

- Index 3: see above, last 32 bits
ClientId | Integer | R | a number identifying which client sent the data that is currently stored in the VREvents object
DeviceInputs List of Dictionaries R

a list of dictionaries, where each dictionary contains the following key-value pairs

- key: "DeviceRole", value: string, "LeftHanded"/"RightHanded"

- key: "Axis2DInputs", value: dict<string, Tuple<float, float>>, 2D inputs (e.g. touchpad)

- key: "AxisInputs", value: dict<string, float>, 1D inputs (e.g. trigger)

- key: "ButtonInputs", value: dict<string, bool>, digital (0/1) button inputs

Note: in all input dictionaries the key value is a string value identifying the input type

(see InputFeatureUsage column in Unity XR input mappings)
DeviceModel | String | R | The model of the connected VR device
Directions List of vcVector R

- Index 0: right controller - forward

- Index 1: right controller - right

- Index 2: left controller - forward

- Index 3: left controller - right

- Index 4: HMD - forward

- Index 5: HMD - right

Note: the up vector can be computed as the crossproduct of the right and forward vector
EventCounter | Integer | R | The number of events processed by the server
EventsEnabled | Boolean | RW | Enable/disable the events
MaxUpdateRate | Integer | RW | Defines the maximum update rate
OneMeterLength | Real | RW | Defines the scale of the units used in Experience. For example, when the value is 1000.0, one meter in Experience is 1000 units in simulation.
Position List of vcVector R

- Index 0: right controller position

- Index 1: left controller position

- Index 2: Head-mounted device (HMD) position
RealEventCounter | Integer | R | Number of events sent by the client

RoomCenter

 vcVector R The physical location of the room
Times List of Real R

- Index 0: time as reported by Experience

- Index 1: delta from the last message sent by Experience

- Index 2: delta from the last update (basically the frametime in Experience)

- Index 3: VR event updates skipped before the last update (the client skips sending updates according to the MaxUpdateRate and also if the server is still processing a certain number of old messages)

- Index 4: VR event updates skipped in total
Touches List of vcVector R

- Index 0: Vector (touchpad x-axis, touchpad y-axis, touchpad is pressed (0.0/1.0)) (right controller)

- Index 1: Vector (??? x-axis, ??? y-axis, 0.0) (right controller, device-specific)

- Index 2: Vector (trigger value, has teleported (0.0/1.0), trigger pressed (0.0/1.0)) (right controller)

Methods

Name | Return Type | Parameters | Description
toggleAction | None | Integer clientId, String action, Boolean value | Makes it possible to enable or disable certain VR actions in Visual Components Experience. The clientId argument is the ClientId received through the VREvents object. The action argument defines the action to be enabled or disabled. Teleport toggles the user's ability to teleport, Elevator toggles the user's ability to use the built-in elevator platform Pause toggles the user's ability to pause and resume the simulation within Experience. The value argument denotes whether the action is enabled (True) or disabled (False).

Events

Name | Parameters | Description
OnVREvents | None | Called when a VR event has been received and the data in the VREvents object has been updated.

Examples

Example. Print the info for VREvents

from vcScript import *

app = getApplication()
vrevents = getApplication().VREvents
last_update = getApplication().RealTime
processed_count = 0

def OnVREvents():
global last_update, processed_count, vrevents, app
if app.RealTime - last_update > 1.0:
last_update = app.RealTime

onemeter = vrevents.OneMeterLength
physical_room_center = vrevents.RoomCenter
helmet_pos = vrevents.Positions[2]
helmet_dir = vrevents.Directions[2*2 + 0]
right_controller_pos = vrevents.Positions[0]
right_controller_dir = vrevents.Directions[0*2 + 0]
axis1 = vrevents.Touches[0]
axis2 = vrevents.Touches[1]
axis3 = vrevents.Touches[2]

print "VREvents: TIMING: ", processed_count, vrevents.Times[0], vrevents.Times[1], vrevents.Times[2], vrevents.Times[3], vrevents.Times[4]
print "VREvents: ROOM INFO: ", physical_room_center.X, physical_room_center.Y, physical_room_center.Z, ", OneMeter:", onemeter
print "VREvents: HELMET:", helmet_pos.X, helmet_pos.Y, helmet_pos.Z, helmet_dir.X, helmet_dir.Y, helmet_dir.Z
print "VREvents: CONTROLLER:", right_controller_pos.X, right_controller_pos.Y, right_controller_pos.Z, right_controller_dir.X, right_controller_dir.Y, right_controller_dir.Z
print "VREvents: AXIS1:", axis1.X, axis1.Y, axis1.Z
print "VREvents: AXIS2:", axis2.X, axis2.Y, axis2.Z
print "VREvents: AXIS3:", axis3.X, axis3.Y, axis3.Z
print "VREvents: BUTTONS: ", vrevents.Buttons[0], vrevents.Buttons[1], vrevents.Buttons[2], vrevents.Buttons[3]

print "---------------------------------------"
print "Device model:", vrevents.DeviceModel
print "Client ID:", vrevents.ClientId

for di in vrevents.DeviceInputs:
print "---------------------------------------"
print "Device role:", di["DeviceRole"]
for name, value in di["Axis2DInputs"].iteritems():
print "Input:", name, value
for name, value in di["AxisInputs"].iteritems():
print "Input:", name, value
for name, value in di["ButtonInputs"].iteritems():
print "Input:", name, value
print "---------------------------------------"

processed_count = 0
else:
processed_count = processed_count + 1

vrevents.EventsEnabled = True
vrevents.MaxUpdateRate = 20
vrevents.OnVREvents = OnVREvents

print "VREvents: ", vrevents.EventsEnabled, vrevents.MaxUpdateRate


vcVolumeDetector

vcVolumeDetector allows you to detect collisions in the 3D world using a box. Collision detection requires at least one node list and a box defined by lower and upper corners.

A collision is detected when nodes in a given list collide with the box. The collision can be tested using geometry or bounding boxes of nodes and limited to the first recorded collision or all collisions.

Contents ShowHide

Properties

Methods

Examples

Properties

Name | Type | Access | Description
Corner1 | vcVector | RW | Defines the lower corner of box in World coordinate system.
Corner2 | vcVector | RW | Defines the upper corner of box in World coordinate system.
HitCount | Integer | R | Gets the number of detected collisions with box.
NodeList | List of 3-tuple (vcNode node, Enumeration inclusion_type, Enumeration inclusion_scope) | RW | Defines a list of one or more nodes that can trigger a collision with box. See Collision Detector Constants for more information.
TestMethod | Enumeration | RW | Defines test method for detecting collisions. See Collision Detector Constants for more information.
Transformation | vcMatrix | RW | Defines the position matrix of box in World coordinate system.

Methods

Name | Return Type | Parameters | Description
getHitFeature | vcFeature | Integer index | Returns a feature at a given index in detected collisions list.
getHitGeometrySet | vcGeometrySet | Integer index | Returns a geometry set at a given index in detected collisions list.
getHitNode | vcNode | Integer index | Returns a node at a given index in detected collisions list.
testAllCollisions | Boolean | [Real tolerance] | Detects all collisions of box with node list. An optional tolerance argument can be given to detect collisions within a certain distance. By default, tolerance is zero. If a collision is detected, returns True; otherwise returns False.
testOneCollision | Boolean | [Real tolerance] | Detects the first collision of box with node list. An optional tolerance argument can be given to detect collisions within a certain distance. By default, tolerance is zero. If a collision is detected, returns True; otherwise returns False.

Examples

Example. Test collisions using volume detector

from vcScript import *
import vcMatrix
import vcVector

def OnRun():
comp = getComponent()
sim = getSimulation()

insideDetector = sim.newVolumeDetector()
insideDetector.Corner1 = vcVector.new()
insideDetector.Corner2 = vcVector.new(102.0, 102.0, 102.0)
insideDetector.NodeList = [(comp, VC_NODELIST_INCLUDE, VC_NODELIST_TREE)]

insideDetector.TestMethod = VC_INTERSECT
insideHit1 = insideDetector.testAllCollisions()

insideDetector.TestMethod = VC_CENTER_INSIDE
insideHit2 = insideDetector.testAllCollisions()

insideDetector.TestMethod = VC_INSIDE
insideHit3 = insideDetector.testAllCollisions()

print "--------"
print insideHit1, "VC_INTERSECT"
print insideHit2, "VC_CENTER_INSIDE"
print insideHit3, "VC_INSIDE"


vcToolFrame

vcToolFrame allows you to manipulate Frame features used as tool frames for tool center points of robot.

Properties

Name | Type | Access | Description
IPOMode | Integer | RW | Defines the interpolation mode of the frame and the external configuration of a referencing robot controller. 0 Default setting, so no effect on robot's external configuration. 1 Robot position inherits orientation of base frame. 2 Robot position inherits orientation of tool frame. Interpolation constants can be used with this property. Note: A conflict can occur if a base-tool pair in a referencing robot have the same IPOMode property value or cannot be used with the robot's current configuration.
Name | String | RW | Defines the name of the frame.
Node | vcNode | RW | Defines the node the frame is attached to in the 3D world.
PositionMatrix | vcMatrix | RW | Defines the frame's position and orientation in the Node property's coordinate system. The position matrix is a result of the node's offset, pivot and joint expressions but can be set manually.
PositionExpression | String | RW | The matrix offset expression for the frame's location.