|
From: Bruce S. <bas...@un...> - 2002-11-06 13:12:39
|
Thanks much for showing me how to avoid the dictionary!
Bruce Sherwood
----- Original Message -----
From: "Cettinich Edwin (LWE)" <edw...@lw...>
To: "Bruce Sherwood" <bas...@un...>;
<vis...@li...>
Sent: Wednesday, November 06, 2002 4:35 AM
Subject: AW: [Visualpython-users] 1 objectlist and 2 displays
Thanks a lot. That helps.
Although I prefer a solution with exactly one object shown in two displays
my hope has gone and I suppose it will not be realizable. So I'll go to
implement some obj-management which can handle several displays.
By the way: There is no need to convert obj.__class__ to a character string.
Here's your program without dictionary:
################################
from visual import *
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:
newobj=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)
################################
Edwin Cettinich
|