Re: Python: Getting and setting view visibility

2013-01-25 Thread Dan Yargici
Thanks Martin!

That was Peter's original suggestion.

His last post was just to explain how to make it work with the command I
was using and it's returned ISIVTCollection (which I'm actually used to
dealing with, but it didn't occur to me in this instance!)

DAN





On Fri, Jan 25, 2013 at 2:27 PM, Martin Chatterjee <
martin.chatterjee.li...@googlemail.com> wrote:

> Dan,
>
> alternatively you should be able to just use the OM method:
>
> for obj in Application.Selection:
>
> over = obj.AddProperty("Override", False, "Vis_Override")
> LogMessage(over.FullName+" -- "+str(over.Type) )
>
>
> Cheers, Martin
>
>
> --
>Martin Chatterjee
>
> [ Freelance Technical Director ]
> [   http://www.chatterjee.de   ]
> [ https://vimeo.com/chatterjee ]
>
>
> On Fri, Jan 25, 2013 at 1:15 PM, Dan Yargici  wrote:
>
>> Aaaah, OK, I see.  I'll try and burn that into memory.
>>
>> Cheers Peter.
>>
>> DAN
>>
>>
>>
>> On Fri, Jan 25, 2013 at 2:10 PM, Peter Agg wrote:
>>
>>> Ah yeah, looking at the docs AddProp uses those funky ISIVTCollection
>>> things to return a collection
>>>
>>>
>>> for obj in Application.Selection:
>>> over = Application.AddProp("Override", obj, "",
>>> "Vis_Override")["Value"][0]
>>>
>>> param = obj.Properties("Visibility").Parameters("viewvis")
>>> over.AddParameterEntry(param)
>>>
>>> That should do it though.
>>>
>>>
>>>
>>> On 25 January 2013 11:59, Dan Yargici  wrote:
>>>
 My last mail's formatting may have been scrambled...




 On Fri, Jan 25, 2013 at 1:58 PM, Dan Yargici wrote:

> Indeed it does!  Try this however, and it fails again.  Seems it's a
> quirk with AddProp.  Strange...
>
> for obj in Application.Selection:
> over = obj.AddProp("Override", oObj, "", "Vis_Override")
>  param = obj.Properties("Visibility").Parameters("viewvis")
> over.AddParameterEntry(param)
>
>
> On Fri, Jan 25, 2013 at 1:50 PM, Peter Agg 
> wrote:
>
>> for obj in Application.Selection:
>> over = obj.AddProperty("Override", False, "Vis_Override")
>> param = obj.Properties("Visibility").Parameters("viewvis")
>> over.AddParameterEntry(param)
>>
>>
>> Does this not work?
>>
>>
>>
>> On 25 January 2013 11:34, Dan Yargici  wrote:
>>
>>> OK, a little help here...
>>>
>>> This parameter gymnastics gets me every time.  I've tried all manner
>>> of variants with no success.  Select an object and then run this:
>>>
>>> from win32com.client import dynamic
>>>
>>> xsi = Application
>>> pr = xsi.LogMessage
>>>
>>> for oObj in xsi.Selection:
>>> oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
>>>  oParam =
>>> dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
>>> pr("Look everyone - A Parameter!")
>>>  
>>> pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
>>> + " is type: " + oParam.type)
>>>  pr("...Yet this next line fails :(")
>>>
>>> oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))
>>>
>>>
>>> DAN
>>>
>>>
>>>
>>> On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
>>> cgo...@googlemail.com> wrote:
>>>
 Thank you for the explanations Stephen and César!

>>>
>>>
>>
>

>>>
>>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Martin Chatterjee
All right guys, sometimes it helps to read the whole thread... :)

Peter already mentioned *obj.AddProperty()* a few mails earlier - feel free
to ignore my last mail...

Cheers, Martin
--
   Martin Chatterjee

