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.
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…
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.
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!