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: 

Is there anyway to filter parts list on custom iProperties ?

5 REPLIES 5
Reply
Message 1 of 6
JeffBongers
668 Views, 5 Replies

Is there anyway to filter parts list on custom iProperties ?

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?

 

5 REPLIES 5
Message 2 of 6
adam.nagy
in reply to: JeffBongers

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,



Adam Nagy
Autodesk Platform Services
Message 3 of 6
JeffBongers
in reply to: adam.nagy

Did you put the code in iLogic or in Visual Studio ?

Message 4 of 6
adam.nagy
in reply to: JeffBongers

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.



Adam Nagy
Autodesk Platform Services
Message 5 of 6
JeffBongers
in reply to: adam.nagy

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
Message 6 of 6
adam.nagy
in reply to: JeffBongers

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,



Adam Nagy
Autodesk Platform Services

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

Post to forums  

Autodesk Design & Make Report