steel-sections 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. steel_sections-0.1.0/LICENSE +18 -0
  2. steel_sections-0.1.0/PKG-INFO +86 -0
  3. steel_sections-0.1.0/README.md +68 -0
  4. steel_sections-0.1.0/pyproject.toml +30 -0
  5. steel_sections-0.1.0/setup.cfg +4 -0
  6. steel_sections-0.1.0/src/steel_sections/DATA-LICENSE.md +14 -0
  7. steel_sections-0.1.0/src/steel_sections/__init__.py +167 -0
  8. steel_sections-0.1.0/src/steel_sections/__main__.py +41 -0
  9. steel_sections-0.1.0/src/steel_sections/data/EUROPE-LICENSE.txt +199 -0
  10. steel_sections-0.1.0/src/steel_sections/data/gauges.csv +37 -0
  11. steel_sections-0.1.0/src/steel_sections/data/hea.csv +25 -0
  12. steel_sections-0.1.0/src/steel_sections/data/heb.csv +25 -0
  13. steel_sections-0.1.0/src/steel_sections/data/hem.csv +25 -0
  14. steel_sections-0.1.0/src/steel_sections/data/ipe.csv +19 -0
  15. steel_sections-0.1.0/src/steel_sections/data/isa-equal-angles.csv +73 -0
  16. steel_sections-0.1.0/src/steel_sections/data/ismb.csv +15 -0
  17. steel_sections-0.1.0/src/steel_sections/data/ismc.csv +21 -0
  18. steel_sections-0.1.0/src/steel_sections/data/iswb.csv +15 -0
  19. steel_sections-0.1.0/src/steel_sections/data/metric-rebar.csv +13 -0
  20. steel_sections-0.1.0/src/steel_sections/data/pipe-schedules.csv +406 -0
  21. steel_sections-0.1.0/src/steel_sections/data/upn.csv +19 -0
  22. steel_sections-0.1.0/src/steel_sections/data/us-rebar.csv +12 -0
  23. steel_sections-0.1.0/src/steel_sections.egg-info/PKG-INFO +86 -0
  24. steel_sections-0.1.0/src/steel_sections.egg-info/SOURCES.txt +26 -0
  25. steel_sections-0.1.0/src/steel_sections.egg-info/dependency_links.txt +1 -0
  26. steel_sections-0.1.0/src/steel_sections.egg-info/entry_points.txt +2 -0
  27. steel_sections-0.1.0/src/steel_sections.egg-info/top_level.txt +1 -0
  28. steel_sections-0.1.0/tests/test_steel_sections.py +49 -0
