Modelical | ColorByParameter | Python code edit help needed

Hello community, @FrantxoMOD ,

I found this Graph (https://www.modelical.com/en/node/color-by-parameter/) which is really useful for my project, except for one thing… I want the colors to change in ALL (even better would be selected) Views.
Can the Python code in the Modelical be changed in such way the color will be overriden in ALL (or or even better selected) Views? I know Dynamo, but i can’t write Python.

I’m guessing the code applies to the active view. You would just need to wrap that portion in a loop for a list of views.

If i only knew how to do that :upside_down_face:

Learning Python is on my to-do list. I am learning Dynamo on the job / during projects and i am getting better at it (made some really nice .dyn). But also learning Python at the same time is a bit much at the moment.

I am looking at this https://forum.dynamobim.com/t/element-overrideinview-but-for-multiple-views/37072/6 topic. To put it differently :sweat_smile:, i am NOT to lazy to find out myself, but i am a bit under time pressure.

There are a bunch of posts on here about modifying python to work on a list. It’s worth looking into for sure. Depending on how complex the original code is, adding another loop is generally pretty straight forward.

That being said. I’m not familiar with this node and I can see enough in your image to know how it works. Are you providing a single view or does it automatically use the active view? If you can provide a view you can easily wrap this node in another custom node and feed it a list of views to iterate over. If the code automatically uses the active view you can still change it to an input and do the same thing.

I gonna go for a different approach. I will use the Python code provided in this :point_down: topic.

Too soon. That script also overrides the lines. I don’t want to override the color of the lines.

EDIT
Fixed the overrides lines

import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import OverrideGraphicSettings, Color
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

elements = UnwrapElement(IN[0])
views = UnwrapElement(IN[1])
fill_pattern = UnwrapElement(IN[2])
color_input = IN[3]
color_l= color_input.split(" ")
color = Color(int(color_l[0]),int(color_l[1]),int(color_l[2]))
TransactionManager.Instance.EnsureInTransaction(doc)
for i in elements:
	for view in views:		
		ogs = OverrideGraphicSettings()		
		ogs.SetProjectionFillColor(color)
		ogs.SetProjectionFillPatternId(fill_pattern.Id)
		ogs.SetCutFillPatternId(fill_pattern.Id)
		ogs.SetCutFillColor(color)
		ogs.SetHalftone(False)
		ogs.SetSurfaceTransparency(IN[4])
		view.SetElementOverrides(i.Id, ogs)	
TransactionManager.Instance.TransactionTaskDone()

Hi,

You could use the Override Graphics in View node with a list of elements, a list of views and a list of colors. (All inputs are optional)

@Alban_de_Chasteigner

Thanks for your reply. I am using your package build 2020.1.16, but i can’t find this node.
I guess it is available in a later version?

Yes the custom node was made in February.

Is there a way to override graphics for linked elements in a View?

Not for the moment. Not avalaible in the Revit API.

1 Like

Depends
If the parameter in the link is a shared parameter
You can add the shared parameter to the host file, as a shared project parameter set to the appropriate category
Then use the override

1 Like