<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I ran into a show stopper with Mojo.  I was progressing using a special form of import, found here:<div><br></div><div><a href="https://docs.modular.com/mojo/programming-manual.html#python-integration">Modular Docs - Mojo🔥 programming manual</a><br></div><div><br></div><div>But ran into:</div><div><br></div><div><div>error: Expression [10]:8:34: keyword arguments are not supported yet</div><div>    let newModel=x3d.X3D(profile='Immersive',version='3.3',</div><div>                                 ^</div></div><div><br></div><div>If anyone is interested, I can provide a notebook to work from.  I might revamp PythonSerializers to do something else with keyword arguments, since there seems to be a showstopper?</div><div><br></div><div>Error below:</div><div><br></div><div><div>error: Expression [10]:8:34: keyword arguments are not supported yet</div><div>    let newModel=x3d.X3D(profile='Immersive',version='3.3',</div><div>                                 ^</div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 20, 2023 at 1:16 AM John Carlson <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">I added a couple of more let's for variables at function scope.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 20, 2023 at 12:13 AM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">I was able to avoid syntax errors (no global variables in Mojo).  Here's my current code (note that this won't run in python due to "let"<div><br></div><div>Thanks!</div><div><br></div><div><div>####################################################################################################</div><div>#</div><div># Now available: developmental python x3d.py package on PyPi for import.</div><div>#   This approach simplifies Python X3D deployment and use.</div><div>#   <a href="https://pypi.org/project/x3d" target="_blank">https://pypi.org/project/x3d</a></div><div>#</div><div># Installation:</div><div>#       pip install x3d</div><div># or</div><div>#       python -m pip install x3d</div><div>#</div><div># Developer options for loading x3d package:</div><div>#</div><div>#    from x3d import *  # preferred approach, terser source that avoids x3d.* class prefixes</div><div>#</div><div># or</div><div>#    import x3d         # traditional way to subclass x3d package, all classes require x3d.* prefix,</div><div>#                       # but python source is very verbose, for example x3d.Material x3d.Shape etc.</div><div>#                       # X3dToPython.xslt stylesheet insertPackagePrefix=true supports this option.</div><div>#</div><div>####################################################################################################</div><div>#print("'''")   # comment out output created by importing x3d (see below)</div><div>from x3d import *</div><div>from x3d import X3D</div><div>from IPython import HTML</div><div>#print("'''")   # comment out output created by importing x3d (see below)</div><div><br></div><div>#  comment preceding root node</div><div>def createScene():</div><div>    let newModel=X3D(profile='Immersive',version='3.3',</div><div>      head=head(</div><div>        children=[</div><div>        meta(content='HelloWorld.x3d',name='title'),</div><div>        meta(content='Simple X3D scene example: Hello World!',name='description'),</div><div>        meta(content='30 October 2000',name='created'),</div><div>        meta(content='31 October 2019',name='modified'),</div><div>        meta(content='Don Brutzman',name='creator'),</div><div>        meta(content='HelloWorld.tall.png',name='Image'),</div><div>        meta(content='<a href="http://en.wikipedia.org/wiki/Hello_world" target="_blank">http://en.wikipedia.org/wiki/Hello_world</a>',name='reference'),</div><div>        meta(content='<a href="https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program" target="_blank">https://en.wikipedia.org/wiki/Hello#.22Hello.2C_World.22_computer_program</a>',name='reference'),</div><div>        meta(content='<a href="https://en.wikipedia.org/wiki/" target="_blank">https://en.wikipedia.org/wiki/</a>"Hello,_World!"_program',name='reference'),</div><div>        meta(content='<a href="http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world" target="_blank">http://en.wikibooks.org/w/index.php?title=Computer_Programming/Hello_world</a>',name='reference'),</div><div>        meta(content='<a href="http://www.HelloWorldExample.net" target="_blank">http://www.HelloWorldExample.net</a>',name='reference'),</div><div>        meta(content='<a href="http://www.web3D.org" target="_blank">http://www.web3D.org</a>',name='reference'),</div><div>        meta(content='<a href="http://www.web3d.org/realtime-3d/news/internationalization-x3d" target="_blank">http://www.web3d.org/realtime-3d/news/internationalization-x3d</a>',name='reference'),</div><div>        meta(content='<a href="http://www.web3d.org/x3d/content/examples/HelloWorld.x3d" target="_blank">http://www.web3d.org/x3d/content/examples/HelloWorld.x3d</a>',name='reference'),</div><div>        meta(content='<a href="http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes" target="_blank">http://X3dGraphics.com/examples/X3dForAdvancedModeling/HelloWorldScenes</a>',name='reference'),</div><div>        meta(content='<a href="http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d" target="_blank">http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.x3d</a>',name='identifier'),</div><div>        meta(content='<a href="http://www.web3d.org/x3d/content/examples/license.html" target="_blank">http://www.web3d.org/x3d/content/examples/license.html</a>',name='license'),</div><div>        meta(content='X3D-Edit 3.3, <a href="https://savage.nps.edu/X3D-Edit" target="_blank">https://savage.nps.edu/X3D-Edit</a>',name='generator'),</div><div>        #  Alternate encodings: VRML97, X3D ClassicVRML Encoding, X3D Compressed Binary Encoding (CBE), X3DOM, JSON </div><div>        meta(content='HelloWorld.wrl',name='reference'),</div><div>        meta(content='HelloWorld.x3dv',name='reference'),</div><div>        meta(content='HelloWorld.x3db',name='reference'),</div><div>        meta(content='HelloWorld.xhtml',name='reference'),</div><div>        meta(content='HelloWorld.json',name='reference')]),</div><div>      Scene=Scene(</div><div>        #  Example scene to illustrate X3D nodes and fields (XML elements and attributes) </div><div>        children=[</div><div>        WorldInfo(title='Hello World!'),</div><div>        WorldInfo(title="Hello ' apostrophe 1"),</div><div>        WorldInfo(title="Hello ' apostrophe 2"),</div><div>        WorldInfo(title='Hello " quotation mark 3'),</div><div>        WorldInfo(title='Hello " quotation mark 4'),</div><div>        MetadataSet(name="items'",</div><div>          value=[</div><div>          MetadataInteger(name='one',value=[1]),</div><div>          MetadataInteger(name='two',value=[2])]),</div><div>        Group(</div><div>          children=[</div><div>          Viewpoint(DEF='ViewUpClose',centerOfRotation=(0,-1,0),description='Hello world!',position=(0,-1,7)),</div><div>          #  insert commas to test removal when converted to ttl </div><div>          Transform(DEF='TestWhitespaceCommas',rotation=(0,1,0,3),</div><div>            children=[</div><div>            Shape(</div><div>              geometry=Sphere(),</div><div>              appearance=Appearance(</div><div>                material=Material(DEF='MaterialLightBlue',diffuseColor=(0.1,0.5,1)),</div><div>                texture=ImageTexture(DEF='ImageCloudlessEarth',url=["earth-topo.png", "earth-topo.jpg", "<a href="https://www.web3d.org/x3d/content/examples/Basic/earth-topo.png" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/earth-topo.png</a>","<a href="http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg" target="_blank">http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg</a>","<a href="http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif" target="_blank">http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif</a>"])))]),</div><div>          Transform(translation=(0,-2,0),</div><div>            children=[</div><div>            Shape(</div><div>              geometry=Text(DEF='TextMessage',string=["Hello","world!"],</div><div>                fontStyle=FontStyle(justify=["MIDDLE","MIDDLE"])),</div><div>              appearance=Appearance(</div><div>                material=Material(USE='MaterialLightBlue')))])])])</div><div>    ) # X3D model complete</div><div><br></div><div>    ####################################################################################################</div><div>    # Self-test diagnostics</div><div>    ####################################################################################################</div><div>    let htmlcode = """</div><div>    <script type='text/javascript' charset="UTF-8" src='<a href="https://x3dom.org/release/x3dom-full.debug.js" target="_blank">https://x3dom.org/release/x3dom-full.debug.js</a>'> </script> </div><div>    <link rel='stylesheet' type='text/css' href='<a href="https://x3dom.org/release/x3dom.css" target="_blank">https://x3dom.org/release/x3dom.css</a>'></link> </div><div>    <style></div><div>     x3d {</div><div>         width:720px;</div><div>         height:720px;</div><div>         border:2px solid black;</div><div>    }</div><div>    </style></div><div>    """</div><div><br></div><div>    let x3dnode = htmlcode+"""</div><div>    <x3d>%s</x3d></div><div>    <script></div><div>    window.x3dom.reload()</div><div>    </script></div><div>    """ % newModel.Scene.HTML5()</div><div><br></div><div>    HTML(x3dnode)</div><div><br></div><div>createScene()</div></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 19, 2023 at 10:45 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Yes, I tried using Vince’s technique (nearly, couldn’t find %%html) with (Mojo) Jupyter and X3DOM.  I was hoping that Vince could show that his technique still works in Jupyter and (my?)binder.</div><div dir="auto"><br></div><div dir="auto">I’m not seeing anyway to render with Jupyter or Mojo Playground.  Brython may still work.</div><div dir="auto"><br></div><div dir="auto">I will try again tonight.</div><div dir="auto"><br></div><div dir="auto">John</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 19, 2023 at 11:34 AM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div><p class="MsoNormal">I recommend you use the methods to export/launch to X3DOM.  If you have a CORS server running locally, you can export/launch to X_ITE as well.<u></u><u></u></p><div><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New""><u style="font-family:"Courier New""></u> <u style="font-family:"Courier New""></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">all the best, Don<u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">-- <u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Don Brutzman  Naval Postgraduate School, Code USW/Br        <a href="mailto:brutzman@nps.edu" style="font-family:"Courier New"" target="_blank">brutzman@nps.edu</a><u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149<u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p><p class="MsoNormal"><span style="font-size:9pt;font-family:"Courier New"">X3D graphics, virtual worlds, navy robotics <a href="https://faculty.nps.edu/brutzman" style="font-family:"Courier New"" target="_blank">https://faculty.nps.edu/brutzman</a><u style="font-family:"Courier New""></u><u style="font-family:"Courier New""></u></span></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div style="border-width:1pt medium medium;border-style:solid none none;padding:3pt 0in 0in;border-color:rgb(225,225,225) currentcolor currentcolor"><p class="MsoNormal"><b>From:</b> John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> <br><b>Sent:</b> Monday, June 19, 2023 6:10 AM<br><b>To:</b> Andreas Plesch <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>>; Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>; Joe D Williams <<a href="mailto:joedwil@earthlink.net" target="_blank">joedwil@earthlink.net</a>>; Peitso, Loren (CIV) <<a href="mailto:lepeitso@nps.edu" target="_blank">lepeitso@nps.edu</a>>; Vincent Marchetti <<a href="mailto:vmarchetti@kshell.com" target="_blank">vmarchetti@kshell.com</a>>; X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br><b>Subject:</b> Re: Mojo Playground available through a JupyterHub<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div style="border:1pt solid rgb(0,70,121);padding:2pt"><p class="MsoNormal" style="line-height:12pt;background:0% 50% repeat rgb(0,70,121)"><span style="font-size:10pt;color:yellow">NPS WARNING: *external sender* verify before acting.<u></u><u></u></span></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">Well, this appears harder than I thought.<u></u><u></u></p></div></div></div></div><div lang="EN-US"><div><div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I haven’t gotten x3d python rendering working anywhere recently!  Python_OCC?  H3Dviewer?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Is there another x3d rendering library (actually a python game engine recommendation would probably be ok) for python (not JavaScript based)??<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Mon, Jun 19, 2023 at 5:55 AM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)"><div><div><p class="MsoNormal">This looks like a promising python library built on top of a native rust GPU driver:  <a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpygfx%2Fwgpu-py%2Fblob%2Fmain%2FLICENSE&data=05%7C01%7Cbrutzman%40nps.edu%7C6c3a4b1466c14e2d934f08db70c6798c%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638227769999994001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MkjcY6prPMp7gWyJqwsP9c%2F6%2FScMMi3%2Bl2pf84xH0a8%3D&reserved=0" target="_blank">https://github.com/pygfx/wgpu-py/blob/main/LICENSE</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">First hit in bing when you search for python webgpu!<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">We're going to start converting JSON to wgpu-py!<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Have fun!<u></u><u></u></p></div></div><div><div><p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p></div><div><p class="MsoNormal">John<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Sun, Jun 18, 2023 at 11:14 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)"><div><p class="MsoNormal"><a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.modular.com%2Fmojo&data=05%7C01%7Cbrutzman%40nps.edu%7C6c3a4b1466c14e2d934f08db70c6798c%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638227769999994001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ew0csK%2F0epaSwqxTSXgrgxSD1%2F4Zvh5HiZ3Wgi93uUI%3D&reserved=0" target="_blank">https://www.modular.com/mojo</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Maybe we can get some people building native X3D graphics in Mojo?  By same guys as LLVM.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I’d love to disrupt the C/C++ community with a Python superset that targets CPUs, GPUs, TPUs, etc. at native speeds.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I know one person who does 3D python!<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">This is not your mama’s C# or Java.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">John<u></u><u></u></p></div></blockquote></div></blockquote></div></div></div></div></div></blockquote></div></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>