Grasshopper Visualization¶
This tutorial explains how to visualize COMPAS Slicer results in Rhino/Grasshopper.
Important
The Grasshopper components only visualize existing results. All slicing computation happens in Python - the components load and display the JSON output files.
Setup¶
- Install COMPAS Slicer (see Installation)
-
Install Grasshopper components:
Workflow¶
graph LR
A[Python Script] -->|generates| B[JSON Files]
B -->|loaded by| C[GH Components]
C -->|displays| D[Rhino Geometry]
- Run your Python slicing script
- Output files are saved to
project/data/output/ - Open the Grasshopper file in
project/ - Click Recompute on components to load latest results
Project Structure¶
my_project/
├── data/
│ ├── model.obj # Input mesh
│ └── output/
│ ├── slicer_data.json
│ └── out_printpoints.json
├── my_script.py # Python slicing code
└── visualization.gh # Grasshopper file
Tip
Place your .gh file in the project root folder so components can find the data/output/ folder.
Components¶
csLoadSlicer¶
Loads slicer results from JSON, including all layer and path data.
Outputs:
- Layers (list of paths per layer)
- Path geometry (polylines)
- Layer heights
csLoadPrintpoints¶
Loads the printpoints dictionary with all fabrication parameters.
Outputs:
- Point locations
- Velocities
- Extruder states
- Up vectors
csLightPathViz¶
Creates a lightweight visualization of toolpaths.
- White tubes: Print paths
- Orange tubes: Travel moves
csRenderPathViz¶
Creates a detailed visualization with actual path cross-sections.
Requires a cross-section curve as input for accurate representation.
Example Workflow¶
-
Run Python script:
-
In Grasshopper:
- Add
csLoadSlicercomponent - Connect to visualization components
- Click Recompute after each Python run
- Add