[ Freelance Technical Director ]
[   http://www.chatterjee.de   ]
[ https://vimeo.com/chatterjee ]


On Fri, Jan 25, 2013 at 1:27 PM, Martin Chatterjee <
martin.chatterjee.li...@googlemail.com> wrote:

> Dan,
>
> alternatively you should be able to just use the OM method:
>
> for obj in Application.Selection:
>
> over = obj.AddProperty("Override", False, "Vis_Override")
> LogMessage(over.FullName+" -- "+str(over.Type) )
>
>
> Cheers, Martin
>
>
> --
>Martin Chatterjee
>
> [ Freelance Technical Director ]
> [   http://www.chatterjee.de   ]
> [ https://vimeo.com/chatterjee ]
>
>
> On Fri, Jan 25, 2013 at 1:15 PM, Dan Yargici  wrote:
>
>> Aaaah, OK, I see.  I'll try and burn that into memory.
>>
>> Cheers Peter.
>>
>> DAN
>>
>>
>>
>> On Fri, Jan 25, 2013 at 2:10 PM, Peter Agg wrote:
>>
>>> Ah yeah, looking at the docs AddProp uses those funky ISIVTCollection
>>> things to return a collection
>>>
>>>
>>> for obj in Application.Selection:
>>> over = Application.AddProp("Override", obj, "",
>>> "Vis_Override")["Value"][0]
>>>
>>> param = obj.Properties("Visibility").Parameters("viewvis")
>>> over.AddParameterEntry(param)
>>>
>>> That should do it though.
>>>
>>>
>>>
>>> On 25 January 2013 11:59, Dan Yargici  wrote:
>>>
 My last mail's formatting may have been scrambled...




 On Fri, Jan 25, 2013 at 1:58 PM, Dan Yargici wrote:

> Indeed it does!  Try this however, and it fails again.  Seems it's a
> quirk with AddProp.  Strange...
>
> for obj in Application.Selection:
> over = obj.AddProp("Override", oObj, "", "Vis_Override")
>  param = obj.Properties("Visibility").Parameters("viewvis")
> over.AddParameterEntry(param)
>
>
> On Fri, Jan 25, 2013 at 1:50 PM, Peter Agg 
> wrote:
>
>> for obj in Application.Selection:
>> over = obj.AddProperty("Override", False, "Vis_Override")
>> param = obj.Properties("Visibility").Parameters("viewvis")
>> over.AddParameterEntry(param)
>>
>>
>> Does this not work?
>>
>>
>>
>> On 25 January 2013 11:34, Dan Yargici  wrote:
>>
>>> OK, a little help here...
>>>
>>> This parameter gymnastics gets me every time.  I've tried all manner
>>> of variants with no success.  Select an object and then run this:
>>>
>>> from win32com.client import dynamic
>>>
>>> xsi = Application
>>> pr = xsi.LogMessage
>>>
>>> for oObj in xsi.Selection:
>>> oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
>>>  oParam =
>>> dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
>>> pr("Look everyone - A Parameter!")
>>>  
>>> pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
>>> + " is type: " + oParam.type)
>>>  pr("...Yet this next line fails :(")
>>>
>>> oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))
>>>
>>>
>>> DAN
>>>
>>>
>>>
>>> On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
>>> cgo...@googlemail.com> wrote:
>>>
 Thank you for the explanations Stephen and César!

>>>
>>>
>>
>

>>>
>>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Martin Chatterjee
Dan,

alternatively you should be able to just use the OM method:

for obj in Application.Selection:

over = obj.AddProperty("Override", False, "Vis_Override")
LogMessage(over.FullName+" -- "+str(over.Type) )


Cheers, Martin


--
   Martin Chatterjee

[ Freelance Technical Director ]
[   http://www.chatterjee.de   ]
[ https://vimeo.com/chatterjee ]


On Fri, Jan 25, 2013 at 1:15 PM, Dan Yargici  wrote:

> Aaaah, OK, I see.  I'll try and burn that into memory.
>
> Cheers Peter.
>
> DAN
>
>
>
> On Fri, Jan 25, 2013 at 2:10 PM, Peter Agg wrote:
>
>> Ah yeah, looking at the docs AddProp uses those funky ISIVTCollection
>> things to return a collection
>>
>>
>> for obj in Application.Selection:
>> over = Application.AddProp("Override", obj, "",
>> "Vis_Override")["Value"][0]
>>
>> param = obj.Properties("Visibility").Parameters("viewvis")
>> over.AddParameterEntry(param)
>>
>> That should do it though.
>>
>>
>>
>> On 25 January 2013 11:59, Dan Yargici  wrote:
>>
>>> My last mail's formatting may have been scrambled...
>>>
>>>
>>>
>>>
>>> On Fri, Jan 25, 2013 at 1:58 PM, Dan Yargici wrote:
>>>
 Indeed it does!  Try this however, and it fails again.  Seems it's a
 quirk with AddProp.  Strange...

 for obj in Application.Selection:
 over = obj.AddProp("Override", oObj, "", "Vis_Override")
  param = obj.Properties("Visibility").Parameters("viewvis")
 over.AddParameterEntry(param)


 On Fri, Jan 25, 2013 at 1:50 PM, Peter Agg wrote:

> for obj in Application.Selection:
> over = obj.AddProperty("Override", False, "Vis_Override")
> param = obj.Properties("Visibility").Parameters("viewvis")
> over.AddParameterEntry(param)
>
>
> Does this not work?
>
>
>
> On 25 January 2013 11:34, Dan Yargici  wrote:
>
>> OK, a little help here...
>>
>> This parameter gymnastics gets me every time.  I've tried all manner
>> of variants with no success.  Select an object and then run this:
>>
>> from win32com.client import dynamic
>>
>> xsi = Application
>> pr = xsi.LogMessage
>>
>> for oObj in xsi.Selection:
>> oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
>>  oParam =
>> dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
>> pr("Look everyone - A Parameter!")
>>  
>> pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
>> + " is type: " + oParam.type)
>>  pr("...Yet this next line fails :(")
>>
>> oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))
>>
>>
>> DAN
>>
>>
>>
>> On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
>> cgo...@googlemail.com> wrote:
>>
>>> Thank you for the explanations Stephen and César!
>>>
>>
>>
>

