vcApplication
vcApplication is the object type for the main application, thereby granting access to the application's GUI, commands and other common properties.
Properties
Name | Type | Access | Description |
ActivationKey | String | R | Gets the floating or stand-alone license that is currently used for the licensing of the application. |
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. |
CustomProductVersion | String | R | Returns the config file customized product version. If the product name has not been customized, returns the internal version. |
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 | vcProcessContext | 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 latest stand-alone key used to activate 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 0.0 <= Value <= 1.0 Value > 1.0 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 | vcCommandPanelAction | 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. |
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. |
RobotSelectionService | vcRobotSelectionService | RW | Gets robot selection service |
SelectionManager | vcSelectionManager | R | Gets the selection manager of the application which is used for handling selections in an environment. |
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 |
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 Configure Drawing Teach |
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, [Boolean case_sensitive] | Returns a material matching a given name. If no material is found with the name, returns None. Optional case_sensitive argument can be used to specify if the method is case-sensitive. By default, the method returns the first match (not case-sensitive). |
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. |
addUxSite | None |
String siteId, [Integer position] |
Adds a new site identified by siteId at the specified position. siteId can be a chained string or a path, thereby allowing you to specify a section of the user interface. For example, 'VcTabDrawing/Example' would create a new ribbon group called Example in the Drawing tab. Note: 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. An optional position parameter specifies the index at which the site should be created in its direct parent. |
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) or (Deprecated) or (Deprecated) |
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 3-key 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 Name Tooltip Description Icon <step value> 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.
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. |
setClipPlane | None | int index, vcMatrix position | Sets the clipping plane position. |
setClipPlaneEnabled | None | int index, bool enabled |
Defines if the clipping plane is enabled or disabled. |
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. |
getPythonDllPath | String | None | Returns the Uri of Python DLL folder as a formatted string. |
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 | 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 |
None or 3-tuple (vcNode hitNode, vcPolygon hitPolygon, vcMatrix hitPosition) or 5-tuple (vcNode hitNode, None hitPolygon, vcMatrix hitPosition, |
vcMatrix start_position, Real ray_length, [vcNode exclude_node], [Boolean use_backface], [List of 3-tuple (vcNode node, Enumeration inclusion_type, Enumeration inclusion_scope) node_filters] | 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. The return value tuple's elements are: 0 1 2 3 4 See Example on how to implement this method. |
render | None | None | Renders the scene of 3D world. |
save | None | String uri, Boolean includecomponents | Saves the contents of 3D world as a layout using a given uri. Also includecomponents parameter defines if the components are included in the layout. |
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. |
OnStart | None | Triggered at the start of the application when main window is being built.
(Deprecated) Use OnAppInitialized. |
Examples
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 |