"""Aluminium T-slot extrusion, metric series. Simplified profile: square section with a rectangular slot on each side and a centre bore. Slot shapes differ between makers: check your supplier's drawing for exact fits. The profile is centred on the origin in XY and extruded along +Z.""" from steve import Model series = "2020" # Profile series length = 100 # mm Length # series: (side a, slot opening w, slot depth t, centre bore b) SERIES = { '2020': (20.0, 6.2, 6.0, 4.2), '3030': (30.0, 8.2, 9.0, 6.8), '4040': (40.0, 8.2, 12.0, 6.8), } a, w, t, b = SERIES[series] h = a / 2 model = Model() with model.sketch("profile", on="XY", name="Section") as sk: sk.polyline("outline", [ (-h, -h), (-w / 2, -h), (-w / 2, -h + t), (w / 2, -h + t), (w / 2, -h), (h, -h), (h, -w / 2), (h - t, -w / 2), (h - t, w / 2), (h, w / 2), (h, h), (w / 2, h), (w / 2, h - t), (-w / 2, h - t), (-w / 2, h), (-h, h), (-h, w / 2), (-h + t, w / 2), (-h + t, -w / 2), (-h, -w / 2), ]) sk.circle("bore", (0, 0), b / 2) model.extrude("bar", "profile", distance=length) result = model.result()