Component .Attributes property not accessible, throw error:

Component .Attributes property not accessible, throw error:

jeanfabre
Enthusiast Enthusiast
609 Views
2 Replies
Message 1 of 3

Component .Attributes property not accessible, throw error:

jeanfabre
Enthusiast
Enthusiast

 

Hi Everyone,

 

 Hitting an issue with accessing the Component, hopefully, it's because I am missing something 🙂

 

I have some attributes added to a component, I used FusionTagger as a mean to debug this feature, and indeed there is an attribute on my component.

 

but when I am going through all components in the design, I can't seem to be able to ask for the .Attributes, I always get the error:

    if component.Attributes:
  File "/Applications/Fusion360.app/Contents/Api/Python/packages/adsk/fusion.py", line 16086, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Occurrence, name)
  File "/Applications/Fusion360.app/Contents/Api/Python/packages/adsk/fusion.py", line 57, in _swig_getattr
    raise AttributeError(name)
AttributeError: Attributes

so my questions are:

 

- how can I check if Attributes are present on a given Component

- How can I iterate over all attributes of a Given Component.

 

 All examples I see are about finding attributes within the design, that's not what I am after ( I am dumping all components into an Xml file for an export tool workflow to Unity). I am after the ability to use this Component.Attributes on a per Component base.

 

Here's the doc for this property

 

what I am noticing here, is that the doc seems to be wrong, as it mentions "faces", but we are in the Component class...

 

 Description
Returns the collection of attributes associated with this face.

also, here's the output of FusionTagger to show that there is indeed an attribute on my component "My First Part :2"

 

could it be that I am confused with occurences and component, I haven't fully understand that distinction yet, but then why would the api doc mention this .Attributes property for a Component class?

 

Autodesk_Fusion_360__Startup_License_.png

 

Thanks for your help!

 

Jean

 

 

 

0 Likes
Accepted solutions (1)
610 Views
2 Replies
Replies (2)
Message 2 of 3

JesusFreke
Advocate
Advocate
Accepted solution

The attribute name is ".attributes", not ".Attributes". Case matters.

Message 3 of 3

jeanfabre
Enthusiast
Enthusiast

Hi JesusFreke,

 

Thanks for that, I was stuck, and could not see the obvious 🙂

 

Bye,

 

 Jean

0 Likes