add adhesive tape geometry

master
sp9unb 2022-10-13 14:59:51 +02:00
rodzic 35ab5bee1c
commit de3bfc1124
1 zmienionych plików z 41 dodań i 14 usunięć

Wyświetl plik

@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 4,
"id": "6ea87a15-f571-4611-8487-5b7556e2ef45",
"metadata": {
"extensions": {
@ -68,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 5,
"id": "d075a994-76bb-46f7-bdfb-cc6ef449dc43",
"metadata": {
"extensions": {
@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 7,
"id": "2f3b63fd-d5ea-40b6-a2f9-b31c84cfef36",
"metadata": {
"extensions": {
@ -129,7 +129,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "77a162e2f4de4b5fa24baba1400ed00b",
"model_id": "0d9bb17572474431815f73b28108bdd4",
"version_major": 2,
"version_minor": 0
},
@ -137,7 +137,7 @@
"VBox(children=(FloatSlider(value=2.0, description='Width [m]:', layout=Layout(width='500px'), max=5.0, min=0.1…"
]
},
"execution_count": 19,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@ -158,7 +158,7 @@
" coatingWeight = coatDens * area\n",
" print( \"Coating weight: {:.2f} [g]\".format(coatingWeight)) \n",
" # adhesive tape density : average 2g/m \n",
" tapeLength = 2 * width + 4 * height\n",
" tapeLength = 2 * width + 2 * depth + 4 * height\n",
" tapeWeight = tapeDens * tapeLength\n",
" print( \"Adh.tape length: {:.2f} [m]\".format(tapeLength)) \n",
" print( \"Adh.tape weight: {:.2f} [g]\".format(tapeWeight)) \n",
@ -181,20 +181,47 @@
" print( \"Free lift force:\", colored(\"{:.2f} [g]\".format(freeLiftForce),color)) \n",
"\n",
" \n",
" box = Mesh(geometry=BoxBufferGeometry(\n",
" width=width, \n",
" height=height, \n",
" depth=depth,\n",
" widthSegments=5, \n",
" heightSegments=10,\n",
" depthSegments=15),\n",
" geometry=BoxBufferGeometry(\n",
" width=width, \n",
" height=height, \n",
" depth=depth,\n",
" widthSegments=5, \n",
" heightSegments=10,\n",
" depthSegments=15)\n",
"\n",
" box = Mesh(geometry=geometry,\n",
" material=MeshLambertMaterial(color='gray')\n",
" )\n",
" \n",
"\n",
"# [ width, height, depth ]\n",
" w2 = width/2\n",
" h2 = height/2\n",
" d2 = depth/2\n",
" w2n = -1 * width/2\n",
" h2n = -1 * height/2\n",
" d2n = -1 * depth/2\n",
" tapeGeometry = LineSegmentsGeometry(\n",
" positions=[\n",
" [[w2, h2, d2], [w2, h2n, d2]],\n",
" [[w2, h2, d2], [w2n, h2, d2]],\n",
" [[w2n, h2, d2], [w2n, h2n, d2]], \n",
" [[w2, h2, d2n], [w2, h2n, d2n]],\n",
" [[w2, h2, d2n], [w2n, h2, d2n]],\n",
" [[w2n, h2,d2n], [w2n, h2n, d2n]], \n",
" [[w2, h2n,d2], [w2, h2n, d2n]],\n",
" [[w2n, h2n,d2], [w2n, h2n, d2n]] \n",
" ],\n",
" ) \n",
" tapeMaterial = LineMaterial(linewidth=3, color='#ffffff') \n",
" tape = LineSegments2( tapeGeometry, tapeMaterial ) \n",
" \n",
" \n",
" keyLight = DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)\n",
"\n",
" c = PerspectiveCamera(position=[2, 2, 5], up=[0, 1, 0], children=[keyLight])\n",
"\n",
" scene = Scene(children=[box, c, AmbientLight(color='#777777')], background=None)\n",
" scene = Scene(children=[box, tape, c, AmbientLight(color='#777777')], background=None)\n",
"\n",
" renderer = Renderer(camera=c,\n",
" scene=scene,\n",