"""MakerBeam 10 x 10 aluminium profile (MakerBeam article 100168 drawing), any length. The section, centred on the origin in the XY plane, extruded along +Z by `length`: a 10 x 10 square with a 3 mm slot in each face (lip 1 thick), the slot widening under the lips into a dovetail whose walls run at 41.1 degrees down to the 4 x 4 core, and a 2.5 mm centre bore (the tap drill of the M3 end threads; the threads are not modelled). All four sides are the same, turned 90 degrees. MakerBeam's 0.2 mm corner and edge radii are not modelled. """ import math from steve import Model length = 100 # mm Length finish = "clear" # Anodising # mm, from MakerBeam's drawing of article 100168 (beam clear anodised, M3, Ø2.5): DXF geometry and printed dimensions SECTION = { "outer": 10.0, # □10 "slot": 3.0, # slot opening "lip": 1.0, # lip thickness (face to lip underside) "core": 4.0, # □4 core (slot floor 2.0 from the centre) "bore": 2.5, # Ø2.5 centre bore # the undercut wall, a straight line in the DXF (x, y from the centre, top slot): two points on it "wall": ((2.8908, 3.6493), (1.0565, 2.0493)), } FINISHES = {"clear": "#cfd2d6", "black": "#2b2c2e"} half, s2 = SECTION["outer"] / 2, SECTION["slot"] / 2 lip_y, floor_y = half - SECTION["lip"], SECTION["core"] / 2 (x1, y1), (x2, y2) = SECTION["wall"] slope = (y1 - y2) / (x1 - x2) under = x1 + (lip_y - y1) / slope # where the wall meets the lip underside foot = x2 + (floor_y - y2) / slope # where the wall meets the slot floor top = [(-half, half), (-s2, half), (-s2, lip_y), (-under, lip_y), (-foot, floor_y), (foot, floor_y), (under, lip_y), (s2, lip_y), (s2, half)] outline = [] for quarter in range(4): # top, right, bottom, left: each side is the top one turned 90 degrees clockwise a = -math.pi / 2 * quarter outline += [(x * math.cos(a) - y * math.sin(a), x * math.sin(a) + y * math.cos(a)) for x, y in top] model = Model() with model.sketch("section", on="XY", name="Section") as sk: sk.polyline("outline", outline) sk.circle("bore", (0, 0), SECTION["bore"] / 2) model.extrude("beam", "section", distance=length, name="Beam") model.material("aluminum-generic", color=FINISHES[finish]) # 6063-T5 (no STEVE entry for 6063) result = model.result()