Browse Source

fixed upper slide assembly

master
hadware 1 month ago
parent
commit
96df8eec0b
  1. 132
      tractocadre.ipynb

132
tractocadre.ipynb

@ -1,72 +1,19 @@
{ {
"cells": [ "cells": [
{ {
"cell_type": "code",
"id": "initial_id",
"metadata": { "metadata": {
"collapsed": true,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2026-05-22T18:32:07.989017130Z", "end_time": "2026-05-22T19:34:57.898062336Z",
"start_time": "2026-05-22T18:32:07.752507264Z" "start_time": "2026-05-22T19:34:56.157896738Z"
} }
}, },
"cell_type": "code",
"source": [ "source": [
"from build123d import *\n", "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", "\n",
"stand_largueur = stand_bordure * 2 + A3_largueur\n", "A5_largueur = 148\n",
"\n", "A5_hauteur = 210\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",
"\n", "\n",
"stand_bordure = 5 # de chaque coté\n", "stand_bordure = 5 # de chaque coté\n",
"stand_epaisseur = 5\n", "stand_epaisseur = 5\n",
@ -78,8 +25,8 @@
"pignons_diam = 10\n", "pignons_diam = 10\n",
"pignons_profondeur = 10\n", "pignons_profondeur = 10\n",
"\n", "\n",
"stand_largueur = stand_bordure * 2 + A3_largueur\n", "stand_largueur = stand_bordure * 2 + A5_largueur\n",
"stand_hauteur = A3_hauteur + stand_bordure\n", "stand_hauteur = A5_hauteur + stand_bordure\n",
"\n", "\n",
"with BuildPart() as cadre:\n", "with BuildPart() as cadre:\n",
" d = Vector(1, 0, 0).rotate(Axis.Y, -stand_angle_pied)\n", " d = Vector(1, 0, 0).rotate(Axis.Y, -stand_angle_pied)\n",
@ -96,20 +43,20 @@
"\n", "\n",
" bottom_face = faces().filter_by(Plane.XY).sort_by(Axis.Z)[0]\n", " bottom_face = faces().filter_by(Plane.XY).sort_by(Axis.Z)[0]\n",
" with BuildSketch(bottom_face):\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", " extrude(amount=-1.8, mode=Mode.SUBTRACT)\n",
"\n", "\n",
" # extrusion du rail\n", " # extrusion du rail\n",
" stand_backface = faces().filter_by(Plane.XY).sort_by(Axis.Z)[-1]\n", " stand_backface = faces().filter_by(Plane.XY).sort_by(Axis.Z)[-1]\n",
" with BuildSketch(stand_backface):\n", " with BuildSketch(stand_backface):\n",
" with Locations((0, stand_backface.width / 2)):\n", " with Locations((0, stand_backface.width / 2 + 2)):\n",
" Rectangle(A3_largueur - 3.2,\n", " Rectangle(A5_largueur - 3.2,\n",
" A3_hauteur + stand_bordure,\n", " A5_hauteur + stand_bordure,\n",
" align=(Align.CENTER, Align.MAX))\n", " align=(Align.CENTER, Align.MAX))\n",
" with BuildSketch(stand_backface.offset(-3.2)):\n", " with BuildSketch(stand_backface.offset(-3.2)):\n",
" with Locations((0, stand_backface.width / 2)):\n", " with Locations((0, stand_backface.width / 2 + 2)):\n",
" Rectangle(A3_largueur,\n", " Rectangle(A5_largueur,\n",
" A3_hauteur + stand_bordure,\n", " A5_hauteur + stand_bordure,\n",
" align=(Align.CENTER, Align.MAX))\n", " align=(Align.CENTER, Align.MAX))\n",
" loft(mode=Mode.SUBTRACT)\n", " loft(mode=Mode.SUBTRACT)\n",
"\n", "\n",
@ -123,18 +70,18 @@
"\n", "\n",
"cadre = cadre.part\n", "cadre = cadre.part\n",
"\n", "\n",
"clearance = 0.5\n", "clearance = 0.7\n",
"\n", "\n",
"with BuildPart() as rail:\n", "with BuildPart() as rail:\n",
" with BuildSketch(Plane.XY) as sk1:\n", " with BuildSketch(Plane.XY) as sk1:\n",
" Rectangle(\n", " Rectangle(\n",
" A3_hauteur + stand_bordure - clearance,\n", " A5_hauteur + stand_bordure - clearance,\n",
" A3_largueur - 3.2 - clearance * 2,\n", " A5_largueur - 3.2 - clearance * 2,\n",
" )\n", " )\n",
" with BuildSketch(Plane.XY.offset(-3.2)) as sk2:\n", " with BuildSketch(Plane.XY.offset(-3.2)) as sk2:\n",
" Rectangle(\n", " Rectangle(\n",
" A3_hauteur + stand_bordure - clearance,\n", " A5_hauteur + stand_bordure - clearance,\n",
" A3_largueur - clearance * 2,\n", " A5_largueur - clearance * 2,\n",
" )\n", " )\n",
" loft()\n", " loft()\n",
" # Optional: add a small fillet to help insertion\n", " # Optional: add a small fillet to help insertion\n",
@ -154,23 +101,24 @@
" label=\"insert\",\n", " label=\"insert\",\n",
" to_part=rail,\n", " to_part=rail,\n",
" axis=-Axis((rail.faces()\n", " axis=-Axis((rail.faces()\n",
" .filter_by(Plane.YZ)\n", " .filter_by(Plane.YZ)\n",
" .sort_by(Axis.X)[-1]\n", " .sort_by(Axis.X)[-1]\n",
" .offset(-(A3_hauteur + stand_bordure) / 2))\n", " .offset(-(A5_hauteur + stand_bordure) / 2))\n",
" .center()\n", " .center()\n",
" + (0, 0, 3.2 / 2), (1, 0, 0)),\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",
"\n", "\n",
"# Connect and set position\n", "# Connect and set position\n",
"cadre_joint.connect_to(rail_joint, position=0)\n", "cadre_joint.connect_to(rail_joint, position=0)\n",
"\n", "\n",
"# Or move to a specific position\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", "assembly = Compound(children=[cadre, rail])\n",
"cog = assembly.center(CenterOf.MASS)\n", "cog = assembly.center(CenterOf.MASS)\n",
"cog_marker = Sphere(2).locate(Location(cog))\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", "id": "a32cfe0f76b167e",
"outputs": [ "outputs": [
@ -178,35 +126,21 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "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": { "data": {
"text/plain": [ "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": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"execution_count": 96 "execution_count": 141
}, },
{ {
"metadata": { "metadata": {
@ -257,7 +191,7 @@
" station_widths=[40, 40, 40, 112.52 / 2, 112.52 / 2, 112.52 / 2],\n", " station_widths=[40, 40, 40, 112.52 / 2, 112.52 / 2, 112.52 / 2],\n",
" side=Side.RIGHT,\n", " side=Side.RIGHT,\n",
" )\n", " )\n",
"show(side.part)" "show(side.part)\n"
], ],
"id": "11df73221c8aad94", "id": "11df73221c8aad94",
"outputs": [ "outputs": [

Loading…
Cancel
Save