ukaea / openmc_workshop

A selection of resources for learning openmc with particular focus on simulations relevant for fusion energy
https://slides.com/openmc_workshop/neutronics_workshop#/
38 stars 18 forks source link

CAD not showing on cloud based solution #225

Open shimwell opened 3 years ago

shimwell commented 3 years ago

In a recently created cloud run version of the workshop the .solids don't show up as 3d shapes in the jupyter notebook

Got some nice suggestions on how to fix this from @agoose

The rendering failure of the solid objects is due to HTTPS/HTTP mixed content blocking. You can patch the rich display hook (for all of these solid types) to replace http with https (hacky, yes!) e.g.

_repr_html = type(my_shape.solid)._reprhtml def _reprhtml(self): return _repr_html(self).replace("http:", "https:") type(my_shape.solid)._reprhtml = _reprhtml

You can also get Jupyter Lab/Notebook interactive STL viewers, e.g. https://github.com/K3D-tools/K3D-jupyter

However, it looks like there is a Jupyter Lab extension for CadQuery: https://github.com/bernhard-42/jupyter-cadquery

These particular examples are currently only JupyterLab 2.x