[Edu-sig] Re: VPython

Kirby Urner urnerk at qwest.net
Tue Jun 1 23:16:55 EDT 2004


> > 2. The functionality I would like to see is PovRay automatically called
> to
> > render the exported code - rather than requiring a separate look for the
> > file and call to PovRay.  At a practical level, this would provide for a
> > more coherent workflow - looking at what you got and redoing it until
> you
> > have it as you want to see it.  But I don't have the confidence that I
> could
> > accomplish this sensibly in a crossplatform way, that would fail
> gracefully,
> > not require config files (where is the pvengine executable?), etc.  Any
> > thoughts?

> I do know the pov-ray people have been pretty insistent on making sure
> nobody repackages it in a way you don't see their interface.  I think
> we'd need to wait for the repackaging they are in the midst of.
> 
> -Scott David Daniels
> Scott.Daniels at Acm.Org

I think it's fine to invoke povray from within Python using os.system or
some such.  Povray remains an independent program with its own identity.

I have a pov.py that looks like this, which might give some ideas.  But yes,
in this version the paths to the pvengine are hardcoded.  It'd take some
doing (not a lot) to make this more friendly to configure (not my need at
this time).  But at least I test for which operating system (no Mac option
as yet).

def render(filename="default.pov"):
    if os.name == 'linux2':
        linuxcomm = "povray +V +W640 +H480 +FN16 +AM2 +Q9 +A0.3 +P
+L/home/urnerk/include"
        print "Rendering... (this will take some time)"
        os.system(linuxcomm+" +I"+filename)

    if os.name == 'nt':
        wincomm = '"c:\\program files\\POV-Ray for Windows
v3.5\\bin\\pvengine" -V fpp.ini'
        print "Rendering... (this will take some time)"
        # os.system(wincomm+" +I"+filename)
        os.system(wincomm)
        

Note -- the fpp.ini thing shows another way to invoke povray, with all the
command line settings pre-saved in a file (which my Python code also happens
to write).

Kirby





More information about the Edu-sig mailing list