By Wayne Brill
If you are trying to determine if an assembly has been created with the Frame Generator use the DocumentInterests object of the document. This object has a hasinterest method that takes a GUID and returns a Boolean. The GUID to use is the following:
{AC211AE0-A7A5-4589-916D-81C529DA6D17}
VBA Example:
Sub docOfInterestTest()
If ThisApplication.Documents.count = 0 _
Then Exit Sub
Dim oDocInts As DocumentInterests
Set oDocInts = ThisApplication. _
ActiveDocument.DocumentInterests
Dim bHasInterest As Boolean
bHasInterest = oDocInts.hasinterest _
("{AC211AE0-A7A5-4589-916D-81C529DA6D17}")
If bHasInterest Then
Dim odocint As DocumentInterest
For Each odocint In oDocInts
'Will be FrameDoc for the
'frame document
Debug.Print odocint.Name
Next
End If
End Sub
VB.NET
Public Class Form1
Dim m_inventorApp As Inventor.Application _
= Nothing
Private Sub Button1_Click(ByVal sender As _
System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
' Get an active instance of Inventor
Try
m_inventorApp = System.Runtime. _
InteropServices.Marshal. _
GetActiveObject("Inventor.Application")
Catch 'Inventor not started
System.Windows.Forms.MessageBox. _
Show("Start an Inventor session")
Exit Sub
End Try
'Call the Sub
docOfInterestTest()
End Sub
Sub docOfInterestTest()
If m_inventorApp.Documents.Count = 0 _
Then Exit Sub
Dim oDocInts As DocumentInterests
oDocInts = m_inventorApp. _
ActiveDocument.DocumentInterests
Dim bHasInterest As Boolean
bHasInterest = oDocInts.hasinterest _
("{AC211AE0-A7A5-4589-916D-81C529DA6D17}")
If bHasInterest Then
Dim odocint As DocumentInterest
For Each odocint In oDocInts
'Will be FrameDoc for the
'frame document
Debug.Print(odocint.Name)
Next
End If
End Sub
End Class