Get lines by subcategory in a project

Hello everyone, I need your help.

I try to get specific lines of a family into Dynamo.

I got it now to get all lines of a family into Dynamo.

but how can I sort this lines by subcategory?

I tried it like this:

but this never gives me the subcategories of the lines in the family.

I looked around here and didnt find a solution for that.
Thank you

Hi @josef.radi,

Is this what you’re expecting ?

Hello @Alban_de_Chasteigner,
I think its close.

This gives me the line Styles of the lines in the project. I need the Subcutegories of the Lines in the families of a project. Is this possible?

1 Like

Are you just trying to sort the lines and group by subcategory? Could you not do GroupByKey? Just use the obj to string as the keys and the line element list as list.

@kennyb6 Yes. In a Project.

Hmm I try. like this?:

Oh I misunderstood the premise. You need to get the subcategory of the lines, what you had before was just the list of all subcategories.

Yes. With this:

I get already all the lines of all Generic Models Families in a project. Now I want to Group the lines by the subcategories. How can I do that?

Yes they have different subcategories and I wanna filter them by those.
I really have no Idea how to work with the API. :grimacing:

I jumped the gun on Subcategories. API will get you them as long as they are curves. I can try in a little bit when I am free, but if anyone else wants to its just the line.Subcategory

So I am giving it a try and first problem is that it is saying subcategories can only be accessed within a family doc, so feeding it your list of lines wouldn’t work. I didn’t expect it to work to begin with since the lines you have are not the Revit family lines but just Dynamo elements based on the curves. Meaning the lines you have selected has no connection to the generic model besides being in the same place, no data or anything.

So instead, you would have to feed it a list of families, open the family docs, select the lines, use the Subcategory method, then return the subcategories.

If you are trying to use this script to filter those lines you see in Dynamo, I don’t think it will work like that.

Hmm thats bad.

I dont understand why I can access the lines within a family in a project, but can not get the subcategorie name.

Does an other Idea come into your mind how I could group lines of families within a project? I thought it would be easiest with subcategories. I would need these different lines to go on with my skript…

I am not familiar enough with Revit API to help you, sorry. Maybe someone more knowledgeable can chime in. As for the lines you accessed, what is in the Dynamo viewer are not the lines from the family but just a Dynamo copy of it. It has no data to it so you cannot get the subcategory for it. All it is is the location/curve geometry.

1 Like

Thank you very much.

Okay I found out now I can get also all the subcategories of all my generic models.
And I already have all the lines of my generic models. How can I filter the lines by the subcategories?

Edit: You still have the same problem that you don’t know what the subcategory the lines are. The subcategory node just tells you all of the subcategories available to that category.

No. The subcategories are just all of them which are anywhere in any Generic Model. And the List of lines is divided in how many lines are existing.

Hi @josef.radi

It seems you’re confused as to what is Revit geometry and what Dynamo geometry and which information is held by what elements…

In any case have you tried looking into this node from Clockwork giving you a list of Dyn-Geometry, Revit-Geometry and sub-Category from elements rather than from Category? :slight_smile:


1 Like

Hello @Jonathan.Olesen

That is a good idea, and it works with all the Solids of my family.

Do you know a way to get this to work also for the Lines in a family?

No I do not, not without having the relevant models to test on at least :slight_smile:

1 Like

Okay Ill give you.