[x3d-public] Exporting VPython objects to STL (or other 3D file formats)

John Carlson yottzumm at gmail.com
Tue Feb 26 07:06:11 PST 2019


Here’s an example API that I getting close to shooting for for X3D-VPython.  Can we align something like this with vpython with possibly a few uppercase/lower case changes? I am getting feedback from another list, and then I will be posting more examples.

John

from X3Dpackage import *
X3D0 = X3D(profile="Immersive", version="3.3", Head = (head(
       Meta = [(meta(name="title", content="abox.x3d")),
       (meta(name="creator", content="John Carlson")),
       (meta(name="generator", content="manual")),
       (meta(name="identifier", content="https://coderextreme.net/X3DJSONLD/abox.x3d")),
       (meta(name="description", content="a box"))])),
       Scene = (Scene(Children = [
       (ProtoDeclare(name="anyShape",
       ProtoInterface = (ProtoInterface(Field = (field(type = field.TYPE_MFNODE, name="myShape",
       accessType=field.ACCESSTYPE_INPUTOUTPUT, Child = (Shape(geometry = (Sphere()))))))),
       ProtoBody = (ProtoBody(Child = (Transform(IS = (IS(Connect = (connect(nodeField="children", protoField="myShape")))))))))),
(ProtoDeclare(name="one",
       ProtoInterface = (ProtoInterface(Field = (field(type = field.TYPE_MFNODE, name="myShape",
       accessType=field.ACCESSTYPE_INPUTOUTPUT, Child = (Shape(geometry = (Cylinder()))))))),
       ProtoBody = (ProtoBody(Child = (Transform(Child =
       (ProtoInstance(name="anyShape", IS = (IS(Connect = (connect(nodeField="myShape", protoField="myShape")))))))))))),
(ProtoInstance(name="one", FieldValue = (fieldValue(name="myShape", Child = (Shape(geometry = (Box(size=[140,140,140]))))))])))))
X3D0.toFileX3D("/x3d-code/www.web3d.org/x3d/stylesheets/java/src/python/pythonapi/data/abox.newf.x3d")

Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, February 26, 2019 5:56 AM
To: VPython-users
Subject: Re: Exporting VPython objects to STL (or other 3D file formats)

Larry, we're interested in X3D format output from VPython. We're currently porting  X3D to python, using VPython or VPython-like APIs.  Then you could take your exported X3D XML (from the API) and convert to X3D JSON, which has STL output (not well tested for medical purposes, please test extensively) from the X3DJSONLD tool. We have a couple of converters to JSON from XML, namely X3d-Edit and X3DJSONLD.  There are also stylesheet and JS converters.

However, I do not have all of X3D implemented at this time in the STL tool.  Box and IndexedFaceSet, yes.  Others are on request

We are looking for Python programmers for the task of converting an XML unified object model to a python API similar to vpython. http://www.web3d.org/specifications/X3DUOM.html, the unified object model, will guide us.  The effort will include exporting scenegraphs to X3D XML and comparing to original XML generated from PythonSerializers (TBD, based on the API). The API and Python Serializers are currently based on PyJNIus.  We want to make it more pythonic, and encourage your participation.

If possible, we could use vpython creating renderings (we have a set of standard images to test if you do not).   Then I would add a Web rendering of vpython to my site https://coderextreme.net/X3DJSONLD/  I currently have X3DOM, X_ITE renderings of JSON and XML.    I want my site to be the swiss-army knife of X3DJSON.  Thus we would convert JSON to vpython and render it on the site.

The pythonic API would serve as the basis for an ISO standard (one implementation) we need 2 implementations for a standard, so ultimately we would have X3DOM, X_ITE, and vpython, all vying for the same developers. vpython would immediately benefit from the WebGL and JavaScript developed in X3DOM and X_ITE using XML or DOM export/import.   We might be able to do embedded scripting with python in X_ITE and X3DOM. We need developers interested in creating a 3D pythonic royalty free standards presence on the web and in 3D based browsers. No, we're not collecting fees on a per browser basis or at all, sorry.

Thus, this would be a good target for python on the web, and extend python ideas into X3D, VRML, etc.

Thanks,

John
-- 
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-users+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190226/5654dc21/attachment-0001.html>


More information about the x3d-public mailing list