I'm creating a VB.exe (Visual Basic 2010 Express) tool that displays iProperties for Inventor using a running session of Inventor. How do I automatically refresh the display on the form when you switch the active inventor document tab within Inventor?
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi,
you could delegate the event ApplicationEvents.OnActivateDocument. in this event, when BeforeOrAfter =kAfter , get the current activate document, get its iProperties and update your dialog accordingly.
I received the same solution from Dan Vang. Thanks to you both. I was able to get this to work. When I change the document in Inventor the form refreshes nicely.
Hello Gary.Belisle,
I try also uptodate Iproperties in Inventor. Can you help me with some code? (Visual Basic 2010 Express)
I am surprised that it is not standard that iProperties being shown live within Inventor.
Thanks, Bastiaan Maalman
' Add these two declatations
Dim _invApp As Inventor.Application
Public appEvents As Inventor.ApplicationEvents
' Add this subroutine
Public Sub appEvents_OnActivateDocument(ByVal docObject As Inventor.Document, _
ByVal b_or_a As Inventor.EventTimingEnum, _
ByVal context As Inventor.NameValueMap, _
ByRef handlingCode As Inventor.HandlingCodeEnum)
If b_or_a = Inventor.EventTimingEnum.kAfter Then
' Add your cade to this subroutine. for example below, iproperties are refreshed by performing
' a button click after an inventor document is activated.
MsgBox("Document activated!")
Me.Invoke(New Action(AddressOf Button_RefreshProperties.Performclick))
End If
End Sub
Public Sub YourMainSub()
' Add these to your main sub routine.
appEvents = _invApp.ApplicationEvents
AddHandler appEvents.OnActivateDocument, AddressOf Me.appEvents_OnActivateDocument
End Sub