From: Bruce S. <bas...@un...> - 2002-11-05 16:22:23
|
I think the problem with copying objects to a second window is that you can't assign to scene.objects, you can only read it. Below is a kludge to copy objects from one window into another. Maybe someone else can think of a way to convert obj.__class__ to a character string so that it can be used in exec, instead of having to create a dictionary of existing Visual objects? Or some other scheme altogether? This program creates two cubes and an arrow on the left, then copies these objects into a second window on the right. The camera positions are adjusted to be different in the two windows, in order to provide a true stereo pair that can be merged by making your eyes "wall-eyed" (the opposite of cross-eyed). Zoom/rotate in the left window and both camera positions change to continue to give you a 3D look. I think I don't have the camera angles quite right, because I get a headache after brief viewing! Bruce Sherwood from visual import * vobjects = {box:'box', sphere:'sphere', cylinder:'cylinder', arrow:'arrow', cone:'cone', ring:'ring', curve:'curve', convex:'convex', label:'label', frame:'frame', faces:'faces'} x = 300 y = 400 w = 200 h = 200 eyeangle = 0.15 # interocular angle left = display(x=x, y=y, width=w, height=h) right = display(x=x+w, y=y, width=w, height=h) left.select() b1=box(pos=(-1,0,0), color=color.red) b2=box(pos=(1,-1,0), color=color.cyan) a1=arrow(pos=(-0.5,0,0), axis=(1,-1,0), color=color.yellow) right.select() for obj in left.objects: exec 'newobj='+vobjects[obj.__class__]+'()' # create object in 2nd window for member in obj.__members__: if member == 'display': continue # avoid putting into scene1 exec 'newobj.'+member+'=obj.'+member # set attribute while 1: right.up = left.up leftforward = left.center-left.mouse.camera right.forward = rotate(leftforward, angle=eyeangle, axis=left.up) ----- Original Message ----- From: "Cettinich Edwin (LWE)" <edw...@lw...> To: <vis...@li...> Sent: Tuesday, November 05, 2002 4:36 AM Subject: [Visualpython-users] 1 objectlist and 2 displays Hi, I try to make 1 objectlist visible in 2 displays. But neither ######################################## from visual import * scene1=display(title="1st") b=box(x=-1) b=box(x=1,y=-1) scene2=display(title="2nd") scene2.objects=scene1.objects ######################################## nor ######################################## import copy from visual import * scene1=display(title="1st") b=box(x=-1) b=box(x=1,y=-1) scene2=display(title="2nd") scene2.objects=copy.deepcopy(scene1.objects) ######################################## could make scene2 show the objects owned by scene1. Does anyone have a suggestion what to do? Thanks, Edwin ------------------------------------------------------- This sf.net email is sponsored by: See the NEW Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en _______________________________________________ Visualpython-users mailing list Vis...@li... https://lists.sourceforge.net/lists/listinfo/visualpython-users |