Browse Source

Ajout des encoches d'alignement!

master
hadware 2 months ago
parent
commit
8563d26715
  1. 10
      .idea/.gitignore
  2. 31
      .idea/inspectionProfiles/Project_Default.xml
  3. 6
      .idea/inspectionProfiles/profiles_settings.xml
  4. 7
      .idea/misc.xml
  5. 8
      .idea/modules.xml
  6. 11
      .idea/tractrudeuse.iml
  7. 6
      .idea/vcs.xml
  8. 46
      tests.ipynb
  9. 107
      tractrudeuse_v2.ipynb

10
.idea/.gitignore vendored

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

31
.idea/inspectionProfiles/Project_Default.xml

@ -0,0 +1,31 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="8">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="institution-list" />
<item index="7" class="java.lang.String" itemvalue="social-media-links" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="PyStubPackagesAdvertiser" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<list>
<option value="pandas" />
</list>
</option>
</inspection_tool>
<inspection_tool class="ReassignedToPlainText" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

6
.idea/inspectionProfiles/profiles_settings.xml

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="uv (tractrudeuse)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="uv (tractrudeuse)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/tractrudeuse.iml" filepath="$PROJECT_DIR$/.idea/tractrudeuse.iml" />
</modules>
</component>
</project>

11
.idea/tractrudeuse.iml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="uv (tractrudeuse)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

46
tests.ipynb

