Modify Line Styles in Filled Regions

I have a pretty successful script that takes lines that are on “incorrect” line styles and changes them to the correct one that I want.

However, sometimes these incorrect line styles are inside the sketch of a filled region and this particular script doesn’t pick them up. Has anyone found a way to get inside the filled region sketches?

Hi Jordan,

Quite a late reply, but please find attached a script to change the filled regions line styles.

It uses the SetLineStyleId Method.

FilledRegionSetLineStyle.dyn (7.8 KB)


Hi yes! Thank You for responding.

Can you tell me what version of Dynamo you are on? I’m on Revit 2018 Dynamo 1.3.1
Mine tells me there is an issue with line 27 in the second python script. It says the run completed but noting happens.

Also, I’m trying to push this through an automated system - I want to to blow though the whole project, all filled regions. Any thoughts on that vs the manual selection mode?

Hi Jordan,

I am using Revit 2017 and Dynamo 1.3.0

Line 27 should take each element from the input list. Please make sure that the input list is flatten:

I have run the script in an empty project with only 7 filled regions on 3 different views and I did not get any error message.

What issue does the python script give you?

hello Giovanni ,
Thank you mate .It seems to be working fine . Just a query of sorts , lets say there are like 45 or more filled regions of the same type and name , and we are looking at changing the structural line types universally using the above script of yours , how do you reckon we go about selecting all the filled regions of that name or type and changing the line type across .

Bit stuck with this , because currently , I am able to select it on an individual basis . Would be grateful for any feedback or input.


You can use List.ContainsItem and FilterByBoolMask to select all the filled regions of a certain type:

hey mate , thank you for the input .
but for some odd reason , the filter doesn’t work on all the filled regions of the type name. Just selects one , have attached a snap shot of the workspace .

think the screen shot above is not clear.
have attached it again in a high

er resolution.

hi mate ,
sorry , was able to figure it out at the end .
seems to be working as you envisaged.
Thanks a tonne!

Yes, great, I got it to work. Sorry for the delayed response. I was on vacation last week.

If I could insert this comment after post #4 on this thread, I would. Oh, it puts it in there, I see.

I do need to expand and explain. I need a little more variety for how we get in there (the filled region). The script you wrote works great but it now broadly changes all line styles in filled regions to Invisible Line, or whatever is plugged in. So what I asked for before probably seems kind of dangerous on its own (and it is).

I have attached a script that is a combination of yours and something I whipped up to modify line styles that aren’t in filled regions. I need to figure out how to combine them somehow but I don’t know where to start. The path that akmyousuf went down is narrowing down the selection by the type name of the filled region, I need to tell dynamo to change specific line style to another specific line style. The simplest example I have is change “Solid - 1” to “1 - Solid”, Implementing company standards kind of thing. My script can’t get into the filled regions and if you delete the line style itself, lines still utilizing the style you deleted, will fall to the “Thin Line” style. But you don’t get a report of that or anything.

Hopefully you will help me on this venture. :grinning:

I attached a snip of a list of scripts that I ran on a project so maybe you can tell what I mean. The chunk up top in the attached script hopefully will be descriptive as well. Maybe we can feed it all into the top half of the original script.

Filled Region Set Line Style - Combo.dyn (26.3 KB)

Filled Region Line Style Change 1

Hi Jordan,

Please find below a script that retrieves the Filled Region edges line styles. You could look for a specific line style and get the filled region that contains it. The only problem I’ve found, is that I was not able to change the line style of a single edge and this could not work for you.

The line style is stored in the Geometry.Element EdgeArray parameter. (If you haven’t done it yet, please install RevitLookup as it would have been impossible for me to find a solution without it).

I should also thank Dimitar_Venkov as I copied the code to access the element geometry from this post: Element.Geometry node (from Revit) to Python Script

Hi @Giovanni_Brogiolo
I very need script that retrieves the Filled Region edges line styles
So can you show me code in this python!
Thanks so much!


I am trying to use this python script in R2018 and DY 2.1. I get this error.

Try to wrap your filled region in a list (List.Create node)

1 Like


Thanks for the reply. It worked!

The explanation for wrapping it in a list node would be how python is handling the inputs?


It’s how python is handling the data, yes. The ‘for’ loop for r in region is expecting a list of filled regions, but you were only provided a single filled region before. By wrapping it in a list you get something to iterate over.

Has anyone looked at solutions for Family files, not projects? Line Style is different from the project, as it’s subcategory…

Any guidance appreciated!

I am attempting to use this python script but encountering an error at line 19 NameError: Name ‘app’ is not defined. I think i may be missing something before line 26 in your screenshot?

Filled Region edges line styles.dyn (8.0 KB)

Add these ones:

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
1 Like