Hide all lines of a specific line style / texts of a specific text type

Hi,

I am trying to create a script to hide all lines of a specific Line Styles. I have followed the instructions from this very similar topic to create the script attached. But when I run the script, all lines in the project disappear. Looks like it fails to filter out the target Line Styles.

Any hints much appreciated!

-Toan

1 Like

Hi @ToanDN ,
what I can say from your screenshot is that the problem most probably happens when you filter your list. Nothing comes out of the “In” output, and thats where the lines of the line style you want should be… I would be intersted in seeing what comes out of the list.map node…

Anyway,
You can try this if you’d like:


This little code will get all lines of a linestyle (then you can hide them with the view.hideelements node) :

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

I have wrapped it in a node called “all lines of linestyle” in the Node-Mode package.

I hope this helps

4 Likes

Wow… that is so simple and working great. Thank you very much!

1 Like

So I am creating a very similar script to hide all text of a specific text type. The list shows correct items being filtered but the final command fails. Please advise. Thanks!

The issue here is that you’re giving the view.hideelements strings instead of revit elements. This should work:

2 Likes

Hi everyone,
I have a similar problem with the hide/unhide node from archi-lab pakage.
I try to hide a CAD file but unfortunately it occurs an error:

I can’t figure out what is wrong, any advice?

Hi @Leo_Hart Could you please start a new topic and add this topic as reference. Thanks.