Hi @gabriel_deber. Maybe. We were working with the 'parts only' view of the BOM in that code example above. That is a flat list of all parts, from all levels, which can also include weldment type assemblies since their BOMStructure is set to 'inseparable' by default, but will not include regular sub assemblies themselves. This is different from the 'structured view', where it is set to include all levels. In the structured all levels view, the same part file could possibly be referenced by multiple different assemblies at the same time...and if so, it could have a different Item Number value within each of the different assemblies' BOMs. However, there would only actually be the one part file on disk, so, it would write one value to that file representing its Item Number within one assembly, but then overwrite that value with its Item Number from within some other assembly, and so on. In the parts only view, there should not be any child rows, so no recursive processing should be needed, but if we switched to the structured view, set to all levels, then there could be child rows, and recursive processing would most likely be needed, which gets more complicated.
It is difficult to explain here, but the BOM of the main assembly looks at all its components from its own perspective, and there are several aspects of those components that can be customized in ways that are only custom from the perspective of that main assembly, without them being different from the perspective of any other sub assembly. One of those things is the Item Number value within the BOM. The Item Number value can even be (and often is) different between the Parts Only view and the Structured view of the same assembly, which is another concern to keep in mind. Just another reason why writing assembly level data back down to part level is often not a good idea (but not always). So, I am not sure what your expectation may be in those awkward types of situations.
Edit: I may have mixed my words there...I know we are not actually planning on writing data to the actual part files, just to instance properties, which should all be recorded by the main assembly, I believe. But this is not something that I do where I work, so maybe I'm wrong. If the components are being edited in the context of the sub assemblies, then ModelStates may come into play here, which may potentially prevent some modifications at those levels, not sure.
Wesley Crihfield

(Not an Autodesk Employee)