Setting View Reference values

Setting View Reference values

theBIMtractor
Contributor Contributor
2,137 Views
11 Replies
Message 1 of 12

Setting View Reference values

theBIMtractor
Contributor
Contributor

I have a large project where I am breaking this down into 1:100 views on A1 sheets. Due to this I have nearly 4000 'For Continuation Refer To...' type View References to place and set to the correct continuation sheet. I have developed a script in Dynamo that is finding the correct Id and View Name of the continuation and have tried to drive these into the View Reference family by both the ValueString and ElementId (see snippet below - note both lists for view Id and Name are mapping correctly to the ViewRef). In both cases I get an error warning saying "Parameter is read-only". Do I need to open a transaction to push this value in or is this still not able to be achieved via the API? Maybe my method needs some rethinking? I recall asking a similar question some time ago and Mr Tammik suggested this was not possible at the time.

 

ctr = 0
for VR in ViewRefsIN:
    VRTargetId = VRTargetFoundId[ctr]
    VRTargetStr = VRTargetFound[ctr]
    for VRP in VR.Parameters:
        if VRP.Definition.Name == "Target view":
            VRP.Set(VRTargetStr).AsValueString
            #VRP.Set(VRTargetId).AsElementId
    ctr += 1

 

Thanks in advance for any ideas or help here.

2,138 Views
11 Replies
Replies (11)
Message 2 of 12

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @theBIMtractor ,

If the parameter is read-only you cannot set a value to the parameter.

Have a look at this below link

https://forums.autodesk.com/t5/revit-api-forum/modify-key-source-parameter/td-p/9591518 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 12

theBIMtractor
Contributor
Contributor

Hi Naveen, your answer seems pretty obvious, I guess my question should be is there any way to set this value other than a user manually selecting all 4000 View References and picking from the drop down list? From your previous response, I'm guessing the answer is no.

0 Likes
Message 4 of 12

theBIMtractor
Contributor
Contributor
Hi again Naveen, a further question on this. Do you know if it is possible to modify the value when placing a new instance of the View Reference?
0 Likes
Message 5 of 12

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @theBIMtractor ,

Q: Do you know if it is possible to modify the value when placing a new instance of the View Reference?

 

A: Sorry, your question looks unclear. What value? Which parameter's value? For view reference, some parameters are modifiable but not all.

I would strongly suggest you download Revit lookup. It will help you find which parameters are modifiable and which parameters are not.

https://github.com/jeremytammik/RevitLookup 

 

If this doesn't help, Could you please explain in detail what you are trying to do?


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 6 of 12

theBIMtractor
Contributor
Contributor

@naveen.kumar.t Hi again Naveen. As far as I'm aware there is only 1 parameter value that is user modifiable, that being the Target view as was highlighted in my original post. This issue seems to be one that Autodesk is ignoring as it has appeared many times over the years with apparently no progress. The posts below all relate to this going back to 2017. Perhaps it's time for your developers to actually come up with a solution instead of pretending to not understand the question?

 

https://forums.autodesk.com/t5/revit-ideas/create-view-reference/idi-p/8421071

https://forums.autodesk.com/t5/revit-api-forum/can-t-create-view-reference/m-p/8420626#M35004

 

Message 7 of 12

snhajared
Participant
Participant
Message 8 of 12

JBersheim
Explorer
Explorer

Isn't this only for Callouts? It's not for View References, right?

0 Likes
Message 9 of 12

snhajared
Participant
Participant

No, it works on both Callouts and reference Sections (read the docs):
EDIT: Just confirmed it also works on referenced Elevations.

snhajared_0-1646860299236.png

 

I've used this method to re-associate all the View References in a project from placeholder (empty) Drafting Views to new (populated) Drafting Views that were brought into the project later using the Insert Views From File tool.

 

0 Likes
Message 10 of 12

snhajared
Participant
Participant

Ooohh, you mean this kind of View Reference:

snhajared_0-1646863371832.png


not this kind:

snhajared_1-1646863526708.png

 

You are correct, that method only works for "Reference Views", not for "View References".

0 Likes
Message 11 of 12

JBersheim
Explorer
Explorer

Correct. View References, not Reference views. Can you guys put that on the to do list? 

Message 12 of 12

amorris3817
Contributor
Contributor

Has there been any movement on this? Are we still not able to set target view in VIEW REFERENCES through the api?

0 Likes