Retrieving .ipt/iam File Path From Drawing Parts List Tree

Retrieving .ipt/iam File Path From Drawing Parts List Tree

Toddy1369
Explorer Explorer
336 Views
1 Reply
Message 1 of 2

Retrieving .ipt/iam File Path From Drawing Parts List Tree

Toddy1369
Explorer
Explorer

My current code cycles through each row on the parts list table, 

I just need to get the file location of that part/assembly such as row(1) = "C:\Temp\part.ipt" to place a view of that part on the opened sheet.

 

' CODE BELOW ==============

 
# NEW IMPLEMENTATION CODE =============
 
oDoc = ThisApplication.Documents.Open("",False)
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(11, 11)
Dim ViewScale As Double = 0.1
Dim oDrawingDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDrawingDoc.ActiveSheet
oSheet.DrawingViews.AddBaseView(oDoc,oPoint1, ViewScale,kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle)
 
# OLD =============
 
Sub CreatingDrawings
        If Create_Drawings_From_BOM = True
                oDocDef1 = ThisDoc.Document
                Dim oSheet1 As Sheet = oDocDef1.ActiveSheet
                lPos1 = InStr(oSheet1.Name, ":")
                sLen1 = Len(oSheet1.Name)
                sSheetNamesOrignal = Left(oSheet1.Name, lPos1 - 1)
                Dim sSheetNumber As Integer = Right(oSheet1.Name, sLen1 -lPos1)
                Dim oDoc As DrawingDocument = ThisDoc.Document
                Dim oPartslist As PartsList = oDoc.Sheets.Item(sSheetNumber).PartsLists(1)
               
                Dim PartsListArray As New ArrayList
                For Each oRow As PartsListRow In oPartslist.PartsListRows
 
======== > FOR EACH ROW RETURN IT'S FILE LOCATION < ======== 
                   
                    Dim oItemDrawingNumber As String = oRow.Item("DRAWING NUMBER").Value
                    If oItemDrawingNumber <>"" Then
                        PartsListArray.Add(oItemDrawingNumber)
                    End If
                Next
               
                AllSheetsTemp = ThisDrawing.Document.Sheets
                Dim SheetListArray As New ArrayList
                For Each oSheetDwg As Sheet In AllSheetsTemp
                    lPos = InStr(oSheetDwg.Name, ":")
                    sLen = Len(oSheetDwg.Name)
                    sSheetNames = Left(oSheetDwg.Name, lPos - 1)
                    SheetListArray.Add(sSheetNames)
                Next
               
                For i = PartsListArray.Count - 1 To 0 Step -1  
                    DrawingNumberCheck = PartsListArray.Item(i)
                    For x = SheetListArray.Count - 1 To 0 Step -1  
                        SheetListNumberCheck = SheetListArray.Item(x)
                        If SheetListNumberCheck = DrawingNumberCheck
                            PartsListArray.Remove(SheetListNumberCheck)
                        End If
                    Next
                Next
               
                For i = PartsListArray.Count - 1 To 0 Step -1
                    Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
                    Dim oFormat As SheetFormat = oDrawDoc.SheetFormats.Item("A3 size, 2 views")
                    'Try
                        Dim oModel As Document = ThisApplication.Documents.Open("C:\temp\TempFile.ipt", False)
                        Dim oSheet2 As Sheet = oDrawDoc.Sheets.AddUsingSheetFormat(oFormat, oModel)
                        Dim oDoc1 As DrawingDocument = ThisDoc.Document
                        Dim oSheet As Sheet = oDoc1.ActiveSheet
                        Dim oView As DrawingView
                        For Each oView In oSheet.DrawingViews
                            oView.Delete
                        Next
                    'Catch
                        ThisDoc.Document.ActiveSheet.Name = PartsListArray(i)
                        Dim oDoc2 As DrawingDocument = ThisApplication.ActiveDocument
                        Dim oSheet3 As Sheet = oDoc2.ActiveSheet
                        Dim oPromptEntry
                        oTitleBlock=oSheet3.TitleBlock
                        oTextBoxes=oTitleBlock.Definition.Sketch.TextBoxes
                        For Each oTextBox In oTitleBlock.Definition.Sketch.TextBoxes
                        Select oTextBox.Text
                       
                        Case "<USED_ON>"
                            oPromptEntry = sSheetNamesOrignal
                            Call oTitleBlock.SetPromptResultText(oTextBox, oPromptEntry)
                        End Select
                        Next
                    'End Try                   
                Next
            Create_Drawings_From_BOM = False
    End If
End Sub
0 Likes
Accepted solutions (1)
337 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Toddy1369.  This has been a thorn in our sides for a while now.  You have to really dig down deep to get to that data.  It will be quicker & simpler to just show you a simple example that you can look at in your own iLogic Rule Editor environment, to follow how to get there.

Dim oPListRow As PartsListRow = (however you are setting its value)
Dim oDBOMRow As DrawingBOMRow = oPListRow.ReferencedRows.Item(1)
Dim oRowDoc As Document = oDBOMRow.BOMRow.ComponentDefinitions.Item(1).Document
Dim oRowFFN As String = oRowDoc.FullFileName

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)