Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: JelteDeJong

OK. Now I feel like I have to ask the question...Why are you checking the "IsiAssemblyMember" property?  And if it was an iAssemblyMember, then why are you using the "FactoryDocument" property to get the correct version of the document.  The AssemblyComponentDefinition already has 4 direct properties specifically for iAssembly's  (IsiAssemblyFactory, IsiAssemblyMember, iAssemblyFactory, & iAssemblyMember).  So, if you are truly checking to see if it represented an iAssemblyMember, then why not use either the AssemblyComponentDefinition's iAssemblyMember property or its iAssemblyFactory property to get that reference, instead of using the FactoryDocument property, which relates to ModelStates?  If you were checking to see if the document represented a ModelState Member document, wouldn't you instead check the "IsModelStateMember" property, or maybe even the "IsModelStateFactory" property?  So, I am confused by how/why that code worked.  Does the IsiAssemblyMember property always return True when it really represents a ModelState member?  If so, that seems like a bug, because last I heard was that the ModelStates and the iParts & iAssemblies were going to remain two separate things that can't be present in the same document at the same time.  Also, if there is only one ModelState in any model document, its ComponentDefinition.FactoryDocument property will return 'Nothing', which seems like that could cause problems if checking IsiAssemblyMember returned True, because the following line is attempting to get components from that document reference that was just set to Nothing.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)