[x3d-public] Jupyter Lab + beta-X3DPSAIL Testers, help! with X3DOM wanted (poor man's Python port of X3DJSAIL to python)

John Carlson yottzumm at gmail.com
Tue May 14 11:32:09 PDT 2019

Install anaconda

Use this command to install pyjnius into Jupyter lab.  Don’t forget your virtual environment:

conda install -c conda-forge pyjnius

Then launch anaconda navigator from start menu, then launch jupyter lab, and type in some python below
import jnius_config
# specify path to jar.   Set Java CLASSPATH
jnius_config.set_classpath('.', 'c:/x3d-code/www.web3d.org/x3d/stylesheets/java/jars/X3DJSAIL.3.3.full.jar')

# put the fully qualified Java class inside the quotes
from jnius import autoclass
Shape = autoclass('org.web3d.x3d.jsail.Shape.ShapeObject')
Transform = autoclass('org.web3d.x3d.jsail.Grouping.TransformObject')
IS = autoclass('org.web3d.x3d.jsail.Core.ISObject')
X3D = autoclass('org.web3d.x3d.jsail.Core.X3DObject')
# declare the rest of the X3DJSAIL classes you are going to load into python using autoclass

# Type your Python code involving Shape, Transform and IS here—basically using X3DJSAIL-like API in python

# generate XML from X3DObject instance Using X3DJSAIL into a variable.
xml = X3D().setProfile("Immersive").setVersion("3.3").toStringX3D(2)

#  Then some tell me best way to get the xml scenegraph into a web page in Jupyter.  Do something like:

# Note that the released/approved X3DPSAIL might be different

# It might be a bumpy ride! If all else falls, don’t chain sets and adds in a single expression.

Have fun with Python and beta-X3DPSAIL!   Would love to see some exported HTML or PDF!   Want to give it a whirl, Andreas? Holger?

It’s kind of a let down that all we did was provided a small layer on top of X3DJSAIL.  I’d really like it well tested in the browser.  I haven’t tested it much inside Jupyter, just got really excited this morning when I saw some expressions working, so I thought I’d share.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190514/b037fa1d/attachment.html>

More information about the x3d-public mailing list