>>>
>>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Dan Yargici
Aaaah, OK, I see.  I'll try and burn that into memory.

Cheers Peter.

DAN



On Fri, Jan 25, 2013 at 2:10 PM, Peter Agg  wrote:

> Ah yeah, looking at the docs AddProp uses those funky ISIVTCollection
> things to return a collection
>
>
> for obj in Application.Selection:
> over = Application.AddProp("Override", obj, "",
> "Vis_Override")["Value"][0]
>
> param = obj.Properties("Visibility").Parameters("viewvis")
> over.AddParameterEntry(param)
>
> That should do it though.
>
>
>
> On 25 January 2013 11:59, Dan Yargici  wrote:
>
>> My last mail's formatting may have been scrambled...
>>
>>
>>
>>
>> On Fri, Jan 25, 2013 at 1:58 PM, Dan Yargici wrote:
>>
>>> Indeed it does!  Try this however, and it fails again.  Seems it's a
>>> quirk with AddProp.  Strange...
>>>
>>> for obj in Application.Selection:
>>> over = obj.AddProp("Override", oObj, "", "Vis_Override")
>>>  param = obj.Properties("Visibility").Parameters("viewvis")
>>> over.AddParameterEntry(param)
>>>
>>>
>>> On Fri, Jan 25, 2013 at 1:50 PM, Peter Agg wrote:
>>>
 for obj in Application.Selection:
 over = obj.AddProperty("Override", False, "Vis_Override")
 param = obj.Properties("Visibility").Parameters("viewvis")
 over.AddParameterEntry(param)


 Does this not work?



 On 25 January 2013 11:34, Dan Yargici  wrote:

> OK, a little help here...
>
> This parameter gymnastics gets me every time.  I've tried all manner
> of variants with no success.  Select an object and then run this:
>
> from win32com.client import dynamic
>
> xsi = Application
> pr = xsi.LogMessage
>
> for oObj in xsi.Selection:
> oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
>  oParam =
> dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
> pr("Look everyone - A Parameter!")
>  
> pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
> + " is type: " + oParam.type)
>  pr("...Yet this next line fails :(")
>
> oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))
>
>
> DAN
>
>
>
> On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
> cgo...@googlemail.com> wrote:
>
>> Thank you for the explanations Stephen and César!
>>
>
>

