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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Component .partNumber throw error

Message 1 of 4
224 Views, 3 Replies

Component .partNumber throw error



 how can one access the part number of a given component?


I did actually set my component to have a part number,



 The api doc mentions that property .partNumber but it throws an error when I try to query for it.


    if component.partNumber:
  File "/Applications/", line 16086, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Occurrence, name)
  File "/Applications/", line 57, in _swig_getattr
    raise AttributeError(name)
AttributeError: partNumber


Any help appreciated 🙂








Message 2 of 4
in reply to: contact

Based on the error message, your "component" variable does not contain a component, but rather, an occurrence.


__getattr__ = lambda self, name: _swig_getattr(self, Occurrence, name)


And Occurrence does not have a .partNumber attribute.


What you probably want in this case is component.component.partNumber


I would also recommend you rename your variable to occurrence, for clarity 🙂

Message 3 of 4
in reply to: JesusFreke



 yes, I started getting a grasp on occurences few minutes ago, and now I understand I was mistaking Components and Occurences. I am still shady as to how I should understand the actual browser listing inside the fusion UI. I think the UI is confusing now, since I can create a new Component in the UI, but it actually becomes an Occurence as you work on it, with the exception of the rootComponent which can only be an occurence in another design. So inside the fusion UI and browser, an occurence is always named "XXX:i" where XXX is the name of the component and i the occurence index of it.


Am I on the right path?


thanks for your help, I am already storming through my parser now 🙂 dumping all Occurences of a design into xml, with their transform matrix, Component part number,  and various meta data like planes and axis, joints,  so that I can reconstruct it inside Unity


Have a good day!



Message 4 of 4
in reply to: contact

The Fusion help system is down at the moment so I can't provide a link, but in the user manual there is a topic on "Document and Assembly Structure" that should help.  The UI is confusing because it refers to everything as a "Component" even when that isn't actually the case.  I also presented a class at AU a couple of years ago that goes into more detail.

Brian Ekins
Inventor and Fusion 360 API Expert

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