Go to Google Groups Home    sage-devel
Re: [sage-devel] 3d display: x3d?

Carl Witty <carl.wi...@gmail.com>

On Sun, Mar 8, 2009 at 3:36 AM, Prabhu Ramachandran

<pra...@aero.iitb.ac.in> wrote:

> Dear Sage developers,

> Is it possible to view an x3d file from a sage worksheet (assuming my
> browser has the necessary plugin or java support for example)? I saw
> numerous mentions of x3d support in the source code in plot/plot3d.  For
> example if one generates a 'foo.png', the image is immediately and very
> conveniently rendered.  This doesn't work if I save an x3d file.

If you want to add such support, the place to look is
sage/server/notebook/cell.py, in the function files_html.  This
function takes a list of all the files that were produced by
evaluating the cell, and produces HTML with display or download links
for those files.  For example, the case of *.svg files is handled like
this:

            elif F.endswith('.svg'):
                images.append('<embed src="%s" type="image/svg+xml"
name="emap">'%url)

So if you know what to put into HTML to display an x3d model, it would
be trivial to add another case in files_html.

Carl