@ -41,6 +41,52 @@
], ],
"execution_count": 1 "execution_count": 1
}, },
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-05-12T15:43:51.244991561Z",
"start_time": "2026-05-12T15:43:51.223161624Z"
}
},
"cell_type": "code",
"source": [
"from build123d import *\n",
"\n",
"# Créer une face plate (exemple : un carré dans le plan XY)\n",
"box = Box(10, 10, 10)\n",
"face = box.faces().filter_by(Plane.YX).sort_by(Axis.Z)[0]\n",
"print(face.center())\n",
"print(\"Normal avant inversion :\", face.orientation) # Affiche le vecteur normal (ex: (0, 0, 1))\n",
"\n",
"# Inverser le vecteur normal\n",
"face_reversed = -face\n",
"print(\"Normal après inversion :\", face_reversed.orientation) # Affiche le vecteur normal inversé\n",
"\n",
"print(Plane(face))\n",
"print(Plane(face).reverse())\n",
"print(Plane.XY)\n",
"print(Plane.XY.reverse())\n",
"print(Plane.YX)"
],
"id": "7450390859017a41",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Vector(0, 0, -5)\n",
"Normal avant inversion : Vector(0, 0, 0)\n",
"Normal après inversion : Vector(0, 0, 0)\n",
"Plane(o=(0.00, 0.00, -5.00), x=(1.00, 0.00, 0.00), z=(-0.00, -0.00, -1.00))\n",
"Plane(o=(0.00, 0.00, -5.00), x=(1.00, 0.00, 0.00), z=(0.00, 0.00, 1.00))\n",
"Plane(o=(0.00, 0.00, 0.00), x=(1.00, 0.00, 0.00), z=(0.00, 0.00, 1.00))\n",
"Plane(o=(0.00, 0.00, 0.00), x=(1.00, 0.00, 0.00), z=(-0.00, -0.00, -1.00))\n",
"Plane(o=(0.00, 0.00, 0.00), x=(0.00, 1.00, 0.00), z=(0.00, 0.00, -1.00))\n"
]
}
],
"execution_count": 13
},
{ {
"metadata": { "metadata": {
"ExecuteTime": { "ExecuteTime": {

107
tractrudeuse_v2.ipynb

@ -6,8 +6,8 @@
"metadata": { "metadata": {
"collapsed": true, "collapsed": true,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2026-05-12T12:54:56.813417603Z", "end_time": "2026-05-12T16:07:33.781803143Z",
"start_time": "2026-05-12T12:54:51.653355189Z" "start_time": "2026-05-12T16:07:26.817563805Z"
} }
}, },
"source": [ "source": [
@ -89,6 +89,11 @@
"vis_couplage_diam_trou = 8\n", "vis_couplage_diam_trou = 8\n",
"vis_couplage_longueur = 20\n", "vis_couplage_longueur = 20\n",
"\n", "\n",
"# Encoches d'emboitages\n",
"encoche_profondeur = 4\n",
"encoche_longueur = 20\n",
"encoche_largueur = epaisseur_paroi / 3\n",
"\n",
"# ─────────────────────────────────────────────────────────────────────────────\n", "# ─────────────────────────────────────────────────────────────────────────────\n",
"# DIMENSIONS DÉRIVÉES\n", "# DIMENSIONS DÉRIVÉES\n",
"# ─────────────────────────────────────────────────────────────────────────────\n", "# ─────────────────────────────────────────────────────────────────────────────\n",
@ -210,28 +215,28 @@
" origin=(0, 0, fente_top_face.center().Z),\n", " origin=(0, 0, fente_top_face.center().Z),\n",
" z_dir=(0, 0, 1)\n", " z_dir=(0, 0, 1)\n",
" ).offset(5)) as sk:\n", " ).offset(5)) as sk:\n",
" # Trou vers le haut (diamètre 10)\n", " # Trou vers le haut (diamètre 10)\n",
" with Locations(hole_locations):\n", " with Locations(hole_locations):\n",
" Cylinder(\n", " Cylinder(\n",
" radius=vis_couplage_diam_trou/2,\n", " radius=vis_couplage_diam_trou / 2,\n",
" height=50,\n", " height=50,\n",
" align=(Align.CENTER, Align.CENTER, Align.MIN),\n", " align=(Align.CENTER, Align.CENTER, Align.MIN),\n",
" mode=Mode.SUBTRACT\n", " mode=Mode.SUBTRACT\n",
" )\n", " )\n",
" Cylinder(\n", " Cylinder(\n",
" radius=vis_couplage_diam /2,\n", " radius=vis_couplage_diam / 2,\n",
" height=5,\n", " height=5,\n",
" rotation=(180, 0, 0), # inverse le sens\n", " rotation=(180, 0, 0), # inverse le sens\n",
" align=(Align.CENTER, Align.CENTER, Align.MIN),\n", " align=(Align.CENTER, Align.CENTER, Align.MIN),\n",
" mode=Mode.SUBTRACT\n", " mode=Mode.SUBTRACT\n",
" )\n", " )\n",
" Cylinder(\n", " Cylinder(\n",
" radius=vis_couplage_diam_pas /2,\n", " radius=vis_couplage_diam_pas / 2,\n",
" height=50,\n", " height=50,\n",
" rotation=(180, 0, 0), # inverse le sens\n", " rotation=(180, 0, 0), # inverse le sens\n",
" align=(Align.CENTER, Align.CENTER, Align.MIN),\n", " align=(Align.CENTER, Align.CENTER, Align.MIN),\n",
" mode=Mode.SUBTRACT\n", " mode=Mode.SUBTRACT\n",
" )\n", " )\n",
"\n", "\n",
" # # Trous de boulons pour fixer la trouyoteuse\n", " # # Trous de boulons pour fixer la trouyoteuse\n",
" with Locations(cav_floor):\n", " with Locations(cav_floor):\n",
@ -264,7 +269,50 @@
" rotation=-90)\n", " rotation=-90)\n",
" extrude(amount=-1, mode=Mode.SUBTRACT)\n", " extrude(amount=-1, mode=Mode.SUBTRACT)\n",
"\n", "\n",
" return p.part\n", " # Couper au niveau de la fente\n",
" top, bottom = split(\n",
" p.part,\n",
" bisect_by=Plane(\n",
" origin=(0, 0, fente_top_face.center().Z),\n",
" z_dir=(0, 0, 1)\n",
" ),\n",
" keep=Keep.BOTH\n",
" )\n",
"\n",
" # Rajouter des encoches tenon/mortaises pour verrouiller les deux pièces\n",
" # l'une dans l'autre\n",
" y_offsets = (bloc_extrudeur_ext_y / 2 - epaisseur_paroi / 2,\n",
" -(bloc_extrudeur_ext_y / 2) + epaisseur_paroi / 2)\n",
" x_offsets = (bloc_extrudeur_ext_x / 2 - epaisseur_paroi * 2,\n",
" - bloc_extrudeur_ext_x / 2 + epaisseur_paroi * 2)\n",
" sockets_offsets = list(product(x_offsets, y_offsets))\n",
" with BuildPart() as p_top:\n",
" add(top)\n",
" bottom_face = faces().filter_by(Plane.XY).sort_by(Axis.Z)[0]\n",
" bottom_plane = Plane(\n",
" origin=(0, 0, bottom_face.center().Z),\n",
" z_dir=(0, 0, 1)\n",
" )\n",
" with BuildSketch(bottom_plane):\n",
" with Locations(sockets_offsets):\n",
" Rectangle(encoche_longueur, encoche_largueur)\n",
" extrude(amount=encoche_profondeur, mode=Mode.SUBTRACT)\n",
"\n",
" with BuildPart() as p_bottom:\n",
" add(bottom)\n",
" top_face = faces().filter_by(Plane.XY).sort_by(Axis.Z)[-1]\n",
" top_plane = Plane(\n",
" origin=(0, 0, top_face.center().Z),\n",
" z_dir=(0, 0, 1)\n",
" )\n",
" with BuildSketch(top_plane):\n",
" with Locations(sockets_offsets):\n",
" Rectangle(encoche_longueur - 0.4, encoche_largueur - 0.4)\n",
" extrude(amount=encoche_profondeur - 0.2, mode=Mode.ADD)\n",
" top_edges = edges(Select.LAST).filter_by_position(Axis.Z, minimum=top_plane.origin.Z + encoche_profondeur / 2, maximum= top_plane.origin.Z + encoche_profondeur * 2)\n",
" chamfer(top_edges, length=1)\n",
"\n",
" return Compound(children=[p_top.part, p_bottom.part])\n",
"\n", "\n",
"\n", "\n",
"# ─────────────────────────────────────────────────────────────────────────────\n", "# ─────────────────────────────────────────────────────────────────────────────\n",
@ -323,7 +371,10 @@
" with Locations(Location((0, 0))):\n", " with Locations(Location((0, 0))):\n",
" Rectangle(couvercle_ouv_largeur, couvercle_ouv_profondeur)\n", " Rectangle(couvercle_ouv_largeur, couvercle_ouv_profondeur)\n",
" extrude(amount=-epaisseur_paroi, mode=Mode.SUBTRACT)\n", " extrude(amount=-epaisseur_paroi, mode=Mode.SUBTRACT)\n",
" # petit coup de chamfrein\n",
" chamfer(edges(Select.LAST), length=2)\n",
"\n", "\n",
" # trous de vis\n",
" with Locations(top_face) as sk:\n", " with Locations(top_face) as sk:\n",
" # Position relative au centre de la face (origine du sketch)\n", " # Position relative au centre de la face (origine du sketch)\n",
" for side_offset in [bloc_extrudeur_ext_y / 2 - epaisseur_paroi,\n", " for side_offset in [bloc_extrudeur_ext_y / 2 - epaisseur_paroi,\n",
@ -349,11 +400,11 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"+cc\n" "c+c+\n"
] ]
} }
], ],
"execution_count": 162 "execution_count": 14
}, },
{ {
"metadata": { "metadata": {
@ -363,7 +414,7 @@
} }
}, },
"cell_type": "code", "cell_type": "code",
"source": "edges(Select.LAST)[0].is_closed", "source": "make_brake_formed",
"id": "810fb3a101c2fccd", "id": "810fb3a101c2fccd",
"outputs": [ "outputs": [
{ {

Loading…
Cancel
Save