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<http://www.x3dom.org/x3dom/release/x3dom.js>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<http://x3dom.org/x3dom/example/blenderExport/horse-inline.html>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


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to