API for interaction with the viewer.
The Configurator 360 Viewer object contains the API for interacting with the viewer.
Only the unload method is available if this object was obtained as a result of an error.
Unload the Configurator 360 Viewer from the page.
After unloading the viewer, do not use the object again.
Gets the UI Property values for the loaded design in a tree structure.
filter (optional => default: ' ')
Type: String
The refChain of the part for which to get properties. If undefined, null, or empty string (' '), it gives values from the root.
callback (optional)
Type: Callback Function
result is a plain object with a tree structure of the properties for the part and its children in an array.
Examples:
// Non-ETO/iLogic application { "refChain": "Root", "properties": [ { "name": "Tier", "value": "1 Tier" }, { "name": "Casters", "value": false }, { "name": "Total_Price", "value": "$700" } ] }
// ETO application { "refChain": "Root", "properties": [ { "name": "uiCompany", "value": "[Enter Company]" }, { "name": "uiTitle", "value": "[Enter Title]" } ], "children": [ { "refChain": "Root.Cap", "properties": [ { "name": "uiBOMPartNumber", "value": "Cap_15CN_NoIndicator_0_3_4" } ] }, { "refChain": "Root.Bowl", "properties": [ { "name": "uiBOMPartNumber", "value": "Bowl_15CN_Single_NoDrain" } ] } ] }
error (optional)
Type: Error Callback Function
Sets the UI Property values for the loaded design.
properties (required)
Type: Plain Object or Array of Plain Objects
Specifies the properties to set and to what values.
Examples:
// Set Properties prop1 and prop2 on the root part. viewer.setPropertyValues({prop1: 5, prop2: 'some string'});
//Do the same with an array viewer.setPropertyValues([{'name': 'prop1', 'value': 5}, {'name': 'prop2', 'value': 'some string'}]);
//Do the same with a tree structure viewer.setPropertyValues({ "refChain": "Root", "properties": [ { 'name': 'prop1', 'value': 5 }, { 'name': 'prop2', 'value': 'some string' } ], 'children': [] // can include child parts with more properties to set }]);
callback (optional)
Type: Callback Function
result is a plain object with a tree structure of at least the properties that were affected by the operation. There may be additional properties included that weren't necessarily changed. See the examples for the result of the getPropertyValues() function for the format
error (optional)
Type: Error Callback Function
Enables or disables the auto-update feature, which automatically updates the 3D view when the properties change. Updates the checkbox status and the display of the button associated with the feature.
enable (required)
Type: Boolean
true to enable auto-updates, false to disable.
callback (optional)
Type: Callback Function
true when auto-update is enabled or false when disabled.
error (optional)
Type: Error Callback Function
Forces the viewer to update the 3D view.
callback (optional)
Type: Function
Same as the standard Callback Function except with no parameters.
error (optional)
Type: Error Callback Function
Gets a list of available actions for a part.
data (Optional => default: undefined)
Type: Plain Object
Input object containing the following properties. If undefined, null, or empty string (' '), it gives actions from the root.
refChain
Type: String
Specifies the target part to get actions for.
callback (Optional)
Type: Callback Function
result is an array of Plain Objects with the following properties:
category
Type: String
Category name
displayName
Type: String
The display name
name
Type: String
Internal name of the action. Use this action to refer to the action programmatically as in executeAction.
error (Optional)
Type: Error Callback Function
Executes an action on a part.
For output actions: If no callback is supplied, the generated file is downloaded by the browser. Otherwise, the file is not automatically downloaded.
data (Required)
Type: Plain Object
Input object containing the following properties.
refChain (Optional => default:"Root")
Type: String
Specifies the target part.
name (Required)
Type: String
Specifies the name of the action.
callback (Optional)
Type: Callback Function
result depends on the type of action executed:
- For C360 standard outputs
A Plain Object with the following property:
url
Type: String
The URL of the generated output
- For actions that set the ServerAction property to ReturnResult
A Plain Object with the following set of properties:
title
Type: String
The title of the output set by the action code
message
Type: String
The message of the output set by the action code
- For actions that set the ServerAction property to UpdateModel
A tree structure of at least the properties that were affected by the operation. There may be additional properties included that weren't necessarily changed. See the examples for the result of the getPropertyValues() function for the format.
error (Optional)
Type: Error Callback Function
Saves the session in an .ikms file. If no callback is supplied, the file is downloaded by the browser. Otherwise, the file is not automatically downloaded.
callback (optional)
Type: Callback Function
result is a Plain Object with the following property:
urlType: String
The URL of the generated .ikms file
Type: Error Callback Function
Type: Number
Specifies a code representing the state of the Configurator 360 Viewer.
The properties on ADSK.C360.loadedState represent all possible values.
Type: Function (function (result) { })
If defined, the callback function is called when the operation completes in the context of the C360Viewer object with the result of the operation as the only argument.
Type: Function (function (err) { })
If defined, the callback function is called when the operation fails in the context of the C360Viewer object with the Error object as the only argument.