Change MembersToInclude of a PartsList

<?xml encoding=”UTF-8″>By Adam Nagy

In the UI you can change which member of an iPart or iAssembly is included by double clicking the parts list and then clicking the “Member Selection” button:

MembersToInclude2

If you try to change the included member like this then you’ll get an “Invalid procedure call or argument” error:

MembersToInclude

If something does not work then it’s always good to try to do it through the UI and then check the results in the VBA Watches window:
http://adndevblog.typepad.com/manufacturing/2013/10/discover-object-model.html

If you did that then you’d find (as shown in the above image) that MembersToInclude stores an array of strings – so that’s what you’d need to pass to it:

Sub ChangeMembersToInclude()
' The PartsList needs to be selected in the UI
Dim oPL As PartsList
Set oPL = ThisApplication.ActiveDocument.SelectSet(1)
' This works
Dim members(0) As String
members(0) = "iPart-02"
oPL.MembersToInclude = members
End Sub

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading