"""Square bar (solid square stock), any size and length: EN 10059 hot-rolled square bars and plain square bar. A square section of side `side` centred on the origin in XY, extruded along +Z by `length`. Sharp corners: the small corner rounding allowed by EN 10059 is not modelled. """ from steve import Model side = 10 # mm Side a length = 100 # mm Length material = "steel" # Material # material choice: (STEVE material library id, appearance colour) MATERIALS = { "steel": ("steel-s235jr", "#8a8d91"), # EN 10025-2 S235JR, hot rolled "stainless-304": ("stainless-304", "#c9ccd0"), # EN 10088 1.4301 "aluminium-6061": ("aluminum-6061-t6", "#d4d7db"), "brass": ("brass", "#c9a54a"), } material_id, colour = MATERIALS[material] model = Model() with model.sketch("section", on="XY", name="Section") as sk: sk.center_rect("outline", (0, 0), side, side) model.extrude("bar", "section", distance=length, name="Bar") model.material(material_id, color=colour) result = model.result()