ILogic - Parts List

ILogic - Parts List

JamieSENG
Advocate Advocate
1,205 Views
1 Reply
Message 1 of 2

ILogic - Parts List

JamieSENG
Advocate
Advocate
Is there anyway of automatically inserting a parts list based on view in a drawing. The idea is that when I've selected my drawing blocks and generated the views a parts list is automatically created.

Thanks in advance.
0 Likes
Accepted solutions (1)
1,206 Views
1 Reply
Reply (1)
Message 2 of 2

Vladimir.Ananyev
Alumni
Alumni
Accepted solution

PartsLists.Add method should help you.

It returns the newly generated PartsList object on the active sheet.

In arguments you should provide at least the DrawingView object and the placement point.  Other arguments are described in the Inventor API help.

 

Here is the iLogic rule that is based on the sample from the help.  To run this sample, have a drawing document open. The active sheet in the drawing should have at least one drawing view and the first drawing view on the sheet should not be a draft view.

 

' iLogic rule CreatePartsList places the parts list 
'at the top right corner of the border if one exists, 
'else it is placed at the top right corner of the sheet.

'Drawing document should be active, 
'The first view should be tied to the assembly model
Try
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument = ThisDoc.Document

'Set a reference to the active sheet.
Dim oSheet As Sheet = 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 = oSheet.DrawingViews(1)


' Set a reference to the sheet's border
Dim oBorder As Border = oSheet.Border

Dim oPlacementPoint As Point2d

If oBorder IsNot Nothing Then
    ' A border exists. The placement point
    ' is the top-right corner of the border.
    oPlacementPoint = oBorder.RangeBox.MaxPoint
Else
    ' There is no border. The placement point
    ' is the top-right corner of the sheet.
    oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width, oSheet.Height)
End If

' Create the parts list.
Dim oPartsList As PartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint)

Catch
    MsgBox("Some error")
End Try

 

You may associate this rule with some Inventor event available in the drawing document context, e.g., Drawing View Change:

Drawing Doc Events.jpg

 

Hope this helps.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network