Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Insert parts list onto titleblock

matmik1
Explorer

Insert parts list onto titleblock

matmik1
Explorer
Explorer

I have found a code where parts list is inserted into sheet border but can't modify it to insert the part list just above my titleblock - drawing table, when I define a distance from X/Y point, parts list isn't placed in the same place on different sheet formats.

 

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument
    
Dim oSheet As Sheet
oSheet = oDrawingDoc.ActiveSheet

'Detect if the template has a parts list
Try 
Dim oPartslistCheck As PartsList
oPartslistCheck = oSheet.PartsLists(1)
partslistpresent=True
Catch
partslistpresent=False
End Try

If partslistpresent=True
        
        'Delete the current parts list
        Dim oPartsList As PartsList
        oPartsList = oDrawingDoc.ActiveSheet.PartsLists.Item(1)
        oPartsList.Delete
        
End If
                
    ' Set a reference to the first drawing view on
    ' the sheet. This assumes the first drawing
    ' view on the sheet is not a draft view.
    Dim oDrawingView As DrawingView
    oDrawingView = oSheet.DrawingViews(1)
    
    ' Set a reference to the sheet's border
    Dim oBorder As Border
    oBorder = oSheet.Border
    
    Dim oPlacementPoint As Point2d
    
        xrev = oBorder.RangeBox.MaxPoint.X
        yrev = oBorder.RangeBox.MaxPoint.Y
        
        oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(xrev, yrev)
        
    ' Create the parts list.
    Dim oPartsList1 As PartsList
    oPartsList1 = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint)
oPartsLis1t = oDrawingDoc.ActiveSheet.PartsLists.Item(1)


oPartsList1.Sort("PART NUMBER")
oPartsList1.Renumber

oPartsList1.Style.UpdateFromGlobal 

'Switch style back and forth to ensure style is up-to-date oPartsList1.Style = oDrawingDoc.StylesManager.PartsListStyles.Item("Parts List (ANSI)") oPartsList1.Style = oDrawingDoc.StylesManager.PartsListStyles.Item("Parts List (ISO)") InventorVb.DocumentUpdate()

 

0 Likes
Reply
Accepted solutions (1)
236 Views
1 Reply
Reply (1)

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @matmik1 . I recently answered a similar question. In case, if you cannot find a solution, let us know about your problem.

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