iLogic Code Parts List Filter Options Variant

iLogic Code Parts List Filter Options Variant

Tim_Mulder
Contributor Contributor
331 Views
2 Replies
Message 1 of 3

iLogic Code Parts List Filter Options Variant

Tim_Mulder
Contributor
Contributor

Hello All,

 

This is probably the easiest question you'll answer today (its been too long since I have done ilogic coding)
I am trying to write a line of code that turns on a Part List Filter, in particular the Purchased Items Only filter.

Tim_Mulder_0-1709190239407.png

I can't (for reasons unknown to me) apply the correct Variant Option to the below code

Tim_Mulder_1-1709190400862.png

How do I write this Variant into the FilterSettings.Add() code?
Thanks in advance for your help
Much Appreciated

 

Regards

Tim

 

0 Likes
332 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @Tim_Mulder.  Here is an example iLogic rule you can try out, or just review for reference.  It first allows you to manually 'Pick' the PartsList object you want to edit, then it attempts to set that one filter in it for you.  However, I was not able to test this code before posting it, because I do not yet have the update that enabled the PartsList filtering tools.

Dim oPList As PartsList = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingPartsListFilter, "Select a Parts List.")
If oPList Is Nothing Then Return
Dim oFSettings As PartsListFilterSettings = oPList.FilterSettings
oFSettings.Enabled = True
Dim oNVM As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oNVM.Add(“PurchasedItemsOnly”, True)
Dim oFilterItem As PartsListFilterItem = oFSettings.Add(PartsListFilterItemTypeEnum.kPurchasedItemsFilterItem, oNVM)
oFilterItem.Enabled = True
Dim oSheet As Inventor.Sheet = oPList.Parent
oSheet.Update
Dim oDDoc As DrawingDocument = oSheet.Parent
If oDDoc.RequiresUpdate Then oDDoc.Update2(True)

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

Tim_Mulder
Contributor
Contributor

Thanks for the reply Wesley,

 

For some reason when I run your code I get an Unspecified Error on line 7.

Tim_Mulder_0-1709712496644.png

This is the part of the code I am interested in as well (applying the Purchased item only filter)

Any ideas?

 

Kind Regards

Tim

0 Likes