|
From: Cettinich E. (LWE) <edw...@lw...> - 2002-11-06 09:35:47
|
Thanks a lot. That helps.=20
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 imp=
lement some obj-management which can handle several displays.=20
By the way: There is no need to convert obj.__class__ to a character string=
=2E
Here's your program without dictionary:
################################
from visual import *
x =3D 300
y =3D 400
w =3D 200
h =3D 200
eyeangle =3D 0.15 # interocular angle
left =3D display(x=3Dx, y=3Dy, width=3Dw, height=3Dh)
right =3D display(x=3Dx+w, y=3Dy, width=3Dw, height=3Dh)
left.select()
b1=3Dbox(pos=3D(-1,0,0), color=3Dcolor.red)
b2=3Dbox(pos=3D(1,-1,0), color=3Dcolor.cyan)
a1=3Darrow(pos=3D(-0.5,0,0), axis=3D(1,-1,0), color=3Dcolor.yellow)
right.select()
for obj in left.objects:
newobj=3Dobj.__class__() # create object in 2nd w=
indow
for member in obj.__members__:
if member =3D=3D 'display': continue # avoid putting into scene1
exec 'newobj.'+member+'=3Dobj.'+member # set attribute
while 1:
right.up =3D left.up
leftforward =3D left.center-left.mouse.camera
right.forward =3D rotate(leftforward, angle=3Deyeangle, axis=3Dleft.up)
################################
Edwin Cettinich
> -----Urspr=FCngliche Nachricht-----
> Von: Bruce Sherwood [SMTP:bas...@un...]
> Gesendet am: Dienstag, 5. November 2002 17:22
> An: Cettinich Edwin (LWE); vis...@li...
> Betreff: Re: [Visualpython-users] 1 objectlist and 2 displays
>=20
> 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.
>=20
> 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?
>=20
> This program creates two cubes and an arrow on the left, then copies thes=
e
> objects into a second window on the right. The camera positions are adjus=
ted
> to be different in the two windows, in order to provide a true stereo pai=
r
> 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 cha=
nge
> 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!
>=20
> Bruce Sherwood
>=20
> from visual import *
> vobjects =3D {box:'box', sphere:'sphere', cylinder:'cylinder',
> arrow:'arrow', cone:'cone', ring:'ring',
> curve:'curve', convex:'convex', label:'label',
> frame:'frame', faces:'faces'}
> x =3D 300
> y =3D 400
> w =3D 200
> h =3D 200
> eyeangle =3D 0.15 # interocular angle
> left =3D display(x=3Dx, y=3Dy, width=3Dw, height=3Dh)
> right =3D display(x=3Dx+w, y=3Dy, width=3Dw, height=3Dh)
> left.select()
>=20
> b1=3Dbox(pos=3D(-1,0,0), color=3Dcolor.red)
> b2=3Dbox(pos=3D(1,-1,0), color=3Dcolor.cyan)
> a1=3Darrow(pos=3D(-0.5,0,0), axis=3D(1,-1,0), color=3Dcolor.yellow)
>=20
> right.select()
> for obj in left.objects:
> exec 'newobj=3D'+vobjects[obj.__class__]+'()' # create object in 2nd
> window
> for member in obj.__members__:
> if member =3D=3D 'display': continue # avoid putting into scene1
> exec 'newobj.'+member+'=3Dobj.'+member # set attribute
>=20
> while 1:
> right.up =3D left.up
> leftforward =3D left.center-left.mouse.camera
> right.forward =3D rotate(leftforward, angle=3Deyeangle, axis=3Dleft.u=
p)
>=20
>=20
> ----- 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
>=20
>=20
> Hi,
>=20
> I try to make 1 objectlist visible in 2 displays.
> But neither
> ########################################>=20
> from visual import *
> scene1=3Ddisplay(title=3D"1st")
> b=3Dbox(x=3D-1)
> b=3Dbox(x=3D1,y=3D-1)
> scene2=3Ddisplay(title=3D"2nd")
> scene2.objects=3Dscene1.objects
> ########################################
> nor
> ########################################
> import copy
> from visual import *
> scene1=3Ddisplay(title=3D"1st")
> b=3Dbox(x=3D-1)
> b=3Dbox(x=3D1,y=3D-1)
> scene2=3Ddisplay(title=3D"2nd")
> scene2.objects=3Dcopy.deepcopy(scene1.objects)
> ########################################
> could make scene2 show the objects owned by scene1.
>=20
> Does anyone have a suggestion what to do?
>=20
> Thanks,
>=20
> Edwin
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> 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
>=20
>=20
>=20
>=20
|