Hi maweilian,
Here is a quick example:
Dim oDoc As Document
oDoc = ThisDoc.Document
If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then
If Typeof ThisApplication.ActiveEditObject Is Sketch Then
MessageBox.Show("You have a sketch active in a part file.", "iLogic")
Else
MessageBox.Show("This is a part file.", "iLogic")
End If
Else If oDoc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
If Typeof ThisApplication.ActiveEditObject Is Sketch Then
MessageBox.Show("You have a sketch active in an assembly file.", "iLogic")
Else
MessageBox.Show("This is an assembly file.", "iLogic")
End If
Else If oDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject Then
If Typeof ThisApplication.ActiveEditObject Is Sketch Then
MessageBox.Show("You have a sketch active in a drawing file.", "iLogic")
Else
MessageBox.Show("This is a drawing file.", "iLogic")
End If
End If
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com