"""Corner bracket for 20, 30 and 40 mm aluminium extrusions, simplified as step.parts' published models draw it: two flat legs at a right angle, no holes. The legs stand on the XY plane and rise along +Z by the bracket's height (the extrusion size). One leg runs along +X, the other along +Y, each `t` thick and centred on its axis, `leg` long from the origin; the small square at the outside of the corner (-t/2..0, -t/2..0) is open, as in the models. """ from steve import Model series = "2020" # Extrusion series variant = "single" # Leg length: single or double material = "unspecified" # Material # mm, measured on step.parts' models corner_bracket___simple (their outline, a polygon read edge by # edge at mid-height, and their height): {series: (height, thickness t, {variant: leg length})} BRACKETS = { "2020": (20.0, 3.0, {"single": 30.0, "double": 40.0}), "3030": (30.0, 4.5, {"single": 45.0, "double": 60.0}), "4040": (40.0, 6.0, {"single": 60.0, "double": 80.0}), } MATERIALS = { "unspecified": (None, None), # the models name no material "aluminum": ("aluminum-generic", "#cfd2d6"), "steel": ("steel-generic", "#7d8085"), } height, t, legs = BRACKETS[series] leg = legs[variant] h = t / 2 material_id, colour = MATERIALS[material] model = Model() with model.sketch("outline_sketch", on="XY", name="Outline") as sk: sk.polyline("outline", [(0, 0), (0, -h), (leg, -h), (leg, h), (h, h), (h, leg), (-h, leg), (-h, 0)]) model.extrude("bracket", "outline_sketch", distance=height, name="Bracket") if material_id: model.material(material_id, color=colour) result = model.result()