[IV 2014] - Open part from Drawing View with part selection filter

[IV 2014] - Open part from Drawing View with part selection filter

gmassart
Collaborator Collaborator
904 Views
3 Replies
Message 1 of 4

[IV 2014] - Open part from Drawing View with part selection filter

gmassart
Collaborator
Collaborator

Hi

I would like to know if it is possible to open a part selected from a view with

ThisApplication.ActiveDocument.SelectionPriority = kPartSelectionPriority

With the application we can do it (right click then open) but what about VBA ?

 

Thank you in advance for the help

Guillaume MASSART
AFFIVAL SAS
Inventor Pro 2022
EESignature

0 Likes
Accepted solutions (1)
905 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

In about 99% of cases, if you can do it with the UI, you can do it with the API.

 

https://forums.autodesk.com/t5/inventor-customization/selectset-part-priority-drawingview/td-p/52756...

 

Using the pick command, I can't find the specific part priority filter that allows you to select objects.

 

I also tried using the selection events similar to the link below.

 

https://forums.autodesk.com/t5/inventor-customization/pick-a-point-in-drawingsketch/td-p/6204822

 

Neither methods allow you to "preview" what part you select, and when you have selectionPriority put to Part in the drawing, it's actually selecting a Generic Object/Variant, so if you want it to show what object you are selecting, you likely need to use the interaction events and pre-highlight to make the full object visible based on what line is selected.

 

At any rate, good luck!

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 4

gmassart
Collaborator
Collaborator

I wonder if I am not in the 1% remaining cases 🐵

I had checked the first link you give, but the final step give you the model of the view, not the part selected (If I select a part in an assembly in a drawing view)

 

I am working on another workflow than the one expected but less convenient (I will ask the user to select the view, open the model, if the model is an assembly start the command for the pick with part only and then open that file and do what I have to do with the part selected, then close back both documents)

 

workflow expected was to select directly the part in the drawing view, open it and do what I have to do with the part and then close a single document.

 

Perhaps I would need the "right click open" using similar command:

    Dim Cm As CommandManager
    Set Cm = ThisApplication.CommandManager
    Call Cm.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, sFileFullPath)
    Dim oCtrlDef As ButtonDefinition
    Set oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("GeomToDXFCommand")
    Call oCtrlDef.Execute

Guillaume MASSART
AFFIVAL SAS
Inventor Pro 2022
EESignature

0 Likes
Message 4 of 4

gmassart
Collaborator
Collaborator
Accepted solution

Ok, here we go with the solution 🙂

    Dim Cm As CommandManager
    Set Cm = ThisApplication.CommandManager
    Call Cm.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, sFileFullPath)
    Dim oCtrlDef As ButtonDefinition
    Set oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("DLxOpenComponentCmd")
    Call oCtrlDef.Execute

Guillaume MASSART
AFFIVAL SAS
Inventor Pro 2022
EESignature

0 Likes