Update View Reference Target View


I’m passing a list of floorplans with an ordered View References elems.

I tried this node hoping it used the same param.

any ideas on a node available? If I used it in python do I need to get the Ids of the view, floorplan and then use a named parameter change? How would I go about it?

I know to use the

ChangeReferencedView(
	Document document,
	ElementId referenceId,
	ElementId desiredViewId
)

Method, but am more familiar with C# Revit recently, been a while since I used Python/Dynamo :smiley:.

Edit: Further to this tried

# Load the Python Standard and DesignScript Libraries
import clr
import sys
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

# The inputs to this node will be stored as a list in the IN variables.
doc =  DocumentManager.Instance.CurrentDBDocument
idx = 0

ViewRefs = IN[0]
FloorPlans = IN[1]

for viewRef in ViewRefs:
	target = FloorPlans[idx]
	viewRef.ChangeReferencedView(doc, view.ElementId, target.ElementId)
	idx = idx + 1

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

And got
image

Sorry for the edits trying to get it done for a project today :smiley:

Hello @george.potts and welcome here…not sure but seems your list length doesnt match…9 callouts…reference have alot

Hi thanks! Yes, in a test project only placed a few for the time being to get it to work, hence why the loop in python is to the view refs and not the floor plans.

I should make it clear I am using View References, not call outs.
image
I was hoping the parameter name was the same, it wasn’t but want to do a similar thing to the node, update the view it references with the associated floorplan

1 Like

Read-only. That will explain the issue in Py.

@george.potts just to confirm, this means Revit API does not allow you to modify target view, right? Thanks

Yes Read-only params cannot be edited from from the API.

1 Like