I’m working on a script to automate changing linetypes and linetypes of filled region sketches in Dynamo. Changing lines works great, but I’m having some trouble with the filled regions. I want to change all filled region sketch lines of Graphic Style “03_Solid_Black” to something else. So far I’ve only found a way to do this by specific filledregion type, not individual sub element graphic styles…
How can I iterate through the subelements and check their line styles? This python returns an empty list of subelements for each filled region.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
region = FilteredElementCollector(doc).OfClass(FilledRegion).WhereElementIsNotElementType().ToElements()
out = []
TransactionManager.Instance.EnsureInTransaction(doc)
for r in region:
z = UnwrapElement(r)
out.append(z.GetSubelements())
TransactionManager.Instance.TransactionTaskDone()
#Assign your outputs to the OUT variable
OUT = out