I have a script where I sort pile foundations on bottom and top elevation and give each elevation a color, bottom and top separate of course. So in plan view you can simply check whatever the elevations are correct.
Now i need one last step. I want to create a list of colors and elevation values behind it. So each color stands for a elevation, so I want it in a schedule or something. I tried to add an instance image parameter for the pile foundation family, but that parameter can only be a type parameter. That is not working, because I need it to be instance.
My idea now is to create several surfaces, as many as colors there are, and place the values behind it. Can this be done on a drafting view? How do I place those surfaces in a drafting view?
A drafting view seems like a good approach, but I’d think you’d need to create a fill region and fill region type for each color. I’ve drawn filled regions before with Dynamo but I’m not sure how straight forward it is to create a new type with a specified fill pattern.
Here’s what I use for drawing fill regions (originally designed for converting space boundaries):
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
spaceBoundaries = IN[0]
filledRegionName = IN[1]
for fr in FilteredElementCollector(doc).OfClass(FilledRegionType):
if Element.Name.GetValue(fr) == filledRegionName:
filledRegion = fr
break
viewId = doc.ActiveView.Id
TransactionManager.Instance.EnsureInTransaction(doc)
regions = []
spaceBoundaries
curveLoopList = []
spaceCurves = CurveLoop()
for boundarySegment in spaceBoundaries:
spaceCurves.Append(boundarySegment)
curveLoopList.Add(spaceCurves)
region = FilledRegion.Create(doc,filledRegion.Id,viewId,curveLoopList)
regions.append(region)
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = regions
Creating a new fill region type works just like duplicating any other element type. The only new thing I ran into was the input value for Color. Revit was taking an integer based on RGB values. You just need a little formula for converting Dynamo colors to the correct integers:
I want to create new Filled Region Type in order to colored specific room of my project. I tried to duplicate Filled Region Type like I used to do with other elements (windows for example) but i must do something wrong because it not works !!
I join a screenshot of my Dynamo in order that you can see what i have done.
@Vtygy, this is one of the few times you don’t want your list size matching up. Try passing the single FilledRegionType into elementType instead of a list. Don’t know why that seems to cause problems, but it does.