|
|
|
|
@ -1,72 +1,19 @@
|
|
|
|
|
{ |
|
|
|
|
"cells": [ |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"id": "initial_id", |
|
|
|
|
"metadata": { |
|
|
|
|
"collapsed": true, |
|
|
|
|
"ExecuteTime": { |
|
|
|
|
"end_time": "2026-05-22T18:32:07.989017130Z", |
|
|
|
|
"start_time": "2026-05-22T18:32:07.752507264Z" |
|
|
|
|
"end_time": "2026-05-22T19:34:57.898062336Z", |
|
|
|
|
"start_time": "2026-05-22T19:34:56.157896738Z" |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"source": [ |
|
|
|
|
"from build123d import *\n", |
|
|
|
|
"from ocp_vscode import show, set_port\n", |
|
|
|
|
"from ocp_vscode import set_port, show\n", |
|
|
|
|
"\n", |
|
|
|
|
"A3_largueur = 148\n", |
|
|
|
|
"A3_hauteur = 210\n", |
|
|
|
|
"\n", |
|
|
|
|
"stand_bordure = 5 # de chaque coté\n", |
|
|
|
|
"stand_epaisseur = 5\n", |
|
|
|
|
"stand_angle_pied = 80 # deg\n", |
|
|
|
|
"\n", |
|
|
|
|
"pied_longueur = 100 # 5mm pour le bend\n", |
|
|
|
|
"pied_epaisseur = 100 # 5mm pour le bend\n", |
|
|
|
|
"\n", |
|
|
|
|
"rail_pignon_hauteur = 10\n", |
|
|
|
|
"pignons_diam = 10\n", |
|
|
|
|
"pignons_profondeur = 10\n", |
|
|
|
|
"\n", |
|
|
|
|
"stand_largueur = stand_bordure * 2 + A3_largueur\n", |
|
|
|
|
"\n", |
|
|
|
|
"with BuildPart() as bp:\n", |
|
|
|
|
" Box(pied_longueur, stand_largueur, stand_epaisseur)\n", |
|
|
|
|
"\n", |
|
|
|
|
" foot_face = faces().filter_by(Plane.YZ).sort_by(Axis.X)[0]\n", |
|
|
|
|
" print(Plane(foot_face))\n", |
|
|
|
|
" with BuildSketch(foot_face):\n", |
|
|
|
|
" Rectangle(stand_epaisseur, stand_largueur * (2 / 3))\n", |
|
|
|
|
" extrude(amount=-0.8 * stand_pied, mode=Mode.SUBTRACT)\n", |
|
|
|
|
"\n", |
|
|
|
|
"stand = bp.part\n", |
|
|
|
|
"\n", |
|
|
|
|
"set_port(3939)\n", |
|
|
|
|
"show(stand)" |
|
|
|
|
], |
|
|
|
|
"outputs": [ |
|
|
|
|
{ |
|
|
|
|
"name": "stdout", |
|
|
|
|
"output_type": "stream", |
|
|
|
|
"text": [ |
|
|
|
|
"Plane(o=(-50.00, 0.00, 0.00), x=(0.00, 0.00, 1.00), z=(-1.00, -0.00, 0.00))\n", |
|
|
|
|
"+\n" |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"execution_count": 116 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"metadata": { |
|
|
|
|
"ExecuteTime": { |
|
|
|
|
"end_time": "2026-05-22T18:42:04.979828290Z", |
|
|
|
|
"start_time": "2026-05-22T18:42:03.360023251Z" |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"source": [ |
|
|
|
|
"A3_largueur = 148\n", |
|
|
|
|
"A3_hauteur = 210\n", |
|
|
|
|
"A5_largueur = 148\n", |
|
|
|
|
"A5_hauteur = 210\n", |
|
|
|
|
"\n", |
|
|
|
|
"stand_bordure = 5 # de chaque coté\n", |
|
|
|
|
"stand_epaisseur = 5\n", |
|
|
|
|
@ -78,8 +25,8 @@
|
|
|
|
|
"pignons_diam = 10\n", |
|
|
|
|
"pignons_profondeur = 10\n", |
|
|
|
|
"\n", |
|
|
|
|
"stand_largueur = stand_bordure * 2 + A3_largueur\n", |
|
|
|
|
"stand_hauteur = A3_hauteur + stand_bordure\n", |
|
|
|
|
"stand_largueur = stand_bordure * 2 + A5_largueur\n", |
|
|
|
|
"stand_hauteur = A5_hauteur + stand_bordure\n", |
|
|
|
|
"\n", |
|
|
|
|
"with BuildPart() as cadre:\n", |
|
|
|
|
" d = Vector(1, 0, 0).rotate(Axis.Y, -stand_angle_pied)\n", |
|
|
|
|
@ -96,20 +43,20 @@
|
|
|
|
|
"\n", |
|
|
|
|
" bottom_face = faces().filter_by(Plane.XY).sort_by(Axis.Z)[0]\n", |
|
|
|
|
" with BuildSketch(bottom_face):\n", |
|
|
|
|
" Rectangle(A3_largueur - 10, A3_hauteur - 10)\n", |
|
|
|
|
" Rectangle(A5_largueur - 10, A5_hauteur - 10)\n", |
|
|
|
|
" extrude(amount=-1.8, mode=Mode.SUBTRACT)\n", |
|
|
|
|
"\n", |
|
|
|
|
" # extrusion du rail\n", |
|
|
|
|
" stand_backface = faces().filter_by(Plane.XY).sort_by(Axis.Z)[-1]\n", |
|
|
|
|
" with BuildSketch(stand_backface):\n", |
|
|
|
|
" with Locations((0, stand_backface.width / 2)):\n", |
|
|
|
|
" Rectangle(A3_largueur - 3.2,\n", |
|
|
|
|
" A3_hauteur + stand_bordure,\n", |
|
|
|
|
" with Locations((0, stand_backface.width / 2 + 2)):\n", |
|
|
|
|
" Rectangle(A5_largueur - 3.2,\n", |
|
|
|
|
" A5_hauteur + stand_bordure,\n", |
|
|
|
|
" align=(Align.CENTER, Align.MAX))\n", |
|
|
|
|
" with BuildSketch(stand_backface.offset(-3.2)):\n", |
|
|
|
|
" with Locations((0, stand_backface.width / 2)):\n", |
|
|
|
|
" Rectangle(A3_largueur,\n", |
|
|
|
|
" A3_hauteur + stand_bordure,\n", |
|
|
|
|
" with Locations((0, stand_backface.width / 2 + 2)):\n", |
|
|
|
|
" Rectangle(A5_largueur,\n", |
|
|
|
|
" A5_hauteur + stand_bordure,\n", |
|
|
|
|
" align=(Align.CENTER, Align.MAX))\n", |
|
|
|
|
" loft(mode=Mode.SUBTRACT)\n", |
|
|
|
|
"\n", |
|
|
|
|
@ -123,18 +70,18 @@
|
|
|
|
|
"\n", |
|
|
|
|
"cadre = cadre.part\n", |
|
|
|
|
"\n", |
|
|
|
|
"clearance = 0.5\n", |
|
|
|
|
"clearance = 0.7\n", |
|
|
|
|
"\n", |
|
|
|
|
"with BuildPart() as rail:\n", |
|
|
|
|
" with BuildSketch(Plane.XY) as sk1:\n", |
|
|
|
|
" Rectangle(\n", |
|
|
|
|
" A3_hauteur + stand_bordure - clearance,\n", |
|
|
|
|
" A3_largueur - 3.2 - clearance * 2,\n", |
|
|
|
|
" A5_hauteur + stand_bordure - clearance,\n", |
|
|
|
|
" A5_largueur - 3.2 - clearance * 2,\n", |
|
|
|
|
" )\n", |
|
|
|
|
" with BuildSketch(Plane.XY.offset(-3.2)) as sk2:\n", |
|
|
|
|
" Rectangle(\n", |
|
|
|
|
" A3_hauteur + stand_bordure - clearance,\n", |
|
|
|
|
" A3_largueur - clearance * 2,\n", |
|
|
|
|
" A5_hauteur + stand_bordure - clearance,\n", |
|
|
|
|
" A5_largueur - clearance * 2,\n", |
|
|
|
|
" )\n", |
|
|
|
|
" loft()\n", |
|
|
|
|
" # Optional: add a small fillet to help insertion\n", |
|
|
|
|
@ -156,21 +103,22 @@
|
|
|
|
|
" axis=-Axis((rail.faces()\n", |
|
|
|
|
" .filter_by(Plane.YZ)\n", |
|
|
|
|
" .sort_by(Axis.X)[-1]\n", |
|
|
|
|
" .offset(-(A3_hauteur + stand_bordure) / 2))\n", |
|
|
|
|
" .offset(-(A5_hauteur + stand_bordure) / 2))\n", |
|
|
|
|
" .center()\n", |
|
|
|
|
" + (0, 0, 3.2 / 2), (1, 0, 0)),\n", |
|
|
|
|
" linear_range=(0, A3_hauteur + stand_bordure)\n", |
|
|
|
|
" linear_range=(0, A5_hauteur + stand_bordure)\n", |
|
|
|
|
")\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Connect and set position\n", |
|
|
|
|
"cadre_joint.connect_to(rail_joint, position=0)\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Or move to a specific position\n", |
|
|
|
|
"cadre_joint.connect_to(rail_joint, position=60)\n", |
|
|
|
|
"cadre_joint.connect_to(rail_joint, position=0)\n", |
|
|
|
|
"assembly = Compound(children=[cadre, rail])\n", |
|
|
|
|
"cog = assembly.center(CenterOf.MASS)\n", |
|
|
|
|
"cog_marker = Sphere(2).locate(Location(cog))\n", |
|
|
|
|
"show(Compound(children=[cadre, rail]), cog_marker)" |
|
|
|
|
"show(assembly, cog_marker)\n", |
|
|
|
|
"export_step(assembly, \"/tmp/cadre.step\")" |
|
|
|
|
], |
|
|
|
|
"id": "a32cfe0f76b167e", |
|
|
|
|
"outputs": [ |
|
|
|
|
@ -178,35 +126,21 @@
|
|
|
|
|
"name": "stdout", |
|
|
|
|
"output_type": "stream", |
|
|
|
|
"text": [ |
|
|
|
|
"+++\n" |
|
|
|
|
"+c+\n" |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"execution_count": 130 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"metadata": { |
|
|
|
|
"ExecuteTime": { |
|
|
|
|
"end_time": "2026-05-22T18:10:39.214716262Z", |
|
|
|
|
"start_time": "2026-05-22T18:10:39.161736598Z" |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"source": "Plane.XY.rotated()", |
|
|
|
|
"id": "9c05871fcb7d0f44", |
|
|
|
|
"outputs": [ |
|
|
|
|
{ |
|
|
|
|
"data": { |
|
|
|
|
"text/plain": [ |
|
|
|
|
"Plane(o=(0.00, 0.00, 0.00), x=(1.00, 0.00, 0.00), z=(0.00, 0.00, 1.00))" |
|
|
|
|
"True" |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
"execution_count": 96, |
|
|
|
|
"execution_count": 141, |
|
|
|
|
"metadata": {}, |
|
|
|
|
"output_type": "execute_result" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"execution_count": 96 |
|
|
|
|
"execution_count": 141 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"metadata": { |
|
|
|
|
@ -257,7 +191,7 @@
|
|
|
|
|
" station_widths=[40, 40, 40, 112.52 / 2, 112.52 / 2, 112.52 / 2],\n", |
|
|
|
|
" side=Side.RIGHT,\n", |
|
|
|
|
" )\n", |
|
|
|
|
"show(side.part)" |
|
|
|
|
"show(side.part)\n" |
|
|
|
|
], |
|
|
|
|
"id": "11df73221c8aad94", |
|
|
|
|
"outputs": [ |
|
|
|
|
|