selected view by ilogic

selected view by ilogic

mohandis2
Advocate Advocate
501 Views
3 Replies
Message 1 of 4

selected view 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
502 Views
3 Replies
Replies (3)
Message 2 of 4

Mark.Lancaster
Consultant
Consultant

@mohandis2

 

iLogic questions, needs and issues should be posted over in the Inventor Customization forum https://forums.autodesk.com/t5/inventor-forum/reinstalling-necessary-when-moving-to-design-and-manuf... for best results

 

I will have the moderator relocate your posting there to best suit your needs.

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

Message 3 of 4

philip1009
Advisor
Advisor

It sounds like you're new to iLogic and the Inventor API but not VBA.  For starters, in the top right of the Inventor window is a drop down menu where you can access the API Help file:

API Help_edited.jpg

 

Keep in mind that iLogic is a custom plug-in for Inventor that can't do everything the full VBA editor can do, i.e. iLogic can't perform With Events and the routines with Classes and Subs are also limited, the pros with iLogic is the ease of building code quickly by directly referencing document parameters, iProperties, etc., with the use of iLogic snippets found to the left of the iLogic window.  You'll also find that VB statements like let and set can't be used among other things.

 

For your particular project, I'd recommend looking through the BrowserNodes Collection for a selected node and then get the native object from that:

ThisDoc.Document.BrowserPanes.ActivePane.TopNode.BrowserNodes.Item( Long Value As Index Number or String As Label ).Selected = Boolean

Message 4 of 4

JamieVJohnson2
Collaborator
Collaborator

This is how I do it:

 Dim vEnd As DrawingView = Nothing
                    For Each item As Object In idwDoc.SelectSet
                        If TypeOf item Is Inventor.DrawingView Then
                            vEnd = item
                            Exit For
                        End If
                    Next

idwDoc is of type Inventor.DrawingDocument you can get from ThisDocument

vEnd is named for my own purpose of getting a view that was the 'end view' of an assembly, you can rename this variable to anything you want.  This code is VB.Net which also works in the iLogic editor.

 

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