Converting from an iterable object to another while losing capabilities (collections have some handy functions, can be added to other collections, etc) doesn't seem too helpful other than getting something that will print something other than "None". In which case since you know .Bones is a property of the chain root you can just print the .Count of the collection to see if it is empty.

Any benefits to converting to a list?

Eric T.


On 11/7/2013 3:58 PM, Orlando Esponda wrote:
you could also use list(chainRoot.Children) to convert a collection into a list.

si = Application

chainRoot = si.Create2DSkeleton(0, 0, 0, 10, 0, 0, -90, 0, 0, 4)
print chainRoot
print list(chainRoot.Children)
print list(chainRoot.Bones)
print chainRoot.Effector


On Thu, Nov 7, 2013 at 11:02 AM, Eric Thivierge <[email protected] <mailto:[email protected]>> wrote:

    It's annoying and I'd rather see the word "Collection" instead of
    None. There was an article on xsisupport.com
    <http://xsisupport.com> about it explaining something of why it
    wasn't changed to say so. Just one of those things you should just
    learn at this point.


    On Thursday, November 07, 2013 11:59:35 AM, Sergio Mucino wrote:

        Ah, I see. In other applications, collections come out as an
        array.
        The "None" made me think something went boom.
        Thanks Eric! Something new learned... and before lunch time!
        Cheers!


        On 07/11/2013 11:56 AM, Eric Thivierge wrote:

            You're printing out collections. When you do a print on a
            collection
            it prints "None".

            Instead if you want to get at the objects it would be
            better to
            iterate over the items in the collection:

            for eachItem in chainRoot.Bones:
               Application.LogMessage(eachItem)

            On Thursday, November 07, 2013 11:46:11 AM, Sergio Mucino
            wrote:

                So, I'm trying to do something pretty simple and
                straightforward.
                Create a 1-bone joint chain, and get back all of its
                elements. Turns
                out this is not being as straight-forward as it should
                be. Here's the
                little snippet of this part of my script...

                si = Application
                chainRoot = si.Create2DSkeleton(0, 0, 0, 10, 0, 0,
                -90, 0, 0, 4)
                print chainRoot
                print chainRoot.Children # Not working
                print chainRoot.Bones # Not working
                print chainRoot.Effector

                '''
                Properties taken from here
                
http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html

                '''

                As you can see, I'm printing out the properties I'd
                need, but two of
                them (the two I'd actually care about) are 'not
                working' (they return
                'None'). Why is this? Are they broken, or am I missing
                something? Any
                help is appreciated. Thanks!
                --







--
IMPRESSUM:
PiXABLE STUDIOS GmbH & Co.KG, Sitz: Dresden, Amtsgericht: Dresden, HRA 6857, Komplementärin: Lenhard & Barth Verwaltungsgesellschaft mbH, Sitz: Dresden, Amtsgericht: Dresden, HRB 26501, Geschäftsführer: Frank Lenhard, Tino Barth

IMPRINT:
PiXABLE STUDIOS GmbH & Co.KG, Domicile: Dresden, Court of Registery: Dresden,
Company Registration Number: HRA 6857, General Partner: Lenhard & Barth
Verwaltungsgesellschaft mbH, Domicile: Dresden, Court of Registery: Dresden, Company Registration Number: HRB 26501, Chief Executive Officers: Frank Lenhard, Tino Barth


--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Reply via email to