- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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()
Solved! Go to Solution.