From fadca8440f879682fddedad9dcbfc6fff1f979a5 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:40:57 -0400 Subject: [PATCH] Wave 384/509: Kernel rig: interference and clearance between placed occurrences (and 2 more) 3 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. - 9fecf7709 jyviko: Kernel rig: interference and clearance between placed occurrences - 22cd8e74f jyviko: Ladder generator: cases.py writes the values committed by hand for 05/007, 06/017, 07/016 and 11/003 - 487914427 jyviko: Ladder 05: UNC, UNF, Rc and NPT tapped holes, each drilled to its tap maker's drill Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ --- .../expected.json | 21 +++ .../recipe.json | 92 ++++++++++ .../expected.json | 21 +++ .../recipe.json | 169 ++++++++++++++++++ .../expected.json | 39 ++++ .../recipe.json | 90 ++++++++++ .../expected.json | 17 ++ .../recipe.json | 79 ++++++++ .../expected.json | 9 + .../014-tapped-1-4-20-unc-through/recipe.json | 16 ++ .../015-tapped-1-4-28-unf-blind/expected.json | 9 + .../015-tapped-1-4-28-unf-blind/recipe.json | 17 ++ .../016-tapped-rc-1-2-through/expected.json | 9 + .../016-tapped-rc-1-2-through/recipe.json | 16 ++ .../017-tapped-1-4-npt-through/expected.json | 9 + .../017-tapped-1-4-npt-through/recipe.json | 16 ++ tests/kernel-cases/ladder/ladder.json | 6 +- tools/kernel-ladder/cases.py | 47 +++-- 18 files changed, 669 insertions(+), 13 deletions(-) create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json new file mode 100644 index 000000000..d196bfa6c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "inspect.clearance of the arm lifted 5 mm off the base", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm moved by (0,0,5): its bottom (z 5) is 5 mm above Base's top (z 0) over x 0..10: distance 5", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "overlaps": [], + "near": [ + { + "distance_mm": 5.0 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json new file mode 100644 index 000000000..f3045bb69 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json @@ -0,0 +1,92 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + 5 + ] + } + }, + { + "command": "inspect.clearance", + "params": { + "clearance": 10 + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json new file mode 100644 index 000000000..07c6dbb0b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "inspect.clearance between the arm turned 90 degrees and a grounded block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a block 10x10x10 from (20,0,0); hinge at 90 puts Arm at x -5..5, y 0..40: the gap to the block's face x = 20 is 15", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 14, + "json": { + "overlaps": [], + "near": [ + { + "distance_mm": 15.0 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json new file mode 100644 index 000000000..78c6abd40 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json @@ -0,0 +1,169 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 20, + 0, + 0 + ], + "operation": "new", + "body_name": "PostBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Post", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "PostBox" + ], + "component": "Post" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Post:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "inspect.clearance", + "params": { + "bodies": [ + "ArmBox" + ], + "against": [ + "PostBox" + ], + "clearance": 20 + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json new file mode 100644 index 000000000..9b67417b3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "inspect.interference of the arm sunk 5 mm into the base", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm moved by (0,0,-5): it shares x 0..10, y -5..5, z -5..0 with Base: 500 mm3, area 2(100+50+50) = 400, centre (5,0,-2.5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "count": 1, + "interferences": [ + { + "volume_mm3": 500.0, + "area_mm2": 400.0, + "center": [ + 5.0, + 0.0, + -2.5 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + -5.0 + ], + "max": [ + 10.0, + 5.0, + 0.0 + ] + } + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json new file mode 100644 index 000000000..489b8e3f4 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json @@ -0,0 +1,90 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + -5 + ] + } + }, + { + "command": "inspect.interference", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json new file mode 100644 index 000000000..3b095dc1a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json @@ -0,0 +1,17 @@ +{ + "sources": [], + "what": "inspect.interference of the arm standing on the base face to face", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); they meet on a face only: no overlap volume", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 8, + "json": { + "count": 0, + "interferences": [] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json new file mode 100644 index 000000000..f98026bbc --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json @@ -0,0 +1,79 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "inspect.interference", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json new file mode 100644 index 000000000..b8dac12c5 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "a 1/4-20 UNC tapped hole through the stock: drilled #7 (0.201 in), cosmetic thread", + "source": "analytic", + "method": "ASME B1.1 1/4-20 UNC: D = 0.25 in, P = 1/20 in, basic minor D1 = D - 1.082532 P = 0.1959 in; the tap drill is #7, 0.201 in = 5.1054 mm (the cutting-tap drill for about 75% thread, Guhring's table in thread_catalog.rs); removed pi 2.5527^2 20; the cosmetic thread adds no geometry: + one cylinder face", + "body_count": 1, + "volume_mm3": 47590.57022274, + "faces": 7 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json new file mode 100644 index 000000000..de94c5af2 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json @@ -0,0 +1,16 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "1/4-20 UNC" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json new file mode 100644 index 000000000..ab031d28d --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "a 1/4-28 UNF tapped blind hole 10 deep, flat bottom: drilled 5.45 mm, cosmetic thread", + "source": "analytic", + "method": "ASME B1.1 1/4-28 UNF: D = 0.25 in, P = 1/28 in, basic minor D1 = D - 1.082532 P = 5.368 mm; the tap maker's drill 5.45 mm (Guhring, thread_catalog.rs), above D1 as a drill must be; removed pi 2.725^2 10; + wall and floor", + "body_count": 1, + "volume_mm3": 47766.717110517, + "faces": 8 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json new file mode 100644 index 000000000..cdc832628 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json @@ -0,0 +1,17 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "1/4-28 UNF", + "depth": 10 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json new file mode 100644 index 000000000..76c02b129 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "an Rc 1/2 tapped hole through the stock (ISO 7-1 internal taper): a straight hole at the tap maker's 17.6 mm, cosmetic thread", + "source": "analytic", + "method": "ISO 7-1 Rc 1/2: gauge diameter d = 20.955 at the face, 14 threads per inch, h = 0.640327 P, minor d1 = d - 2h = 18.631 there and 1/16 smaller per mm deeper (18.631 - 13.2/16 = 17.806 at the end of the 13.2 mm useful thread); a straight (not reamed) hole takes the tap maker's 17.6 (Yamawa YEU23 p.709, the largest for non-full threads): removed pi 8.8^2 20; + one cylinder face", + "body_count": 1, + "volume_mm3": 43134.30129812, + "faces": 7 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json new file mode 100644 index 000000000..886ccd640 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json @@ -0,0 +1,16 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "Rc 1/2" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json new file mode 100644 index 000000000..0a2b2a99e --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "a 1/4-18 NPT tapped hole through the stock (ASME B1.20.1): a straight hole at the tap maker's 10.85 mm, cosmetic thread", + "source": "analytic", + "method": "ASME B1.20.1 1/4-18 NPT: E0 = 0.47739 in, L1 = 0.2278 in, h = 0.8 P; at the face the minor E1 - h = 0.48163 - 0.04444 in = 11.105 mm, 1/16 smaller per mm deeper; a straight hole takes the tap maker's 10.85 (Yamawa YEU23 p.710): removed pi 5.425^2 20; + one cylinder face", + "body_count": 1, + "volume_mm3": 46150.819294189, + "faces": 7 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json new file mode 100644 index 000000000..0ea44228c --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json @@ -0,0 +1,16 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "1/4-18 NPT" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/ladder.json b/tests/kernel-cases/ladder/ladder.json index 77c68a5c1..3bc77da54 100644 --- a/tests/kernel-cases/ladder/ladder.json +++ b/tests/kernel-cases/ladder/ladder.json @@ -91,7 +91,11 @@ "ladder/05-holes-and-taps/011-crossing-holes-steinmetz", "ladder/05-holes-and-taps/012-crossing-tapped-holes-offset", "ladder/05-holes-and-taps/008-tapped-m5-into-curved-face", - "ladder/05-holes-and-taps/013-part-holes" + "ladder/05-holes-and-taps/013-part-holes", + "ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through", + "ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind", + "ladder/05-holes-and-taps/016-tapped-rc-1-2-through", + "ladder/05-holes-and-taps/017-tapped-1-4-npt-through" ], "tier": "05-holes-and-taps", "what": "holes and tapped holes" diff --git a/tools/kernel-ladder/cases.py b/tools/kernel-ladder/cases.py index 562a4e09a..03ad3d2da 100644 --- a/tools/kernel-ladder/cases.py +++ b/tools/kernel-ladder/cases.py @@ -530,11 +530,11 @@ case(T5, "005-countersink", "a countersunk hole: d6.6 through, d12 x 90 deg coun case(T5, "006-tapped-m6-through", "an M6 tapped hole through: the tap drill d5 (major - pitch), cosmetic thread", [H(position=top, thread="M6")], {"body_count": 1, "volume_mm3": VB - PI * 6.25 * 20, "faces": 7}, "M6 coarse pitch 1: tap drill 6 - 1 = 5; removed pi 2.5^2 20; the cosmetic thread adds no geometry", base=B1) -ch8 = 3.375 / math.tan(math.radians(59)) +ch8 = 3.4 / math.tan(math.radians(59)) case(T5, "007-tapped-m8-blind", "an M8 tapped blind hole 12 deep with a 118 deg drill point", [H(position=top, thread="M8", depth=12, type="drilled", tip_angle=118)], - {"body_count": 1, "volume_mm3": VB - PI * 3.375 ** 2 * 12 - PI * 3.375 ** 2 * ch8 / 3, "faces": 8}, - "M8 coarse pitch 1.25: tap drill (major - pitch) 6.75; removed pi r^2 12 to the shoulder + the point cone pi r^2 (r/tan59)/3", base=B1) + {"body_count": 1, "volume_mm3": VB - PI * 3.4 ** 2 * 12 - PI * 3.4 ** 2 * ch8 / 3, "faces": 8}, + "M8 coarse pitch 1.25: the tap maker's drill 6.8 (Yamawa YEU23 p.704); removed pi r^2 12 to the shoulder + the point cone pi r^2 (r/tan59)/3", base=B1) r, Rc = 2.1, 20 vint = quad(lambda y: 2 * math.sqrt(max(r * r - y * y, 0)) * 2 * math.sqrt(Rc * Rc - y * y), -r, r, 128) case(T5, "008-tapped-m5-into-curved-face", "an M5 tapped hole drilled radially through a cylinder r20 lying along X", @@ -568,6 +568,29 @@ case(T5, "013-part-holes", "the running part: an M6 tapped through hole, an M5 t {"body_count": 1, "volume_mm3": V5, "faces": 20}, "removed pi 2.5^2 20 (M6, tap drill 5) + pi 2.1^2 8 (M5, tap drill 4.2, flat) + pi 1.65^2 35; faces +1 +2 +1", base=C4) C5 = up(T5, "013-part-holes") +# Tapped holes of the other catalogued families: cosmetic threads in a hole drilled to the tap +# maker's drill (crates/doc/src/thread_catalog.rs), so a drilled cylinder is all the geometry. +case(T5, "014-tapped-1-4-20-unc-through", "a 1/4-20 UNC tapped hole through the stock: drilled #7 (0.201 in), cosmetic thread", + [H(position=top, thread="1/4-20 UNC")], + {"body_count": 1, "volume_mm3": VB - PI * (0.201 * 25.4 / 2) ** 2 * 20, "faces": 7}, + "ASME B1.1 1/4-20 UNC: D = 0.25 in, P = 1/20 in, basic minor D1 = D - 1.082532 P = 0.1959 in; the tap drill is #7, 0.201 in = 5.1054 mm " + "(the cutting-tap drill for about 75% thread, Guhring's table in thread_catalog.rs); removed pi 2.5527^2 20; the cosmetic thread adds no geometry: + one cylinder face", base=B1) +case(T5, "015-tapped-1-4-28-unf-blind", "a 1/4-28 UNF tapped blind hole 10 deep, flat bottom: drilled 5.45 mm, cosmetic thread", + [H(position=top, thread="1/4-28 UNF", depth=10)], + {"body_count": 1, "volume_mm3": VB - PI * 2.725 ** 2 * 10, "faces": 8}, + "ASME B1.1 1/4-28 UNF: D = 0.25 in, P = 1/28 in, basic minor D1 = D - 1.082532 P = 5.368 mm; the tap maker's drill 5.45 mm (Guhring, thread_catalog.rs), " + "above D1 as a drill must be; removed pi 2.725^2 10; + wall and floor", base=B1) +case(T5, "016-tapped-rc-1-2-through", "an Rc 1/2 tapped hole through the stock (ISO 7-1 internal taper): a straight hole at the tap maker's 17.6 mm, cosmetic thread", + [H(position=top, thread="Rc 1/2")], + {"body_count": 1, "volume_mm3": VB - PI * 8.8 ** 2 * 20, "faces": 7}, + "ISO 7-1 Rc 1/2: gauge diameter d = 20.955 at the face, 14 threads per inch, h = 0.640327 P, minor d1 = d - 2h = 18.631 there and 1/16 smaller per mm deeper " + "(18.631 - 13.2/16 = 17.806 at the end of the 13.2 mm useful thread); a straight (not reamed) hole takes the tap maker's 17.6 (Yamawa YEU23 p.709, the largest for " + "non-full threads): removed pi 8.8^2 20; + one cylinder face", base=B1) +case(T5, "017-tapped-1-4-npt-through", "a 1/4-18 NPT tapped hole through the stock (ASME B1.20.1): a straight hole at the tap maker's 10.85 mm, cosmetic thread", + [H(position=top, thread="1/4-18 NPT")], + {"body_count": 1, "volume_mm3": VB - PI * 5.425 ** 2 * 20, "faces": 7}, + "ASME B1.20.1 1/4-18 NPT: E0 = 0.47739 in, L1 = 0.2278 in, h = 0.8 P; at the face the minor E1 - h = 0.48163 - 0.04444 in = 11.105 mm, 1/16 smaller per mm deeper; " + "a straight hole takes the tap maker's 10.85 (Yamawa YEU23 p.710): removed pi 5.425^2 20; + one cylinder face", base=B1) # ---------------------------------------------------------------- 06 threads def thr(face, **p): @@ -759,14 +782,14 @@ case(T6, "019-external-tr40x14-p7-two-start", "a modelled two-start trapezoidal "groove of pitch 7 would: over 42 mm (three leads, six pitches) between free ends") + "ISO 2904 for P 7: 30 deg, H1 = P/2, crest flat 0.366 P, " "ac = 0.5 (P 6..12), external minor d3 = d - 2 (H1 + ac) = 32") -rf10 = 5 - 5 * math.sqrt(3) / 2 * 1.5 / 8 -case(T6, "017-external-m10-chamfered-tip", "001's modelled M10 thread with ISO 4753's chamfered end at both free ends: a 45 deg cone down to the minor diameter, cut after the groove", - cylT + [thr([5, 0, 15], designation="M10", tip="chamfer")], +rf10 = 5 - 17 / 24 * math.sqrt(3) / 2 * 1.5 # ISO 724: d3 = d - 2 (17/24) H +case(T6, "017-external-m10-chamfered-tip", "001's modelled M10 thread with ISO 4753's chamfered end at both free ends: a 45 deg cone down to the external minor diameter d3, cut after the groove", + cylT + [thr([5, 0, 15], designation="M10", tip="both")], {"body_count": 1, "volume_mm3": ext_volume(10, 1.5, [(0, 5 - rf10, lambda z: rf10 + z), (5 - rf10, 25 + rf10, lambda z: 5), (25 + rf10, 30, lambda z: rf10 + 30 - z)]), "tolerance": {"rel": 1e-4}}, TMETH.replace("Tolerance 0.5%: solid.thread cuts faceted by design (chords within P/200 on the body, P/100 on the tool)", "Tolerance 0.01%: SMLib's exact screw sweep") + - "; the chamfer is axisymmetric and cut after the groove, so it only lowers the stock's outer radius: r <= d_f/2 + distance from the end (45 deg), d_f the minor diameter d - 5H/4 = 8.376 " - "(ISO 4753 chamfered end: the end's diameter at most the minor diameter)") + "; the chamfer is axisymmetric and cut after the groove, so it only lowers the stock's outer radius: r <= d_f/2 + distance from the end (45 deg), d_f the external minor diameter d3 = d - 1.226869 P = 8.160 " + "(ISO 724; ISO 4753 chamfered end: the end's diameter at most the minor diameter), below the modelled root d1") # ---------------------------------------------------------------- 07 fillets F = lambda edges, r, **p: C("solid.fillet", edges=edges, radius=r, **p) @@ -814,7 +837,7 @@ case(T7, "010-corner-unequal-r7-r3", "an r7 vertical round at a corner, then r3 "Faces: 6 planes + the r7 cylinder + the r3 chain's cylinder, torus, cylinder; edges: 5 round the bottom, 5 round the top, 5 vertical (two r7 tangent lines, the box's " "three other verticals), the chain's three on the walls and two end arcs, its two seams; vertices from Euler (V - E + F = 2): 14", base=B1) case(T7, "016-corner-three-sequential-r5-r3-r7", 'rounds r5 and r3 on the two top edges at a corner, then r7 on the vertical edge under them: refused, the r7 cannot exist', - [F([corner[0]], 5), F([corner[1]], 3, tangent_chain=False), F([[60, 40, 8]], 7)], {"outcome": "refused"}, + [F([corner[0]], 5), F([corner[1]], 3, tangent_chain=False), F([[60, 40, 8]], 7)], {"outcome": "refused", "refusal": "the fillet is larger than the faces beside its edges allow"}, "the r7 runs on (tangent chain) up the side x=60 along its arc on the r5 round, a circle of radius 5 about the r5 axis: the r7's contact line on that face would be the arc offset 7 towards its centre, radius 5 - 7 < 0, so the blend passes through itself; and along the seam of the r5 and r3 rounds no ball over r3 fits the r3 round. No such round exists, so the right answer is a clean refusal (SMLib: no room for the rolling ball). 018 is the same corner with a radius that fits.", base=B1, source="invariants") case(T7, "018-corner-three-sequential-r5-r3-r2", 'rounds r5 and r3 on the two top edges at a corner, then r2 on the vertical edge under them, run on up into the corner', [F([corner[0]], 5), F([corner[1]], 3, tangent_chain=False), F([[60, 40, 8]], 2)], {"body_count": 1, "faces": 11, "bbox": BBOX}, @@ -1119,12 +1142,12 @@ case(T11, "002-flange", "a revolved flange and hub with a bore, six bolt holes, w30 = ext_half_width(30, 3.5) case(T11, "003-threaded-flange", "the flange with a modelled M30 thread on its hub, between the round and the chamfer, and M8 tapped holes in the disk", [thr([15, 0, 20], designation="M30"), H(position=[0, 28, 10], thread="M8", name="Tap"), C("solid.pattern.circular", features=["Tap"], axis="Z", count=3)], - {"body_count": 1, "volume_mm3": Vf - groove(30, 3.5, [(13 + w30, 28.5, lambda z: 15), (28.5, 30, lambda z: 15 - (z - 28.5))]) - 3 * PI * 3.375 ** 2 * 10, + {"body_count": 1, "volume_mm3": Vf - groove(30, 3.5, [(13 + w30, 28.5, lambda z: 15), (28.5, 30, lambda z: 15 - (z - 28.5))]) - 3 * PI * 3.4 ** 2 * 10, "bbox": {"min": [-40, -40, 0], "max": [40, 40, 30]}, "tolerance": {"rel": 1e-4}}, "the hub's cylinder (r15) runs from the r3 round at its root (z 13) to the 1.5 chamfer at its top (z 28.5): the M30 groove (P 3.5) stops w = %.6f clear of the round, " "a shoulder (06/007's rule), and runs out through the chamfer, a free end (06/006's): it removes the stock less 2 pi int int r m(r) dr dz over z 13 + w..28.5 at r 15 and the chamfer " - "(r 15 - (z - 28.5)); the bore r8 is inside the root r 13.1. The M8 tap drills (6.75) go through the 10 mm disk at r 28, 90 deg + k 120, clear of the bolt holes (30 deg apart): " - "3 pi 3.375^2 10. Bbox: the flange's" % w30, base=up(T11, "002-flange")) + "(r 15 - (z - 28.5)); the bore r8 is inside the root r 13.1. The M8 tap drills (6.8, the tap maker's) go through the 10 mm disk at r 28, 90 deg + k 120, clear of the bolt holes (30 deg apart): " + "3 pi 3.4^2 10. Bbox: the flange's" % w30, base=up(T11, "002-flange")) case(T11, "004-housing", "the running part with every tier: back wall, boss, slot, spline window, tapped holes, rounds, chamfers, shell, vents, and a modelled M16 thread on the boss", [thr([23, 15, 25], designation="M16")], {"body_count": 1, "volume_mm3": V9 - 4 * PI * 1.5 ** 2 * 1.5 - groove(16, 2, [(21 + w16, 29, lambda z: 8), (29, 30, lambda z: 8 - (z - 29))]),