If you are looping through the collection of allreferenceddocuments then you don't need to call it multiple times, it is already the entire collection of every child and child's child etc.
My first question is does ThreadData and HoleData care what type it is? The way it is written i would have to assume not, or it has it's own code to handle either doctype. In which case why do you need to distinguish between doctype in this sub?
If you really do you can do something like this (I'm going on memory, not intellisense)
dim DocType as DocumentType: set DocType = aDoc.DocumentType
Select Case DocType
Case kPartDocumentObject, kSheetMetalDocumentObject 'Im just showing you can list types, not totally sure if sheet metal exists here.
ThreadData
HoleData
Case kAssemblyDocumentObject
ThreadData
HoleData
Case Else
'Any other type
End Select
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro