[x3d-public] X3D python update

Don Brutzman brutzman at nps.edu
Mon Dec 23 19:57:35 PST 2019


Several good improvements to X3D Python implementation.  Thanks to my being able to configure a second laptop in "plain old Python user" mode, have finally unraveled a few PYTHONPATH problems that complicated previous releases.

* Python X3D Package x3d.py
   https://www.web3d.org/x3d/stylesheets/python/python.html

=============================
🔖 Installation

Download and install Python (https://www.python.org) on your system.

Python x3d.py package installation and update options:

     *pip install x3d*
     or
     *python -m pip install x3d*

That should be all that is needed for most Python X3D programmers!
Here is an example screenshot for PythonX3dSmokeTests.py using IDLE.
https://www.web3d.org/x3d/stylesheets/python/images/PythonX3dSmokeTestsIDLE.png
(image attached)
=============================

Test reports welcome.  Anyone else using X3D Python?

More development details:

Examples now include /HelloWorldPrefixed.py/ which is produced from HelloWorld.x3d by the X3dToPython.xslt stylesheet with invocation parameter insertPackagePrefix=true.

* https://www.web3d.org/x3d/stylesheets/python/examples/HelloWorldPrefixed.py

Tests for /HelloWorld.py/ and /HelloWorldPrefixed.py/ and /PythonX3dSmokeTests.py/ are all satisfactory.

* https://www.web3d.org/x3d/stylesheets/python/build.examples.log.txt

As described in the Design Features section, this library tracks with latest draft X3DUOM for X3Dv4.

On 11/18/2019 6:01 AM, Brutzman, Donald (Don) (CIV) wrote:
> have upgraded to 3.8 and made significant improvement in numeric MF types, now handling lists of tuples satisfactorily.
> 
> TODO is handling field/fieldValue declarations for Script and Proto, they still default to string.

So the good news is that the converter is now able to represent strict numeric types in field and fieldValue initialization values, not just strings.

Thus the next line of work will be to get the x3d.py package to properly parse non-SFString field and fieldValue initialization values.

Getting that squared away handles most of the remaining issues in the comprehensive build of X3D Examples.  At that point we can consider whether further extensions (such as the following interesting suggestion from Loren) ought to be added to the core x3d.py module, or else better left as a separate technique for programmers.

> On 11/15/2019 12:26 PM, Peitso, Loren (CIV) wrote:
>> Subject: Re: python 3.8 addition that could be very useful for the X3D code
>>
>> https://www.python.org/dev/peps/pep-0589/
>>
>> Representing an object or structured data using (potentially nested) dictionaries with string keys (instead of a user-defined class) is a common pattern in Python programs. Representing JSON objects is perhaps the canonical use case, and this is popular enough that Python ships with a JSON library. This PEP proposes a way to allow such code to be type checked more effectively.
>>
>> v/r  Loren

Have fun with X3D Python!

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PythonX3dSmokeTestsIDLE.png
Type: image/png
Size: 141042 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20191223/c34e4b21/attachment-0001.png>


More information about the x3d-public mailing list