@@ -0,0 +1,18 @@
1
+ MIT License (code)
2
+
3
+ Copyright (c) 2026 Anders Lee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11
+ Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+
18
+ The data files in steel_sections/data/ are not covered by this licence; see DATA-LICENSE.md.
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.1
2
+ Name: steel-sections
3
+ Version: 0.1.0
4
+ Summary: Steel section weights, dimensions and properties: IS 808 (ISMB, ISMC, ISA), IPE, HEA, HEB, UPN, pipe schedules, rebar and sheet gauges. No dependencies.
5
+ Author: Anders Lee
6
+ License: MIT (code); CC BY 4.0, Apache-2.0 and CC BY-SA 4.0 (data, see DATA-LICENSE.md)
7
+ Project-URL: Homepage, https://steelweight-calculator.com/
8
+ Keywords: steel,structural steel,steel weight,IS 808,ISMB,IPE,HEA,HEB,rebar,pipe schedule,sheet metal gauge,civil engineering,section properties
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Manufacturing
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+
19
+ # steel-sections
20
+
21
+ Weights, dimensions and section properties of standard steel sections, plus weight formulas for plate, bar and
22
+ tube. Pure Python, no dependencies, data bundled.
23
+
24
+ ```
25
+ pip install steel-sections
26
+ ```
27
+
28
+ ```python
29
+ import steel_sections as ss
30
+
31
+ ss.get("ISMB 200").mass_kg_m # 24.17
32
+ ss.get("ismb200").mass_1964_kg_m # 25.4 (the old handbook value many charts still print)
33
+ ss.get("IPE 300").iy_cm4 # 8356.0
34
+ ss.get("ISA 50x50x5").mass_kg_m # 3.79
35
+
36
+ [s.section for s in ss.series("HEA")][:3] # ['HEA 100', 'HEA 120', 'HEA 140']
37
+
38
+ ss.rebar(12).weight_kg_m # 0.888
39
+ ss.rebar("#5").weight_lb_ft # 1.043
40
+ ss.pipe("2", "40").weight_lb_ft # 3.66
41
+ ss.gauge(16).mm # 1.519
42
+
43
+ # formulas: dimensions in mm, kg per metre (plate: kg per piece); density defaults to 7850 kg/m³
44
+ ss.round_bar(12) * 12 # 10.65 kg for a 12 m bar
45
+ ss.flat_bar(50, 6) # 2.355
46
+ ss.round_tube(60.3, 3.91) # 5.44
47
+ ss.plate(2500, 1250, 10) # 245.3 kg
48
+ ss.round_bar(20, density=2700) # aluminum
49
+ ```
50
+
51
+ Command line:
52
+
53
+ ```
54
+ $ steel-sections ISMB 200
55
+ $ steel-sections --series ISMC
56
+ $ steel-sections --rebar 16
57
+ $ steel-sections --pipe 1-1/2 80
58
+ $ steel-sections --gauge 14
59
+ ```
60
+
61
+ ## What is included
62
+
63
+ | Series | Standard | Sizes | Fields |
64
+ |---|---|---|---|
65
+ | ISMB, ISWB, ISMC, ISA (equal angles) | IS 808:2021 | 120 | dimensions, kg/m, lb/ft, area, Ix, Iy, Iu, Iv, r, Z, Zp, It, Iw, and the IS 808:1989 and 1964 handbook masses |
66
+ | IPE, HEA, HEB, HEM, UPN | EN 10365 profiles | 108 | dimensions, kg/m, lb/ft, area, Iy, Iz |
67
+ | Pipe | ASME B36.10M / B36.19M sizes | 405 NPS × schedule rows | OD, wall, lb/ft, kg/m |
68
+ | Rebar | ASTM A615 #3–#18; metric 6–50 mm | 23 | diameter, area, kg/m, lb/ft |
69
+ | Sheet metal gauges | Manufacturers' standard gauge | 36 | steel, galvanized, stainless, aluminum thickness |
70
+
71
+ Every section row was checked against the source: mass against 0.785 × area, radius of gyration against √(I/A),
72
+ elastic modulus against I/(D/2). Misprints in the printed IS 808 tables are corrected. Section attributes keep the
73
+ CSV column names, with units in the name (`mass_kg_m`, `ix_cm4`, `depth_mm`). European sections use EN axis names
74
+ (y-y major, z-z minor). American W, S, C, MC, L and HSS shapes are not included: the AISC Shapes Database has no
75
+ redistribution licence.
76
+
77
+ Values are theoretical (7850 kg/m³). Check them against the current standard or the mill certificate before design
78
+ or purchase. Interactive version with drawings, charts and a calculator:
79
+ [steelweight-calculator.com](https://steelweight-calculator.com/).
80
+
81
+ ## Licence
82
+
83
+ Code: MIT. Data: Indian sections CC BY 4.0 (values from IS 808 as made public by Public.Resource.Org); European
84
+ sections Apache-2.0 (geometry from the fib-international structuralcodes library); pipe, rebar and sheet gauge
85
+ tables CC BY-SA 4.0 (adapted from the Wikipedia articles Nominal Pipe Size, Rebar and Sheet metal). See
86
+ DATA-LICENSE.md.
@@ -0,0 +1,68 @@
1
+ # steel-sections
2
+
3
+ Weights, dimensions and section properties of standard steel sections, plus weight formulas for plate, bar and
4
+ tube. Pure Python, no dependencies, data bundled.
5
+
6
+ ```
7
+ pip install steel-sections
8
+ ```
9
+
10
+ ```python
11
+ import steel_sections as ss
12
+
13
+ ss.get("ISMB 200").mass_kg_m # 24.17
14
+ ss.get("ismb200").mass_1964_kg_m # 25.4 (the old handbook value many charts still print)
15
+ ss.get("IPE 300").iy_cm4 # 8356.0
16
+ ss.get("ISA 50x50x5").mass_kg_m # 3.79
17
+
18
+ [s.section for s in ss.series("HEA")][:3] # ['HEA 100', 'HEA 120', 'HEA 140']
19
+
20
+ ss.rebar(12).weight_kg_m # 0.888
21
+ ss.rebar("#5").weight_lb_ft # 1.043
22
+ ss.pipe("2", "40").weight_lb_ft # 3.66
23
+ ss.gauge(16).mm # 1.519
24
+
25
+ # formulas: dimensions in mm, kg per metre (plate: kg per piece); density defaults to 7850 kg/m³
26
+ ss.round_bar(12) * 12 # 10.65 kg for a 12 m bar
27
+ ss.flat_bar(50, 6) # 2.355
28
+ ss.round_tube(60.3, 3.91) # 5.44
29
+ ss.plate(2500, 1250, 10) # 245.3 kg
30
+ ss.round_bar(20, density=2700) # aluminum
31
+ ```
32
+
33
+ Command line:
34
+
35
+ ```
36
+ $ steel-sections ISMB 200
37
+ $ steel-sections --series ISMC
38
+ $ steel-sections --rebar 16
39
+ $ steel-sections --pipe 1-1/2 80
40
+ $ steel-sections --gauge 14
41
+ ```
42
+
43
+ ## What is included
44
+
45
+ | Series | Standard | Sizes | Fields |
46
+ |---|---|---|---|
47
+ | ISMB, ISWB, ISMC, ISA (equal angles) | IS 808:2021 | 120 | dimensions, kg/m, lb/ft, area, Ix, Iy, Iu, Iv, r, Z, Zp, It, Iw, and the IS 808:1989 and 1964 handbook masses |
48
+ | IPE, HEA, HEB, HEM, UPN | EN 10365 profiles | 108 | dimensions, kg/m, lb/ft, area, Iy, Iz |
49
+ | Pipe | ASME B36.10M / B36.19M sizes | 405 NPS × schedule rows | OD, wall, lb/ft, kg/m |
50
+ | Rebar | ASTM A615 #3–#18; metric 6–50 mm | 23 | diameter, area, kg/m, lb/ft |
51
+ | Sheet metal gauges | Manufacturers' standard gauge | 36 | steel, galvanized, stainless, aluminum thickness |
52
+
53
+ Every section row was checked against the source: mass against 0.785 × area, radius of gyration against √(I/A),
54
+ elastic modulus against I/(D/2). Misprints in the printed IS 808 tables are corrected. Section attributes keep the
55
+ CSV column names, with units in the name (`mass_kg_m`, `ix_cm4`, `depth_mm`). European sections use EN axis names
56
+ (y-y major, z-z minor). American W, S, C, MC, L and HSS shapes are not included: the AISC Shapes Database has no
57
+ redistribution licence.
58
+
59
+ Values are theoretical (7850 kg/m³). Check them against the current standard or the mill certificate before design
60
+ or purchase. Interactive version with drawings, charts and a calculator:
61
+ [steelweight-calculator.com](https://steelweight-calculator.com/).
62
+
63
+ ## Licence
64
+
65
+ Code: MIT. Data: Indian sections CC BY 4.0 (values from IS 808 as made public by Public.Resource.Org); European
66
+ sections Apache-2.0 (geometry from the fib-international structuralcodes library); pipe, rebar and sheet gauge
67
+ tables CC BY-SA 4.0 (adapted from the Wikipedia articles Nominal Pipe Size, Rebar and Sheet metal). See
68
+ DATA-LICENSE.md.
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "steel-sections"
7
+ version = "0.1.0"
8
+ description = "Steel section weights, dimensions and properties: IS 808 (ISMB, ISMC, ISA), IPE, HEA, HEB, UPN, pipe schedules, rebar and sheet gauges. No dependencies."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = {text = "MIT (code); CC BY 4.0, Apache-2.0 and CC BY-SA 4.0 (data, see DATA-LICENSE.md)"}
12
+ authors = [{name = "Anders Lee"}]
13
+ keywords = ["steel", "structural steel", "steel weight", "IS 808", "ISMB", "IPE", "HEA", "HEB", "rebar", "pipe schedule", "sheet metal gauge", "civil engineering", "section properties"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ "Topic :: Scientific/Engineering",
18
+ "Intended Audience :: Science/Research",
19
+ "Intended Audience :: Developers",
20
+ "Intended Audience :: Manufacturing",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://steelweight-calculator.com/"
25
+
26
+ [project.scripts]
27
+ steel-sections = "steel_sections.__main__:main"
28
+
29
+ [tool.setuptools.package-data]
30
+ steel_sections = ["data/*.csv", "data/*.txt", "DATA-LICENSE.md"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ # Licence
2
+
3
+ The folders carry the licences of the sources they were built from.
4
+
5
+ | Files | Licence | Source |
6
+ |---|---|---|
7
+ | `data/ismb.csv`, `iswb.csv`, `ismc.csv`, `isa-equal-angles.csv` | CC BY 4.0 | Values from IS 808:2021, IS 808:1989 and SP 6(1):1964 as made public by Public.Resource.Org; compilation, corrections and derived columns by steelweight-calculator.com |
8
+ | `data/ipe.csv`, `hea.csv`, `heb.csv`, `hem.csv`, `upn.csv` | Apache-2.0 (text in `data/EUROPE-LICENSE.txt`) | Section geometry from fib-international/structuralcodes (Apache-2.0); derived columns by steelweight-calculator.com |
9
+ | `data/pipe-schedules.csv`, `us-rebar.csv`, `metric-rebar.csv`, `gauges.csv` | CC BY-SA 4.0 | Adapted from the Wikipedia articles "Nominal Pipe Size", "Rebar" and "Sheet metal" (CC BY-SA 4.0); weights recomputed by steelweight-calculator.com |
10
+
11
+ Attribution: "Steel section data by steelweight-calculator.com", plus the source credits above where the licence requires them.
12
+
13
+ The data is provided as is, without warranty. Check values against the current standard or the
14
+ supplier's mill certificate before design or purchase.
@@ -0,0 +1,167 @@
1
+ """Steel section weights, dimensions and properties: IS 808 (ISMB, ISWB, ISMC, ISA), IPE, HEA, HEB, HEM, UPN,
2
+ pipe schedules, rebar and sheet metal gauges, plus weight formulas for plate, bar and tube. No dependencies.
3
+
4
+ >>> import steel_sections as ss
5
+ >>> ss.get("ISMB 200").mass_kg_m
6
+ 24.17
7
+ >>> ss.get("ipe300").iy_cm4
8
+ 8356.0
9
+ >>> round(ss.round_bar(12) * 12, 2) # a 12 m length of 12 mm bar, kg
10
+ 10.65
11
+
12
+ Data checked against the source standards; see https://steelweight-calculator.com/ for the interactive version.
13
+ """
14
+ import csv
15
+ import math
16
+ import re
17
+ import os
18
+ from types import SimpleNamespace
19
+
20
+ __version__ = "0.1.0"
21
+ __all__ = ["get", "find", "series", "SERIES", "pipe", "rebar", "gauge", "plate", "flat_bar", "round_bar",
22
+ "square_bar", "hex_bar", "round_tube", "rect_tube", "angle", "DENSITY"]
23
+
24
+ DENSITY = 7850.0 # kg/m³, carbon steel
25
+ KG_M_TO_LB_FT = 1 / 1.48816
26
+
27
+ # series → (data file, standard)
28
+ SERIES = {
29
+ "ISMB": ("ismb", "IS 808:2021"), "ISWB": ("iswb", "IS 808:2021"), "ISMC": ("ismc", "IS 808:2021"),
30
+ "ISA": ("isa-equal-angles", "IS 808:2021"), "IPE": ("ipe", "EN 10365"), "HEA": ("hea", "EN 10365"),
31
+ "HEB": ("heb", "EN 10365"), "HEM": ("hem", "EN 10365"), "UPN": ("upn", "EN 10365"),
32
+ }
33
+ _cache = {}
34
+
35
+
36
+ def _rows(name):
37
+ if name not in _cache:
38
+ with open(os.path.join(os.path.dirname(__file__), "data", f"{name}.csv"), encoding="utf-8") as f:
39
+ text = f.read()
40
+ _cache[name] = [{k: _num(v) for k, v in r.items()} for r in csv.DictReader(text.splitlines())]
41
+ return _cache[name]
42
+
43
+
44
+ def _num(v):
45
+ if v == "":
46
+ return None
47
+ try:
48
+ return float(v)
49
+ except ValueError:
50
+ return v
51
+
52
+
53
+ def _s(v):
54
+ """CSV value back to its text form: 2.0 → '2', '1-1/2' → '1 1/2'."""
55
+ if isinstance(v, float) and v.is_integer():
56
+ v = int(v)
57
+ return str(v).replace("-", " ").upper()
58
+
59
+
60
+ def _key(label):
61
+ """'ISMB 200', 'ismb200', 'ISA 50x50x5', 'isa 50 X 50 X 5' → 'ismb200', 'isa50x50x5'."""
62
+ return re.sub(r"[^a-z0-9.]", "", str(label).lower())
63
+
64
+
65
+ def series(name):
66
+ """All sections of a series, lightest first, e.g. series("HEA")."""
67
+ s = name.upper()
68
+ if s not in SERIES:
69
+ raise KeyError(f"unknown series {name!r}; one of {', '.join(SERIES)}")
70
+ file, std = SERIES[s]
71
+ return [SimpleNamespace(series=s, standard=std, **r) for r in _rows(file)]
72
+
73
+
74
+ def find(label):
75
+ """The section with this designation, or None. Spaces and case don't matter: 'ipe300' == 'IPE 300'."""
76
+ k = _key(label)
77
+ for s in SERIES:
78
+ if k.startswith(s.lower()):
79
+ for sec in series(s):
80
+ if _key(sec.section) == k:
81
+ return sec
82
+ return None
83
+
84
+
85
+ def get(label):
86
+ """Like find(), but raises KeyError if there is no such section."""
87
+ sec = find(label)
88
+ if sec is None:
89
+ raise KeyError(f"no section {label!r}")
90
+ return sec
91
+
92
+
93
+ def pipe(nps, schedule="40"):
94
+ """Carbon steel pipe by nominal size and schedule: pipe("2", "40"), pipe("1-1/2", "80"), pipe("6", "STD")."""
95
+ nps, sch = _s(str(nps).replace('"', "").strip()), _s(str(schedule).upper().replace("SCH", "").strip())
96
+ for r in _rows("pipe-schedules"):
97
+ if _s(r["nps"]) == nps and _s(r["schedule"]) == sch:
98
+ return SimpleNamespace(**r)
99
+ raise KeyError(f"no pipe NPS {nps} schedule {schedule}")
100
+
101
+
102
+ def rebar(size):
103
+ """Rebar by US bar size ('#5', '5') or metric diameter (12, '12mm'). Weight in kg/m and lb/ft."""
104
+ s = str(size).lower().replace(" ", "")
105
+ if s.endswith("mm") or (isinstance(size, (int, float)) and size >= 6) or s.replace(".", "").isdigit() and float(s) >= 6:
106
+ d = float(s.replace("mm", ""))
107
+ for r in _rows("metric-rebar"):
108
+ if r["diameter_mm"] == d:
109
+ return SimpleNamespace(**r, weight_lb_ft=r["weight_kg_m"] * KG_M_TO_LB_FT)
110
+ else:
111
+ s = "#" + s.lstrip("#")
112
+ for r in _rows("us-rebar"):
113
+ if r["size"] == s:
114
+ return SimpleNamespace(**r)
115
+ raise KeyError(f"no rebar size {size!r}")
116
+
117
+
118
+ def gauge(number, material="steel"):
119
+ """Sheet metal gauge thickness in inches and mm: material steel, galvanized, stainless or aluminum."""
120
+ for r in _rows("gauges"):
121
+ if _s(r["gauge"]) == _s(number):
122
+ inch = r.get(f"{material}_in")
123
+ if inch is None:
124
+ raise KeyError(f"no {material} thickness for gauge {number}")
125
+ return SimpleNamespace(gauge=number, material=material, inch=inch, mm=inch * 25.4,
126
+ kg_m2=inch * 25.4 * DENSITY / 1000 if material != "aluminum" else None)
127
+ raise KeyError(f"no gauge {number}")
128
+
129
+
130
+ # Weight formulas: dimensions in mm, result in kg per metre (plate: kg per piece). Density in kg/m³.
131
+ def _kg_m(area_mm2, density):
132
+ return area_mm2 * density / 1e6
133
+
134
+
135
+ def flat_bar(width, thickness, density=DENSITY):
136
+ return _kg_m(width * thickness, density)
137
+
138
+
139
+ def round_bar(d, density=DENSITY):
140
+ return _kg_m(math.pi / 4 * d * d, density)
141
+
142
+
143
+ def square_bar(a, density=DENSITY):
144
+ return _kg_m(a * a, density)
145
+
146
+
147
+ def hex_bar(across_flats, density=DENSITY):
148
+ return _kg_m(math.sqrt(3) / 2 * across_flats ** 2, density)
149
+
150
+
151
+ def round_tube(od, wall, density=DENSITY):
152
+ return _kg_m(math.pi * (od - wall) * wall, density)
153
+
154
+
155
+ def rect_tube(width, height, wall, density=DENSITY):
156
+ """Square / rectangular hollow section with square corners (cold-formed tubes weigh ~1-3 % less)."""
157
+ return _kg_m(width * height - (width - 2 * wall) * (height - 2 * wall), density)
158
+
159
+
160
+ def angle(a, b, t, density=DENSITY):
161
+ """Equal or unequal angle with square corners (rolled angles with root radius weigh slightly more)."""
162
+ return _kg_m((a + b - t) * t, density)
163
+
164
+
165
+ def plate(length, width, thickness, density=DENSITY):
166
+ """Weight of one plate in kg, all dimensions in mm."""
167
+ return length * width * thickness * density / 1e9
@@ -0,0 +1,41 @@
1
+ """Command line: steel-sections ISMB 200 | steel-sections --series HEA | steel-sections --rebar 12 | --pipe 2 40 | --gauge 16"""
2
+ import argparse
3
+ import sys
4
+
5
+ from . import SERIES, gauge, get, pipe, rebar, series
6
+
7
+
8
+ def show(ns):
9
+ for k, v in vars(ns).items():
10
+ if v is not None:
11
+ print(f"{k:>18} {v:g}" if isinstance(v, float) else f"{k:>18} {v}")
12
+
13
+
14
+ def main(argv=None):
15
+ p = argparse.ArgumentParser(prog="steel-sections", description="Steel section weights and properties.")
16
+ p.add_argument("section", nargs="*", help='designation, e.g. "ISMB 200", ipe300, "ISA 50x50x5"')
17
+ p.add_argument("--series", help=f"list a series: {', '.join(SERIES)}")
18
+ p.add_argument("--rebar", help="rebar size: #5 or 12 (mm)")
19
+ p.add_argument("--pipe", nargs=2, metavar=("NPS", "SCHEDULE"), help="pipe size and schedule, e.g. 2 40")
20
+ p.add_argument("--gauge", help="sheet metal gauge")
21
+ a = p.parse_args(argv)
22
+ try:
23
+ if a.series:
24
+ for s in series(a.series):
25
+ print(f"{s.section:<20} {s.mass_kg_m:>8g} kg/m {s.mass_lb_ft:>8.2f} lb/ft")
26
+ elif a.rebar:
27
+ show(rebar(a.rebar))
28
+ elif a.pipe:
29
+ show(pipe(*a.pipe))
30
+ elif a.gauge:
31
+ show(gauge(a.gauge))
32
+ elif a.section:
33
+ show(get(" ".join(a.section)))
34
+ else:
35
+ p.print_help()
36
+ except KeyError as e:
37
+ sys.exit(str(e).strip("'\""))
38
+
39
+
40
+ if __name__ == "__main__":
41
+ main()
@@ -0,0 +1,199 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+
4
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
5
+
6
+ 1. Definitions.
7
+
8
+ "License" shall mean the terms and conditions for use, reproduction,
9
+ and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by
12
+ the copyright owner that is granting the License.
13
+
14
+ "Legal Entity" shall mean the union of the acting entity and all
15
+ other entities that control, are controlled by, or are under common
16
+ control with that entity. For the purposes of this definition,
17
+ "control" means (i) the power, direct or indirect, to cause the
18
+ direction or management of such entity, whether by contract or
19
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity
23
+ exercising permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications,
26
+ including but not limited to software source code, documentation
27
+ source, and configuration files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical
30
+ transformation or translation of a Source form, including but
31
+ not limited to compiled object code, generated documentation,
32
+ and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or
35
+ Object form, made available under the License, as indicated by a
36
+ copyright notice that is included in or attached to the work
37
+ (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding those notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ APPENDIX: How to apply the Apache License to your work.
178
+
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "printed page" as the copyright notice for easier
186
+ identification within third-party archives.
187
+
188
+ Copyright 2023 fib - Fédération Internationale du Béton
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+
195
+ Unless required by applicable law or agreed to in writing, software
196
+ distributed under the License is distributed on an "AS IS" BASIS,
197
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198
+ See the License for the specific language governing permissions and
199
+ limitations under the License.