Message 1 of 3
GetVisibility fails for Associative DrawingView
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a simple function in a larger rule which checks if an object [mostly used to check ComponentOccurence object] is visible in a DrawingView. I've recently found that the Function "GetVisibilty" on the DrawingView Object throws an exception when the DrawingView is associative. Am i missing something obvious? Is this behavior intended? Sample function:
Sub Main
Dim PickView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view")
If IsNothing(PickView) Then Exit Sub ' If nothing gets selected then we're done
If PickView.ReferencedDocumentDescriptor.ReferencedDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then Logger.Debug("Please select a drawing view of an assembly document")
Dim firstCO As ComponentOccurrence = PickView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences.Item(1)
Logger.Debug(firstCO.Name & " Visibility: " & TestGetVisibility(PickView, firstCO))
End Sub
Function TestGetVisibility(v As DrawingView, ob As Object) As Boolean
Try
Return v.GetVisibility(ob)
Catch
Logger.Debug("Assuming the component is visible if the view rep is locked")
Return True
End Try
End Function