VRML 97 Processing Libraries for Python
Parsing, Generation, Processing and Output

Note: work on mcf.vrml has been suspended, and as a result this page is somewhat out-of-date.  See the OpenGLContext project for my current work with VRML.

The mcf.vrml libraries are an extensive set of programming tools for manipulating VRML 97 sceneGraphs. Their primary purpose is to allow the creation of design-time tools to programmatically process and generate complex VRML 97 content. Lately they have been used for generating VRML 97 sceneGraphs in response to Zope queries.  See the glscenegraph package for the beginnings of a sceneGraph viewer project.


See the SourceForge page for the CVS download of the latest (2001/04) versions of the package.  A tar archive of the current CVS version is here.

You will need SimpleParse and mxTextTools, you will likely also want Numeric Python.

Release Notes

2000/05/09 -- version 2.0 beta
Made minor changes to lineariser to re-introduce rounding of vector values (prevents getting 17 digit output when you multiply/divide the values and re-export).  Not released, too minor to both with.

2000/04/19 -- version 2.0 beta
This represents the first public release after re-writing the core node structures (prototype, node, etc.) and revising all scripts to use the new (simplified) interfaces (surprising minor revisions, giving the level of the change).

The re-writing was triggered by switching to the SimpleParse parser generator from the older parser generator (it was simpler to write a new builder/parser using the SimpleParse generator's more reliable parse tree than to retro-fit the original fragile converter).  In doing so, the memory overhead for parsing long files with many root-level nodes has been reduced.  Overall speed appears somewhat better, but not dramatically so.

Testing of this release has been as extensive as possible, and it is now the only official release.  If you require an older release, please contact me directly (and soon).


Basic Operation

Load sceneGraph from VRML 97 file (has basic support for gzip compression, url retrieval etc.)

from mcf.vrml import loader
sceneGraph = loader.load ( filename )

Save sceneGraph to file. The encodedName parameter allows for encoding an arbitrary filename into gzipped files.

from mcf.vrml import loader (sceneGraph, filename) (sceneGraph, filename, gzip = 1, encodedName="somename" )

Set/Get attributes of nodes

from mcf.vrml import basenodes
transform = basenodes.Transform (
translation = [0, 1,0],
rotation = [0, 1,0,3.14159],
children = [
basenodes.Group ()
print "Transform Translation", transform.translation
transform.translation = [2,3,4]
print "After Alteration", transform.translation

Get VRML 97 representation of node/sceneGraph

print node.toString()
print sceneGraph.toString()

Parse in-memory string to sceneGraph

from mcf.vrml import parser
sceneGraph = parser.Parser (data).parse()

Determine node type (generic identifier), DEF name

print node.__gi__
print node.DEF

Back to my homepage...