- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Using Inventor 2018 Ultimate debugging with visual studio 2015 community
I am trying to learn how to use interactive selections with the API (VB.net). So I started building an add in following the admapi example for user interactive selection as a tutorial. However I cannot seem to get the onselect event to fire. The admapi example is written in VBA so my code is a little different and evidently I am missing something as I am able to select edges as expected but the onselect event never fires as the admapi example suggests it should. The form is called from the StandardAddInServer...
' Sample handler for the button. Private Sub m_sampleButton_OnExecute(Context As NameValueMap) Handles m_sampleButton.OnExecute MsgBox("Button was clicked.") Dim oForm As New Form2 oForm.Show() End Sub
Below is the code for the form...
Imports Inventor Public Class Form2 Private WithEvents oInteraction As InteractionEvents Private WithEvents oSelect As SelectEvents Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load oInteraction = g_inventorApplication.CommandManager.CreateInteractionEvents oSelect = oInteraction.SelectEvents oInteraction.StatusBarText = "Select an edge" oSelect.AddSelectionFilter(SelectionFilterEnum.kPartEdgeFilter) oSelect.SingleSelectEnabled = True oInteraction.Start() End Sub Private Sub oSelect_Onselect(ByVal JustSelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View) Handles oSelect.OnSelect Dim i As Long Dim dlength As Double For i = 1 To JustSelectedEntities.Item(i) Dim oEdge As Edge = JustSelectedEntities.Item(i) Dim dMin As Double Dim dMax As Double oEdge.Evaluator.GetParamExtents(dMin, dMax) Dim dSingleLength As Double oEdge.Evaluator.GetLengthAtParam(dMin, dMax, dSingleLength) dlength = dlength + dSingleLength TextBox1.Text = Format(dlength, "0.0000 cm") TextBox2.Text = JustSelectedEntities.Count Next MsgBox("IT WORKED!!!",, "") End Sub End Class
Why does the oSelect_Onselect sub not fire when the edges are selected? What am I missing?
Solved! Go to Solution.