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

John Carlson yottzumm at gmail.com
Tue Feb 26 07:49:18 PST 2019


Here’s another example (HelloWorld.kwargs.py). (pardon excessive meta objects, they were in the original).  This one nearly compiles.  Can some small changes allow this to compile under vpython/glowscript?   Thanks!   If there are small changes, I will proceed to adapt to the vpython/glowscript 3D API in hopes that we can standardize it (write a specification for the API).  If there are larger changes, then I will attempt to write an X3D API on top of vpython/glowscript 3D API

from X3Dpackage import *
X3D0 = X3D(profile="Immersive", version="3.3", Head = head(
    Meta = [meta(content="HelloWorld.x3d", name="title"),
        meta(content="Simple X3D scene example: Hello World!", name="description"),
        meta(content="30 October 2000", name="created"),
        meta(content="14 April 2017", name="modified"),
        meta(content="Don Brutzman", name="creator"),
        meta(content="HelloWorld.tall.png", name="Image"),
        meta(content="http://en.wikipedia.org/wiki/Hello_world", name="reference"),
        meta(content="https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program", name="reference"),
        meta(content="https://en.wikipedia.org/wiki/\"Hello,_World!\"_program", name="reference"),
        meta(content="http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world", name="reference"),
        meta(content="http://www.HelloWorldExample.net", name="reference"),
        meta(content="http://www.web3D.org", name="reference"),
        meta(content="http://www.web3d.org/realtime-3d/news/internationalization-x3d", name="reference"),
        meta(content="http://www.web3d.org/x3d/content/examples/HelloWorld.x3d", name="reference"),
        meta(content="http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes", name="reference"),
        meta(content="http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d", name="identifier"),
        meta(content="http://www.web3d.org/x3d/content/examples/license.html", name="license"),
        meta(content="X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit", name="generator") # Alternate encodings: VRML97, X3D ClassicVRML Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON
,
        meta(content="HelloWorld.wrl", name="reference"),
        meta(content="HelloWorld.x3dv", name="reference"),
        meta(content="HelloWorld.x3db", name="reference"),
        meta(content="HelloWorld.xhtml", name="reference"),
        meta(content="HelloWorld.json", name="reference")]
    ),
    Scene = Scene( # Example scene to illustrate X3D nodes and fields (XML elements and attributes)
        Child = [
            WorldInfo(title="Hello world!"),
            Group(
                Child = [
                    Viewpoint(DEF="ViewUpClose", centerOfRotation=[0,-1,0], description="Hello world!", position=[0,-1,7]),
                    Transform(
                        Child = [ Shape(
                            Geometry = Sphere(),
                            Appearance = Appearance(
                                Material = Material(
                                    Texture = (ImageTexture(DEF="ImageCloudlessEarth", url=["earth-topo.png","earth-topo.jpg","earth-topo-small.gif","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg","http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif"])),
       DEF="MaterialLightBlue",
       diffuseColor=[0.1,0.5,1]))),
                        rotation=[0,1,0,3],
                        ),
                    Transform(
                        Child = [ Shape(
                            Geometry = Text(DEF="TextMessage", string=["Hello","world!"], FontStyle = (FontStyle(justify=["MIDDLE","MIDDLE"]))),
                            Appearance = Appearance(
                                Material = Material(USE="MaterialLightBlue")))],
                        translation=[0,-2,0])])]))
X3D0.toFileX3D("/x3d-code/www.web3d.org/x3d/stylesheets/java/src/python/pythonapi/data/HelloWorld.newf.x3d")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190226/7e07d741/attachment.html>


More information about the x3d-public mailing list