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": {} + } + ] +}