Message 1 of 12
API add partslist on drawing

Not applicable
05-27-2015
02:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to create a partslist on drawing. I managed to achieve this for getting the partslist for the first object on sheet (got the rule from Programming help).
Public Sub CreatePartsList() On Error Resume Next ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet ' 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 Set oDrawingView = oSheet.DrawingViews(1) ' Set a reference to th sheet's border Dim oBorder As Border Set oBorder = oSheet.Border Dim oPlacementPoint As Point2d If Not oBorder Is Nothing Then ' A border exists. The placement point ' is the top-right corner of the border. Set oPlacementPoint = oBorder.RangeBox.MaxPoint Else ' There is no border. The placement point ' is the top-right corner of the sheet. Set oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width, oSheet.height) End If ' Create the parts list. Dim oPartsList As PartsList Set oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint) End Sub
But this does not serve my need, I want to get the partslist from the first object on sheet1. How can i adjust to do this?
Or can i just replace "oDrawingView" with my object location? (tried it but this does not generate anything.)