- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I am using VB.net to iterate a parts list and check some information for each row. Some of the information requires accessing the part document itself, so I do something like this:
Private Function CheckPartRow(ByRef row As PartsListRow) As Boolean
If row.ReferencedFiles.Count = 0 Then Return True
If Not row.ReferencedFiles(1).DocumentType = DocumentTypeEnum.kPartDocumentObject Then Return False
If CType(row.ReferencedFiles(1).ReferencedDocument, PartDocument).ComponentDefinition.Features.Count = 0 Then Return True
...
This works fine for nearly all of drawings, but occasionally this routine fails when we attempt to cast the referenced document to a PartDocument, and I've determined that in such cases row.ReferencedFiles(1).ReferencedDocument is null. Also in these cases row.ReferencedFiles(1).ReferenceStatus = ReferenceStatusEnum.kUnknownReference where typically the value is ReferenceStatusEnum.kUpToDateReference.
Can anyone shed light on why the ReferencedDocument may be null? The file exists and row.ReferencedFiles(1).DocumentFound is True, it appears on the drawing properly, it can even be open in my workspace and I get the same results. It is unclear if this is an issue with the part file, the drawing file, or if this is expected behavior that I need to handle in my code.
Thanks,
Kerry
Solved! Go to Solution.