Skip to content

Commit 77afad8

Browse files
committed
Moved imports for rhino libraries into rhino methods
1 parent 8655277 commit 77afad8

23 files changed

+6305
-57
lines changed

.coverage

52 KB
Binary file not shown.

.ipynb_checkpoints/Dissimilar_Materials_Error-checkpoint.ipynb

Lines changed: 151 additions & 0 deletions
Large diffs are not rendered by default.

.ipynb_checkpoints/Nastran Plastic Property Error-checkpoint.ipynb

Lines changed: 280 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 5
6+
}
Lines changed: 387 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,387 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "1d13607b-3d09-4207-aebe-86b8c31fede8",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"%load_ext autoreload\n",
11+
"%autoreload 2"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 21,
17+
"id": "b0191929-3433-4b25-84dd-47280c4ce3f1",
18+
"metadata": {},
19+
"outputs": [
20+
{
21+
"ename": "TypeError",
22+
"evalue": "'Geometry' object is not subscriptable",
23+
"output_type": "error",
24+
"traceback": [
25+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
26+
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
27+
"\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_14388/3499978206.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 27\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 28\u001b[0m \u001b[0msuper_t\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mbridge_sections\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msuper_t_girder_section\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mgirder_type\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mw\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mw\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmaterial\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mprecast\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 29\u001b[1;33m \u001b[0mslab\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mstandard_sections\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrectangular_section\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0md\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mDslab\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mw\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmaterial\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0minsitu\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0malign_center\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msuper_t\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0malign_to\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msuper_t\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"top\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 30\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 31\u001b[0m \u001b[0mgeom\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msuper_t\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mslab\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
28+
"\u001b[1;32m~\\Notebooks\\package_development\\section-properties\\sectionproperties\\pre\\geometry.py\u001b[0m in \u001b[0;36malign_to\u001b[1;34m(self, other, on, inner)\u001b[0m\n\u001b[0;32m 442\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 443\u001b[0m \u001b[0mother_extents\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mother\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 444\u001b[1;33m \u001b[0malign_to_coord\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mother_extents\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0malign_to_idx\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 445\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 446\u001b[0m \u001b[0moffset\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0malign_to_coord\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mself_align_coord\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
29+
"\u001b[1;31mTypeError\u001b[0m: 'Geometry' object is not subscriptable"
30+
]
31+
}
32+
],
33+
"source": [
34+
"import sectionproperties.pre.library.bridge_sections as bridge_sections\n",
35+
"import sectionproperties.pre.library.primitive_sections as standard_sections\n",
36+
"from sectionproperties.pre.pre import Material\n",
37+
"from sectionproperties.analysis.section import Section\n",
38+
"from sectionproperties.pre.geometry import CompoundGeometry\n",
39+
"# from shapely.wkt import loads, dumps\n",
40+
"from shapely.geometry import Polygon, MultiPolygon\n",
41+
"\n",
42+
"Dslab, w, t_f = 180, 2100, 75\n",
43+
"\n",
44+
"precast = Material(\n",
45+
" name=\"65 MPa\",\n",
46+
" elastic_modulus=37.4e3,\n",
47+
" poissons_ratio=0.2,\n",
48+
" yield_strength=65,\n",
49+
" density=2.4e-6,\n",
50+
" color=\"grey\",\n",
51+
")\n",
52+
"insitu = Material(\n",
53+
" name=\"40 MPa\",\n",
54+
" elastic_modulus=32.8e3,\n",
55+
" poissons_ratio=0.2,\n",
56+
" yield_strength=40,\n",
57+
" density=2.4e-6,\n",
58+
" color=\"lightgrey\",\n",
59+
")\n",
60+
"\n",
61+
"super_t = bridge_sections.super_t_girder_section(girder_type=5, w=w, material=precast)\n",
62+
"slab = standard_sections.rectangular_section(d=Dslab, b=w, material=insitu).align_center(super_t).align_to(super_t, \"top\")\n",
63+
"\n",
64+
"geom = super_t + slab\n",
65+
"geom.plot_geometry(labels=['points', 'facets'])\n",
66+
"geom\n",
67+
"# need to add a hole?\n",
68+
"# geom.holes.append([0, -Dslab])\n",
69+
"\n",
70+
"\n",
71+
"# geom.create_mesh(mesh_sizes=[500])\n",
72+
"\n",
73+
"# sec = Section(geom)\n",
74+
"# sec.plot_mesh()\n",
75+
"\n",
76+
"# sec.calculate_geometric_properties()\n",
77+
"# sec.calculate_warping_properties()\n",
78+
"# sec.display_results(fmt=\".3f\")"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": 4,
84+
"id": "b01012ae-fea8-4cc7-b33c-52d01910ab42",
85+
"metadata": {},
86+
"outputs": [
87+
{
88+
"data": {
89+
"text/plain": [
90+
"'POLYGON ((398.7715041472865 50, 423.7715041472865 50, 423.7715041472865 75, 1050 75, 1050 13, 1037 0, 613.5 0, 506.42670409480445 -75, 344.2440591535388 -1712, 330.0125320599427 -1725, -330.0125320599427 -1725, -344.2440591535388 -1712, -506.42670409480445 -75, -613.5 0, -1037 0, -1050 13, -1050 75, -423.7715041472865 75, -423.7715041472865 50, -398.7715041472865 50, -266.12378458128774 -1350.2293277386782, 0 -1400, 266.12378458128774 -1350.2293277386782, 398.7715041472865 50))'"
91+
]
92+
},
93+
"execution_count": 4,
94+
"metadata": {},
95+
"output_type": "execute_result"
96+
}
97+
],
98+
"source": [
99+
"super_t.geom.wkt"
100+
]
101+
},
102+
{
103+
"cell_type": "code",
104+
"execution_count": 5,
105+
"id": "ff3c8350-2a93-4eaf-ad07-5bfdfeefbd05",
106+
"metadata": {},
107+
"outputs": [
108+
{
109+
"data": {
110+
"text/plain": [
111+
"'POLYGON ((-1050 75.00000000000011, 1050 75.00000000000011, 1050 255.0000000000001, -1050 255.0000000000001, -1050 75.00000000000011))'"
112+
]
113+
},
114+
"execution_count": 5,
115+
"metadata": {},
116+
"output_type": "execute_result"
117+
}
118+
],
119+
"source": [
120+
"slab.geom.wkt"
121+
]
122+
},
123+
{
124+
"cell_type": "code",
125+
"execution_count": 10,
126+
"id": "1e77f59d-1059-48c7-8dad-737c5a62f318",
127+
"metadata": {},
128+
"outputs": [
129+
{
130+
"name": "stdout",
131+
"output_type": "stream",
132+
"text": [
133+
"0 [0, 1]\n",
134+
"1 [1, 2]\n",
135+
"2 [2, 3]\n",
136+
"3 [3, 4]\n",
137+
"4 [4, 5]\n",
138+
"5 [5, 6]\n",
139+
"6 [6, 7]\n",
140+
"7 [7, 8]\n",
141+
"8 [8, 9]\n",
142+
"9 [9, 10]\n",
143+
"10 [10, 11]\n",
144+
"11 [11, 12]\n",
145+
"12 [12, 13]\n",
146+
"13 [13, 14]\n",
147+
"14 [14, 15]\n",
148+
"15 [15, 16]\n",
149+
"16 [16, 17]\n",
150+
"17 [17, 18]\n",
151+
"18 [18, 19]\n",
152+
"19 [19, 20]\n",
153+
"20 [20, 21]\n",
154+
"21 [21, 22]\n",
155+
"22 [22, 0]\n",
156+
"23 [16, 3]\n",
157+
"24 [3, 23]\n",
158+
"25 [23, 24]\n",
159+
"26 [24, 16]\n"
160+
]
161+
}
162+
],
163+
"source": [
164+
"for idx, facet in enumerate(geom.facets):\n",
165+
" print(idx, facet)"
166+
]
167+
},
168+
{
169+
"cell_type": "code",
170+
"execution_count": 11,
171+
"id": "6eebbb82-8556-44a1-8a10-947454b0a6cb",
172+
"metadata": {},
173+
"outputs": [
174+
{
175+
"data": {
176+
"text/plain": [
177+
"[[398.771504147287, 50.0],\n",
178+
" [423.771504147287, 50.0],\n",
179+
" [423.771504147287, 75.0],\n",
180+
" [1050.0, 75.0],\n",
181+
" [1050.0, 13.0],\n",
182+
" [1037.0, 0.0],\n",
183+
" [613.5, 0.0],\n",
184+
" [506.426704094804, -75.0],\n",
185+
" [344.244059153539, -1712.0],\n",
186+
" [330.012532059943, -1725.0],\n",
187+
" [-330.012532059943, -1725.0],\n",
188+
" [-344.244059153539, -1712.0],\n",
189+
" [-506.426704094804, -75.0],\n",
190+
" [-613.5, 0.0],\n",
191+
" [-1037.0, 0.0],\n",
192+
" [-1050.0, 13.0],\n",
193+
" [-1050.0, 75.0],\n",
194+
" [-423.771504147287, 75.0],\n",
195+
" [-423.771504147287, 50.0],\n",
196+
" [-398.771504147287, 50.0],\n",
197+
" [-266.123784581288, -1350.229327738678],\n",
198+
" [0.0, -1400.0],\n",
199+
" [266.123784581288, -1350.229327738678],\n",
200+
" [1050.0, 255.0],\n",
201+
" [-1050.0, 255.0]]"
202+
]
203+
},
204+
"execution_count": 11,
205+
"metadata": {},
206+
"output_type": "execute_result"
207+
}
208+
],
209+
"source": [
210+
"geom.points"
211+
]
212+
},
213+
{
214+
"cell_type": "code",
215+
"execution_count": 12,
216+
"id": "e1eb42a6-55b0-42db-81aa-217720f1e83f",
217+
"metadata": {},
218+
"outputs": [
219+
{
220+
"name": "stdout",
221+
"output_type": "stream",
222+
"text": [
223+
"sectionproperties.pre.geometry.CompoundGeometry\n",
224+
"object at: 0x2bd3304dee0\n",
225+
"Materials incl.: ['40 MPa']\n"
226+
]
227+
},
228+
{
229+
"data": {
230+
"image/svg+xml": [
231+
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"300\" height=\"300\" viewBox=\"-1134.0 -1809.0 2268.0 2148.0\" preserveAspectRatio=\"xMinYMin meet\"><g transform=\"matrix(1,0,0,-1,0,-1470.0)\"><g><path fill-rule=\"evenodd\" fill=\"#66cc99\" stroke=\"#555555\" stroke-width=\"15.12\" opacity=\"0.6\" d=\"M -1050.0,75.00000000000011 L 1050.0,75.00000000000011 L 1050.0,255.0000000000001 L -1050.0,255.0000000000001 L -1050.0,75.00000000000011 z\" /><path fill-rule=\"evenodd\" fill=\"#66cc99\" stroke=\"#555555\" stroke-width=\"15.12\" opacity=\"0.6\" d=\"M 398.7715041472865,50.0 L 423.7715041472865,50.0 L 423.7715041472865,75.0 L 1050.0,75.0 L 1050.0,13.0 L 1037.0,0.0 L 613.5,0.0 L 506.42670409480445,-75.0 L 344.2440591535388,-1712.0 L 330.0125320599427,-1725.0 L -330.0125320599427,-1725.0 L -344.2440591535388,-1712.0 L -506.42670409480445,-75.0 L -613.5,0.0 L -1037.0,0.0 L -1050.0,13.0 L -1050.0,75.0 L -423.7715041472865,75.0 L -423.7715041472865,50.0 L -398.7715041472865,50.0 L -266.12378458128774,-1350.2293277386782 L 0.0,-1400.0 L 266.12378458128774,-1350.2293277386782 L 398.7715041472865,50.0 z\" /></g></g></svg>"
232+
],
233+
"text/plain": [
234+
"<sectionproperties.pre.geometry.CompoundGeometry at 0x2bd3304dee0>"
235+
]
236+
},
237+
"execution_count": 12,
238+
"metadata": {},
239+
"output_type": "execute_result"
240+
}
241+
],
242+
"source": [
243+
"slab | super_t"
244+
]
245+
},
246+
{
247+
"cell_type": "code",
248+
"execution_count": 17,
249+
"id": "d8efe6d4-a7fb-482d-a3ac-c861fcd17d05",
250+
"metadata": {},
251+
"outputs": [
252+
{
253+
"data": {
254+
"text/plain": [
255+
"'POLYGON ((-1050 75.00000000000011, 1050 75.00000000000011, 1050 255.0000000000001, -1050 255.0000000000001, -1050 75.00000000000011))'"
256+
]
257+
},
258+
"execution_count": 17,
259+
"metadata": {},
260+
"output_type": "execute_result"
261+
}
262+
],
263+
"source": [
264+
"slab.geom.wkt"
265+
]
266+
},
267+
{
268+
"cell_type": "code",
269+
"execution_count": 16,
270+
"id": "94cd9b9f-04ea-48bf-9612-2ad0c8ac7278",
271+
"metadata": {},
272+
"outputs": [
273+
{
274+
"data": {
275+
"text/plain": [
276+
"[(-1050.0, 75.00000000000011),\n",
277+
" (-1050.0, 255.0000000000001),\n",
278+
" (1050.0, 255.0000000000001),\n",
279+
" (1050.0, 75.00000000000011),\n",
280+
" (-1050.0, 75.00000000000011)]"
281+
]
282+
},
283+
"execution_count": 16,
284+
"metadata": {},
285+
"output_type": "execute_result"
286+
}
287+
],
288+
"source": [
289+
"list(slab.geom.normalize().exterior.coords)"
290+
]
291+
},
292+
{
293+
"cell_type": "code",
294+
"execution_count": 15,
295+
"id": "9d739df9-725e-41ac-a85f-ad742c591b9f",
296+
"metadata": {},
297+
"outputs": [
298+
{
299+
"data": {
300+
"text/plain": [
301+
"[(398.7715041472865, 50.0),\n",
302+
" (423.7715041472865, 50.0),\n",
303+
" (423.7715041472865, 75.0),\n",
304+
" (1050.0, 75.0),\n",
305+
" (1050.0, 13.0),\n",
306+
" (1037.0, 0.0),\n",
307+
" (613.5, 0.0),\n",
308+
" (506.42670409480445, -75.0),\n",
309+
" (344.2440591535388, -1712.0),\n",
310+
" (330.0125320599427, -1725.0),\n",
311+
" (-330.0125320599427, -1725.0),\n",
312+
" (-344.2440591535388, -1712.0),\n",
313+
" (-506.42670409480445, -75.0),\n",
314+
" (-613.5, 0.0),\n",
315+
" (-1037.0, 0.0),\n",
316+
" (-1050.0, 13.0),\n",
317+
" (-1050.0, 75.0),\n",
318+
" (-423.7715041472865, 75.0),\n",
319+
" (-423.7715041472865, 50.0),\n",
320+
" (-398.7715041472865, 50.0),\n",
321+
" (-266.12378458128774, -1350.2293277386782),\n",
322+
" (0.0, -1400.0),\n",
323+
" (266.12378458128774, -1350.2293277386782),\n",
324+
" (398.7715041472865, 50.0)]"
325+
]
326+
},
327+
"execution_count": 15,
328+
"metadata": {},
329+
"output_type": "execute_result"
330+
}
331+
],
332+
"source": [
333+
"list(super_t.geom.exterior.coords)"
334+
]
335+
},
336+
{
337+
"cell_type": "code",
338+
"execution_count": 18,
339+
"id": "a08ff296-a59b-45e5-9478-68a2ba675079",
340+
"metadata": {},
341+
"outputs": [
342+
{
343+
"data": {
344+
"text/plain": [
345+
"[[-1050.0, 75.0], [1050.0, 75.0], [1050.0, 255.0], [-1050.0, 255.0]]"
346+
]
347+
},
348+
"execution_count": 18,
349+
"metadata": {},
350+
"output_type": "execute_result"
351+
}
352+
],
353+
"source": [
354+
"slab.points"
355+
]
356+
},
357+
{
358+
"cell_type": "code",
359+
"execution_count": null,
360+
"id": "4a76799d-79fa-4289-9c76-c858acc566ed",
361+
"metadata": {},
362+
"outputs": [],
363+
"source": []
364+
}
365+
],
366+
"metadata": {
367+
"kernelspec": {
368+
"display_name": "sectionproperties",
369+
"language": "python",
370+
"name": "sectionproperties"
371+
},
372+
"language_info": {
373+
"codemirror_mode": {
374+
"name": "ipython",
375+
"version": 3
376+
},
377+
"file_extension": ".py",
378+
"mimetype": "text/x-python",
379+
"name": "python",
380+
"nbconvert_exporter": "python",
381+
"pygments_lexer": "ipython3",
382+
"version": "3.8.12"
383+
}
384+
},
385+
"nbformat": 4,
386+
"nbformat_minor": 5
387+
}

0 commit comments

Comments
 (0)