"""Accessories for 20, 30 and 40 mm T-slot extrusions, simplified as step.parts' published models draw them: end cap, slot cover strip, anchor fastener and inside corner connector. - end-cap: a square plate the size of the profile (centred on the origin, z = -1.5 to 1.5) with one round plug peg standing on it; - cover-strip: a flat strip along X, centred, `length` long; - anchor: a block along X with a round pin through it along Z, both centred; - inside-corner: an L of square bar in the XY plane, its arms along +X and +Y from the corner at the origin, centred on z = 0, its outer corner square-cut. See the README. """ from steve import Model kind = "end-cap" # Kind: end-cap, cover-strip, anchor, inside-corner series = "20" # Profile series (20, 30, 40 mm) length = 100 # mm Length (cover strip only) material = "unspecified" # Material # mm, measured on step.parts' models extrusion___simple (every face read; the 2040, 2060, 2080 # models are the 2020 ones, 3060 the 3030 ones, 4080 the 4040 ones). Per series: # end cap: plate side, plate thickness, peg diameter, peg centre (x = y), peg height above the plate # cover strip: width, thickness; anchor: block length (X), block width (Y), block height (Z), pin diameter, pin length # inside corner: bar section (square), arm length from the corner SERIES = { "20": {"cap": (20.0, 3.0, 3.6, 5.0, 4.0), "strip": (5.6, 2.0), "anchor": (14.0, 7.0, 7.0, 5.0, 16.0), "corner": (7.0, 20.0)}, "30": {"cap": (30.0, 3.0, 5.4, 7.5, 4.0), "strip": (8.4, 2.0), "anchor": (21.0, 10.5, 10.5, 7.5, 24.0), "corner": (10.5, 30.0)}, "40": {"cap": (40.0, 3.0, 7.2, 10.0, 4.0), "strip": (11.2, 2.0), "anchor": (28.0, 14.0, 14.0, 10.0, 32.0), "corner": (14.0, 40.0)}, } # material choice: (STEVE material library id, appearance colour); the models name no material MATERIALS = {"unspecified": (None, None), "nylon": ("pa6", "#2b2c2e"), "aluminum": ("aluminum-generic", "#cfd2d6"), "steel": ("steel-generic", "#9da2a8")} s = SERIES[series] material_id, colour = MATERIALS[material] model = Model() if kind == "end-cap": side, t, peg_d, peg_at, peg_h = s["cap"] model.box("plate", side, side, t, name="Cap plate") model.cylinder("peg", peg_d / 2, peg_h, at=(peg_at, peg_at, t / 2), op="join", name="Plug peg") elif kind == "cover-strip": w, t = s["strip"] model.box("strip", length, w, t, name="Cover strip") elif kind == "anchor": bl, bw, bh, pin_d, pin_l = s["anchor"] model.box("block", bl, bw, bh, name="Anchor block") model.cylinder("pin", pin_d / 2, pin_l, at=(0, 0, -pin_l / 2), op="join", name="Pin") else: bar, arm = s["corner"] a = bar / 2 with model.sketch("corner_sketch", on="XY", name="Corner connector") as sk: sk.polyline("outline", [(0, -a), (arm, -a), (arm, a), (a, a), (a, arm), (-a, arm), (-a, 0), (0, 0)]) model.extrude("corner", "corner_sketch", distance=bar, both=True, name="Corner connector") if material_id: model.material(material_id, color=colour) result = model.result()