[x3d-public] FW: HelloWorld.py, PYTHON PROGRAMMERS please provide feedback.

John Carlson yottzumm at gmail.com
Sun Mar 10 14:37:15 PDT 2019


Has anyone looked at generareds, pyxb or pyxsd for the task?   Thanks

On Mon, Mar 4, 2019 at 8:26 PM John Carlson <yottzumm at gmail.com> wrote:

> Thank you for looking at my examples. I haven’t heard any votes for a
> particular Python API or any discussions.  I think Don prefers either
> HelloWorld.py or HelloWorld.future.py (due to compatibility with
> X3DJSAIL).  Vpython’s API is more like HelloWorld.kwargs.py, and may be
> more pythonic.
>
>
>
> I would lean towards HelloWorld.py or HelloWorld.kwargs.py (or some
> combination).
>
>
>
> Is there a python application API board I can post to for recommendations?
>
>
>
> Your thoughts?   Should I pursue the combination between HelloWorld.py and
> HelloWorld.kwargs.py?
>
>
>
> John
>
>
>
> from X3Dpackage import *
>
> X3D0 =  X3D()
>
> X3D0.setProfile("Immersive")
>
> X3D0.setVersion("3.3")
>
>
>
> head1 = head()
>
>
>
> meta2 = meta()
>
> meta2.setContent("HelloWorld.x3d")
>
> meta2.setName("title")
>
>
>
> head1.addMeta(meta2)
>
> meta3 = meta()
>
> meta3.setContent("Simple X3D scene example: Hello World!")
>
> meta3.setName("description")
>
>
>
> head1.addMeta(meta3)
>
> meta4 = meta()
>
> meta4.setContent("30 October 2000")
>
> meta4.setName("created")
>
>
>
> head1.addMeta(meta4)
>
> meta5 = meta()
>
> meta5.setContent("14 April 2017")
>
> meta5.setName("modified")
>
>
>
> head1.addMeta(meta5)
>
> meta6 = meta()
>
> meta6.setContent("Don Brutzman")
>
> meta6.setName("creator")
>
>
>
> head1.addMeta(meta6)
>
> meta7 = meta()
>
> meta7.setContent("HelloWorld.tall.png")
>
> meta7.setName("Image")
>
>
>
> head1.addMeta(meta7)
>
> meta8 = meta()
>
> meta8.setContent("http://en.wikipedia.org/wiki/Hello_world")
>
> meta8.setName("reference")
>
>
>
> head1.addMeta(meta8)
>
> meta9 = meta()
>
> meta9.setContent("
> https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program
> ")
>
> meta9.setName("reference")
>
>
>
> head1.addMeta(meta9)
>
> meta10 = meta()
>
> meta10.setContent("https://en.wikipedia.org/wiki/\
> "Hello,_World!\"_program")
>
> meta10.setName("reference")
>
>
>
> head1.addMeta(meta10)
>
> meta11 = meta()
>
> meta11.setContent("
> http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world
> ")
>
> meta11.setName("reference")
>
>
>
> head1.addMeta(meta11)
>
> meta12 = meta()
>
> meta12.setContent("http://www.HelloWorldExample.net")
>
> meta12.setName("reference")
>
>
>
> head1.addMeta(meta12)
>
> meta13 = meta()
>
> meta13.setContent("http://www.web3D.org")
>
> meta13.setName("reference")
>
>
>
> head1.addMeta(meta13)
>
> meta14 = meta()
>
> meta14.setContent("
> http://www.web3d.org/realtime-3d/news/internationalization-x3d")
>
> meta14.setName("reference")
>
>
>
> head1.addMeta(meta14)
>
> meta15 = meta()
>
> meta15.setContent("
> http://www.web3d.org/x3d/content/examples/HelloWorld.x3d")
>
> meta15.setName("reference")
>
>
>
> head1.addMeta(meta15)
>
> meta16 = meta()
>
> meta16.setContent("
> http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes")
>
> meta16.setName("reference")
>
>
>
> head1.addMeta(meta16)
>
> meta17 = meta()
>
> meta17.setContent("
> http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d
> ")
>
> meta17.setName("identifier")
>
>
>
> head1.addMeta(meta17)
>
> meta18 = meta()
>
> meta18.setContent("http://www.web3d.org/x3d/content/examples/license.html
> ")
>
> meta18.setName("license")
>
>
>
> head1.addMeta(meta18)
>
> meta19 = meta()
>
> meta19.setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit")
>
> meta19.setName("generator")
>
>
>
> head1.addMeta(meta19)
>
>
>
> head1.addComments(CommentsBlock(""" Alternate encodings: VRML97, X3D
> ClassicVRML Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON
> """))
>
> meta20 = meta()
>
> meta20.setContent("HelloWorld.wrl")
>
> meta20.setName("reference")
>
>
>
> head1.addMeta(meta20)
>
> meta21 = meta()
>
> meta21.setContent("HelloWorld.x3dv")
>
> meta21.setName("reference")
>
>
>
> head1.addMeta(meta21)
>
> meta22 = meta()
>
> meta22.setContent("HelloWorld.x3db")
>
> meta22.setName("reference")
>
>
>
> head1.addMeta(meta22)
>
> meta23 = meta()
>
> meta23.setContent("HelloWorld.xhtml")
>
> meta23.setName("reference")
>
>
>
> head1.addMeta(meta23)
>
> meta24 = meta()
>
> meta24.setContent("HelloWorld.json")
>
> meta24.setName("reference")
>
>
>
> head1.addMeta(meta24)
>
> X3D0.setHead(head1)
>
> Scene25 = Scene()
>
>
>
>
>
> Scene25.addComments(CommentsBlock(""" Example scene to illustrate X3D
> nodes and fields (XML elements and attributes) """))
>
> WorldInfo26 = WorldInfo()
>
> WorldInfo26.setTitle("Hello world!")
>
>
>
> Scene25.addChild(WorldInfo26)
>
> Group27 = Group()
>
>
>
> Viewpoint28 = Viewpoint()
>
> Viewpoint28.setDEF("ViewUpClose")
>
> Viewpoint28.setCenterOfRotation([0,-1,0])
>
> Viewpoint28.setDescription("Hello world!")
>
> Viewpoint28.setPosition([0,-1,7])
>
>
>
> Group27.addChild(Viewpoint28)
>
> Transform29 = Transform()
>
> Transform29.setRotation([0,1,0,3])
>
>
>
> Shape30 = Shape()
>
>
>
> Sphere31 = Sphere()
>
>
>
> Shape30.setGeometry(Sphere31)
>
> Appearance32 = Appearance()
>
>
>
> Material33 = Material()
>
> Material33.setDEF("MaterialLightBlue")
>
> Material33.setDiffuseColor([0.1,0.5,1])
>
>
>
> Appearance32.setMaterial(Material33)
>
> ImageTexture34 = ImageTexture()
>
> ImageTexture34.setDEF("ImageCloudlessEarth")
>
>
> ImageTexture34.setUrl(["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"])
>
>
>
> Appearance32.setTexture(ImageTexture34)
>
> Shape30.setAppearance(Appearance32)
>
> Transform29.addChild(Shape30)
>
> Group27.addChild(Transform29)
>
> Transform35 = Transform()
>
> Transform35.setTranslation([0,-2,0])
>
>
>
> Shape36 = Shape()
>
>
>
> Text37 = Text()
>
> Text37.setDEF("TextMessage")
>
> Text37.setString(["Hello","world!"])
>
>
>
> FontStyle38 = FontStyle()
>
> FontStyle38.setJustify(["MIDDLE","MIDDLE"])
>
>
>
> Text37.setFontStyle(FontStyle38)
>
> Shape36.setGeometry(Text37)
>
> Appearance39 = Appearance()
>
>
>
> Material40 = Material()
>
> Material40.setUSE("MaterialLightBlue")
>
>
>
> Appearance39.setMaterial(Material40)
>
> Shape36.setAppearance(Appearance39)
>
> Transform35.addChild(Shape36)
>
> Group27.addChild(Transform35)
>
> Scene25.addChild(Group27)
>
> X3D0.setScene(Scene25)
>
>
>
> X3D0.toFileX3D("/x3d-code/
> www.web3d.org/x3d/stylesheets/java/src/python/pythonapi/data/HelloWorld.new.x3d
> ")
>
>
>
>
> 2========================================================================================================================================
>
>
>
> from X3Dpackage import *
>
> X3D0 = X3D() \
>
>    .setProfile("Immersive") \
>
>    .setVersion("3.3") \
>
>    .setHead(head() \
>
>     .addMeta(meta() \
>
>      .setContent("HelloWorld.x3d") \
>
>      .setName("title") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("Simple X3D scene example: Hello World!") \
>
>      .setName("description") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("30 October 2000") \
>
>      .setName("created") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("14 April 2017") \
>
>      .setName("modified") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("Don Brutzman") \
>
>      .setName("creator") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("HelloWorld.tall.png") \
>
>      .setName("Image") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("http://en.wikipedia.org/wiki/Hello_world") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("
> https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program")
> \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("https://en.wikipedia.org/wiki/\"Hello,_World!\"_program")
> \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("
> http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world")
> \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("http://www.HelloWorldExample.net") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("http://www.web3D.org") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("
> http://www.web3d.org/realtime-3d/news/internationalization-x3d") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("http://www.web3d.org/x3d/content/examples/HelloWorld.x3d")
> \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("
> http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes")
> \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("
> http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d")
> \
>
>      .setName("identifier") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("http://www.web3d.org/x3d/content/examples/license.html")
> \
>
>      .setName("license") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit") \
>
>      .setName("generator") \
>
>     ) \
>
> .addComments(CommentsBlock(""" Alternate encodings: VRML97, X3D
> ClassicVRML Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON
> """)) \
>
>     .addMeta(meta() \
>
>      .setContent("HelloWorld.wrl") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("HelloWorld.x3dv") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("HelloWorld.x3db") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("HelloWorld.xhtml") \
>
>      .setName("reference") \
>
>     ) \
>
>     .addMeta(meta() \
>
>      .setContent("HelloWorld.json") \
>
>      .setName("reference") \
>
>     ) \
>
>    ) \
>
>    .setScene(Scene() \
>
> .addComments(CommentsBlock(""" Example scene to illustrate X3D nodes and
> fields (XML elements and attributes) """)) \
>
>     .addChild(WorldInfo() \
>
>      .setTitle("Hello world!") \
>
>     ) \
>
>     .addChild(Group() \
>
>      .addChild(Viewpoint() \
>
>       .setDEF("ViewUpClose") \
>
>       .setCenterOfRotation([0,-1,0]) \
>
>       .setDescription("Hello world!") \
>
>       .setPosition([0,-1,7]) \
>
>      ) \
>
>      .addChild(Transform() \
>
>       .setRotation([0,1,0,3]) \
>
>       .addChild(Shape() \
>
>        .setGeometry(Sphere() \
>
>        ) \
>
>        .setAppearance(Appearance() \
>
>         .setMaterial(Material() \
>
>          .setDEF("MaterialLightBlue") \
>
>          .setDiffuseColor([0.1,0.5,1]) \
>
>         ) \
>
>         .setTexture(ImageTexture() \
>
>          .setDEF("ImageCloudlessEarth") \
>
>
> .setUrl(["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"]) \
>
>         ) \
>
>        ) \
>
>       ) \
>
>      ) \
>
>      .addChild(Transform() \
>
>       .setTranslation([0,-2,0]) \
>
>       .addChild(Shape() \
>
>        .setGeometry(Text() \
>
>         .setDEF("TextMessage") \
>
>         .setString(["Hello","world!"]) \
>
>         .setFontStyle(FontStyle() \
>
>          .setJustify(["MIDDLE","MIDDLE"]) \
>
>         ) \
>
>        ) \
>
>        .setAppearance(Appearance() \
>
>         .setMaterial(Material() \
>
>          .setUSE("MaterialLightBlue") \
>
>         ) \
>
>        ) \
>
>       ) \
>
>      ) \
>
>     ) \
>
>    ) \
>
>
>
> X3D0.toFileX3D("/x3d-code/
> www.web3d.org/x3d/stylesheets/java/src/python/pythonapi/data/HelloWorld.newf.x3d
> ")
>
>
>
>
> 3========================================================================================================================================
>
> from X3Dpackage import *
>
> X3D0 = X3D(head1 = compound([meta2 = meta(content="HelloWorld.x3d",
> name="title"),
>
> meta3 = meta(content="Simple X3D scene example: Hello World!",
> name="description"),
>
> meta4 = meta(content="30 October 2000", name="created"),
>
> meta5 = meta(content="14 April 2017", name="modified"),
>
> meta6 = meta(content="Don Brutzman", name="creator"),
>
> meta7 = meta(content="HelloWorld.tall.png", name="Image"),
>
> meta8 = meta(content="http://en.wikipedia.org/wiki/Hello_world",
> name="reference"),
>
> meta9 = meta(content="
> https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program",
> name="reference"),
>
> meta10 = meta(content="https://en.wikipedia.org/wiki/\"Hello,_World!\"_program",
> name="reference"),
>
> meta11 = meta(content="
> http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world",
> name="reference"),
>
> meta12 = meta(content="http://www.HelloWorldExample.net",
> name="reference"),
>
> meta13 = meta(content="http://www.web3D.org", name="reference"),
>
> meta14 = meta(content="
> http://www.web3d.org/realtime-3d/news/internationalization-x3d",
> name="reference"),
>
> meta15 = meta(content="
> http://www.web3d.org/x3d/content/examples/HelloWorld.x3d",
> name="reference"),
>
> meta16 = meta(content="
> http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes",
> name="reference"),
>
> meta17 = meta(content="
> http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d",
> name="identifier"),
>
> meta18 = meta(content="
> http://www.web3d.org/x3d/content/examples/license.html", name="license"),
>
> meta19 = 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
>
>
>
> meta20 = meta(content="HelloWorld.wrl", name="reference"),
>
> meta21 = meta(content="HelloWorld.x3dv", name="reference"),
>
> meta22 = meta(content="HelloWorld.x3db", name="reference"),
>
> meta23 = meta(content="HelloWorld.xhtml", name="reference"),
>
> meta24 = meta(content="HelloWorld.json", name="reference")]),
>
> Scene25 = compound([#  Example scene to illustrate X3D nodes and fields
> (XML elements and attributes)
>
>
>
> WorldInfo26 = WorldInfo(title="Hello world!"),
>
> Group27 = Group(Viewpoint28 = Viewpoint(DEF="ViewUpClose",
> centerOfRotation=[0,-1,0], description="Hello world!", position=[0,-1,7]),
>
> Transform29 = Transform(Shape30 = Shape(Sphere31 = Sphere(),
>
> Appearance32 = Appearance(Material33 = Material(DEF="MaterialLightBlue",
> diffuseColor=[0.1,0.5,1]),
>
> ImageTexture34 = 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"]))),
> rotation=[0,1,0,3]),
>
> Transform35 = Transform(Shape36 = Shape(Text37 = Text(FontStyle38 =
> FontStyle(justify=["MIDDLE","MIDDLE"]), DEF="TextMessage",
> string=["Hello","world!"]),
>
> Appearance39 = Appearance(Material40 =
> Material(USE="MaterialLightBlue"))), translation=[0,-2,0]]),
> profile="Immersive", version="3.3")
>
> 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/20190310/e170efc0/attachment-0001.html>


More information about the x3d-public mailing list