I have been working on a way to view sage x3d files interactively through the sage notebook. If anyone is interested, I got it working (although you have to refresh the page to see the display, I am pretty sure someone could tell me why/how to fix it).
* First, I added the following code to the cell.py file (new code starts at #new code below):
elif F.startswith('.jmol_'):
# static jmol data and images
hasjmolimages=True
#new code below
elif F.endswith('.x3d'):
script = '<x3d id="someUniqueId" showStat="false" showLog="false" x="0px" y="0px" width="400px" height="400px">'
script += '<scene><inline url="%s" ></inline></scene></x3d>' % url
images.append(script)
* Then I downloaded
this javascript file to the /usr/lib/sagemath/devel/sagenb-main/sagenb/data/sage/js/ directory as 3xdom.js.
* Then I added the following line to the notebook_dynamic.js file:
{% include "js/x3dom.js" %}
Now when I save a .x3d file and refresh the page, a nice interactive screen comes up that allows me to zoom and rotate. See
here for an example (not a sage notebook, but the same interactive viewer I get).
I just thought I would pass this on. I am sure someone more familiar with the inner workings of the notebook server could improve upon this technique and get it working without the page refresh.
Thanks,
Alex Eftimiades