VB.NET SelectEvents Filter Problem

VB.NET SelectEvents Filter Problem

tdant
Collaborator Collaborator
504 Views
4 Replies
Message 1 of 5

VB.NET SelectEvents Filter Problem

tdant
Collaborator
Collaborator

I've struggled with this for two days now and can't figure it out. I'm calling a form with an add-in to Inventor 2017. This form is the troublemaker:

 

Imports Inventor

Public Class ViewsForm
    Private m_interactionEvents As InteractionEvents
    Private m_selectEvents As SelectEvents

    Private Sub ViewsForm_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        m_interactionEvents = g_inventorApplication.CommandManager.CreateInteractionEvents()
        m_interactionEvents.StatusBarText() = "Select part views to label"
        m_selectEvents = m_interactionEvents.SelectEvents
        m_selectEvents.AddSelectionFilter(SelectionFilterEnum.kAllEntitiesFilter)
        m_selectEvents.SingleSelectEnabled = False
        m_interactionEvents.Start()
    End Sub

    Private Sub cmdOK_Click(sender As Object, e As EventArgs) Handles cmdOK.Click
        Dim selectedViews As New Collection
        For Each drawingView As DrawingView In m_selectEvents.SelectedEntities
            selectedViews.Add(drawingView)
        Next

        MsgBox(selectedViews.Count)
    End Sub

    Private Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click
        Me.Close()
    End Sub
End Class

I'm able to call the form from the ribbon no problem, but the SelectEvents interaction won't allow the user to select anything in Inventor. It's as if the SelectionFilter isn't letting anything through at all. I'm not getting any error at compilation or runtime, but I'm using VS2017 Community, so I don't have real-time debugging. Can anyone help please?

0 Likes
505 Views
4 Replies
Replies (4)
Message 2 of 5

smilinger
Advisor
Advisor
What do you mean you don't have real-time debugging? VS2017 community is more than enough for debugging inventor addin.

You need to set the output and debug option in your project settings and click start debug to let VS start Inventor for debugging. Just set the breakpoints you need then it's OK.
Message 3 of 5

bradeneuropeArthur
Mentor
Mentor

Put This in your code:

 

m_interactionEvents.SelectionActive = True

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 5

bradeneuropeArthur
Mentor
Mentor

Hi,

 

I also found this:

 

 

 

http://modthemachine.typepad.com/my_weblog/2012/07/set-embed-interop-types-to-false-to-avoid-problem... 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 5

tdant
Collaborator
Collaborator

A little more research and I learned about the native debugging capabilities in VS2017. I fired that up and everything executes just fine. I added that line of code (which interestingly enough doesn't show up in the API reference manual), but it didn't change anything. What's really bugging me is that this exact same code in VBA form works beautifully. What could be so different between VBA and VB.NET?