Skip to content

Instantly share code, notes, and snippets.

@stephensmitchell
Created October 14, 2025 10:35
Show Gist options
  • Select an option

  • Save stephensmitchell/08c10404dec76d5063876458d0ab7ee2 to your computer and use it in GitHub Desktop.

Select an option

Save stephensmitchell/08c10404dec76d5063876458d0ab7ee2 to your computer and use it in GitHub Desktop.
Getting User Input
#https://help.alibre.com/articles/#!alibre-help-v28/getting-user-input
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment