iLogic to select by iLogic

iLogic to select by iLogic

mohandis2
Advocate Advocate
322 Views
3 Replies
Message 1 of 4

iLogic to select by iLogic

mohandis2
Advocate
Advocate

looking to detect if a view is selected, I think I used IsSelected in VBA with Autocad or Excel before,

but it does not exist in inventor iLogic,

please help.

 

For Each oView In oSheet.DrawingViews

     If oView.IsSelected=true then .......

next

0 Likes
323 Views
3 Replies
Replies (3)
Message 2 of 4

JamieVJohnson2
Collaborator
Collaborator

This will work:

  Public Sub DoWorkOnView()
        Dim invApp as Inventor.Application = ThisApplication
        If invApp IsNot Nothing Then
            If invApp.ActiveDocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
                Dim invDoc As Inventor.DrawingDocument = invApp.ActiveDocument
                Dim trans As Inventor.Transaction = invApp.TransactionManager.StartTransaction(invDoc, "DoWorkOnView")
                If invDoc.SelectSet.Count = 0 Then MsgBox("Please select the view first.")
                For Each item As Object In invDoc.SelectSet
                    If TypeOf item Is Inventor.DrawingView Then
                        Dim dv As DrawingView = item
                         'verify this is the view you want to use, and do your work on it.                
                    End If
                Next
                trans.End()
            End If
        End If
    End Sub

Instead of asking each view object, we cycle through the document selection set.

 

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
Message 3 of 4

mohandis2
Advocate
Advocate

thank you, this is a VBA routin

0 Likes
Message 4 of 4

JamieVJohnson2
Collaborator
Collaborator

you should be able to 'shoe horn' it into your VBA, just change all the:

dim object as type = instance

to two lines:

dim object as type

set object = instance

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes