Skip to content

Commit

Permalink
jupyterscad integration (jreiberkyle#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-dh committed Oct 19, 2023
1 parent b560430 commit 443c109
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions solid2/core/object_base/object_base_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ def save_as_stl(self, filename=None):
from ..scad_render import render_to_stl_file
return render_to_stl_file(self, filename)

def _ipython_display_(self):
from IPython import get_ipython, display
from importlib import find_loader

def is_notebook():
return get_ipython().__class__.__name__ == 'ZMQInteractiveShell'

if is_notebook() and find_loader("jupyterscad", None):
from jupyterscad import render
display.display(render(self))
else:
print(self.as_scad())

class ObjectBase(RenderMixin):
def __init__(self):
self._children = []
Expand Down

0 comments on commit 443c109

Please sign in to comment.