"""Flat bar / rectangular bar (solid rectangular stock), any width, thickness and length: EN 10058 hot-rolled flat bars and plain flat or rectangular bar. A rectangular section, `width` along X and `thickness` along Y, centred on the origin, extruded along +Z by `length`. Sharp edges: the edge rounding allowed by EN 10058 is not modelled. """ from steve import Model width = 20 # mm Width b thickness = 5 # mm Thickness t 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), width, thickness) model.extrude("bar", "section", distance=length, name="Bar") model.material(material_id, color=colour) result = model.result()