Change Reference Planes (colour / line pattern) in Family

Hi All, trying to create a graph that changes the line colour and line pattern of reference planes in a family. I have been having great difficulty though simply trying to extract this info, let alone start changing it. I started with get and set subcategories from the Genius loci package, but that was only showing me model subcategory properties, I need to see annotation categories, then realised default reference planes in families are just categories (duh) so then ended up where I am now, but I just can’t find any nodes that get or set the properties of the reference planes… I have RevitLookup, but am not very experienced using it, so wasn’t sure what to look for…
so I think it is time to ask for some direction because I have nodes all over the place that were connected at some point or another, but none seem to be helping :laughing:

Good news and bad news for you, I am dealing with a bunch of templates in my new office and this is something I´ll have to do soon, so I created the script:

import clr
from Autodesk.DesignScript.Geometry import *

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

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

doc = DocumentManager.Instance.CurrentDBDocument

# Get all categories
cats = doc.Settings.Categories

# Set helpers and variables
color = Color(IN[0][0], IN[0][1], IN[0][2])
graphSty = GraphicsStyleType.Projection
refPlanes = ""

# Retrieve Ref Planes
for cat in cats:
	if cat.Name == "Reference Planes":
		refPlanes = cat

# Start Transaction

# Modify color and line pattern of ref planes
refPlanes.LineColor = color
refPlanes.SetLinePatternId(ElementId(IN[1].Id), graphSty)
# End Transaction

OUT = 0

Bad news, you will have to move a ref plane and back again in dynamo (under the pump and I wish I could give you the finished version but too busy).

1 Like

Hi @Damo3,

Here’s how you can do it with nodes.

As @architectcoding pointed out, you need to refresh he graphics display of the reference plane elements. I used the Elements.SetPinnedStatus node to force this refresh.
Personally, I will avoid moving reference planes because I can’t predict what will be the consequence.


Ahh, really, you have to refresh, how odd? Thanks to you both for the feedback, I haven’t been able to try these because my Revit install packed it the day after, so I will get onto these this weekend.

thanks @Alban_de_Chasteigner. I tried your graph modifications, but it actually isn’t working for me. Both the colour and line pattern doesnt change, i even tried them separately. I know the graph is doing something though, because all the ref planes pin. Which made me realise, i can’t use the pin method to refresh because it will break the family. In short, I am gobsmacked I managed a graph by myself the other day to search and filter element ids and export to excel, but I cant change the line pattern of a ref plane :joy::joy::laughing:

The Set SubCategory Properties node is ligth grey. This means that a value is missing at one of the inputs. Primer : Node States

For some unknown reason, one of the default values of the node isn’t enabled. Connect a codeblock with null; inside to the ProjectionLine, CutLine and Material inputs and it should work.

To refresh the graphics display, you can also close and reopen the family.