<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Here’s an example of a possible Python API for X3D.   Comments besides lack of lines?   I  hand edited this to remove 1) a lack of lists/arrays. 2) duplicated kwargs (same problem as JSON, we have to insert an array/list/object into the kwargs to contain a list/object around the common keys.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>What would your idea Python API for X3D look like?    A call with a dict in it sending it to the X3D subsystem (totally declarative)?  Why or why not?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>How should PROTOs be handled in Python?     Comments?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>How do people like looking at YAT (yet another take) on X3D? Is it more like VRML, X3D or JSON?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Are we improving the API by making it less Java-like?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>What interested animation and event handling and data binding opportunities grant us?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Comments from others working on Python APIs (thanks in advance).</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Can we start on a stylesheet converter from XML based on this example? (I know it’s not HelloWorld, but I’m the JavaScript/PROTO guy, and it’s basically the first file translated in my bunch.) HelloWorld will come next.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Too many ()’s? Almost feels like LISP? Certainly we could remove the parentheses around the objects.</p><p class=MsoNormal><br>Thanks,</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>John</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>from X3Dpackage import *<o:p></o:p></p><p class=MsoNormal>X3D0 = X3D(profile="Immersive", version="3.3", Head = (head(<o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'>Meta = [(meta(name="title", content="abox.x3d")),<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>(meta(name="creator", content="John Carlson")),<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>(meta(name="generator", content="manual")),<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>(meta(name="identifier", content="https://coderextreme.net/X3DJSONLD/abox.x3d")),<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>(meta(name="description", content="a box"))))],<o:p></o:p></p><p class=MsoNormal style='text-indent:.5in'>Scene = (Scene(Children = [<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>(ProtoDeclare(name="anyShape",<o:p></o:p></p><p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>ProtoInterface = (ProtoInterface(Field = (field(type = field.TYPE_MFNODE, name="myShape",<o:p></o:p></p><p class=MsoNormal style='margin-left:1.5in;text-indent:.5in'>accessType=field.ACCESSTYPE_INPUTOUTPUT, Child = (Shape(geometry = (Sphere()))))))),<o:p></o:p></p><p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>ProtoBody = (ProtoBody(Child = (Transform(IS = (IS(Connect = (connect(nodeField="children", protoField="myShape")))))))))),<o:p></o:p></p><p class=MsoNormal style='margin-left:1.0in'>(ProtoDeclare(name="one",<o:p></o:p></p><p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>ProtoInterface = (ProtoInterface(Field = (field(type = field.TYPE_MFNODE, name="myShape",<o:p></o:p></p><p class=MsoNormal style='margin-left:1.5in;text-indent:.5in'>accessType=field.ACCESSTYPE_INPUTOUTPUT, Child = (Shape(geometry = (Cylinder()))))))),<o:p></o:p></p><p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>ProtoBody = (ProtoBody(Child = (Transform(Child =<o:p></o:p></p><p class=MsoNormal style='margin-left:1.5in;text-indent:.5in'>(ProtoInstance(name="anyShape", IS = (IS(Connect = (connect(nodeField="myShape", protoField="myShape")))))))))))),<o:p></o:p></p><p class=MsoNormal style='margin-left:1.0in'> (ProtoInstance(name="one", FieldValue = (fieldValue(name="myShape", Child = (Shape(geometry = (Box(size=[140,140,140]))))))])))))<o:p></o:p></p><p class=MsoNormal>X3D0.toFileX3D("/x3d-code/www.web3d.org/x3d/stylesheets/java/src/python/pythonapi/data/abox.newf.x3d")</p></div></body></html>