Open document from drawing partslistrow

Open document from drawing partslistrow

Anonymous
Not applicable
878 Views
3 Replies
Message 1 of 4

Open document from drawing partslistrow

Anonymous
Not applicable

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

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

jdkriek
Advisor
Advisor
Accepted solution

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
Not applicable

Thats it! thanks

0 Likes
Message 4 of 4

Anonymous
Not applicable

Hi All,

 

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

 

Thanks

 

 

0 Likes