>>>
>>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Peter Agg
Ah yeah, looking at the docs AddProp uses those funky ISIVTCollection
things to return a collection


for obj in Application.Selection:
over = Application.AddProp("Override", obj, "",
"Vis_Override")["Value"][0]
param = obj.Properties("Visibility").Parameters("viewvis")
over.AddParameterEntry(param)

That should do it though.


On 25 January 2013 11:59, Dan Yargici  wrote:

> My last mail's formatting may have been scrambled...
>
>
>
>
> On Fri, Jan 25, 2013 at 1:58 PM, Dan Yargici  wrote:
>
>> Indeed it does!  Try this however, and it fails again.  Seems it's a
>> quirk with AddProp.  Strange...
>>
>> for obj in Application.Selection:
>> over = obj.AddProp("Override", oObj, "", "Vis_Override")
>>  param = obj.Properties("Visibility").Parameters("viewvis")
>> over.AddParameterEntry(param)
>>
>>
>> On Fri, Jan 25, 2013 at 1:50 PM, Peter Agg wrote:
>>
>>> for obj in Application.Selection:
>>> over = obj.AddProperty("Override", False, "Vis_Override")
>>> param = obj.Properties("Visibility").Parameters("viewvis")
>>> over.AddParameterEntry(param)
>>>
>>>
>>> Does this not work?
>>>
>>>
>>>
>>> On 25 January 2013 11:34, Dan Yargici  wrote:
>>>
 OK, a little help here...

 This parameter gymnastics gets me every time.  I've tried all manner of
 variants with no success.  Select an object and then run this:

 from win32com.client import dynamic

 xsi = Application
 pr = xsi.LogMessage

 for oObj in xsi.Selection:
 oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
  oParam =
 dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
 pr("Look everyone - A Parameter!")
  
 pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
 + " is type: " + oParam.type)
  pr("...Yet this next line fails :(")

 oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))


 DAN



 On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
 cgo...@googlemail.com> wrote:

> Thank you for the explanations Stephen and César!
>


>>>
>>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Dan Yargici
My last mail's formatting may have been scrambled...




On Fri, Jan 25, 2013 at 1:58 PM, Dan Yargici  wrote:

> Indeed it does!  Try this however, and it fails again.  Seems it's a quirk
> with AddProp.  Strange...
>
> for obj in Application.Selection:
> over = obj.AddProp("Override", oObj, "", "Vis_Override")
>  param = obj.Properties("Visibility").Parameters("viewvis")
> over.AddParameterEntry(param)
>
>
> On Fri, Jan 25, 2013 at 1:50 PM, Peter Agg wrote:
>
>> for obj in Application.Selection:
>> over = obj.AddProperty("Override", False, "Vis_Override")
>> param = obj.Properties("Visibility").Parameters("viewvis")
>> over.AddParameterEntry(param)
>>
>>
>> Does this not work?
>>
>>
>>
>> On 25 January 2013 11:34, Dan Yargici  wrote:
>>
>>> OK, a little help here...
>>>
>>> This parameter gymnastics gets me every time.  I've tried all manner of
>>> variants with no success.  Select an object and then run this:
>>>
>>> from win32com.client import dynamic
>>>
>>> xsi = Application
>>> pr = xsi.LogMessage
>>>
>>> for oObj in xsi.Selection:
>>> oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
>>>  oParam =
>>> dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
>>> pr("Look everyone - A Parameter!")
>>>  
>>> pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
>>> + " is type: " + oParam.type)
>>>  pr("...Yet this next line fails :(")
>>>
>>> oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))
>>>
>>>
>>> DAN
>>>
>>>
>>>
>>> On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
>>> cgo...@googlemail.com> wrote:
>>>
 Thank you for the explanations Stephen and César!

