<div dir="auto">It’s either program synthesis or use eval. I haven’t heard of alternatives.</div><div dir="auto"><br></div><div dir="auto">John</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 2, 2023 at 2:50 PM John Carlson <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">The JSON parser/loader is part of Python, so if you use it, fewer problems will happen, as you say. There are VRML parsers/loaders in each VRML supporting browser. I think X_ITE/x3d-tidy has one. I’m just trying to get one loader working, and my current choice is python program synthesis. Ugh! I guess i could write something that instantiates x3d instances with eval. I’ve always heard that eval is a “bad thing,” but I’ve used it in a pinch.</div></div><div dir="auto"><br></div><div dir="auto">John </div><div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 2, 2023 at 2:28 PM GPU Group <<a href="mailto:gpugroup@gmail.com" target="_blank">gpugroup@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I haven't seen any import functions in x3d.py. The code isn't too hard to read. I think import is harder than export, because there are so many things that can be wrong with an import file, and it's not 1:1. But exporting --once you have a clean scenegraph-- is easy.<div>I think the default brute force way to import is to load a file into its native tree -- html into an html tree, json into a json tree (like we load glTF), x3d into an xml tree. There are standard loaders for those. Is there a loader like that for vrml/classic/x3dv? </div><div>Then traverse that tree and convert to x3d.py nodes as you go. </div><div>-Doug</div><div>Here's another example code of a standalone program using x3d.py I was working on recently.</div><div><a href="https://freewrl.sourceforge.io/tests/43_MIDI/88key/OLD/keyboard_gen_x3dpy.py" target="_blank">https://freewrl.sourceforge.io/tests/43_MIDI/88key/OLD/keyboard_gen_x3dpy.py</a> <br></div><div>- which shows a few more examples of the syntax x3d.py needs.</div><div>- program didn't work due to hard thing: a ProtoInstance with SFNode in an MFNode fieldvalue. Hypotheses: H0: I'm not using the right syntax for x3d.py in that case H1: x3d.py has a bug. </div><div>- But generally works pretty good once you figure out the syntax, class names, fields etc.</div><div><br></div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 2, 2023 at 1:00 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote></div><div class="gmail_quote"><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">I am thinking about X3d.py design.</div><div dir="auto"><br></div><div dir="auto">I was not aware if x3d.py had any input, clarification?</div><div dir="auto"><br></div><div dir="auto">I’m trying to read this:</div><div dir="auto"><br></div><div dir="auto"><div><a href="https://www.web3d.org/x3d/stylesheets/python/python.html" target="_blank">https://www.web3d.org/x3d/stylesheets/python/python.html</a></div><br></div><div dir="auto"><br></div><div dir="auto">It would seem appropriate to have a core X3D abstract python model, call it the python object model or POM, and then add what i call python “view,” “presentation,” or “encoding” models for XML, JSON, X3DOM, VRML, and X_ITE …input/output, perhaps generated by more than one stylesheet. I think stuffing the encodings into one package is not the right design. We should follow the standards way of separating abstract architecture from encoding and binding.</div><div dir="auto"><br></div><div dir="auto">I would propose stylesheets for each encoding, just like we have for converting XML to various encodings, X3dTo….xslt.</div><div dir="auto"><br></div><div dir="auto">What’s the counter argument?</div><div dir="auto"><br></div><div dir="auto">I welcome any discussion, this is kind of the monolithic kernel versus microkernel idea i realize. Monolithic won.</div><div dir="auto"><br></div><div dir="auto">This is also along the lines of HTMLElement, SVGElement, Node, and Element in ECMAScript.</div><div dir="auto"><br></div><div dir="auto">You can still stuff it all in the same x3d.py file, one can also support XML(), VRML() methods on the abstract model that defer or delegate to encoding models. I don’t think anything breaks.</div><div dir="auto"><br></div><div dir="auto">Is this somehow un-pythonic?</div><div dir="auto"><br></div><div dir="auto">John </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 2, 2023 at 1:21 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">Does anyone know good tools for tree-to-tree transformation? I know ANTLR and XML/XSL/XSLT. I guess this is pretty much a compiler task. Are there tools for Classic VRML and JSON? Python/Perl/ECMAScrpt?<div dir="auto"><br></div><div dir="auto">John</div>
</blockquote></div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div></div>
</div>
</blockquote></div></div>