Skip to content

Instantly share code, notes, and snippets.

View stephensmitchell's full-sized avatar
🎯
Focusing

Stephen S. Mitchell stephensmitchell

🎯
Focusing
View GitHub Profile
@stephensmitchell
stephensmitchell / Working-with-Configurations.py
Created October 14, 2025 10:35
Working with Configurations
#https://help.alibre.com/articles/#!alibre-help-v28/working-with-configurations
# create a new part
P = Part('Test')
# create a new configuration
Foo = P.AddConfiguration('Foo')
# it's already unlocked by default but this is how to unlock a configuration
Foo.UnlockAll()
# set a single lock
#https://help.alibre.com/articles/#!alibre-help-v28/wave-washer
import math
from math import *
# radius
R = 100.0
# amplitude
A = 10.0
# number of waves (must be a whole number)
#https://help.alibre.com/articles/#!alibre-help-v28/useful-dialogs
Win = Windows()
Win.InfoDialog('I am about to create a part', 'My Script')
Win.ErrorDialog("Oops. That didn't go as planned", 'My Script')
# returns True for 'yes' and False for 'no'
print Win.QuestionDialog('Shall I stop?', 'My Script')
#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
@stephensmitchell
stephensmitchell / Type-11-flanges-according-to-BS-EN-1092-PN16.py
Created October 14, 2025 10:35
Type 11 flanges according to BS EN 1092 PN16
#https://help.alibre.com/articles/#!alibre-help-v28/type-11-flanges-according-to-bs-en-1092-pn16
from math import cos,sin,radians
# Size of Flange TYPE 11 According to BS/EN-1092 PN16
#--- INPUT HERE ---#
print('Input DN Flange size: 10, 15, 20, 25, 32, 40, 50, 65, 80, 100, 125, 150, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600')
DN = int(Read())