>>>
>>>
>>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Dan Yargici
Indeed it does!  Try this however, and it fails again.  Seems it's a quirk
with AddProp.  Strange...

for obj in Application.Selection:
over = obj.AddProp("Override", oObj, "", "Vis_Override")
param = obj.Properties("Visibility").Parameters("viewvis")
over.AddParameterEntry(param)


On Fri, Jan 25, 2013 at 1:50 PM, Peter Agg  wrote:

> for obj in Application.Selection:
> over = obj.AddProperty("Override", False, "Vis_Override")
> param = obj.Properties("Visibility").Parameters("viewvis")
> over.AddParameterEntry(param)
>
>
> Does this not work?
>
>
>
> On 25 January 2013 11:34, Dan Yargici  wrote:
>
>> OK, a little help here...
>>
>> This parameter gymnastics gets me every time.  I've tried all manner of
>> variants with no success.  Select an object and then run this:
>>
>> from win32com.client import dynamic
>>
>> xsi = Application
>> pr = xsi.LogMessage
>>
>> for oObj in xsi.Selection:
>> oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
>>  oParam =
>> dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
>> pr("Look everyone - A Parameter!")
>>  
>> pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
>> + " is type: " + oParam.type)
>>  pr("...Yet this next line fails :(")
>>
>> oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))
>>
>>
>> DAN
>>
>>
>>
>> On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
>> cgo...@googlemail.com> wrote:
>>
>>> Thank you for the explanations Stephen and César!
>>>
>>
>>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Peter Agg
for obj in Application.Selection:
over = obj.AddProperty("Override", False, "Vis_Override")
param = obj.Properties("Visibility").Parameters("viewvis")
over.AddParameterEntry(param)


Does this not work?


On 25 January 2013 11:34, Dan Yargici  wrote:

> OK, a little help here...
>
> This parameter gymnastics gets me every time.  I've tried all manner of
> variants with no success.  Select an object and then run this:
>
> from win32com.client import dynamic
>
> xsi = Application
> pr = xsi.LogMessage
>
> for oObj in xsi.Selection:
> oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
>  oParam =
> dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
> pr("Look everyone - A Parameter!")
>  
> pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
> + " is type: " + oParam.type)
>  pr("...Yet this next line fails :(")
>
> oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))
>
>
> DAN
>
>
>
> On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger <
> cgo...@googlemail.com> wrote:
>
>> Thank you for the explanations Stephen and César!
>>
>
>


Re: Python: Getting and setting view visibility

2013-01-25 Thread Dan Yargici
OK, a little help here...

This parameter gymnastics gets me every time.  I've tried all manner of
variants with no success.  Select an object and then run this:

from win32com.client import dynamic

xsi = Application
pr = xsi.LogMessage

for oObj in xsi.Selection:
oOverride = xsi.AddProp("Override", oObj, "", "Vis_Override")
 oParam =
dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")
pr("Look everyone - A Parameter!")
 pr("""dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis")"""
+ " is type: " + oParam.type)
 pr("...Yet this next line fails :(")
oOverride.AddParameterEntry(dynamic.Dispatch(oObj).Properties("Visibility").Parameters("viewvis"))


DAN



On Wed, Jan 23, 2013 at 5:10 PM, Christian Gotzinger
wrote:

> Thank you for the explanations Stephen and César!
>


Re: Python: Getting and setting view visibility

2013-01-23 Thread Christian Gotzinger
Thank you for the explanations Stephen and César!


Re: Python: Getting and setting view visibility

2013-01-23 Thread César Sáez
The explicit form always work, a bit more to type but it's more reliable
IMHO.

print Application.Selection(0).Properties("Visibility").*Parameters*
("viewvis").Value


On Wed, Jan 23, 2013 at 3:46 PM, Stephen Blair wrote:

