Here are a few simple examples that you can demonstrate on your licensed copy of SpinFire Ulitmate.
Acquire full scripting help from within SpinFire Ultimate using the Documentation menu item from the script menu.
The following shows simple examples of some scripting primitives
Expand | ||
---|---|---|
| ||
The following demonstrates getting the physical properties of the assembly and printing to the console through scriptnig. UsageGetPhysicalProperties() Parametersnone Code Block | | |
language | py | |
firstline | 1 |
Code Block | ||
---|---|---|
| ||
# First open a 3D model to execute this script # Open the python.NET console panel import spinfirescript as sfs sfs.SelectItem([]) propertiesData = sfs.GetPhysicalProperties() print(propertiesData) print(propertiesData.Message) |
Multimedia | ||
---|---|---|
|
Expand | |||||||||
---|---|---|---|---|---|---|---|---|---|
| |||||||||
test | |||||||||
Expand | |||||||||
| |||||||||
| |||||||||
The following demonstrates selecting and rotating an assembly through scripting. UsageRotaeSelectedAssemblyItems(axis, degrees) Parametersaxis: selectd the x, y, or z axis degrees: amount to rotate in degrees List physical properties for model
|
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
The following demonstrates creating 2D lines through scriptnigscripting. UsageInsertLine(x-coord, y-coord, color, thickness) Parametersx-coord: Startingstarting x-coordinate. y-coord: Startingstarting y-coordinate. color: color as a string in the form "#AARRGGBB" where AA is the alpha channel RR is the red channel GG is the green channel BB is the blue channel thickness: lneline thickness number > 0 Code Block | | py | title |
Code Block | ||
---|---|---|
| ||
# First open a 2D workspace to execute this script import spinfirescript as sfs import random for i in range(1,10): newColor = "#FF"+''.join([random.choice('0123456789ABCDEF') for j in range(6)]) sfs.InsertLine([0, (i+(i*4))*-1], [50, (i+(i*4))*-1], "#FF000000", i) sfs.InsertLine([100, (i+(i*4))*-1], [150, (i+(i*4))*-1], newColor, i) |
Multimedia | ||
---|---|---|
|
Expand | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
The following demonstrates creating 2D lines through scriptniga 3D polyline through scripting. Usage: InsertLine(InsertPolyline([x-coord 1, y-coord 1, z-coord 1], [x-coord 2, y-coord 2, z-coord 2], [x-coord n, y-coord n, z-coord n], color, thickness) Parameters x-coord: Starting x-coordinate. y-coord: Starting y-coordinate. z-coord: Starting z-coordinate. color: color as a string in the form "#AARRGGBB", thickness: lne thickness number > 0 3D Polyline Example code
| |||||||||||||
Expand | |||||||||||||
| |||||||||||||
test
|
Expand | |||||
---|---|---|---|---|---|
| |||||
The following demonstrates saving the workspace to an ACT3D file through scripting. Usage: ImportFile(filename path) Parameters filename path: filename path of the file to import. Import a File Example code
|
Expand | |||||
---|---|---|---|---|---|
| |||||
The following demonstrates saving the workspace to an ACT3D file through scripting. Usage: SaveFile(filename path) Parameters filename path: filename path of the ACT3D file. Save ACT3D File Example code
|