"""Round tube, any outside diameter, wall and length: EN 10305-1 precision steel tubes and EN 10220 tube sizes. A hollow cylinder of outside diameter `diameter` (D) and wall thickness `wall` (T), its axis along +Z, one end face on the XY plane centred on the origin. The bore is D - 2T. Dimensions are nominal; tolerances are not modelled. """ from steve import Model diameter = 20 # mm Outside diameter D wall = 2 # mm Wall thickness T length = 1000 # mm Length material = "steel" # Material # Standard sizes the presets use, "DxT": (standard and table, D, T), mm, nominal. The model takes any D and T. SIZES = { "6x1": ("EN 10305-1 Table 5", 6, 1), "8x1": ("EN 10305-1 Table 5", 8, 1), "10x1": ("EN 10305-1 Table 5", 10, 1), "12x1.2": ("EN 10305-1 Table 5", 12, 1.2), "16x1.6": ("EN 10220 Table 1", 16, 1.6), "20x2": ("EN 10305-1 Table 5", 20, 2), "25x2.5": ("EN 10305-1 Table 5", 25, 2.5), } # material choice: (STEVE material library id, appearance colour) MATERIALS = { "steel": ("steel-generic", "#8a8d91"), # E235 (EN 10305-1) "stainless-304": ("stainless-304", "#c9ccd0"), # EN 10088 1.4301 "aluminium-6061": ("aluminum-6061-t6", "#d4d7db"), } if not 0 < 2 * wall < diameter: raise ValueError("The wall must be less than half the outside diameter.") material_id, colour = MATERIALS[material] model = Model() with model.sketch("section", on="XY", name="Section") as sk: sk.circle("outside", (0, 0), diameter / 2) sk.circle("bore", (0, 0), diameter / 2 - wall) model.extrude("tube", "section", distance=length, name="Tube") model.material(material_id, color=colour) result = model.result()