-
Notifications
You must be signed in to change notification settings - Fork 0
Exporting and using x3d from Mayavi plots
Jussi Nurminen edited this page Apr 29, 2020
·
2 revisions
X3D is a free standard for representing 3D graphics, typically using XML.
Having created a Mayavi figure with handle fig
, you can use mlab.savefig('test.x3d', figure=fig)
to export to X3D. Mayavi X3D export is not perfect; see http://fpavogt.github.io/x3d-pathway/dices.html for discussion.
view3dscene seems to work. sudo apt install view3dscene
Use something like the following (assuming test.x3d
is available on the localhost web server):
<html>
<head>
<title>X3D data</title>
<script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'> </script>
<link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link>
</head>
<body>
<x3d width='800px' height='600px'>
<scene>
<inline url="http://localhost/test.x3d" nameSpaceName="figtest" mapDEFToID="true" onclick=''/>
</scene>
</x3d>
</body></html>
Doesn't work directly due to browser security settings. Haven't yet figured it out.