Filter or Separate Revit Model Lines

I need to separate curved model lines from straight ones into two separate lists so that I can run different nodes on each type of line. I noticed that curved lines have a parameter called “Center Mark Visible” That I was trying to use with the Element.ParameterExists node from the Clockwork package. Even though I can get the node along with List.FilterByString to create a list of just the curved lines, when I try to use the List.FilterByBoolMask it creates a list that from the first elements that only match the same quantity of of the curved lines and not the correct index of the curved lines.

Any suggestions on how to break this list into two more efficiently?

Hi @CBailey

you should just use the output of the “parameterexists” node as mask on the “filterbyboolmask” node.
The “in” output will then be the elements that have the parameter and the “out” output will be the rest of the curves.

Also, here’s an alternative workflow you could use :

@Mostafa_El_Ayoubi

Thanks! That worked great. One last question though. How would you suggest getting only lines from just one line style vs all line styles. As you can see I am using Categories and All Elements of Category which gets me all lines.

Thanks

@CBailey
there are no OOTB nodes for that… You’re going to have to use some python.
you could do it like this :

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *


doc = DocumentManager.Instance.CurrentDBDocument


alllines = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Lines)
n = IN[0]
lines = [x for x in alllines if x.LineStyle.Name == n ]

OUT = lines

@Mostafa_El_Ayoubi

Python is way above my head right now. :smile: I copied the code as shown, but only get items in the list when I use “Lines” in the code block. It appears to bring in all lines regardless of their style name. Would I also need to edit the Python script to get the other line styles?

Thanks


List.FilterByBoolMask(lines,lines.GetParameterValueByName(“Line Style”).Name == lineStyle);

2 Likes

2 Likes

@CBailey
I was about to post a very similra graph to Vikrams:

Line Style is actually way easier to access than I thought… :slight_smile:
As for the python code, I’m not sure why it doesnt work for you:

1 Like

@Mostafa_El_Ayoubi @CBailey @Organon Here is another approach.


1 Like

@Mostafa_El_Ayoubi @Kulkul @Vikram_Subbaiah @Organon

Thanks for all the help!!! :grin: Awesome community. Here is what I decided to go with since I needed to create two separate lists for only the two specific line styles needed.

@Mostafa_El_Ayoubi
The reason why the Python didn’t work for me was that I had an older version of my test file open that Dynamo was pointing at. In the old file it had only the one line style that I was able to pull. ID-10-T error. :blush: