|
|
|
|
@ -6,11 +6,13 @@
|
|
|
|
|
"metadata": { |
|
|
|
|
"collapsed": true, |
|
|
|
|
"ExecuteTime": { |
|
|
|
|
"end_time": "2026-05-09T14:28:10.474719577Z", |
|
|
|
|
"start_time": "2026-05-09T14:28:05.535127271Z" |
|
|
|
|
"end_time": "2026-05-12T12:43:07.527133896Z", |
|
|
|
|
"start_time": "2026-05-12T12:43:02.563122699Z" |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
"source": [ |
|
|
|
|
"from itertools import product\n", |
|
|
|
|
"\n", |
|
|
|
|
"from ocp_vscode import show\n", |
|
|
|
|
"\n", |
|
|
|
|
"\"\"\"\n", |
|
|
|
|
@ -28,7 +30,7 @@
|
|
|
|
|
"# Fente (guide tract) — face droite, centrée en Y\n", |
|
|
|
|
"fente_largeur = 152.0 # mm — largeur de la fente -> Y\n", |
|
|
|
|
"fente_profondeur = 80.0 # mm — profondeur (longueur de la rainure) -> X\n", |
|
|
|
|
"fente_section = 2.0 # mm — hauteur de la section (épaisseur papier + jeu)\n", |
|
|
|
|
"fente_hauteur = 2.0 # mm — hauteur de la section (épaisseur papier + jeu)\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Zone à extruder du tract\n", |
|
|
|
|
"tract_extrusion_cote = 45 # mm\n", |
|
|
|
|
@ -67,13 +69,26 @@
|
|
|
|
|
"emboitement_jeu = 0.3 # mm\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Couvercle\n", |
|
|
|
|
"couvercle_epaisseur = 3.0 # mm\n", |
|
|
|
|
"couvercle_epaisseur = 5 # mm\n", |
|
|
|
|
"couvercle_ouv_largeur = 150 # mm — ouverture X\n", |
|
|
|
|
"couvercle_ouv_profondeur = 60 # mm — ouverture Y\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Bac\n", |
|
|
|
|
"bac_hauteur = 100.0 # mm\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Fixations couvercle\n", |
|
|
|
|
"vis_diam = 4 + 0.1\n", |
|
|
|
|
"vis_longueur = 40\n", |
|
|
|
|
"vis_profondeur_trou_bloc = vis_longueur - couvercle_epaisseur\n", |
|
|
|
|
"vis_ecrou_diam = 7 + 0.15\n", |
|
|
|
|
"vis_ecrou_hauteur = 3.2 + 0.15\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Fixation couplage des deux sous-parties du bloc extrudeur\n", |
|
|
|
|
"vis_couplage_diam_pas = 2.8\n", |
|
|
|
|
"vis_couplage_diam = 4\n", |
|
|
|
|
"vis_couplage_diam_trou = 8\n", |
|
|
|
|
"vis_couplage_longueur = 20\n", |
|
|
|
|
"\n", |
|
|
|
|
"# ─────────────────────────────────────────────────────────────────────────────\n", |
|
|
|
|
"# DIMENSIONS DÉRIVÉES\n", |
|
|
|
|
"# ─────────────────────────────────────────────────────────────────────────────\n", |
|
|
|
|
@ -83,7 +98,6 @@
|
|
|
|
|
"fente_y = fente_largeur / 2 - tracte_extrusion_center_y_offset\n", |
|
|
|
|
"fente_z_abs = epaisseur_fond + zone_extrusion_offset_hauteur # hauteur absolue depuis le bas\n", |
|
|
|
|
"\n", |
|
|
|
|
"\n", |
|
|
|
|
"bloc_extrudeur_int_x = (fente_profondeur - tract_extrusion_center_x_offset\n", |
|
|
|
|
" + cav_dim_x - zone_extrusion_offset_avant)\n", |
|
|
|
|
"bloc_extrudeur_int_y = max(cav_dim_y, fente_largeur + fente_y)\n", |
|
|
|
|
@ -96,7 +110,6 @@
|
|
|
|
|
"cav_x = (bloc_extrudeur_ext_x - cav_dim_x) / 2 # centrée en X\n", |
|
|
|
|
"cav_y = 0\n", |
|
|
|
|
"\n", |
|
|
|
|
"\n", |
|
|
|
|
"# Bac\n", |
|
|
|
|
"bac_ext_x = bloc_extrudeur_ext_x + 2 * (epaisseur_paroi + emboitement_jeu)\n", |
|
|
|
|
"bac_ext_y = bloc_extrudeur_ext_y + 2 * (epaisseur_paroi + emboitement_jeu)\n", |
|
|
|
|
@ -142,11 +155,16 @@
|
|
|
|
|
" # Position relative au centre de la face (origine du sketch)\n", |
|
|
|
|
" # with Locations(Location((fente_y, fente_z_abs - bloc_extrudeur_ext_z))):\n", |
|
|
|
|
" with Locations(Location((fente_y, fente_z_abs - bloc_extrudeur_ext_z / 2))):\n", |
|
|
|
|
" Rectangle(fente_largeur, fente_section)\n", |
|
|
|
|
" Rectangle(fente_largeur, fente_hauteur)\n", |
|
|
|
|
"\n", |
|
|
|
|
" extrude(amount=-fente_profondeur, mode=Mode.SUBTRACT)\n", |
|
|
|
|
" # ptit coup de chamfrein sur la fente\n", |
|
|
|
|
" chamfer(p.edges(Select.LAST), length=0.5)\n", |
|
|
|
|
" chamfer(\n", |
|
|
|
|
" p.edges(Select.LAST)\n", |
|
|
|
|
" .filter_by(Axis.Y)\n", |
|
|
|
|
" .filter_by_position(Axis.X, bloc_extrudeur_ext_x / 2 - 0.01, bloc_extrudeur_ext_x / 2 + 0.01),\n", |
|
|
|
|
" length=2\n", |
|
|
|
|
" )\n", |
|
|
|
|
"\n", |
|
|
|
|
" # # 4. Trou d'évacuation (perce le fond depuis en dessous)\n", |
|
|
|
|
" cav_floor = faces().filter_by(Axis.Z).sort_by(Axis.Z)[1]\n", |
|
|
|
|
@ -160,6 +178,61 @@
|
|
|
|
|
" # ptit coup de chamfrein sur le trou\n", |
|
|
|
|
" chamfer(edges(Select.LAST), length=2)\n", |
|
|
|
|
"\n", |
|
|
|
|
" # trous de boulon pour fixer le couvercle\n", |
|
|
|
|
" with Locations(top_face) as sk:\n", |
|
|
|
|
" # Position relative au centre de la face (origine du sketch)\n", |
|
|
|
|
" for side_offset in [bloc_extrudeur_ext_y / 2 - epaisseur_paroi,\n", |
|
|
|
|
" -bloc_extrudeur_ext_y / 2 + epaisseur_paroi]:\n", |
|
|
|
|
" with Locations((0, side_offset)):\n", |
|
|
|
|
" Hole(radius=vis_diam / 2, depth=vis_profondeur_trou_bloc)\n", |
|
|
|
|
" with BuildSketch(Plane(top_face).offset(-10)) as sk:\n", |
|
|
|
|
" for side_offset in [bloc_extrudeur_ext_y / 2 - epaisseur_paroi,\n", |
|
|
|
|
" -bloc_extrudeur_ext_y / 2 + epaisseur_paroi]:\n", |
|
|
|
|
" with Locations((0, side_offset)):\n", |
|
|
|
|
" RegularPolygon(radius=vis_ecrou_diam / 2, side_count=6)\n", |
|
|
|
|
"\n", |
|
|
|
|
" extrude(amount=-vis_ecrou_hauteur, mode=Mode.SUBTRACT)\n", |
|
|
|
|
"\n", |
|
|
|
|
" fente_top_face = (faces()\n", |
|
|
|
|
" .filter_by(Plane.YX)\n", |
|
|
|
|
" .filter_by_position(Axis.Z,\n", |
|
|
|
|
" - bloc_extrudeur_ext_z / 2 + fente_z_abs,\n", |
|
|
|
|
" -bloc_extrudeur_ext_z / 2 + fente_z_abs + fente_hauteur)[0])\n", |
|
|
|
|
"\n", |
|
|
|
|
" # Position relative au centre de la face (origine du sketch)\n", |
|
|
|
|
" y_offsets = (bloc_extrudeur_ext_y / 2 - epaisseur_paroi,\n", |
|
|
|
|
" -(bloc_extrudeur_ext_y / 2) + epaisseur_paroi)\n", |
|
|
|
|
" x_offsets = (bloc_extrudeur_ext_x / 2 - (fente_profondeur + 20),\n", |
|
|
|
|
" - bloc_extrudeur_ext_x / 2 + epaisseur_paroi)\n", |
|
|
|
|
" hole_locations = list(product(x_offsets, y_offsets))\n", |
|
|
|
|
" # Trous de couplage des deux parties du bloc une fois séparées\n", |
|
|
|
|
" with Locations(Plane(\n", |
|
|
|
|
" origin=(0, 0, fente_top_face.center().Z),\n", |
|
|
|
|
" z_dir=(0, 0, 1)\n", |
|
|
|
|
" ).offset(5)) as sk:\n", |
|
|
|
|
" # Trou vers le haut (diamètre 10)\n", |
|
|
|
|
" with Locations(hole_locations):\n", |
|
|
|
|
" Cylinder(\n", |
|
|
|
|
" radius=vis_couplage_diam_trou/2,\n", |
|
|
|
|
" height=50,\n", |
|
|
|
|
" align=(Align.CENTER, Align.CENTER, Align.MIN),\n", |
|
|
|
|
" mode=Mode.SUBTRACT\n", |
|
|
|
|
" )\n", |
|
|
|
|
" Cylinder(\n", |
|
|
|
|
" radius=vis_couplage_diam /2,\n", |
|
|
|
|
" height=5,\n", |
|
|
|
|
" rotation=(180, 0, 0), # inverse le sens\n", |
|
|
|
|
" align=(Align.CENTER, Align.CENTER, Align.MIN),\n", |
|
|
|
|
" mode=Mode.SUBTRACT\n", |
|
|
|
|
" )\n", |
|
|
|
|
" Cylinder(\n", |
|
|
|
|
" radius=vis_couplage_diam_pas /2,\n", |
|
|
|
|
" height=50,\n", |
|
|
|
|
" rotation=(180, 0, 0), # inverse le sens\n", |
|
|
|
|
" align=(Align.CENTER, Align.CENTER, Align.MIN),\n", |
|
|
|
|
" mode=Mode.SUBTRACT\n", |
|
|
|
|
" )\n", |
|
|
|
|
"\n", |
|
|
|
|
" # # Trous de boulons pour fixer la trouyoteuse\n", |
|
|
|
|
" with Locations(cav_floor):\n", |
|
|
|
|
" with GridLocations(50, 60, 2, 2):\n", |
|
|
|
|
@ -251,20 +324,22 @@
|
|
|
|
|
" Rectangle(couvercle_ouv_largeur, couvercle_ouv_profondeur)\n", |
|
|
|
|
" extrude(amount=-epaisseur_paroi, mode=Mode.SUBTRACT)\n", |
|
|
|
|
"\n", |
|
|
|
|
" return p.part\n", |
|
|
|
|
"\n", |
|
|
|
|
" with Locations(top_face) as sk:\n", |
|
|
|
|
" # Position relative au centre de la face (origine du sketch)\n", |
|
|
|
|
" for side_offset in [bloc_extrudeur_ext_y / 2 - epaisseur_paroi,\n", |
|
|
|
|
" -bloc_extrudeur_ext_y / 2 + epaisseur_paroi]:\n", |
|
|
|
|
" with Locations((0, side_offset)):\n", |
|
|
|
|
" Hole(radius=vis_diam / 2)\n", |
|
|
|
|
"\n", |
|
|
|
|
"def center_xy(part):\n", |
|
|
|
|
" bb = part.bounding_box()\n", |
|
|
|
|
" return part.translate((-bb.center().X, -bb.center().Y, 0))\n", |
|
|
|
|
" return p.part\n", |
|
|
|
|
"\n", |
|
|
|
|
"\n", |
|
|
|
|
"gap = 50\n", |
|
|
|
|
"\n", |
|
|
|
|
"show(\n", |
|
|
|
|
" center_xy(make_bloc_extrudeur()),\n", |
|
|
|
|
" center_xy(make_bac_recup()).translate((0, 0, -(bloc_extrudeur_ext_z / 2 + 2 * gap))),\n", |
|
|
|
|
" center_xy(make_couvercle()).translate((0, 0, bloc_extrudeur_ext_z / 2 + gap)),\n", |
|
|
|
|
" make_bloc_extrudeur(),\n", |
|
|
|
|
" make_bac_recup().translate((0, 0, -(bloc_extrudeur_ext_z / 2 + 2 * gap))),\n", |
|
|
|
|
" make_couvercle().translate((0, 0, bloc_extrudeur_ext_z / 2 + gap)),\n", |
|
|
|
|
" names=[\"superieure\", \"inferieure\", \"couvercle\"],\n", |
|
|
|
|
" colors=[\"#ff7800\", \"#000000\", \"#000000\"],\n", |
|
|
|
|
")" |
|
|
|
|
@ -274,11 +349,11 @@
|
|
|
|
|
"name": "stdout", |
|
|
|
|
"output_type": "stream", |
|
|
|
|
"text": [ |
|
|
|
|
"+++\n" |
|
|
|
|
"+cc\n" |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"execution_count": 110 |
|
|
|
|
"execution_count": 161 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"metadata": { |
|
|
|
|
@ -288,7 +363,7 @@
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"source": "bloc_extrudeur_ext_x", |
|
|
|
|
"source": "edges(Select.LAST)[0].is_closed", |
|
|
|
|
"id": "810fb3a101c2fccd", |
|
|
|
|
"outputs": [ |
|
|
|
|
{ |
|
|
|
|
|