11-22-2024
02:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-22-2024
02:03 PM
Maybe you can take another route and create your own class with your variable. And then get the object containing your variable in the ilogic rule from your addin. It works something like this. Your StandardAddInServer would look something like this:
<GuidAttribute("[YOUR GUID]"), ComVisible(True)>
Public Class StandardAddInServer
Implements Inventor.ApplicationAddInServer
Private _myVariableObject As MyVariableObject
Public Sub Activate(AddInSiteObject As ApplicationAddInSite, FirstTime As Boolean) Implements ApplicationAddInServer.Activate
_myVariableObject = New MyVariableObject()
_myVariableObject.MyVariable = "TEST"
End Sub
Public ReadOnly Property Automation As Object Implements ApplicationAddInServer.Automation
Get
Return _myVariableObject
End Get
End Property
End Class
Public Class MyVariableObject
Public Property MyVariable As String
End Class
Notice:
- Notice the GUID on line 1. You need it in the iLogic rule.
- on line 19, 20 en 21: we have a class that we can use in the ilogic rule
- on line 5, 8 en 9: we initialize the variable and set some value
- on line 12 to 16: You find something that is not in the tutorial. but here the magic happens. This function can be called from within the iLogic rule. And it returns our object.
Now in your iLogic rule you can do this:
Dim addIn As ApplicationAddIn = ThisApplication.ApplicationAddIns.ItemById("{[YOUR GUID]}")
Dim myVariableObject = addIn.Automation
msgbox(myVariableObject.MyVariable)
On line 1 and 2 you get the object from your addin.
Then you can use it. For example in a MsgBox like on line 4
. It this case that would look like this:
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com