LinePatternElement names


I have a question about a python code i started with.

My main goal is to use this as a line fill pattern node.The code now collects all the Lines in the project and i can do a name pick. But what i would like is that Python creates a list of all the lines patterns (names) as the OUT value and that you can pick one of the patterns as the line you want to use. Now you have to change the patterns[1] to patterns[3] within the code to get an other pattern. But that isn’t a nice workflow :frowning:
Maybe someone with ideas?


You could replace line 15 and down with:

output = []    
for i in range(len(patterns)):
    namepick = pattern[i].ToDSType(True)
OUT = output

1 Like


This is what i searched for :slight_smile:

Final result

Nice! :slight_smile:

I just reviewed the code and this is more efficient:

import clr
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
import Revit
doc = DocumentManager.Instance.CurrentDBDocument
output = []    
for type in FilteredElementCollector(doc).OfClass(LinePatternElement).ToElements():
    namepick = type.ToDSType(True)
OUT = output


I used your code part to create the filter node. So it was very helpfull to understand python a little bit :slight_smile:

I only can’t find the Id for a Solid line when you decide you don’t want an other pattern. Do you know where to find this?

For other users, this was the basic part as a start to make this code/node:

1 Like

Have a look here:
and here:

The “solid” is special and is not really a line pattern (even tough it looks that way). It can however be set using:
“ProjectionLinePatternId” of the “OverrideGraphicSettings” of a category the Id of the Solid “pattern” is: -3000010

Hi @vanlion
I’ll take the freedom to change the solution back to the original solution as this was in fact the solution to the issue stated in the name (making it easier for other users to find).

This last bit is a “add-on information” for those interested :slight_smile:

1 Like

Only thing that is not so “fancy” with my code is the Pattern input.

Would be nice if you had the possibility to make a drop down node where you can select the pattern

Like this:


Yes :slight_smile:

Is that node available in Dynamo 1.2.1?

Can’t speak for 1.2.1 but it is in 1.3.2 :slight_smile:

Nope can’t find it :frowning:

Oke but i can’t find it in version 1.2.1 working with an older version of Revit that doesn’t support 1.3.2

I don’t know if this is within your abilities, but you could find the source code for the node on github and simply create it for yourself :slight_smile:

Oke Always can give it a try.

Python is new for but before i did a lot of things with Ruby and Sketch up.

Where can you find the github source codes from Revit/ Dynamo?

The code is in C#, and the github brach of 1.3.3 is here:

and for DynamoRevit2018: