Browsed by
Tag: user input

Custom Values and Settings Window

Custom Values and Settings Window

Compatible with WizoScript versions: 2.50

Shows how to create a custom dialog window that prompts the user to enter values and settings. Supports inputs are: integer, real (float), checkbox and text.

# create windows object
Win = Windows()
 
# construct list of items for the window
Options = []
# ask user for text
Options.append(["Name of the item", WindowsInputTypes.String, "Baz"])
# ask user for a floating point (real) value
Options.append(["Scale", WindowsInputTypes.Real, 1.234])
# checkbox
Options.append(["Enabled", WindowsInputTypes.Boolean, True])
# ask user for an integer
Options.append(["Count", WindowsInputTypes.Integer, 123456])
 
# show window and output results
# if user closes window or clicks on Cancel button then Values will be set to 'None'
Values = Win.OptionsDialog("Test", Options)
print Values
Getting User Input

Getting User Input

Compatible with WizoScript versions: 1.42

Shows how to request information from the user and then use that data to construct a part.

# Demonstrates requesting values from the user then creating a part
# with those values
 
print "Input width in mm and press Enter"
Width = float(Read())
if Width < 0.1:
  sys.exit("Width must be at least 0.1 mm")
 
print "Input height in mm and press Enter"
Height = float(Read())
if Height < 0.1:
  sys.exit("Height must be at least 0.1 mm")
   
print "Input depth in mm and press Enter"
Depth = float(Read())
if Depth < 0.1:
  sys.exit("Depth must be at least 0.1 mm")
 
print "Creating a box measuring %f mm x %f mm x %f mm..." % (Width, Height, Depth)
 
MyPart = Part("My Part")
Profile = MyPart.AddSketch("Profile", MyPart.GetPlane("XY-Plane"))
Profile.AddRectangle(0, 0, Width, Height, False)
MyPart.AddExtrudeBoss("Box", Profile, Depth, False)