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: 

Orphan Attributes!

Message 1 of 3
266 Views, 2 Replies

Orphan Attributes!

Attributes will remain in design after deletion of their parents. In fact their parents will become nullptr (in C++). It can potentially cause exceptions if you iterate through all design attributes and try to work with their parents without nullptr checking.


Is it by design or a bug?

Message 2 of 3
in reply to: nnikbin



Taken from the documentation:


Something that might seem a little odd at first is that it is possible to get an attribute whose parent entity no longer exists. In that case, calling the parent property will return null. One example of where you can get an unattached attribute is in the case of B-Rep entities (faces, edges, and vertices of a model). When an attribute is created on a B-Rep entity it is never automatically deleted because the lifetime of that entity is unknown. For example, if you add an attribute to an edge and then the edge is filleted, that edge is consumed and no longer exists in the model and the parent property of the attribute will return null. However, it's possible that the edge can come back in the future; the fillet can be deleted or suppressed and then the parent property of the attribute will return the edge. Because attributes can exist without an owner, it's important to always check the return value of the parent property to verify that you did get back an entity.


Message 3 of 3
in reply to: JeromeBriot

Thank you @JeromeBriot. It seems that I need to read the documentation more carefully!

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

Post to forums  

Technology Administrators

Autodesk Design & Make Report