Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Component .Attributes property not accessible, throw error:

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
contact
307 Views, 2 Replies

Component .Attributes property not accessible, throw error:

 

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

 

 

 

2 REPLIES 2
Message 2 of 3
JesusFreke
in reply to: contact

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

Message 3 of 3
contact
in reply to: JesusFreke

Hi JesusFreke,

 

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

 

Bye,

 

 Jean

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report