Add CSG operations to the Feature Tree (#6028)
* Add operation tracking for CSG boolean functions * Add CSG operations to the Feature Tree * Add just command * Add union sim test * Update output with new sim test * Add CSG subtract test * Update output from subtract test * Add intersect sim test * Update output for intersect test
This commit is contained in:
		
							
								
								
									
										554
									
								
								rust/kcl-lib/tests/intersect_cubes/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										554
									
								
								rust/kcl-lib/tests/intersect_cubes/artifact_commands.snap
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,554 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Artifact commands intersect_cubes.kcl
 | 
			
		||||
---
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "edge_lines_visible",
 | 
			
		||||
      "hidden": false
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "set_scene_units",
 | 
			
		||||
      "unit": "mm"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "object_visible",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "hidden": true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "object_visible",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "hidden": true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "make_plane",
 | 
			
		||||
      "origin": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      },
 | 
			
		||||
      "x_axis": {
 | 
			
		||||
        "x": 1.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      },
 | 
			
		||||
      "y_axis": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 1.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      },
 | 
			
		||||
      "size": 60.0,
 | 
			
		||||
      "clobber": false,
 | 
			
		||||
      "hide": true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "enable_sketch_mode",
 | 
			
		||||
      "entity_id": "[uuid]",
 | 
			
		||||
      "ortho": false,
 | 
			
		||||
      "animated": false,
 | 
			
		||||
      "adjust_camera": false,
 | 
			
		||||
      "planar_normal": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 1.0
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "start_path"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "move_path_pen",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "to": {
 | 
			
		||||
        "x": -10.0,
 | 
			
		||||
        "y": -10.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "sketch_mode_disable"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extend_path",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "segment": {
 | 
			
		||||
        "type": "line",
 | 
			
		||||
        "end": {
 | 
			
		||||
          "x": 10.0,
 | 
			
		||||
          "y": -10.0,
 | 
			
		||||
          "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "relative": false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extend_path",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "segment": {
 | 
			
		||||
        "type": "line",
 | 
			
		||||
        "end": {
 | 
			
		||||
          "x": 10.0,
 | 
			
		||||
          "y": 10.0,
 | 
			
		||||
          "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "relative": false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extend_path",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "segment": {
 | 
			
		||||
        "type": "line",
 | 
			
		||||
        "end": {
 | 
			
		||||
          "x": -10.0,
 | 
			
		||||
          "y": 10.0,
 | 
			
		||||
          "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "relative": false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "close_path",
 | 
			
		||||
      "path_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "enable_sketch_mode",
 | 
			
		||||
      "entity_id": "[uuid]",
 | 
			
		||||
      "ortho": false,
 | 
			
		||||
      "animated": false,
 | 
			
		||||
      "adjust_camera": false,
 | 
			
		||||
      "planar_normal": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 1.0
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extrude",
 | 
			
		||||
      "target": "[uuid]",
 | 
			
		||||
      "distance": 10.0,
 | 
			
		||||
      "faces": null
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "sketch_mode_disable"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "object_bring_to_front",
 | 
			
		||||
      "object_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_extrusion_face_info",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "make_plane",
 | 
			
		||||
      "origin": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      },
 | 
			
		||||
      "x_axis": {
 | 
			
		||||
        "x": 1.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      },
 | 
			
		||||
      "y_axis": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 1.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      },
 | 
			
		||||
      "size": 60.0,
 | 
			
		||||
      "clobber": false,
 | 
			
		||||
      "hide": true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "enable_sketch_mode",
 | 
			
		||||
      "entity_id": "[uuid]",
 | 
			
		||||
      "ortho": false,
 | 
			
		||||
      "animated": false,
 | 
			
		||||
      "adjust_camera": false,
 | 
			
		||||
      "planar_normal": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 1.0
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "start_path"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "move_path_pen",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "to": {
 | 
			
		||||
        "x": -2.0,
 | 
			
		||||
        "y": -2.0,
 | 
			
		||||
        "z": 0.0
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "sketch_mode_disable"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extend_path",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "segment": {
 | 
			
		||||
        "type": "line",
 | 
			
		||||
        "end": {
 | 
			
		||||
          "x": 18.0,
 | 
			
		||||
          "y": -2.0,
 | 
			
		||||
          "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "relative": false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extend_path",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "segment": {
 | 
			
		||||
        "type": "line",
 | 
			
		||||
        "end": {
 | 
			
		||||
          "x": 18.0,
 | 
			
		||||
          "y": 18.0,
 | 
			
		||||
          "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "relative": false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extend_path",
 | 
			
		||||
      "path": "[uuid]",
 | 
			
		||||
      "segment": {
 | 
			
		||||
        "type": "line",
 | 
			
		||||
        "end": {
 | 
			
		||||
          "x": -2.0,
 | 
			
		||||
          "y": 18.0,
 | 
			
		||||
          "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "relative": false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "close_path",
 | 
			
		||||
      "path_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "enable_sketch_mode",
 | 
			
		||||
      "entity_id": "[uuid]",
 | 
			
		||||
      "ortho": false,
 | 
			
		||||
      "animated": false,
 | 
			
		||||
      "adjust_camera": false,
 | 
			
		||||
      "planar_normal": {
 | 
			
		||||
        "x": 0.0,
 | 
			
		||||
        "y": 0.0,
 | 
			
		||||
        "z": 1.0
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "extrude",
 | 
			
		||||
      "target": "[uuid]",
 | 
			
		||||
      "distance": 10.0,
 | 
			
		||||
      "faces": null
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "sketch_mode_disable"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "object_bring_to_front",
 | 
			
		||||
      "object_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_extrusion_face_info",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_opposite_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "cmdId": "[uuid]",
 | 
			
		||||
    "range": [],
 | 
			
		||||
    "command": {
 | 
			
		||||
      "type": "solid3d_get_next_adjacent_edge",
 | 
			
		||||
      "object_id": "[uuid]",
 | 
			
		||||
      "edge_id": "[uuid]",
 | 
			
		||||
      "face_id": "[uuid]"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -0,0 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Artifact graph flowchart intersect_cubes.kcl
 | 
			
		||||
extension: md
 | 
			
		||||
snapshot_kind: binary
 | 
			
		||||
---
 | 
			
		||||
@ -0,0 +1,117 @@
 | 
			
		||||
```mermaid
 | 
			
		||||
flowchart LR
 | 
			
		||||
  subgraph path2 [Path]
 | 
			
		||||
    2["Path<br>[52, 103, 0]"]
 | 
			
		||||
    3["Segment<br>[111, 163, 0]"]
 | 
			
		||||
    4["Segment<br>[171, 223, 0]"]
 | 
			
		||||
    5["Segment<br>[231, 283, 0]"]
 | 
			
		||||
    6["Segment<br>[291, 298, 0]"]
 | 
			
		||||
    7[Solid2d]
 | 
			
		||||
  end
 | 
			
		||||
  subgraph path24 [Path]
 | 
			
		||||
    24["Path<br>[52, 103, 0]"]
 | 
			
		||||
    25["Segment<br>[111, 163, 0]"]
 | 
			
		||||
    26["Segment<br>[171, 223, 0]"]
 | 
			
		||||
    27["Segment<br>[231, 283, 0]"]
 | 
			
		||||
    28["Segment<br>[291, 298, 0]"]
 | 
			
		||||
    29[Solid2d]
 | 
			
		||||
  end
 | 
			
		||||
  1["Plane<br>[27, 44, 0]"]
 | 
			
		||||
  8["Sweep Extrusion<br>[306, 326, 0]"]
 | 
			
		||||
  9[Wall]
 | 
			
		||||
  10[Wall]
 | 
			
		||||
  11[Wall]
 | 
			
		||||
  12[Wall]
 | 
			
		||||
  13["Cap Start"]
 | 
			
		||||
  14["Cap End"]
 | 
			
		||||
  15["SweepEdge Opposite"]
 | 
			
		||||
  16["SweepEdge Adjacent"]
 | 
			
		||||
  17["SweepEdge Opposite"]
 | 
			
		||||
  18["SweepEdge Adjacent"]
 | 
			
		||||
  19["SweepEdge Opposite"]
 | 
			
		||||
  20["SweepEdge Adjacent"]
 | 
			
		||||
  21["SweepEdge Opposite"]
 | 
			
		||||
  22["SweepEdge Adjacent"]
 | 
			
		||||
  23["Plane<br>[27, 44, 0]"]
 | 
			
		||||
  30["Sweep Extrusion<br>[306, 326, 0]"]
 | 
			
		||||
  31[Wall]
 | 
			
		||||
  32[Wall]
 | 
			
		||||
  33[Wall]
 | 
			
		||||
  34[Wall]
 | 
			
		||||
  35["Cap Start"]
 | 
			
		||||
  36["Cap End"]
 | 
			
		||||
  37["SweepEdge Opposite"]
 | 
			
		||||
  38["SweepEdge Adjacent"]
 | 
			
		||||
  39["SweepEdge Opposite"]
 | 
			
		||||
  40["SweepEdge Adjacent"]
 | 
			
		||||
  41["SweepEdge Opposite"]
 | 
			
		||||
  42["SweepEdge Adjacent"]
 | 
			
		||||
  43["SweepEdge Opposite"]
 | 
			
		||||
  44["SweepEdge Adjacent"]
 | 
			
		||||
  1 --- 2
 | 
			
		||||
  2 --- 3
 | 
			
		||||
  2 --- 4
 | 
			
		||||
  2 --- 5
 | 
			
		||||
  2 --- 6
 | 
			
		||||
  2 ---- 8
 | 
			
		||||
  2 --- 7
 | 
			
		||||
  3 --- 9
 | 
			
		||||
  3 --- 15
 | 
			
		||||
  3 --- 16
 | 
			
		||||
  4 --- 10
 | 
			
		||||
  4 --- 17
 | 
			
		||||
  4 --- 18
 | 
			
		||||
  5 --- 11
 | 
			
		||||
  5 --- 19
 | 
			
		||||
  5 --- 20
 | 
			
		||||
  6 --- 12
 | 
			
		||||
  6 --- 21
 | 
			
		||||
  6 --- 22
 | 
			
		||||
  8 --- 9
 | 
			
		||||
  8 --- 10
 | 
			
		||||
  8 --- 11
 | 
			
		||||
  8 --- 12
 | 
			
		||||
  8 --- 13
 | 
			
		||||
  8 --- 14
 | 
			
		||||
  8 --- 15
 | 
			
		||||
  8 --- 16
 | 
			
		||||
  8 --- 17
 | 
			
		||||
  8 --- 18
 | 
			
		||||
  8 --- 19
 | 
			
		||||
  8 --- 20
 | 
			
		||||
  8 --- 21
 | 
			
		||||
  8 --- 22
 | 
			
		||||
  23 --- 24
 | 
			
		||||
  24 --- 25
 | 
			
		||||
  24 --- 26
 | 
			
		||||
  24 --- 27
 | 
			
		||||
  24 --- 28
 | 
			
		||||
  24 ---- 30
 | 
			
		||||
  24 --- 29
 | 
			
		||||
  25 --- 31
 | 
			
		||||
  25 --- 37
 | 
			
		||||
  25 --- 38
 | 
			
		||||
  26 --- 32
 | 
			
		||||
  26 --- 39
 | 
			
		||||
  26 --- 40
 | 
			
		||||
  27 --- 33
 | 
			
		||||
  27 --- 41
 | 
			
		||||
  27 --- 42
 | 
			
		||||
  28 --- 34
 | 
			
		||||
  28 --- 43
 | 
			
		||||
  28 --- 44
 | 
			
		||||
  30 --- 31
 | 
			
		||||
  30 --- 32
 | 
			
		||||
  30 --- 33
 | 
			
		||||
  30 --- 34
 | 
			
		||||
  30 --- 35
 | 
			
		||||
  30 --- 36
 | 
			
		||||
  30 --- 37
 | 
			
		||||
  30 --- 38
 | 
			
		||||
  30 --- 39
 | 
			
		||||
  30 --- 40
 | 
			
		||||
  30 --- 41
 | 
			
		||||
  30 --- 42
 | 
			
		||||
  30 --- 43
 | 
			
		||||
  30 --- 44
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										1011
									
								
								rust/kcl-lib/tests/intersect_cubes/ast.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1011
									
								
								rust/kcl-lib/tests/intersect_cubes/ast.snap
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										14
									
								
								rust/kcl-lib/tests/intersect_cubes/input.kcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								rust/kcl-lib/tests/intersect_cubes/input.kcl
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
fn cube(center) {
 | 
			
		||||
  return startSketchOn(XY)
 | 
			
		||||
    |> startProfileAt([center[0] - 10, center[1] - 10], %)
 | 
			
		||||
    |> line(endAbsolute = [center[0] + 10, center[1] - 10])
 | 
			
		||||
    |> line(endAbsolute = [center[0] + 10, center[1] + 10])
 | 
			
		||||
    |> line(endAbsolute = [center[0] - 10, center[1] + 10])
 | 
			
		||||
    |> close()
 | 
			
		||||
    |> extrude(length = 10)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
part001 = cube([0, 0])
 | 
			
		||||
part002 = cube([8, 8])
 | 
			
		||||
 | 
			
		||||
fullPart = intersect([part001, part002])
 | 
			
		||||
							
								
								
									
										158
									
								
								rust/kcl-lib/tests/intersect_cubes/ops.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								rust/kcl-lib/tests/intersect_cubes/ops.snap
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,158 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Operations executed intersect_cubes.kcl
 | 
			
		||||
---
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "type": "UserDefinedFunctionCall",
 | 
			
		||||
    "name": "cube",
 | 
			
		||||
    "functionSourceRange": [
 | 
			
		||||
      7,
 | 
			
		||||
      328,
 | 
			
		||||
      0
 | 
			
		||||
    ],
 | 
			
		||||
    "unlabeledArg": null,
 | 
			
		||||
    "labeledArgs": {},
 | 
			
		||||
    "sourceRange": []
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "labeledArgs": {
 | 
			
		||||
      "data": {
 | 
			
		||||
        "value": {
 | 
			
		||||
          "type": "Plane",
 | 
			
		||||
          "artifact_id": "[uuid]"
 | 
			
		||||
        },
 | 
			
		||||
        "sourceRange": []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "name": "startSketchOn",
 | 
			
		||||
    "sourceRange": [],
 | 
			
		||||
    "type": "StdLibCall",
 | 
			
		||||
    "unlabeledArg": null
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "labeledArgs": {
 | 
			
		||||
      "length": {
 | 
			
		||||
        "value": {
 | 
			
		||||
          "type": "Number",
 | 
			
		||||
          "value": 10.0,
 | 
			
		||||
          "ty": {
 | 
			
		||||
            "type": "Default",
 | 
			
		||||
            "len": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            },
 | 
			
		||||
            "angle": {
 | 
			
		||||
              "type": "Degrees"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "sourceRange": []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "name": "extrude",
 | 
			
		||||
    "sourceRange": [],
 | 
			
		||||
    "type": "StdLibCall",
 | 
			
		||||
    "unlabeledArg": {
 | 
			
		||||
      "value": {
 | 
			
		||||
        "type": "Sketch",
 | 
			
		||||
        "value": {
 | 
			
		||||
          "artifactId": "[uuid]"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "sourceRange": []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "type": "UserDefinedFunctionReturn"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "type": "UserDefinedFunctionCall",
 | 
			
		||||
    "name": "cube",
 | 
			
		||||
    "functionSourceRange": [
 | 
			
		||||
      7,
 | 
			
		||||
      328,
 | 
			
		||||
      0
 | 
			
		||||
    ],
 | 
			
		||||
    "unlabeledArg": null,
 | 
			
		||||
    "labeledArgs": {},
 | 
			
		||||
    "sourceRange": []
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "labeledArgs": {
 | 
			
		||||
      "data": {
 | 
			
		||||
        "value": {
 | 
			
		||||
          "type": "Plane",
 | 
			
		||||
          "artifact_id": "[uuid]"
 | 
			
		||||
        },
 | 
			
		||||
        "sourceRange": []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "name": "startSketchOn",
 | 
			
		||||
    "sourceRange": [],
 | 
			
		||||
    "type": "StdLibCall",
 | 
			
		||||
    "unlabeledArg": null
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "labeledArgs": {
 | 
			
		||||
      "length": {
 | 
			
		||||
        "value": {
 | 
			
		||||
          "type": "Number",
 | 
			
		||||
          "value": 10.0,
 | 
			
		||||
          "ty": {
 | 
			
		||||
            "type": "Default",
 | 
			
		||||
            "len": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            },
 | 
			
		||||
            "angle": {
 | 
			
		||||
              "type": "Degrees"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "sourceRange": []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "name": "extrude",
 | 
			
		||||
    "sourceRange": [],
 | 
			
		||||
    "type": "StdLibCall",
 | 
			
		||||
    "unlabeledArg": {
 | 
			
		||||
      "value": {
 | 
			
		||||
        "type": "Sketch",
 | 
			
		||||
        "value": {
 | 
			
		||||
          "artifactId": "[uuid]"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "sourceRange": []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "type": "UserDefinedFunctionReturn"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "labeledArgs": {
 | 
			
		||||
      "solids": {
 | 
			
		||||
        "value": {
 | 
			
		||||
          "type": "Array",
 | 
			
		||||
          "value": [
 | 
			
		||||
            {
 | 
			
		||||
              "type": "Solid",
 | 
			
		||||
              "value": {
 | 
			
		||||
                "artifactId": "[uuid]"
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
              "type": "Solid",
 | 
			
		||||
              "value": {
 | 
			
		||||
                "artifactId": "[uuid]"
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          ]
 | 
			
		||||
        },
 | 
			
		||||
        "sourceRange": []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "name": "intersect",
 | 
			
		||||
    "sourceRange": [],
 | 
			
		||||
    "type": "StdLibCall",
 | 
			
		||||
    "unlabeledArg": null
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										543
									
								
								rust/kcl-lib/tests/intersect_cubes/program_memory.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										543
									
								
								rust/kcl-lib/tests/intersect_cubes/program_memory.snap
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,543 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Variables in memory after executing intersect_cubes.kcl
 | 
			
		||||
---
 | 
			
		||||
{
 | 
			
		||||
  "cube": {
 | 
			
		||||
    "type": "Function"
 | 
			
		||||
  },
 | 
			
		||||
  "fullPart": {
 | 
			
		||||
    "type": "Solid",
 | 
			
		||||
    "value": {
 | 
			
		||||
      "type": "Solid",
 | 
			
		||||
      "id": "[uuid]",
 | 
			
		||||
      "artifactId": "[uuid]",
 | 
			
		||||
      "value": [
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      "sketch": {
 | 
			
		||||
        "type": "Sketch",
 | 
			
		||||
        "id": "[uuid]",
 | 
			
		||||
        "paths": [
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        "on": {
 | 
			
		||||
          "type": "plane",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "artifactId": "[uuid]",
 | 
			
		||||
          "value": "XY",
 | 
			
		||||
          "origin": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "xAxis": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "yAxis": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "zAxis": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
          },
 | 
			
		||||
          "units": {
 | 
			
		||||
            "type": "Mm"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "start": {
 | 
			
		||||
          "from": [
 | 
			
		||||
            -10.0,
 | 
			
		||||
            -10.0
 | 
			
		||||
          ],
 | 
			
		||||
          "to": [
 | 
			
		||||
            -10.0,
 | 
			
		||||
            -10.0
 | 
			
		||||
          ],
 | 
			
		||||
          "units": {
 | 
			
		||||
            "type": "Mm"
 | 
			
		||||
          },
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "__geoMeta": {
 | 
			
		||||
            "id": "[uuid]",
 | 
			
		||||
            "sourceRange": []
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "artifactId": "[uuid]",
 | 
			
		||||
        "originalId": "[uuid]",
 | 
			
		||||
        "units": {
 | 
			
		||||
          "type": "Mm"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "height": 10.0,
 | 
			
		||||
      "startCapId": "[uuid]",
 | 
			
		||||
      "endCapId": "[uuid]",
 | 
			
		||||
      "units": {
 | 
			
		||||
        "type": "Mm"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "part001": {
 | 
			
		||||
    "type": "Solid",
 | 
			
		||||
    "value": {
 | 
			
		||||
      "type": "Solid",
 | 
			
		||||
      "id": "[uuid]",
 | 
			
		||||
      "artifactId": "[uuid]",
 | 
			
		||||
      "value": [
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      "sketch": {
 | 
			
		||||
        "type": "Sketch",
 | 
			
		||||
        "id": "[uuid]",
 | 
			
		||||
        "paths": [
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              -10.0,
 | 
			
		||||
              -10.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        "on": {
 | 
			
		||||
          "type": "plane",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "artifactId": "[uuid]",
 | 
			
		||||
          "value": "XY",
 | 
			
		||||
          "origin": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "xAxis": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "yAxis": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "zAxis": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
          },
 | 
			
		||||
          "units": {
 | 
			
		||||
            "type": "Mm"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "start": {
 | 
			
		||||
          "from": [
 | 
			
		||||
            -10.0,
 | 
			
		||||
            -10.0
 | 
			
		||||
          ],
 | 
			
		||||
          "to": [
 | 
			
		||||
            -10.0,
 | 
			
		||||
            -10.0
 | 
			
		||||
          ],
 | 
			
		||||
          "units": {
 | 
			
		||||
            "type": "Mm"
 | 
			
		||||
          },
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "__geoMeta": {
 | 
			
		||||
            "id": "[uuid]",
 | 
			
		||||
            "sourceRange": []
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "artifactId": "[uuid]",
 | 
			
		||||
        "originalId": "[uuid]",
 | 
			
		||||
        "units": {
 | 
			
		||||
          "type": "Mm"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "height": 10.0,
 | 
			
		||||
      "startCapId": "[uuid]",
 | 
			
		||||
      "endCapId": "[uuid]",
 | 
			
		||||
      "units": {
 | 
			
		||||
        "type": "Mm"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "part002": {
 | 
			
		||||
    "type": "Solid",
 | 
			
		||||
    "value": {
 | 
			
		||||
      "type": "Solid",
 | 
			
		||||
      "id": "[uuid]",
 | 
			
		||||
      "artifactId": "[uuid]",
 | 
			
		||||
      "value": [
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          "faceId": "[uuid]",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "sourceRange": [],
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "type": "extrudePlane"
 | 
			
		||||
        }
 | 
			
		||||
      ],
 | 
			
		||||
      "sketch": {
 | 
			
		||||
        "type": "Sketch",
 | 
			
		||||
        "id": "[uuid]",
 | 
			
		||||
        "paths": [
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              -2.0,
 | 
			
		||||
              -2.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              18.0,
 | 
			
		||||
              -2.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              18.0,
 | 
			
		||||
              -2.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              18.0,
 | 
			
		||||
              18.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              18.0,
 | 
			
		||||
              18.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              -2.0,
 | 
			
		||||
              18.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "__geoMeta": {
 | 
			
		||||
              "id": "[uuid]",
 | 
			
		||||
              "sourceRange": []
 | 
			
		||||
            },
 | 
			
		||||
            "from": [
 | 
			
		||||
              -2.0,
 | 
			
		||||
              18.0
 | 
			
		||||
            ],
 | 
			
		||||
            "tag": null,
 | 
			
		||||
            "to": [
 | 
			
		||||
              -2.0,
 | 
			
		||||
              -2.0
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "ToPoint",
 | 
			
		||||
            "units": {
 | 
			
		||||
              "type": "Mm"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        "on": {
 | 
			
		||||
          "type": "plane",
 | 
			
		||||
          "id": "[uuid]",
 | 
			
		||||
          "artifactId": "[uuid]",
 | 
			
		||||
          "value": "XY",
 | 
			
		||||
          "origin": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "xAxis": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "yAxis": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
          },
 | 
			
		||||
          "zAxis": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
          },
 | 
			
		||||
          "units": {
 | 
			
		||||
            "type": "Mm"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "start": {
 | 
			
		||||
          "from": [
 | 
			
		||||
            -2.0,
 | 
			
		||||
            -2.0
 | 
			
		||||
          ],
 | 
			
		||||
          "to": [
 | 
			
		||||
            -2.0,
 | 
			
		||||
            -2.0
 | 
			
		||||
          ],
 | 
			
		||||
          "units": {
 | 
			
		||||
            "type": "Mm"
 | 
			
		||||
          },
 | 
			
		||||
          "tag": null,
 | 
			
		||||
          "__geoMeta": {
 | 
			
		||||
            "id": "[uuid]",
 | 
			
		||||
            "sourceRange": []
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "artifactId": "[uuid]",
 | 
			
		||||
        "originalId": "[uuid]",
 | 
			
		||||
        "units": {
 | 
			
		||||
          "type": "Mm"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "height": 10.0,
 | 
			
		||||
      "startCapId": "[uuid]",
 | 
			
		||||
      "endCapId": "[uuid]",
 | 
			
		||||
      "units": {
 | 
			
		||||
        "type": "Mm"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								rust/kcl-lib/tests/intersect_cubes/rendered_model.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								rust/kcl-lib/tests/intersect_cubes/rendered_model.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 67 KiB  | 
							
								
								
									
										18
									
								
								rust/kcl-lib/tests/intersect_cubes/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								rust/kcl-lib/tests/intersect_cubes/unparsed.snap
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
---
 | 
			
		||||
source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Result of unparsing intersect_cubes.kcl
 | 
			
		||||
---
 | 
			
		||||
fn cube(center) {
 | 
			
		||||
  return startSketchOn(XY)
 | 
			
		||||
    |> startProfileAt([center[0] - 10, center[1] - 10], %)
 | 
			
		||||
    |> line(endAbsolute = [center[0] + 10, center[1] - 10])
 | 
			
		||||
    |> line(endAbsolute = [center[0] + 10, center[1] + 10])
 | 
			
		||||
    |> line(endAbsolute = [center[0] - 10, center[1] + 10])
 | 
			
		||||
    |> close()
 | 
			
		||||
    |> extrude(length = 10)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
part001 = cube([0, 0])
 | 
			
		||||
part002 = cube([8, 8])
 | 
			
		||||
 | 
			
		||||
fullPart = intersect([part001, part002])
 | 
			
		||||
		Reference in New Issue
	
	Block a user