[x3d-public] native Python package for X3D
Brutzman, Donald (Don) (CIV)
brutzman at nps.edu
Sat Jul 6 16:47:42 PDT 2019
Have started work, initial build harness is in place.
Am generating from X3DUOM via stylesheet, in x3d stylesheets subdirectory 'python' at same level as subdirectory 'java' for X3DJSAIL.
http://www.web3d.org/x3d/stylesheets/build.xml
ant target BuildX3dPythonPackageFromX3duom.saxon
using stylesheet
http://www.web3d.org/x3d/stylesheets/X3duomToX3dPythonPackage.xslt
producing
http://www.web3d.org/x3d/stylesheets/python/X3dPythonPackage.py
version control:
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/build.xml
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/X3duomToX3dPythonPackage.xslt
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/python/X3dPythonPackage.py
So far have simplistic entries for field types, nodes and statements. Excerpts:
###############################################
# X3D Package for Python
# generator: X3duomToX3dPythonPackage.xslt
# X3DUOM: X3dUnifiedObjectModel-4.0.xml
###############################################
# FieldTypes
class SFBool:
"""
SFBool is a logical type with possible values (true|false).
"""
specificationUrl = 'http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html#SFBoolAndMFBool'
tooltip = 'https://www.web3d.org/x3d/tooltips/X3dTooltips.html#SFBool'
defaultValue = True
def __init__(self, value):
self._value = value
if value == None:
value = defaultValue
regex = '\s*(true|false)\s*'
###############################################
# ConcreteNodes
class Anchor:
specificationUrl = 'http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/networking.html#Anchor'
tooltip = 'https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Anchor'
def __init__(self, **kwargs):
pass
###############################################
Will work on simple-type fields as properties next, adapting patterns from Python Cookbook.
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
More information about the x3d-public
mailing list