Edit scripts
Use the Script Editor
to write javascript scripts to
manipulate per point attributes of objects. Scripts are able to be saved
and imported. Typical properties to script include position and colour,
with the help of conditional statements and loops if required.
-
On the Labs ribbon tab navigate to the Edit group and select Script.
-
Write script in text box area at the top of the panel. Line numbers are automatically added and text colouring will automatically indicate the function of different words, numbers and symbols.
-
Click Test script to undertake preliminary testing of the code for semantics errors.
-
Select one or more objects. Click Apply script to selection to perform script on the selected objects.
Further options:
- Change label used for Point variable (default 'p'). This variable is used to assign a generic label that represents every point on an object. Attributes for points can be accessed via the point variable.
- Enter new script name and save using Save script button.
Debugging window
The Debugging window displays a list of attributes relevant to the selected object - these attributes are available for scripting. The Before column allows you to enter initial values of attributes. The After column displays values of attributes after application of the script. The After values are updated after each change to the Before values.
Example script
The following
script provides an example of the layout and punctuation of scripting
commands.
Note: Text is case
sensitive. Additional spaces can be used between words to improve readability.
if (p.Z > 10200) {
p.Red = 0;
p.Green = 0;
p.Blue
= 255;
}
else if (p.Z < 10010) {
p.Red = 255;
p.Green = 0;
p.Blue
= 0;
}