Open assembly of selected view

Open assembly of selected view

josh.linares-stanley
Enthusiast Enthusiast
374 Views
3 Replies
Message 1 of 4

Open assembly of selected view

josh.linares-stanley
Enthusiast
Enthusiast

Could someone provide a short rule to open the part/assembly of a drawing view when selected using the snippet below?

ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view.")

 

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

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @josh.linares-stanley . Try this iLogic code:

Dim oInvApp As Inventor.Application = ThisApplication
Dim oDoc As Document = oInvApp.ActiveDocument
If Not TypeOf oDoc Is DrawingDocument Then Exit Sub
Dim oDDoc As DrawingDocument = oDoc
Dim oView As DrawingView
oView = oInvApp.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view.")
If oView Is Nothing Then Exit Sub
oDoc = oInvApp.Documents.Open(oView.ReferencedDocumentDescriptor.FullDocumentName, True)

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

0 Likes
Message 3 of 4

A.Acheson
Mentor
Mentor

Hi @josh.linares-stanley  from this API sample here for the referenced document

And to open the find document use Documents.Open

Dim drawView as DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view.")
Dim refDoc As Document = drawView.ReferencedDocumentDescriptor.ReferenceDocument
ThisApplication.Documents.Open(refDoc.FullFileName,True)

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 4 of 4

josh.linares-stanley
Enthusiast
Enthusiast

Works a charm, thanks

0 Likes