Browsed by
Tag: parameters

Global Parameters

Global Parameters

Compatible with WizoScript versions: 2.00

Demonstrates creating and modifying global parameters

# create a new global parameters set
Params = GlobalParameters("Test")
# add a distance parameter in millimeters
Params.AddParameter("Width", ParameterTypes.Distance, 4.56)
# save and close
Params.Save(r"P:\temp")
Params.Close()
 
# open global parameters
Params2 = GlobalParameters(r"P:\temp", "Test")
# get access to a parameter and display the current value
Width = Params2.GetParameter("Width")
print Width.Value
# change the value of the parameter
Width.Value = 12.34
Parameters with Units

Parameters with Units

Compatible with WizoScript versions: 1.99

Demonstrates how to add and read parameters in the current script units, with specific units and with no units.

# this script uses inches for it's units
Units.Current = UnitTypes.Inches
 
MyPart = Part("Foo")
 
# create parameter using current script units
LengthParam = MyPart.AddParameter("Length", ParameterTypes.Distance, 123.4)
# parameter value reads back in current script units
print "Value in script units =", LengthParam.Value
 
# cteate parameter in degrees
RotationParam = MyPart.AddParameter("Rotation", ParameterTypes.Angle, 34.2)
# parameter reads back in degrees
print "Value in degrees = ", RotationParam.Value
 
# create parameter with specific units
WidthParam = MyPart.AddParameter("Width", ParameterTypes.Distance, ParameterUnits.Centimeters, 7.32)
# reads back in current script units
print "Value in script units = ", WidthParam.Value
# reads back the actual value we wrote
print "Value we wrote = ", WidthParam.RawValue
 
# create parameter with specific units
WidthParam2 = MyPart.AddParameter("Width2", ParameterTypes.Distance, ParameterUnits.Inches, 1.0)
# reads back in current script units
print "Value in script units = ", WidthParam2.Value
# reads back the actual value we wrote
print "Value we wrote = ", WidthParam2.RawValue
 
# create parameter with no units
Count = MyPart.AddParameter("Count", ParameterTypes.Count, ParameterUnits.Unitless, 45)
# reads back value
print "Count value = ", Count.Value