Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
titleGet the Physical Properties of Items

The following demonstrates getting the physical properties of the assembly and printing to the console through scriptnig.

Usage

GetPhysicalProperties()

Parameters

none


Code Block
languagepy
firstline1
titleList physical properties for model
linenumberstrue
# 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
name2021-12-23 10-45-03.mp4



Expand
titleGet the Assembly Item Properties

test


Expand
titleRotate the Entire Assembly

The following demonstrates selecting and rotating an assembly through scriptnig.

Usage

RotaeSelectedAssemblyItems(axis, degrees)

Parameters

axis: selectd the x, y, or z axis

degrees: amount to rotate in degrees


Code Block
languagepy
firstline1
titleList physical properties for model
linenumberstrue
# First open a 3D model to execute this script  
import spinfirescript as sfs

for i in range(0,10):
	sfs.SelectItem([])
	sfs.RotateSelectedAssemblyItems(sfs.Axis.X, 30)
	sfs.RotateSelectedAssemblyItems(sfs.Axis.Y, 20)
	sfs.RotateSelectedAssemblyItems(sfs.Axis.Z, 45)
	sfs.ClearSelectedItems()

Multimedia
namerotatingScript.mp4



Expand
titleChange Various Assembly Item Properties

test


Expand
titleInsert a 2D Line

The following demonstrates creating 2D lines through scriptnig.

Usage

InsertLine(x-coord, y-coord, color, thickness)

Parameters

x-coord: starting x-coordinate.

y-coord: starting 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: line thickness number > 0 


Code Block
languagepy
title2D Line Example code
linenumberstrue
# 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
name2021-11-15 08-51-26.mp4



Expand
titleInsert a 2D Polyline

The following demonstrates creating 2D lines through scriptnig.

Usage:

InsertLine(x-coord, y-coord, color, thickness)

Parameters

x-coord: Starting x-coordinate.

y-coord: Starting y-coordinate.

color: color as a string in the form "#AARRGGBB",


thickness: lne thickness number > 0 


Code Block
languagepy
title2D Line Example code
linenumberstrue
# 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
name2021-11-15 08-51-26.mp4



Expand
titleImport a Model

test


Expand
titleSave to an ACT3D File

test


Related Topics