Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Parts List Check

1 REPLY 1
Reply
Message 1 of 2
Anonymous
189 Views, 1 Reply

Parts List Check

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.

1 REPLY 1
Message 2 of 2
Vladimir.Ananyev
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report