Bernard,
Would you care to share with us what this hack for pywin32 involves?
Andre
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Bernard Lebel
Sent: April 14, 2007 10:17 AM
To: XSI(at)Softimage.COM
Subject: Re: Python for loops on objects
Kim,
I ran your example both in XSI 5.11 and 6.01, using Python 2.4 with
hacked pywin32. Worked flawlessly, no error whatsoever.
I then unhacked pywin32, ran the example in 6.01, and got the object
model dispatching attribute error. So apparently, the 6.x fix to
dynamic dispatching still has some shortcomings. Unless I'm missing
something, looks like the hack has to remain in use...
Cheers
Bernard
On 4/14/07, kim aldis <kim.aldis(at)gmail.com> wrote:
> Works for me too, but try this as it stands, you get an error on the last
> line. Change the loof to I in range (oClusters.count) and it works.:-
>
> import win32com
> c = win32com.client.constants
> xsi = Application
>
> oClusters = xsi.Selection(0).ActivePrimitive.Geometry.Clusters
>
> for oCls in oClusters:
> if ( oCls.type == c.siSampledPointCluster ):
> oCluster = oCls
> break
>
> oUVspace = oCluster.LocalProperties(0)
> aElements = oUVspace.Elements.Array
>
>
>
> > -----Original Message-----
> > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> > Behalf Of Marc-André Belzile
> > Sent: 13 April 2007 19:41
> > To: XSI(at)Softimage.COM
> > Subject: RE: Python for loops on objects
> >
> > Works afterall on my side: XSI 6.0 + py 2.5
> >
> > import win32com
> > c = win32com.client.constants
> > xsi = Application
> >
> > oClusters = xsi.Selection(0).ActivePrimitive.Geometry.Clusters
> >
> > for oCls in oClusters:
> > if ( oCls.type == c.siSampledPointCluster ):
> > oCluster = oCls
> > break
> >
> > t = oCls.Elements
> > xsi.logmessage( t.Count )
> > xsi.logmessage( xsi.ClassName( t ) )
> > xsi.logmessage( str( t.Array ) )
> >
> > # INFO : 17
> > # INFO : ClusterElementCollection
> > # INFO : (0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15, 17, 18, 20, 21, 23, 24)
> >
> > -----Original Message-----
> > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> > Behalf Of Francois Lord
> > Sent: April 13, 2007 2:33 PM
> > To: XSI(at)Softimage.COM
> > Subject: Re: Python for loops on objects
> >
> > Yes. I have Active Python 2.4 with the hack and your script (and Kim's)
> > works fine in 6.01.
> >
> > Bernard Lebel wrote:
> > > Indeed. Before 6.0, that used to be a typical dispatch problem that
> > > required the pywin32 hack or forced dynamic dispatching to work.
> > >
> > > This works perfectly for me in 5.11:
> > >
> > > import win32com
> > > c = win32com.client.constants
> > > xsi = Application
> > >
> > > oClusters = xsi.selection(0).activeprimitive.geometry.clusters
> > >
> > > for oCls in oClusters:
> > > if ( oCls.type == c.siSampledPointCluster ):
> > > oCluster = oCls
> > > break
> > >
> > > t = oCls.Elements
> > > xsi.logmessage( t.count )
> > > xsi.logmessage( xsi.classname( t ) )
> > > xsi.logmessage( str( t.array ) )
> > >
> > >
> > >
> > > I wonder if hacking pywin32, even if used in 6.0, would fix this.
> > >
> > >
> > > Cheers
> > > Bernard
> > >
> > >
> > >
> > > On 4/13/07, Kim Aldis <XSI(at)kim-aldis.co.uk> wrote:
> > >> It's misleading. Putting a logmessage of oCls in the loop prints a
> > >> sensible name. it's only when you try and access any properties that
> > >> it kicks you out. If you haven't checked it thoroughly you may want
> > >> to.
> > >>
> > >> > -----Original Message-----
> > >> > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> > >> > Behalf Of Bernard Lebel
> > >> > Sent: 13 April 2007 15:16
> > >> > To: XSI(at)Softimage.COM
> > >> > Subject: Re: Python for loops on objects
> > >> >
> > >> > No problem at all here.
> > >> > Note that I'm using XSI 5.11, so my pywin32 is hacked......
> > >> >
> > >> > Cheers
> > >> > Bernard
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > On 4/13/07, Kim Aldis <XSI(at)kim-aldis.co.uk> wrote:
> > >> > > Has anyone noticed this seems to give you an object in oCls but
> > >> > > you
> > >> > can't
> > >> > > actually get any of its properties :-
> > >> > >
> > >> > > for oCls in oClusters :
> > >> > > if ( oCls.type == constants.siSampledPointCluster ):
> > >> > > oCluster = oCls
> > >> > > break
> > >> > >
> > >> > > t = oCls.Elements # ERROR!
> > >> > >
> > >> > >
> > >> > > But this works just fine:-
> > >> > >
> > >> > > for i in range( oClusters.count ) :
> > >> > > oCls = oClusters(i)
> > >> > > if ( oCls.type == constants.siSampledPointCluster ):
> > >> > > oCluster = oCls
> > >> > > break
> > >> > >
> > >> > > t = oCls.Elements # Works
> > >> > >
> > >> > > www.kim-aldis.co.uk | kim(at)kim-aldis.co.uk
> > >> > >
> > >> > >
> > >> > >
> > >> > > ---
> > >> > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following
> > text
> > >> > > in
> > >> > body:
> > >> > > unsubscribe xsi
> > >> > >
> > >> > ---
> > >> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
> > >> > in
> > >> > body:
> > >> > unsubscribe xsi
> > >>
> > >> ---
> > >> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> > >> body:
> > >> unsubscribe xsi
> > >>
> > > ---
> > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> > > body:
> > > unsubscribe xsi
> > >
> > ---
> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> > body:
> > unsubscribe xsi
> >
> > ---
> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> > body:
> > unsubscribe xsi
>
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi