Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Open document from drawing partslistrow

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
528 Views, 3 Replies

Open document from drawing partslistrow

Hello,

 

I wish to open a part or assemblydocument by its item number in the drawingdocument.

 

I can make an inputlistbox with all Item numbers in the drawing.

I can also link the result of the inputlistbox to the partslistrow.Item("Item").Value.

 

I am stuck here. I can not find the link/reference from a partslistrow to a document.

Is there a propertyfield that keeps the link? Or another way?

 

Comparing partlist and BOM cells by value is not a method I can use

 

Thanks in advance,

 

 

Arnold

3 REPLIES 3
Message 2 of 4
jdkriek
in reply to: Anonymous

Look at the PartsListRow.ReferencedFiles Method 

 

Here's a quick example:

 

Public Sub OpenPartFromList()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    ' Get the part list
    Dim oPartList As PartsList
    Set oPartList = oDoc.ActiveSheet.PartsLists.Item(1)
    
    ' Find the first row
    Dim oRow As PartsListRow
    Set oRow = oPartList.PartsListRows.Item(1)
    
    ' Get Ref Doc
    Dim oRefDoc As Document
    Set oRefDoc = oRow.ReferencedFiles.Item(1).ReferencedDocument
    
    ' Open the doc
    ThisApplication.Documents.Open (oRefDoc.FullDocumentName)
End Sub
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 4
Anonymous
in reply to: jdkriek

Thats it! thanks

Message 4 of 4
Anonymous
in reply to: Anonymous

Hi All,

 

Any chance to mod this code to open the model from first sheet ,first view instead BOM?

 

Thanks

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report