Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

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


 Get 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


List physical properties for model
# 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)

 Get the Assembly Item Properties

test

 Change Various Assembly Item Properties

test

 Insert 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"

thickness: lne thickness number > 0 


2D Line Example code
# 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)


 Insert 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 


2D Line Example code
# 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)


 Import a Model

test

Related Topics

  • No labels