Parts List Check

Parts List Check

Anonymous
Not applicable
257 Views
1 Reply
Message 1 of 2

Parts List Check

Anonymous
Not applicable

I have a checking rule where a part of it iterates through a parts list. However, when there's no parts list it errors.

The reason is the initial call....

 

Dim oPartList As PartsList
oPartList = oDoc.ActiveSheet.PartsLists.Item(1)

 

So if a drawing has no parts list, how can I make it jump over this.

0 Likes
258 Views
1 Reply
Reply (1)
Message 2 of 2

Vladimir.Ananyev
Alumni
Alumni

You may check PartsLists.Count property value.  If it is equal to 0, then  partslists collection is empty.

  Dim oDrawDoc As DrawingDocument
  Set oDrawDoc = ThisApplication.ActiveDocument
  Dim oSheet As Sheet
  Set oSheet = oDrawDoc.ActiveSheet
  If oSheet.PartsLists.Count > 0 Then
    Dim oPartList As PartsList
    Set oPartList = oSheet.PartsLists.Item(1)
  Else
    'oSheet does not contain any PartsList
  End If

 cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes