Set linestyle to <Invisible>


I would like to set the line style of some filled regions to ‘Invisible’. I’ve used various nodes to get the document’s line styles but ‘Invisible’ is not included. I’m guessing that this is because it is some sort of in-built special line style.

Any ideas how I can access it?

  1. Correct name is ‘Invisible line’
  2. ‘Invisible line’ is not really a ‘Line Style’ but ‘Override Style’.
    I think both of above or one of them cause it.
    You can use Element.OverrideInView instead.

Yes sorry, I meant ‘Invisible line’.

So how do you create or retrieve the override style for ‘Invisible line’? It is not contained in Line Patterns…

Connect “True” to ‘hide’

1 Like

This should work.

1 Like

@Hyunu_Kim Connecting True to Hide results in the entire filled region being hidden. I only want to set the sketch lines to invisible.

@SeanP Thanks. So Invisible is a GraphicStyle?! Looks like the Archilab node is using a different method instead of the FilteredElementCollector, hence why it is different.

With the invisible graphic style, I then needed to set the filled region perimeter. Filled regions don’t have a Line Style parameter so needed to use a different method. The Plissken package had this python code which works:

##Written By Thed Hogan

import clr
from Autodesk.DesignScript.Geometry import *

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System import *

#The inputs to this node will be stored as a list in the IN variables.
doc =  DocumentManager.Instance.CurrentDBDocument
app =  DocumentManager.Instance.CurrentUIApplication.Application
#These are my inputs for the Node
filledRegion = IN[0]
toggle = IN[1]
gStyle = IN[2]

#Declared Variables
output = list()
startPoint = list()
endPoint = list()
existingLines = list()
profiles = list()
filledRegionCount = 0

collector = FilteredElementCollector(doc).WherePasses(ElementOwnerViewFilter(doc.ActiveView.Id)).OfClass(CurveElement)

for element in filledRegion:
	filledRegionCount = filledRegionCount + 1
	notProfile = True
	idSub = 1
	while notProfile:
		if doc.GetElement(Autodesk.Revit.DB.ElementId(element.Id - idSub)).ToString() == "Autodesk.Revit.DB.Sketch":
			profiles.append(doc.GetElement(Autodesk.Revit.DB.ElementId(element.Id - idSub)))
			notProfile = False
			idSub = idSub + 1
			if idSub > 1000:
				notProfile = False
#Collect existing <sketch> lines in the view, the toggle can reset the collection
if toggle == True:
    for detailLine in collector:
        if detailLine.get_Parameter(BuiltInParameter.ELEM_CATEGORY_PARAM).AsValueString() == "<Sketch>":
#Check each filled region
for i in range(0, filledRegionCount):
	#Set currentRegion:
	currentRegion = profiles[i].Profile.get_Item(0)
	changeRegion = False
	#Find the Curves of Each Filled Region, using start and end points of existing lines in the <sketch> Category of the current view
	#Compare the lines current linestyle to the given linestyle and determine if a change needs to happen
	for curve in currentRegion:
		if curve.GetEndPoint(0).ToString() in startPoint and curve.GetEndPoint(1).ToString() == endPoint[startPoint.index(curve.GetEndPoint(0).ToString())]:
			#The Method .get_Parameter() was depricated after Revit 2015
				if gStyle[0].Name != existingLines[startPoint.index(curve.GetEndPoint(0).ToString())].get_Parameter('Subcategory').AsValueString():
					changeRegion = True
			#If the above fails, it means this is is being run in Revit 2016 or later, so we will use .LookupParameter() instead, the try/except allows us to avoid having to perform a Revit version check for a relatively minor change
				if gStyle[0].Name.ToString() != existingLines[startPoint.index(curve.GetEndPoint(0).ToString())].LookupParameter('Subcategory').AsValueString():
					changeRegion = True
	#If one or more Lines in the border are not the same as the given linestyle, begin a transaction to change that filled region
	#This transaction must be nested inside of an if statement, to prevent it from running indefinitely and crashing the file while Dynamo is set to Automatic
	if changeRegion == True:
	#Send back the list of Filled Regions

#Assign your output to the OUT variable.
OUT = output


Hello …another way without python…


Ha, I am so conditioned at this point I jump to Python first almost without thinking. This is a good catch!


hehe :wink: you old python shark ;)…

I can’t seem to get this to work in Revit 22, but it works just fine in Revit '21 and older… do you have any insight (if you still use this script)?