I have an assembly drawing but i want to seperate parts list in purchased items and items that need to be editted in the workplace.
I know you can filter the parts list but the standard filters are not doing it for me. So is there anyway to add a custom filter of custom iproperties?
Hi,
If you cannot filter for that in the UI, then it's not available in the API either.
But through the API you can implement your own logic of determining what to show and what not to show and then just hide the rows you do not want:
Private Sub FilterRows() ' Select the parts list you want to modify, then run the code
Dim dl As PartsList Set dl = ThisApplication.ActiveDocument.SelectSet(1) dl.PartsListRows(1).Visible = False End Sub
Cheers,
It's VBA code, but could be used in iLogic or VB.NET AddIn as well - you'd just have to remove the "Set" keyword.
If you wanted to test it in iLogic, then you'd have to run it without opening the iLogic Rule Editor, because that would cancel the selection.
Thanks for replying btw 😛
when i put the code in iLogic it says "error in rule program format: All other Subs or Functions must be after Sub Main ()".
When i put Sub Main () in front of the code it says the following:
Error in rule: Rule0, in document: test
The parameter is invalid. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
you know what this means ?
This is the code so far:
Sub Main() Private Sub FilterRows() ' Select the parts list you want to modify, then run the code Dim dl As PartsList dl = ThisApplication.ActiveDocument.SelectSet(1) dl.PartsListRows(1).Visible = False End Sub
Hi Jeff,
You cannot place a function inside another function. What the error said was that if you have multiple functions, then one of them should be the main function. In this specific case you can just remove all the function header stuff:
' Select the parts list you want to modify, then run the code Dim dl As PartsList dl = ThisApplication.ActiveDocument.SelectSet(1) dl.PartsListRows(1).Visible = False
But it might be easier to test in VBA. There you can debug into the code and there you also get intellisense when writing your code.
Cheers,