>  https://groups.google.com/d/msg/xsi_list/NSV-e-thdtY/d9Vp49sZAzUJ
>
>
> On 23/01/2013 9:32 AM, Stephen Blair wrote:
>
>
> for obj in Application.Selection:
> print hasattr( obj.Properties("Visibility"), "viewvis" )
>
> for i in range( Application.Selection.Count ) :
> print hasattr( Application.Selection(i).Properties("Visibility"),
> "viewvis" )
>
> print '#'
>
> import win32com.client
> for obj in Application.Selection:
> print hasattr( win32com.client.Dispatch( obj
> ).Properties("Visibility"), "viewvis" )
>
> from win32com.client import dynamic
> for obj in Application.Selection:
> print hasattr( dynamic.Dispatch( obj ).Properties("Visibility"),
> "viewvis" )
>
>
> # False
> # True
> # #
> # False
> # True
>
>
> On 23/01/2013 8:45 AM, Christian Gotzinger wrote:
>
> Hi list,
>
> I don't understand why this won't work. Consider the following 1-liner:
> *print Application.Selection(0).Properties("Visibility").viewvis.Value*
>
> This works as expected. But when I try this:
> *for obj in Application.Selection:
> print obj.Properties("Visibility").viewvis.Value*
>
> I get an attribute error?? I only have one or multiple polygon meshes
> selected, so the attribute is there.
>
> Christian
>
>
>
>


Re: Python: Getting and setting view visibility

2013-01-23 Thread Stephen Blair

https://groups.google.com/d/msg/xsi_list/NSV-e-thdtY/d9Vp49sZAzUJ

On 23/01/2013 9:32 AM, Stephen Blair wrote:


for obj in Application.Selection:
print hasattr( obj.Properties("Visibility"), "viewvis" )

for i in range( Application.Selection.Count ) :
print hasattr( Application.Selection(i).Properties("Visibility"), 
"viewvis" )


print '#'

import win32com.client
for obj in Application.Selection:
print hasattr( win32com.client.Dispatch( obj 
).Properties("Visibility"), "viewvis" )


from win32com.client import dynamic
for obj in Application.Selection:
print hasattr( dynamic.Dispatch( obj ).Properties("Visibility"), 
"viewvis" )



# False
# True
# #
# False
# True


On 23/01/2013 8:45 AM, Christian Gotzinger wrote:

Hi list,

I don't understand why this won't work. Consider the following 1-liner:
*print Application.Selection(0).Properties("Visibility").viewvis.Value*

This works as expected. But when I try this:
*for obj in Application.Selection:
print obj.Properties("Visibility").viewvis.Value*

I get an attribute error?? I only have one or multiple polygon meshes 
selected, so the attribute is there.


Christian






Re: Python: Getting and setting view visibility

2013-01-23 Thread Stephen Blair


for obj in Application.Selection:
print hasattr( obj.Properties("Visibility"), "viewvis" )

for i in range( Application.Selection.Count ) :
print hasattr( Application.Selection(i).Properties("Visibility"), 
"viewvis" )


print '#'

import win32com.client
for obj in Application.Selection:
print hasattr( win32com.client.Dispatch( obj 
).Properties("Visibility"), "viewvis" )


from win32com.client import dynamic
for obj in Application.Selection:
print hasattr( dynamic.Dispatch( obj ).Properties("Visibility"), 
"viewvis" )



# False
# True
# #
# False
# True


On 23/01/2013 8:45 AM, Christian Gotzinger wrote:

Hi list,

I don't understand why this won't work. Consider the following 1-liner:
*print Application.Selection(0).Properties("Visibility").viewvis.Value*

This works as expected. But when I try this:
*for obj in Application.Selection:
print obj.Properties("Visibility").viewvis.Value*

I get an attribute error?? I only have one or multiple polygon meshes 
selected, so the attribute is there.


Christian




Python: Getting and setting view visibility

2013-01-23 Thread Christian Gotzinger
Hi list,

I don't understand why this won't work. Consider the following 1-liner:
*print Application.Selection(0).Properties("Visibility").viewvis.Value*

This works as expected. But when I try this:
*for obj in Application.Selection:
print obj.Properties("Visibility").viewvis.Value*

I get an attribute error?? I only have one or multiple polygon meshes
selected, so the attribute is there.

Christian