Skip to content

Visualization

Ioanna Mitropoulou edited this page Oct 13, 2020 · 9 revisions

Visualization

There are two options in order to visualize the results of the slicing process.

Compas Viewers

The first quick-and-easy visualization uses compas viewers (make sure you have installed it as explained in the README.md). The classes that can be visualized are the BaseSlicer and all classes inheriting from it (so all the slicers), as well as the PrintOrganiser and all the classes inheriting from it (so all the print organizers). See examples for how to use it, but basically you need to do the following:

from compas_viewers.objectviewer import ObjectViewer

viewer = ObjectViewer()

viewer.view.use_shaders = False

# create and use your slicer

slicer.visualize_on_viewer(viewer)

# create and use your print_organiser

print_organiser.visualize_on_viewer(viewer)

# at the end of your script

viewer.update()

viewer.show()

Visualization in compas_viewers

Grasshopper

The second and recommended option is to visualize the results in grasshopper. This allows for a lot more flexibility. How this works is that the results of the slicer and print_organizer are saved in json files, and then they are loaded and visualized in grasshopper using python scripts. In order to export your data you can do:

save_to_json(slicer.to_data(), DATA_PATH, 'slicer_data.json')

save_to_json(robotic_commands, DATA_PATH, 'robotic_commands.json')

Then copy the visualization_master.gh file from the examples, into your files making sure you maintain the following folder structure, with all the json files inside the data folder. If you are unsure about this, then look at the examples.

Folder structure

Open the grasshopper file and you should see the results of your slicing. If you change the json files, you need to press on the 'recompute' button to update the visualization.

In grasshopper, you can visualize the various parameters with color and easily turn information on/off. Also you can visualize the print paths geometry, section of the printed object, or the tool during the print process.

Grasshopper visualization

Grasshopper visualization

Grasshopper visualization

Clone this wiki locally