diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/expected.json new file mode 100644 index 0000000000..2bc234e984 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/expected.json @@ -0,0 +1,13 @@ +{ + "sources": [], + "what": "the body of an arm turned 90 degrees copied to the root", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); hinge driven to 90 puts ArmBox at (0,20,5); its copy in the root stays there: centres (0,0,-5), (0,20,5), (0,20,5): mean (0,13.333,1.667)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 0, + 13.333333, + 1.666667 + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/recipe.json new file mode 100644 index 0000000000..aa170d056c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/recipe.json @@ -0,0 +1,127 @@ +{ + "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": "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": "component.copy_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "root" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/expected.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/expected.json new file mode 100644 index 0000000000..90fa79ad13 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "the arm's body copied into the base's component", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a copy stays where its body is: Base then holds 4000 at (0,0,-5) and 4000 at (20,0,5): 8000, centre (10,0,0); the world has 3 bodies, 12000", + "body_count": 3, + "volume_mm3": 12000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 10.0, + 0.0, + 0.0 + ], + "volume_mm3": 8000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/recipe.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/recipe.json new file mode 100644 index 0000000000..1b6860670c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/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": "component.copy_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Base" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Base:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/expected.json b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/expected.json new file mode 100644 index 0000000000..ab0f37d727 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "component.extract of a component that is already linked", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5), Arm's box built inside Arm; after one extract Arm is linked; extracting it again is refused", + "outcome": "refused", + "refusal": "is linked to a design file already" +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/recipe.json b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/recipe.json new file mode 100644 index 0000000000..dba3163041 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/recipe.json @@ -0,0 +1,86 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": true + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.activate", + "params": { + "component": "root" + } + }, + { + "command": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm.solidcraft" + } + }, + { + "command": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm2.solidcraft" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/expected.json b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/expected.json new file mode 100644 index 0000000000..053a6763ee --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "component.extract of a component whose body was moved in from the root", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm's body came in by component.move_bodies, a feature outside it: its history can't move to a design of its own, so extract is refused", + "outcome": "refused", + "refusal": "moves bodies into or out of Arm" +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/recipe.json b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/recipe.json new file mode 100644 index 0000000000..d4701fd89a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/recipe.json @@ -0,0 +1,82 @@ +{ + "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": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm.solidcraft" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/expected.json b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/expected.json new file mode 100644 index 0000000000..bd49223040 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/expected.json @@ -0,0 +1,62 @@ +{ + "sources": [], + "what": "an arm built in its component extracted to a design file, then that file inserted again 50 mm along y", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5), Arm's box built inside Arm; extract keeps Arm where it is (now linked to the file: centre (20,0,5)); the file inserted with translate (0,50,0) holds the same 40x10x10 bar: centre (20,50,5)", + "body_count": 3, + "volume_mm3": 12000.0, + "results": [ + { + "step": 8, + "json": { + "bodies": [ + "ArmBox" + ] + } + }, + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "volume_mm3": 4000.0 + } + } + }, + { + "step": 10, + "json": { + "name": "Arm copy" + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 50.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + 45.0, + 0.0 + ], + "max": [ + 40.0, + 55.0, + 10.0 + ] + }, + "volume_mm3": 4000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/recipe.json b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/recipe.json new file mode 100644 index 0000000000..cca31d878b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/recipe.json @@ -0,0 +1,103 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": true + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.activate", + "params": { + "component": "root" + } + }, + { + "command": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm.solidcraft" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "component.insert_design", + "params": { + "path": "$OUT/arm.solidcraft", + "name": "Arm copy", + "translate": [ + 0, + 50, + 0 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm copy:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/expected.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/expected.json new file mode 100644 index 0000000000..e0a7999224 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/expected.json @@ -0,0 +1,36 @@ +{ + "sources": [], + "what": "component.from_bodies on two root bodies", + "source": "analytic", + "method": "boxes P 10x10x10 from (0,0,0) and Q 20x10x10 from (30,0,0): one component each, named after its body, in place: P:1 (5,5,5), Q:1 (40,5,5)", + "body_count": 2, + "volume_mm3": 3000.0, + "results": [ + { + "step": 4, + "json": { + "total": { + "center_of_mass": [ + 5.0, + 5.0, + 5.0 + ], + "volume_mm3": 1000.0 + } + } + }, + { + "step": 5, + "json": { + "total": { + "center_of_mass": [ + 40.0, + 5.0, + 5.0 + ], + "volume_mm3": 2000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/recipe.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/recipe.json new file mode 100644 index 0000000000..6de465f4cb --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/recipe.json @@ -0,0 +1,55 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 0, + 0, + 0 + ], + "operation": "new", + "body_name": "P" + } + }, + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "corner": [ + 30, + 0, + 0 + ], + "operation": "new", + "body_name": "Q" + } + }, + { + "command": "component.from_bodies", + "params": { + "bodies": [ + "P", + "Q" + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "P:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Q:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/expected.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/expected.json new file mode 100644 index 0000000000..20f1c4d7ad --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "component.from_bodies naming a body that is not there", + "source": "analytic", + "method": "a design with one body P: from_bodies of 'Nope' is refused, naming it", + "outcome": "refused", + "refusal": "Nope" +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/recipe.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/recipe.json new file mode 100644 index 0000000000..21e4a3e44c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "operation": "new", + "body_name": "P" + } + }, + { + "command": "component.from_bodies", + "params": { + "bodies": [ + "Nope" + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/expected.json b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/expected.json new file mode 100644 index 0000000000..8ec526f9f6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/expected.json @@ -0,0 +1,57 @@ +{ + "sources": [], + "what": "a hand-written design (one 30x20x10 box) inserted 100 mm along x", + "source": "analytic", + "method": "plate.solidcraft in the case directory: a box 30x20x10 at the origin; inserted with translate (100,0,0): 6000 mm3, box (100,0,0)-(130,20,10), centre (115,10,5)", + "body_count": 1, + "volume_mm3": 6000.0, + "area_mm2": 2200.0, + "bbox": { + "min": [ + 100, + 0, + 0 + ], + "max": [ + 130, + 20, + 10 + ] + }, + "results": [ + { + "step": 1, + "json": { + "bodies": [ + "Plate" + ], + "name": "plate" + } + }, + { + "step": 2, + "json": { + "total": { + "center_of_mass": [ + 115.0, + 10.0, + 5.0 + ], + "bbox": { + "min": [ + 100.0, + 0.0, + 0.0 + ], + "max": [ + 130.0, + 20.0, + 10.0 + ] + }, + "volume_mm3": 6000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/plate.solidcraft b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/plate.solidcraft new file mode 100644 index 0000000000..456fc27089 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/plate.solidcraft @@ -0,0 +1,11 @@ +{ + "format": "solidcraft/40", + "name": "plate", + "units": "mm", + "params": [], + "next_id": 2, + "features": [ + {"id": 1, "name": "Box1", "type": "box", "suppressed": false, "operation": "new_body", "body_names": ["Plate"], + "corner": [0.0, 0.0, 0.0], "length": "30", "width": "20", "height": "10"} + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/recipe.json b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/recipe.json new file mode 100644 index 0000000000..512ffc305f --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/recipe.json @@ -0,0 +1,21 @@ +{ + "commands": [ + { + "command": "component.insert_design", + "params": { + "path": "$CASE/plate.solidcraft", + "translate": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "plate:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/expected.json b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/expected.json new file mode 100644 index 0000000000..62d56bedf5 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "the hand-written design inserted twice, the second reusing the first's link", + "source": "analytic", + "method": "plate.solidcraft (box 30x20x10) at (0,0,0) and again with translate (0,50,0): 2 bodies, 12000 mm3, box (0,0,0)-(30,70,10)", + "body_count": 2, + "volume_mm3": 12000.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 30, + 70, + 10 + ] + }, + "center_of_mass": [ + 15, + 35, + 5 + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/plate.solidcraft b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/plate.solidcraft new file mode 100644 index 0000000000..456fc27089 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/plate.solidcraft @@ -0,0 +1,11 @@ +{ + "format": "solidcraft/40", + "name": "plate", + "units": "mm", + "params": [], + "next_id": 2, + "features": [ + {"id": 1, "name": "Box1", "type": "box", "suppressed": false, "operation": "new_body", "body_names": ["Plate"], + "corner": [0.0, 0.0, 0.0], "length": "30", "width": "20", "height": "10"} + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/recipe.json b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/recipe.json new file mode 100644 index 0000000000..e9b5a590c4 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "component.insert_design", + "params": { + "path": "$CASE/plate.solidcraft" + } + }, + { + "command": "component.insert_design", + "params": { + "path": "$CASE/plate.solidcraft", + "reuse": true, + "translate": [ + 0, + 50, + 0 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/expected.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/expected.json new file mode 100644 index 0000000000..7c2abacf9a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a root body moved into a component placed 100 mm along x", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Holder (empty) moved by (100,0,0), then a box 10x10x10 from (0,20,0) moved into it: the body keeps its world place, centre (5,25,5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 5.0, + 25.0, + 5.0 + ], + "volume_mm3": 1000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/recipe.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/recipe.json new file mode 100644 index 0000000000..056a83357a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/recipe.json @@ -0,0 +1,124 @@ +{ + "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": "component.create", + "params": { + "name": "Holder", + "parent": "root", + "activate": false + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Holder:1", + "translate": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 0, + 20, + 0 + ], + "operation": "new", + "body_name": "Cube" + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "Cube" + ], + "component": "Holder" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Holder:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/expected.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/expected.json new file mode 100644 index 0000000000..480082801c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/expected.json @@ -0,0 +1,72 @@ +{ + "sources": [], + "what": "two bodies moved from the root into a component each", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); moving bodies into components keeps them where they are: Arm (20,0,5), Base (0,0,-5), 4000 mm3 each", + "body_count": 2, + "volume_mm3": 8000.0, + "bbox": { + "min": [ + -10, + -10, + -10 + ], + "max": [ + 40, + 10, + 10 + ] + }, + "results": [ + { + "step": 8, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + }, + "volume_mm3": 4000.0 + } + } + }, + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 0.0, + -5.0 + ], + "bbox": { + "min": [ + -10.0, + -10.0, + -10.0 + ], + "max": [ + 10.0, + 10.0, + 0.0 + ] + }, + "volume_mm3": 4000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/recipe.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/recipe.json new file mode 100644 index 0000000000..b5a4469dc8 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/recipe.json @@ -0,0 +1,87 @@ +{ + "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.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Base:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/expected.json new file mode 100644 index 0000000000..9884f2e316 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "component.paste_new in place of an arm turned 90 degrees, 20 mm up", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); hinge at 90 puts Arm at (0,20,5), box x -5..5, y 0..40; in_place puts the copy where it is in the world, moved (0,0,20): centres (0,0,-5), (0,20,5), (0,20,25): mean (0,13.333,8.333)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 0, + 13.333333, + 8.333333 + ], + "bbox": { + "min": [ + -10, + -10, + -10 + ], + "max": [ + 10, + 40, + 30 + ] + } +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/recipe.json new file mode 100644 index 0000000000..15917ebf2a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/recipe.json @@ -0,0 +1,131 @@ +{ + "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": "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": "component.paste_new", + "params": { + "component": "Arm", + "occurrence": "Arm:1", + "in_place": true, + "translate": [ + 0, + 0, + 20 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/expected.json b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/expected.json new file mode 100644 index 0000000000..84578dd997 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "component.paste_new of the arm 30 mm along y", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); an independent copy of Arm moved by (0,30,0): centres (0,0,-5), (20,0,5), (20,30,5), 4000 each: total 12000, centre (13.333,10,1.667), box (-10,-10,-10)-(40,35,10)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 13.333333, + 10, + 1.666667 + ], + "bbox": { + "min": [ + -10, + -10, + -10 + ], + "max": [ + 40, + 35, + 10 + ] + } +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/recipe.json b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/recipe.json new file mode 100644 index 0000000000..afcc9d6826 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/recipe.json @@ -0,0 +1,86 @@ +{ + "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": "component.paste_new", + "params": { + "component": "Arm", + "translate": [ + 0, + 30, + 0 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json new file mode 100644 index 0000000000..21464fb601 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json @@ -0,0 +1,43 @@ +{ + "sources": [], + "what": "an automatic exploded view of scale 2", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); each occurrence moves scale \u00d7 (its centre - the mean of the centres): centres (0,0,-5) and (20,0,5), mean (10,0,0): Base by (-20,0,-10), Arm by (20,0,10); shown, Arm at (40,0,15)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 8, + "json": { + "moves": [ + { + "translate": [ + -20.0, + 0.0, + -10.0 + ] + }, + { + "translate": [ + 20.0, + 0.0, + 10.0 + ] + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 40.0, + 0.0, + 15.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/recipe.json b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/recipe.json new file mode 100644 index 0000000000..557244826b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/recipe.json @@ -0,0 +1,94 @@ +{ + "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": "explode.create", + "params": { + "name": "Apart", + "scale": 2 + } + }, + { + "command": "explode.show", + "params": { + "view": "Apart" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json new file mode 100644 index 0000000000..63cb1244da --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json @@ -0,0 +1,36 @@ +{ + "sources": [], + "what": "an exploded view moving the arm 30 mm up, shown", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); explode.show places Arm by (0,0,30): centre (20,0,35)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 8, + "json": { + "moves": [ + { + "translate": [ + 0.0, + 0.0, + 30.0 + ] + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 35.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/recipe.json b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/recipe.json new file mode 100644 index 0000000000..714c2d324f --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/recipe.json @@ -0,0 +1,103 @@ +{ + "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": "explode.create", + "params": { + "name": "Up", + "moves": [ + { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + 30 + ] + } + ] + } + }, + { + "command": "explode.show", + "params": { + "view": "Up" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/expected.json new file mode 100644 index 0000000000..90d25eb5f5 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "occurrence.copy in place of an arm turned 90 degrees, 20 mm up", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); hinge at 90 puts Arm at (0,20,5); in_place copies where it is in the world, translate in world axes: Arm:2 at (0,20,25)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 0, + 13.333333, + 8.333333 + ], + "results": [ + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 25.0 + ], + "bbox": { + "min": [ + -5.0, + 0.0, + 20.0 + ], + "max": [ + 5.0, + 40.0, + 30.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/recipe.json new file mode 100644 index 0000000000..1d9349c319 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/recipe.json @@ -0,0 +1,136 @@ +{ + "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": "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": "occurrence.copy", + "params": { + "occurrence": "Arm:1", + "in_place": true, + "translate": [ + 0, + 0, + 20 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:2" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/expected.json new file mode 100644 index 0000000000..de5c9baf86 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "occurrence.copy of the arm 20 mm up", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a second placement of Arm moved by (0,0,20): Arm:2 at (20,0,25); totals 12000, centre (13.333,0,8.333)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 13.333333, + 0, + 8.333333 + ], + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 25.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 20.0 + ], + "max": [ + 40.0, + 5.0, + 30.0 + ] + }, + "volume_mm3": 4000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/recipe.json new file mode 100644 index 0000000000..3af2cdcaf3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/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.copy", + "params": { + "component": "Arm", + "translate": [ + 0, + 0, + 20 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:2" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/expected.json new file mode 100644 index 0000000000..8571d1b20d --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "occurrence.drag of the grounded base", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a grounded part is refused", + "outcome": "refused", + "refusal": "grounded" +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/recipe.json new file mode 100644 index 0000000000..ba8da70c5f --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/recipe.json @@ -0,0 +1,91 @@ +{ + "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.drag", + "params": { + "occurrence": "Base:1", + "at": [ + 0, + 0, + -5 + ], + "point": [ + 0, + 10, + -5 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/expected.json new file mode 100644 index 0000000000..010b344040 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "occurrence.drag of the free arm from (20,0,5) to (20,10,5)", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm moves by point - at = (0,10,0): centre (20,10,5), box (0,5,0)-(40,15,10)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 10.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + 5.0, + 0.0 + ], + "max": [ + 40.0, + 15.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/recipe.json new file mode 100644 index 0000000000..80141b23df --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/recipe.json @@ -0,0 +1,97 @@ +{ + "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.drag", + "params": { + "occurrence": "Arm:1", + "at": [ + 20, + 0, + 5 + ], + "point": [ + 20, + 10, + 5 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/expected.json new file mode 100644 index 0000000000..e2431cad0f --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "the arm reparented under a component placed 100 mm along x", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Holder moved by (100,0,0); reparenting keeps Arm's world place: (20,0,5); and back to the root, still (20,0,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 13, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/recipe.json new file mode 100644 index 0000000000..d64612f0c4 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/recipe.json @@ -0,0 +1,120 @@ +{ + "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": "component.create", + "params": { + "name": "Holder", + "parent": "root", + "activate": false + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Holder:1", + "translate": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "occurrence.reparent", + "params": { + "occurrence": "Arm:1", + "parent": "Holder" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "occurrence.reparent", + "params": { + "occurrence": "Arm:1", + "parent": "root" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/expected.json new file mode 100644 index 0000000000..e8c46f1d62 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "the arm reparented under a component turned 90 degrees about z", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Holder turned 90 about z through (100,0,0); reparenting keeps Arm's world place: centre (20,0,5), box (0,-5,0)-(40,5,10)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/recipe.json new file mode 100644 index 0000000000..d612d9e6a2 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/recipe.json @@ -0,0 +1,113 @@ +{ + "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": "component.create", + "params": { + "name": "Holder", + "parent": "root", + "activate": false + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Holder:1", + "axis": [ + 0, + 0, + 1 + ], + "angle": "90 deg", + "origin": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "occurrence.reparent", + "params": { + "occurrence": "Arm:1", + "parent": "Holder" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +}