Get list of all system/loadable categories of families in document

Hi all,
is there a way to retrieve a list of all used categories in the document, divided by system and loadable?
I’ve searched the forum and tried various ways combining several package nodes but had no luck.

I stumbled into this useful script by @AmolShah which retrieves all used and unused categories, which is a good start for me. Now I would like to get all the filtered output of used categories divided into lists of system categories and loadable categories.

Anyone run into this need before or know of any workflow to get to it?

Thanks in advance.

If you change the variable count to fecElems, and stop the collector before the .GetElementCount() method, you could then pull the parent family (not the type), try to get the family document for each and that will tell you which are are lovable and which are not (by the error)…

I think it might be easier to start at the family level rather than the category level though… tough to say as both have specific advantages.

Why are you after this data?