From: Arne K. <arn...@pp...> - 2001-06-07 15:24:04
|
I just install Vpython (I compile it from the cvs) on Linux 2.2.18 (suse 7.1 distribution) under python2.0. It seems that Vpython work fine. But I have a problem with povexport.py (from povexport1-1.zip). It seems that the problem comes from the call to hasattr() in the add_texture() function in povexport.py. for testing purpose, I have modified the add_texture function in povexport.py as: ------------------------------------------------------- def add_texture(a, code): # add in user-specified texture (will override color) print 'in add_texture',a,a.__class__,a.__members__ #added by A.K if hasattr(a, 'pov_texture'): print 'yes, has attr pov_texture' #added by A.K. tstring = ' texture { '+ a.pov_texture + ' }\n' end = rfind(code, '}') code = code[:end] + tstring + code[end:] else:#else block added by A.K. print 'no, has not attr pov_texture' return code ------------------------------------------------- and I excute the following python povsimple.py module: --------------------------------------------------- #file povsimple.py from visual import * import povexport #with the modified add_texture print 'Instructions: zoom and rotate to get the viewing angle\n\ you want. Click the mouse to generate POV-Ray code.\n' scene.x=scene.y=0 rod = cylinder(pos=(0,2,1), axis=(5,0,0), radius=1) rod.color = (0,0,1) # make rod be blue filename = 'povexample.pov' scene.mouse.getclick() ## position camera somewhere, then click code = povexport.export(display=scene) ff = open(filename, 'w') ff.write(code) ff.close() print 'PovRay code written to ',filename ----------------------------------------------------------- then the execution of: python povsimple.py gives: ------------------------------------------------- Visual-2001-02-20 Instructions: zoom and rotate to get the viewing angle you want. Click the mouse to generate POV-Ray code. in add_texture <Primitive object at 0x818f5c8> cylinder ['axis', 'blue', 'color', 'display', 'frame', 'green', 'length', 'pos', 'radius', 'red', 'up', 'visible', 'x', 'y', 'z'] Erreur de segmentation ------------------------------------------------ thanks for your help -- Arne Keller Laboratoire de Photophysique Moleculaire du CNRS, Bat. 213. Universite de Paris-Sud, 91405 Orsay Cedex, France. tel.: (33) 1 69 15 82 83 -- fax. : (33) 1 69 15 67 77 |