Skip to content

Instantly share code, notes, and snippets.

@stephensmitchell
Created October 14, 2025 10:35
Show Gist options
  • Save stephensmitchell/7e1000969282b0c925ba8ef875e8eacc to your computer and use it in GitHub Desktop.
Save stephensmitchell/7e1000969282b0c925ba8ef875e8eacc to your computer and use it in GitHub Desktop.
Units
#https://help.alibre.com/articles/#!alibre-help-v28/units
# demonstrates using multiple units in a script
# create a part and a sketch
MyPart = Part('My Part')
XYPlane = MyPart.GetPlane('XY-Plane')
Sketch = MyPart.AddSketch('Sketch', XYPlane)
# set units to mm - this is implied at the start of every script
Units.Current = UnitTypes.Millimeters
# create circle 50mm in diameter
Sketch.AddCircle(0, 0, 50, False)
# set units to inches
# all values from now on are in inches
Units.Current = UnitTypes.Inches
# create a circle 1.34 inches in diameter
Sketch.AddCircle(0, 0, 1.34, False)
# switch to cm
# now all values from this point until the next units change are in cm
Units.Current = UnitTypes.Centimeters
# create a circle 4.2cm in diameter
Sketch.AddCircle(0, 0, 4.2, False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment