Ask Your Question

Transferring 3D plots

asked 2015-03-08 12:56:45 -0500

nerak99 gravatar image

I want to export 3D plots from Sage in some 3D format or other (NOt just a single png frame)

This script produces a jMol file for me. (I am on cloud.sagemath)

> from sage.interfaces.jmoldata import JmolData 3 sage: JData = JmolData() 4
> u,v = var('u v') 5 f_x = u 6 f_y =
> cos(1*v) 7 f_z = sin(3*v) 8
> img=parametric_plot3d([f_x, f_y, f_z],
> (u, 0, 0.6), (v, 0, 6*pi),
> color='blue', mesh=1, frame=False) 9
>'myfile.png') 10
> img.export_jmol('thisjmol') 11 img 12

The file produced is about 20K or so but if I try to open it via JMol standalone viewer I just get black.

Mind you if I try the example jmols I also get black.

My end point is to get the 3D view into a 3D package such as Blender but to start with I need to get my 3D image out of sage.

Any idea of where I am going wrong?

edit retag flag offensive close merge delete



There is a ticket waiting to help export 3D plots : but it has been waiting since a long time.

FrédéricC gravatar imageFrédéricC ( 2015-03-08 14:12:58 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2015-03-08 17:16:23 -0500

tmonteil gravatar image

updated 2015-03-09 09:11:58 -0500

There used to be a way to save the 3D scene with the extension but is seems currently broken:

AttributeError: 'OutputSceneJmol' object has no attribute 'jmol'

What you can do, if you do not have many plots, is to view them with jmol and then export them.


  • From the Sage command-line, it is on the top of the window, you can export in .spt format from the jmol applet : FILE > Export > Write State

  • From the Sage notebook, click on the circular arrow (bottom left of the image) to let jmol start, then right click on the image, you will get a menu: with File > Save you can export as a JVXL isosurface, from File > Export, you can export as VRML and X3D 3D models.

edit flag offensive delete link more


How do I access the context menu in the jmol applet?

nerak99 gravatar imagenerak99 ( 2015-03-09 07:38:31 -0500 )edit

I updated my answer since the answer depends on how jmol was opened.

tmonteil gravatar imagetmonteil ( 2015-03-09 09:12:30 -0500 )edit

I can't see the sage command line that you speak of. I am using cloud.sagemath though. I have managed to get jmol import of three.js objects to work. I think that in the screen rendering, three.js is involved.

nerak99 gravatar imagenerak99 ( 2015-03-10 07:09:16 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-08 12:56:45 -0500

Seen: 448 times

Last updated: Mar 09 '15