Oh! Hold the horses!
Although I'm all for reusing already written stuff we should not
happily go ahead and check in everything we have. That's going
to pollute the repository in no time. If we are actually uploading
anything that is not tailored to fit into the p-r package it should
only go in a separate branch (let's call it "dump") from where
bits can be copied/merged into the "trunk" (sorry, don't know
what mercurial calls it yet).
First we need to discuss what the structure of the project should
look like. I was about to rip my projects apart and remove the
bits that are specific to my projects. What's left I will open
up for discussion of the implementation and concepts and if
those are along the lines of r-p and if they are Dave can check
them in.
I think that's a sensible way to consolidate all of our individual
efforts so far.
Thomas
> Here's some ---ancient--- code I wrote a century ago:
> http://www.jelleferinga.com/files/python-radiance/ ( right-click save
> as... otherwise you get a 500 error... )
Can't get the *.py files. Only html decorated error messages. Sorry.
Thomas
Got a rough draft of that.
And would be happy to share that, such that we can use this to focus the discussion.
Saw the http://code.google.com/p/python-radiance/ repo, excellent!
Would it be useful to add this?
Also got a nice abstraction of radiance primitives ( materials, polygons, stuff like that ) which makes it easy to implement reading and writing to radiance data from other sources.
Here's an example of how I used this primitive API to export a mesh to radiance format by scripting Rhino from the COM API.
( Uh… this is from years ago… rhino5 will have python programming support ( and yes its cool ;) )
I use this with pythonocc in a similar manner.
from jf.rhino import loadBeta
from radiance.primitives import RadianceMesh # primitive polygon not get confused...
RS = loadBeta.RS; d1= loadBeta.d1; RF.Rsreg(RS)
def rhinoMeshToRadMesh(mshId, identifier, modifier, f=None, triangulate=True):
''' '''
assert RS.IsMesh(mshId)
if RS.MeshQuadCount(mshId) != 0 and triangulate:
print 'mesh has quads...'
mshId = RF.cmdTriangulate(mshId)
mshIndices = map(tuple, RS.MeshFaceVertices(mshId))
mshVerts = map(tuple, RS.MeshVertices(mshId))
# rhino uses 4 coords to encode a cell
# since we've triangulated the mesh anyhow
get_slice = lambda x: x.__getslice__(0,3)
mshIndices = map(get_slice, mshIndices)
mshVerts = map(get_slice, mshVerts)
# ---> these are the radiance primitives
rm = RadianceMesh('jelle', 'zulu')
rm.setIndices(mshIndices)
rm.setVerts(mshVerts)
return rm.write(f)
# ---> done writing radiance geometry...
mshId = RS.GetObject('ugh', 32)
print rhinoMeshToRadMesh(mshId, 'jelle', 'zulu')