struct_utils 0.0.1__py3-none-any.whl
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.
- struct_utils/__init__.py +2 -0
- struct_utils/general_utils/__init__.py +2 -0
- struct_utils/general_utils/logprint.py +132 -0
- struct_utils/software_utils/__init__.py +3 -0
- struct_utils/software_utils/folder_structure_tree.py +24 -0
- struct_utils/structural_utils/NASA_TM_108378_fitting_factor.py +228 -0
- struct_utils/structural_utils/__init__.py +17 -0
- struct_utils/structural_utils/bolt_pattern_elastic_method.py +755 -0
- struct_utils/structural_utils/bolt_pattern_elastic_method_README.md +60 -0
- struct_utils/structural_utils/margin_table.py +306 -0
- struct_utils/structural_utils/shared_helpers.py +46 -0
- struct_utils-0.0.1.dist-info/METADATA +70 -0
- struct_utils-0.0.1.dist-info/RECORD +15 -0
- struct_utils-0.0.1.dist-info/WHEEL +4 -0
- struct_utils-0.0.1.dist-info/licenses/LICENSE.txt +21 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
MODULE/FUNCTION: bolt_pattern_elastic_method.py
|
|
2
|
+
OBJECTIVE: Implements the elastic method from NASA RP-1228 for extracting fastener loads from arbitrary bolt patterns under arbitrary loading in 3D space.
|
|
3
|
+
STATUS: [UTILITY=<1>; STABILITY=<1>; VALIDATION=<1>; DOCUMENTATION=<0.5>;]
|
|
4
|
+
CODE LAST UPDATED: 2611
|
|
5
|
+
DOCUMENTATION LAST UPDATED: 2611
|
|
6
|
+
VALIDATION NOTES: Outputs verified against the calculator here: https://mechanicalc.com/reference/bolt-pattern-force-distribution
|
|
7
|
+
LIMITATIONS: All fasteners are assumed to be oriented in the same axis. Other limitations inherent to elastic method assumptions.
|
|
8
|
+
BUGS/QUIRKS: N/A
|
|
9
|
+
INPUTS: Bolt pattern fastener 2D positions and sizes and the location and magnitude of applied loads and moments at arbitrary 3D locations relative to the pattern centroid.
|
|
10
|
+
OUTPUTS: Returns pattern centroidal loads, Ic_p (moment of inertia of the pattern) and tensile and shear loads on each fastener, and saves an interactive 3D HTML plot of results.
|
|
11
|
+
DEPENDENCIES: plotly
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Example usage:
|
|
18
|
+
|
|
19
|
+
if __name__ == "__main__":
|
|
20
|
+
import os
|
|
21
|
+
import bolt_pattern_elastic_method
|
|
22
|
+
|
|
23
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
24
|
+
|
|
25
|
+
positions_1 = [(-3.5, 15), (3.5, 15), (-3.5, -15), (3.5, -15)
|
|
26
|
+
, (10, -15), (18.82, -12.14), (24.27, -4.635)
|
|
27
|
+
, (24.27, 4.635), (18.82, 12.14), (10, 15)
|
|
28
|
+
, (-10, 15), (-18.82, 12.14), (-24.27, 4.635)
|
|
29
|
+
, (-24.27, -4.635), (-18.82, -12.14), (-10, -15)] #[x,y]
|
|
30
|
+
|
|
31
|
+
# ------------------------------------------------------------------
|
|
32
|
+
# Example 1: 4-bolt rectangular pattern, in-plane eccentric shear
|
|
33
|
+
# A 1000 N force applied in X at (y=5) – creates torsion about Z
|
|
34
|
+
# ------------------------------------------------------------------
|
|
35
|
+
print("\nEXAMPLE 1 – General 3-D loading")
|
|
36
|
+
title="bolt_pattern_ex1"
|
|
37
|
+
analysis_1 = BoltPatternAnalysis(
|
|
38
|
+
bolts=[Bolt(x, y) for (x, y) in positions_1],
|
|
39
|
+
loads=[AppliedLoad(Fx=1500.0, Fy=500.0, Fz=5000.0, z=15.0),
|
|
40
|
+
AppliedLoad(Mz=1000.0)],
|
|
41
|
+
)
|
|
42
|
+
save_dir=os.path.join(HERE)
|
|
43
|
+
results_1 = analysis_1.solve()
|
|
44
|
+
print_results(results_1, analysis_1)
|
|
45
|
+
plot_bolt_pattern_3d(
|
|
46
|
+
analysis_1, results_1,
|
|
47
|
+
title=title,
|
|
48
|
+
show=False,
|
|
49
|
+
save_dir=save_dir,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
#bp.print_results(results_1, analysis_1)
|
|
53
|
+
max_tension = max(results_1, key=lambda r: r.Fz_total)
|
|
54
|
+
min_tension = min(results_1, key=lambda r: r.Fz_total)
|
|
55
|
+
max_shear = max(results_1, key=lambda r: r.F_shear)
|
|
56
|
+
min_shear = min(results_1, key=lambda r: r.F_shear)
|
|
57
|
+
print(f" Max tension (lbf): {max_tension.bolt.label:>6} Fz = {max_tension.Fz_total:+.2f}")
|
|
58
|
+
print(f" Min tension (lbf): {min_tension.bolt.label:>6} Fz = {min_tension.Fz_total:+.2f}")
|
|
59
|
+
print(f" Max shear (lbf): {max_shear.bolt.label:>6} Fs = {max_shear.F_shear:.2f}")
|
|
60
|
+
print(f" Min shear (lbf): {min_shear.bolt.label:>6} Fs = {min_shear.F_shear:.2f}")
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"""
|
|
2
|
+
margin_table.py — Structural Margin of Safety Summary
|
|
3
|
+
|
|
4
|
+
FI = (FOS × applied) / allowable
|
|
5
|
+
MS = 1/FI - 1 (positive = pass)
|
|
6
|
+
|
|
7
|
+
Single entry point: add_row(). The row type is inferred automatically:
|
|
8
|
+
- Supply fos_ult + allow_ult → stress row (yield & ultimate columns)
|
|
9
|
+
- Omit fos_ult / allow_ult → single-check row (specify metric=)
|
|
10
|
+
|
|
11
|
+
print_table() writes the console table AND saves margin_table.html.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import textwrap, datetime, os
|
|
15
|
+
|
|
16
|
+
rows = []
|
|
17
|
+
|
|
18
|
+
W = {"part": 18, "lc": 16, "metric": 13, "units": 5, "material": 14, "notes": 20}
|
|
19
|
+
|
|
20
|
+
# header width
|
|
21
|
+
NCOLS_SHARED = [("Applied", 11)]
|
|
22
|
+
NCOLS_YLD = [("FOS", 6), ("Allow (Yld)", 12), ("FI", 9), ("MS", 10)]
|
|
23
|
+
NCOLS_ULT = [("FOS", 6), ("Allow (Ult)", 12), ("FI", 9), ("MS", 10)]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def add_row(part, load_case, units, applied,
|
|
27
|
+
fos_yld, allow_yld,
|
|
28
|
+
fos_ult=None, allow_ult=None,
|
|
29
|
+
metric="VM Stress", material="", notes=""):
|
|
30
|
+
"""Add a margin row. Row type is inferred from whether fos_ult+allow_ult are supplied.
|
|
31
|
+
|
|
32
|
+
Stress row — yield & ultimate columns both populated:
|
|
33
|
+
add_row(part, load_case, units, applied,
|
|
34
|
+
fos_yld, allow_yld, fos_ult, allow_ult,
|
|
35
|
+
material=..., notes=...)
|
|
36
|
+
|
|
37
|
+
Single-check row — only the ultimate columns used, yield shows —:
|
|
38
|
+
add_row(part, load_case, units, applied,
|
|
39
|
+
fos_yld, allow_yld,
|
|
40
|
+
metric="Deflection", material=..., notes=...)
|
|
41
|
+
"""
|
|
42
|
+
if fos_ult is not None and allow_ult is not None:
|
|
43
|
+
# ── stress row: yield + ultimate ──────────────────────────────────────
|
|
44
|
+
fi_y = fos_yld * applied / allow_yld; ms_y = 1/fi_y - 1
|
|
45
|
+
fi_u = fos_ult * applied / allow_ult; ms_u = 1/fi_u - 1
|
|
46
|
+
rows.append(("stress", part, load_case, metric, units,
|
|
47
|
+
applied, fos_yld, allow_yld, fi_y, ms_y,
|
|
48
|
+
fos_ult, allow_ult, fi_u, ms_u,
|
|
49
|
+
material, notes))
|
|
50
|
+
else:
|
|
51
|
+
# ── single-check row ──────────────────────────────────────────────────
|
|
52
|
+
fi = fos_yld * applied / allow_yld; ms = 1/fi - 1
|
|
53
|
+
rows.append(("single", part, load_case, metric, units,
|
|
54
|
+
applied, fos_yld, allow_yld, fi, ms,
|
|
55
|
+
None, None, None, None,
|
|
56
|
+
material, notes))
|
|
57
|
+
|
|
58
|
+
# ── Formatting helpers ────────────────────────────────────────────────────────
|
|
59
|
+
def _n(v, w): # general numeric
|
|
60
|
+
if v is None: return f"{'—':>{w}}"
|
|
61
|
+
if abs(v) >= 100: return f"{v:>{w},.0f}"
|
|
62
|
+
if abs(v) >= 1: return f"{v:>{w},.3f}"
|
|
63
|
+
return f"{v:>{w}.4f}"
|
|
64
|
+
|
|
65
|
+
def _ms(v, w): # signed margin
|
|
66
|
+
return f"{v:>+{w}.4f}" if v is not None else f"{'—':>{w}}"
|
|
67
|
+
|
|
68
|
+
def _wrap(text, width):
|
|
69
|
+
return textwrap.wrap(str(text), width) or [""]
|
|
70
|
+
|
|
71
|
+
def _fmt(applied, fy, ay, fiy, msy, fu, au, fiu, msu):
|
|
72
|
+
return "".join([
|
|
73
|
+
_n(applied, NCOLS_SHARED[0][1]),
|
|
74
|
+
_n(fy, NCOLS_YLD[0][1]), _n(ay, NCOLS_YLD[1][1]),
|
|
75
|
+
_n(fiy, NCOLS_YLD[2][1]), _ms(msy,NCOLS_YLD[3][1]),
|
|
76
|
+
_n(fu, NCOLS_ULT[0][1]), _n(au, NCOLS_ULT[1][1]),
|
|
77
|
+
_n(fiu, NCOLS_ULT[2][1]), _ms(msu,NCOLS_ULT[3][1]),
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
# ── Console table ─────────────────────────────────────────────────────────────
|
|
81
|
+
def _print_console(analyst="", system=""):
|
|
82
|
+
sh = "".join(h.rjust(w) for h,w in NCOLS_SHARED)
|
|
83
|
+
yh = "".join(h.rjust(w) for h,w in NCOLS_YLD)
|
|
84
|
+
uh = "".join(h.rjust(w) for h,w in NCOLS_ULT)
|
|
85
|
+
|
|
86
|
+
tw = W["part"]+1 + W["lc"]+1 + W["metric"]+1 + W["units"]+1
|
|
87
|
+
|
|
88
|
+
H = (f"{'Part':<{W['part']}} {'Load Case':<{W['lc']}} "
|
|
89
|
+
f"{'Metric':<{W['metric']}} {'Units':<{W['units']}} {'Material':<{W['material']}} "
|
|
90
|
+
f"{sh}{yh}{uh} {'Notes':<{W['notes']}}")
|
|
91
|
+
sep = "-" * len(H)
|
|
92
|
+
|
|
93
|
+
ylab = "Yield".center(len(yh))
|
|
94
|
+
ulab = "Ultimate".center(len(uh))
|
|
95
|
+
mat_gap = W["material"] + 1
|
|
96
|
+
sub = (f"{'':^{tw}} {'':^{mat_gap}} {'':^{NCOLS_SHARED[0][1]}} {ylab} {ulab}")
|
|
97
|
+
|
|
98
|
+
if system: print(f" System : {system}")
|
|
99
|
+
if analyst: print(f" Analyst : {analyst}")
|
|
100
|
+
print(sep)
|
|
101
|
+
print(sub)
|
|
102
|
+
print(f"{'Part':<{W['part']}} {'Load Case':<{W['lc']}} "
|
|
103
|
+
f"{'Metric':<{W['metric']}} {'Units':<{W['units']}} {'Material':<{W['material']}} "
|
|
104
|
+
f"{sh}{yh}{uh} {'Notes':<{W['notes']}}")
|
|
105
|
+
print(sep)
|
|
106
|
+
|
|
107
|
+
for r in rows:
|
|
108
|
+
kind = r[0]
|
|
109
|
+
part, lc, metric, units = r[1], r[2], r[3], r[4]
|
|
110
|
+
applied = r[5]
|
|
111
|
+
if kind == "stress":
|
|
112
|
+
fy, ay, fiy, msy = r[6], r[7], r[8], r[9]
|
|
113
|
+
fu, au, fiu, msu = r[10], r[11], r[12], r[13]
|
|
114
|
+
else:
|
|
115
|
+
fy, ay, fiy, msy = None, None, None, None
|
|
116
|
+
fu, au, fiu, msu = r[6], r[7], r[8], r[9]
|
|
117
|
+
material = r[14]
|
|
118
|
+
notes = r[15]
|
|
119
|
+
|
|
120
|
+
fail = (msy is not None and msy < 0) or (msu is not None and msu < 0)
|
|
121
|
+
flag = " ← FAIL" if fail else ""
|
|
122
|
+
nums = _fmt(applied, fy, ay, fiy, msy, fu, au, fiu, msu)
|
|
123
|
+
blank = " " * len(nums)
|
|
124
|
+
|
|
125
|
+
ps = _wrap(part, W["part"])
|
|
126
|
+
ls = _wrap(lc, W["lc"])
|
|
127
|
+
mts = _wrap(metric, W["metric"])
|
|
128
|
+
mats = _wrap(material, W["material"])
|
|
129
|
+
ns = _wrap(notes, W["notes"])
|
|
130
|
+
for i in range(max(len(ps), len(ls), len(mts), len(mats), len(ns))):
|
|
131
|
+
p = (ps[i] if i < len(ps) else "").ljust(W["part"])
|
|
132
|
+
l = (ls[i] if i < len(ls) else "").ljust(W["lc"])
|
|
133
|
+
m = (mts[i] if i < len(mts) else "").ljust(W["metric"])
|
|
134
|
+
u = (units if i == 0 else "").ljust(W["units"])
|
|
135
|
+
a = (mats[i] if i < len(mats) else "").ljust(W["material"])
|
|
136
|
+
n = (ns[i] if i < len(ns) else "").ljust(W["notes"])
|
|
137
|
+
print(f"{p} {l} {m} {u} {a} {nums if i==0 else blank} {n}{flag if i==0 else ''}")
|
|
138
|
+
|
|
139
|
+
print(sep)
|
|
140
|
+
|
|
141
|
+
# ── HTML helpers ──────────────────────────────────────────────────────────────
|
|
142
|
+
def _fi_color(fi):
|
|
143
|
+
"""CSS background color keyed on FI value (FI < 1.0 = pass)."""
|
|
144
|
+
if fi is None: return "#e8e8e8" # grey — N/A
|
|
145
|
+
if fi > 1.0: return "#f28b82" # red — FAIL
|
|
146
|
+
if fi > 0.90: return "#ffd666" # amber — tight (FI 0.90–1.0)
|
|
147
|
+
if fi > 0.70: return "#fff475" # yellow— adequate (FI 0.70–0.90)
|
|
148
|
+
return "#a8d5a2" # green — comfortable (FI < 0.70)
|
|
149
|
+
|
|
150
|
+
def _fi_text(fi):
|
|
151
|
+
"""White text on red for failing cells, dark otherwise."""
|
|
152
|
+
return "#ffffff" if fi is not None and fi > 1.0 else "#111111"
|
|
153
|
+
|
|
154
|
+
def _fmt_val(v, is_ms=False):
|
|
155
|
+
if v is None: return "—"
|
|
156
|
+
if is_ms: return f"{v:+.4f}"
|
|
157
|
+
if abs(v) >= 100: return f"{v:,.0f}"
|
|
158
|
+
if abs(v) >= 1: return f"{v:,.3f}"
|
|
159
|
+
return f"{v:.4f}"
|
|
160
|
+
|
|
161
|
+
def _th(txt, extra=""):
|
|
162
|
+
return f'<th {extra}>{txt}</th>'
|
|
163
|
+
|
|
164
|
+
def _write_html(path, analyst="", system=""):
|
|
165
|
+
ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
|
|
166
|
+
meta = f" Generated: {ts}"
|
|
167
|
+
if system: meta += f" | System: <strong>{system}</strong>"
|
|
168
|
+
if analyst: meta += f" | Analyst: <strong>{analyst}</strong>"
|
|
169
|
+
meta += (f" | FI = (FOS × Applied) / Allowable"
|
|
170
|
+
f" | MS = 1/FI − 1"
|
|
171
|
+
f" <strong style=\"color:#cba6f7\">(MS > 0 = pass, FI < 1 = pass)</strong>")
|
|
172
|
+
CELL = "#2a2a3e" # neutral dark background for all non-FI cells
|
|
173
|
+
|
|
174
|
+
rows_html = []
|
|
175
|
+
for r in rows:
|
|
176
|
+
kind = r[0]
|
|
177
|
+
part = r[1]; lc = r[2]; metric = r[3]; units = r[4]
|
|
178
|
+
applied = r[5]
|
|
179
|
+
if kind == "stress":
|
|
180
|
+
fy, ay, fiy, msy = r[6], r[7], r[8], r[9]
|
|
181
|
+
fu, au, fiu, msu = r[10], r[11], r[12], r[13]
|
|
182
|
+
else:
|
|
183
|
+
fy, ay, fiy, msy = None, None, None, None
|
|
184
|
+
fu, au, fiu, msu = r[6], r[7], r[8], r[9]
|
|
185
|
+
material = r[14]
|
|
186
|
+
notes = r[15]
|
|
187
|
+
|
|
188
|
+
def c(txt, align="right", bg=CELL, bold=False, color="#cdd6f4"):
|
|
189
|
+
style = f"background:{bg};text-align:{align};color:{color};"
|
|
190
|
+
if bold: style += "font-weight:bold;"
|
|
191
|
+
return f'<td style="{style}">{txt}</td>'
|
|
192
|
+
|
|
193
|
+
cells = c(part, align="left")
|
|
194
|
+
cells += c(lc, align="left")
|
|
195
|
+
cells += c(metric, align="left")
|
|
196
|
+
cells += c(units, align="center")
|
|
197
|
+
cells += c(material, align="left") # ← after units
|
|
198
|
+
cells += c(_fmt_val(applied))
|
|
199
|
+
# yield block — only FI cell is colored
|
|
200
|
+
cells += c(_fmt_val(fy))
|
|
201
|
+
cells += c(_fmt_val(ay))
|
|
202
|
+
cells += c(_fmt_val(fiy),
|
|
203
|
+
bg=_fi_color(fiy), bold=True, color=_fi_text(fiy))
|
|
204
|
+
cells += c(_fmt_val(msy, is_ms=True))
|
|
205
|
+
# ultimate block
|
|
206
|
+
cells += c(_fmt_val(fu))
|
|
207
|
+
cells += c(_fmt_val(au))
|
|
208
|
+
cells += c(_fmt_val(fiu),
|
|
209
|
+
bg=_fi_color(fiu), bold=True, color=_fi_text(fiu))
|
|
210
|
+
cells += c(_fmt_val(msu, is_ms=True))
|
|
211
|
+
cells += c(notes, align="left")
|
|
212
|
+
|
|
213
|
+
rows_html.append(f" <tr>{cells}</tr>")
|
|
214
|
+
|
|
215
|
+
table_body = "\n".join(rows_html)
|
|
216
|
+
|
|
217
|
+
html = f"""<!DOCTYPE html>
|
|
218
|
+
<html lang="en">
|
|
219
|
+
<head>
|
|
220
|
+
<meta charset="UTF-8">
|
|
221
|
+
<title>Margin of Safety Summary</title>
|
|
222
|
+
<style>
|
|
223
|
+
body {{ font-family: 'Segoe UI', Arial, sans-serif; font-size: 13px;
|
|
224
|
+
background: #1e1e2e; color: #cdd6f4; margin: 24px; }}
|
|
225
|
+
h2 {{ color: #cba6f7; margin-bottom: 4px; letter-spacing: 0.5px; }}
|
|
226
|
+
p.ts {{ color: #6c7086; font-size: 11px; margin-top: 0; margin-bottom: 16px; }}
|
|
227
|
+
.wrap {{ overflow-x: auto; }}
|
|
228
|
+
table {{ border-collapse: collapse; min-width: 100%; }}
|
|
229
|
+
th {{ background: #313244; color: #cba6f7; padding: 6px 10px;
|
|
230
|
+
border: 1px solid #45475a; white-space: nowrap; font-size: 12px;
|
|
231
|
+
position: sticky; top: 0; z-index: 2; }}
|
|
232
|
+
td {{ padding: 5px 10px; border: 1px solid #45475a;
|
|
233
|
+
white-space: nowrap; font-size: 12px; }}
|
|
234
|
+
tr:hover td {{ filter: brightness(1.12); }}
|
|
235
|
+
.legend {{ display: flex; gap: 20px; margin-top: 14px; align-items: center;
|
|
236
|
+
flex-wrap: wrap; }}
|
|
237
|
+
.leg-item {{ display: flex; align-items: center; gap: 6px; font-size: 12px; }}
|
|
238
|
+
.swatch {{ width: 16px; height: 16px; border-radius: 3px;
|
|
239
|
+
border: 1px solid #45475a; display: inline-block; flex-shrink: 0; }}
|
|
240
|
+
</style>
|
|
241
|
+
</head>
|
|
242
|
+
<body>
|
|
243
|
+
<h2>Structural Margin of Safety Summary</h2>
|
|
244
|
+
<p class="ts">
|
|
245
|
+
{meta}
|
|
246
|
+
</p>
|
|
247
|
+
<div class="wrap">
|
|
248
|
+
<table>
|
|
249
|
+
<thead>
|
|
250
|
+
<tr>
|
|
251
|
+
{_th('Part', 'rowspan="2" style="text-align:left"')}
|
|
252
|
+
{_th('Load Case', 'rowspan="2" style="text-align:left"')}
|
|
253
|
+
{_th('Metric', 'rowspan="2" style="text-align:left"')}
|
|
254
|
+
{_th('Units', 'rowspan="2"')}
|
|
255
|
+
{_th('Material', 'rowspan="2" style="text-align:left"')}
|
|
256
|
+
{_th('Applied', 'rowspan="2"')}
|
|
257
|
+
{_th('——— Yield ———', 'colspan="4"')}
|
|
258
|
+
{_th('——— Ultimate ———','colspan="4"')}
|
|
259
|
+
{_th('Notes', 'rowspan="2" style="text-align:left"')}
|
|
260
|
+
</tr>
|
|
261
|
+
<tr>
|
|
262
|
+
{_th('FOS')}{_th('Allowable')}{_th('FI')}{_th('MS')}
|
|
263
|
+
{_th('FOS')}{_th('Allowable')}{_th('FI')}{_th('MS')}
|
|
264
|
+
</tr>
|
|
265
|
+
</thead>
|
|
266
|
+
<tbody>
|
|
267
|
+
{table_body}
|
|
268
|
+
</tbody>
|
|
269
|
+
</table>
|
|
270
|
+
</body>
|
|
271
|
+
</html>
|
|
272
|
+
"""
|
|
273
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
274
|
+
f.write(html)
|
|
275
|
+
print(f" [margin_table] HTML saved → {os.path.abspath(path)}")
|
|
276
|
+
|
|
277
|
+
# ── Public entry point ────────────────────────────────────────────────────────
|
|
278
|
+
def print_table(analyst="", system="", html_path="margin_table.html"):
|
|
279
|
+
"""Print console table and write margin_table.html alongside it."""
|
|
280
|
+
_print_console(analyst, system)
|
|
281
|
+
_write_html(html_path, analyst, system)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
# ── Demo ──────────────────────────────────────────────────────────────────────
|
|
285
|
+
"""if __name__ == "__main__":
|
|
286
|
+
# Stress row: fos_ult + allow_ult supplied → yield & ultimate columns
|
|
287
|
+
add_row("Wing Spar Cap", "2.5g Pull-up", "psi", 42800,
|
|
288
|
+
fos_yld=1.5, allow_yld=65000, fos_ult=1.5, allow_ult=80000,
|
|
289
|
+
material="Al 7075-T6", notes="Fwd spar")
|
|
290
|
+
# Single-check row: fos_ult omitted → metric= required
|
|
291
|
+
add_row("Wing Spar Cap", "2.5g Pull-up", "in", 0.45,
|
|
292
|
+
fos_yld=1.0, allow_yld=0.75,
|
|
293
|
+
metric="Tip Deflection", material="Al 7075-T6", notes="Stiffness limit")
|
|
294
|
+
add_row("Fuselage Frame 3", "Landing 3.0g", "psi", 71200,
|
|
295
|
+
fos_yld=1.5, allow_yld=65000, fos_ult=1.5, allow_ult=80000,
|
|
296
|
+
material="Al 2024-T3", notes="Recheck load")
|
|
297
|
+
add_row("Fuselage Frame 3", "Pressurization", "psi", 12000,
|
|
298
|
+
fos_yld=1.0, allow_yld=18000, fos_ult=1.5, allow_ult=22000,
|
|
299
|
+
material="Al 2024-T3", notes="Hoop stress")
|
|
300
|
+
add_row("Fastener #A7", "2.5g Pull-up", "lbf", 9500,
|
|
301
|
+
fos_yld=1.5, allow_yld=14000,
|
|
302
|
+
metric="Shear Force", material="A286 CRES", notes="AN3 bolt, ult shear")
|
|
303
|
+
add_row("Panel — Fwd Skin", "Compression 2.5g", "lbf", 4200,
|
|
304
|
+
fos_yld=1.5, allow_yld=7500,
|
|
305
|
+
metric="Buckling Load", material="Al 7075-T6", notes="Eigenvalue buckling")
|
|
306
|
+
print_table()"""
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
3
|
+
#### shared_helpers.py
|
|
4
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
5
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
6
|
+
# FUNCTIONS:
|
|
7
|
+
# von_mises
|
|
8
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
13
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
14
|
+
#Function: VM_stress_function
|
|
15
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
16
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
17
|
+
"""
|
|
18
|
+
MODULE/FUNCTION: von_mises
|
|
19
|
+
OBJECTIVE:
|
|
20
|
+
STATUS: [UTILITY=<1>; STABILITY=<1>; VALIDATION=<1>; DOCUMENTATION=<0,1,-1>;]
|
|
21
|
+
CODE LAST UPDATED:
|
|
22
|
+
DOCUMENTATION LAST UPDATED:
|
|
23
|
+
VALIDATION NOTES:
|
|
24
|
+
LIMITATIONS:
|
|
25
|
+
BUGS:
|
|
26
|
+
INPUTS:
|
|
27
|
+
OUTPUTS:
|
|
28
|
+
TODO:
|
|
29
|
+
DEPENDENCIES: numpy
|
|
30
|
+
"""
|
|
31
|
+
import numpy as np
|
|
32
|
+
def von_mises(sx, sy, sz, txy, txz, tyz):
|
|
33
|
+
"""Von Mises equivalent stress — accepts scalars or equal-length arrays."""
|
|
34
|
+
return np.sqrt(0.5*((sx-sy)**2 + (sy-sz)**2 + (sz-sx)**2)
|
|
35
|
+
+ 3*(txy**2 + txz**2 + tyz**2))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
43
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
44
|
+
#Function: margin_table
|
|
45
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
46
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: struct_utils
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Development package consisting of many small utility functions, mainly oriented towards structural engineering. Currently structured for personal use, hit me up if there is interest in further development of additional or extended functionality. Published functions should be feature complete. USERS ASSUME FULL RISK AND RESPONSIBILITY FOR VERIFYING THAT THE RESULTS ARE ACCURATE AND APPROPRIATE FOR THEIR APPLICATION.
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026 A-Thomas-eng
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
License-File: LICENSE.txt
|
|
27
|
+
Keywords: engineering,mechanical,utilities,structural,fastener,fasteners,bolt,bolts,stress,materials,NASA
|
|
28
|
+
Author: T. Andrade
|
|
29
|
+
Author-email: andrade.thomas.eng@gmail.com
|
|
30
|
+
Requires-Python: >=3,<4
|
|
31
|
+
Classifier: Development Status :: 1 - Planning
|
|
32
|
+
Classifier: Intended Audience :: Science/Research
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
40
|
+
Classifier: Operating System :: OS Independent
|
|
41
|
+
Requires-Dist: matplotlib (>=3.7)
|
|
42
|
+
Requires-Dist: numpy (>=1.24)
|
|
43
|
+
Requires-Dist: pandas (>=3.0.0)
|
|
44
|
+
Requires-Dist: pint (>=0.25.2)
|
|
45
|
+
Requires-Dist: plotly (>=6.6.0)
|
|
46
|
+
Requires-Dist: uncertainties (>=3.2.3)
|
|
47
|
+
Project-URL: Homepage, https://github.com/A-Thomas-eng/
|
|
48
|
+
Project-URL: Owner_contact, https://www.linkedin.com/in/andrade-t/
|
|
49
|
+
Project-URL: PIP, https://pypi.org/user/eng_calcs/
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
Development package consisting of many small utility functions, mostly for structural engineering. Currently oriented for personal use, hit me up if there is interest in further development of these tools. USERS ASSUME FULL RISK AND RESPONSIBILITY FOR VERIFYING THAT THE RESULTS ARE ACCURATE AND APPROPRIATE FOR THEIR APPLICATION.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Engineering is a series of approximations. There is always a risk of errors, Validate the assumptions, models, and implementation of the methods provided are appropriate for your usecase prior to using any of these utilities. Always version lock your use of these packages, as the packages are subject to change.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Main modules:
|
|
59
|
+
│ └── eng_utils
|
|
60
|
+
│ ├── general_utils
|
|
61
|
+
│ │ └── logprint.py (from .logprint import logprint)
|
|
62
|
+
│ ├── software_utils
|
|
63
|
+
│ │ └── folder_structure_tree.py (from .folder_structure_tree import folder_structure_tree)
|
|
64
|
+
│ ├── structural_utils
|
|
65
|
+
│ │ ├── bolt_pattern_elastic_method.py (from .bolt_pattern_elastic_method import (Bolt, AppliedLoad, BoltResult, BoltPatternAnalysis, bolt_pattern_force_distribution, plot_bolt_pattern_3d, print_results))
|
|
66
|
+
│ │ ├── NASA_TM_108378_fitting_factor.py (from .NASA_TM_108378_fitting_factor import NASA_TM_108378_fitting_factor)
|
|
67
|
+
│ │ ├── margin_table.py (from .margin_table import add_row, print_table)
|
|
68
|
+
│ │ └── shared_helpers.py (from .shared_helpers import von_mises)
|
|
69
|
+
|
|
70
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
struct_utils/__init__.py,sha256=LxbeQ-pkWy_60mU8ChPrIF90QA7PFKHxb3kkyXSpRlU,34
|
|
2
|
+
struct_utils/general_utils/__init__.py,sha256=c5pd3OArtTpxFhPbdwg7VOUiTZbEGb0ad5mXc886HIk,34
|
|
3
|
+
struct_utils/general_utils/logprint.py,sha256=u4NwJU9bedB0_J4v1NEkBFpIl3kMQQ_MdUaNpE0pgh4,4428
|
|
4
|
+
struct_utils/software_utils/__init__.py,sha256=f5flh8s9qS3b6UG_Uf69hLedWL0zmOl9SJIBU3CSEKc,65
|
|
5
|
+
struct_utils/software_utils/folder_structure_tree.py,sha256=4Ti9Zv-L1GqOOHZU5W7NJB1cGgXmVfDZ2kiHL0hm1cE,676
|
|
6
|
+
struct_utils/structural_utils/__init__.py,sha256=FySHaODNV3gyKIXqrwdVBPjTVxoZYoi6ULgpv391gAM,542
|
|
7
|
+
struct_utils/structural_utils/bolt_pattern_elastic_method.py,sha256=H33aYBfmmCOGU9e56Olc6R4bisd8sL8ekhI4h2e0oso,29151
|
|
8
|
+
struct_utils/structural_utils/bolt_pattern_elastic_method_README.md,sha256=RmNXGuB5GAUYOaacdaytVg36hEIMYS08kSR_e6TPu_s,3061
|
|
9
|
+
struct_utils/structural_utils/margin_table.py,sha256=bNPYJ4quklat3nPIy3wT1pJJKUBw7FLc9KBt2Bv1wi0,14174
|
|
10
|
+
struct_utils/structural_utils/NASA_TM_108378_fitting_factor.py,sha256=MBwfoTbJRdXHaN72BnAh8k6ayzwyxkywVXs1xLJ0CaM,19314
|
|
11
|
+
struct_utils/structural_utils/shared_helpers.py,sha256=UDv7lXEwLp2aEB0L3x3CgJl2HJr9t6siEz8dHXYtPII,2403
|
|
12
|
+
struct_utils-0.0.1.dist-info/licenses/LICENSE.txt,sha256=BXlZtMKXvEOK26JbK25vtTbbCZ9ILOIUgX2PhwQRYjQ,1069
|
|
13
|
+
struct_utils-0.0.1.dist-info/METADATA,sha256=qTFRMvXc20AKVlH4AhxRR1y0mAdlMtFsUp0NHhSM3yE,4380
|
|
14
|
+
struct_utils-0.0.1.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
15
|
+
struct_utils-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 A-Thomas-eng
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|