Renaming Views - Manually Selecting View

In Revit I am creating callouts for floorplan details however there have been a couple of times where I have had to include another detail in amongst others and then manually rename the views and sheet names after the new detail (to keep them in sequence when looking at the overall floor plan). I’ve got PyRevit installed and I was able to increment the sheet names by selecting each view I wanted to increment however I also need to do the same with the views. The views are named with the following syntax: Sheet Number “Detail”. (The latter is likely to change to something a bit more descriptive).

First question, can I create a form interface similar to incrementing sheets in PyRevit?

If not, is there a recommended method that will specifically allow me to select the range of views I wish to change?

What, more specifically do you mean with range of views?

As an example,

If my views start from CO(21)25 Detail and end at CO(21)120 Detail and I have to add another detail e.g. CO(21)78 Detail, the existing CO(21)78 Detail and all subsequent views up to CO(21)120 Detail would then be incremented by 1.

Does that make sense?

There are custom nodes that can give all views (Grimshaw package has one). You could then filter some out by name if you’ve build a good system for it.

Hi Marcel, thanks for the screenshot. I’ve done a bit of research this afternoon and come up with a different approach which allows for my wish for selecting views. I believe I’m almost there but for some reason I’m unable to yet determine (due to my lack of dynamo experience) my graph is trying to write back the original view name to the view instead of the value I see in the graph. The screenshot should explain everything

Oops, my bad. It turns out I did already have a view 73 only it didnt have the view template applied to it causing me to think the last view was 72. I tried the graph on 73 and it works perfect on a single file however not on multiple. I’m almost certain its because its starting with the lowest number first instead of the last. To overcome this should I create a list and then reverse it? If I create a list from the selection, it puts everything on to row 0 of the list instead of 1 view name per list row. How do I go about this?

I’m sure you will solve it, you are almost there

From what I’ve read it appears rather than reversing the order the accepted approach is to apply a temp string to the parameter to allow renumbering with the desired sequence. I’ve seen this done as a manual 2 stage operation which requires unlacing a collection of nodes after apply the temporary string. I’d prefer an automated approach however in a single process. I’ve been trying tests to see if this is achievable but success has so far eluded me. After updating the parameters with the changed number and temporary string, I’ve then got a separate branch to which utilises string.replace to remove the temporary string and leave me with the renumber sequence I desire. I used the clockworks passthrough node in an attempt to sequence the renumber and then temporary string removal however the 2nd branch is renaming the view back to the original which I think is due to passing the original elements from Springs.Collector.CurrentSelection to the Element input the Element.SetParameterByName which follows the Passthrough Node. Is there anyway I can get updated values for Springs.Collector.CurrentSelection once the rewrite stage is complete?


Springs has a Refresh All node, you can also disconnect the Current Selection node, run the script (nothing happens), and reconnect.

Morning Marcel, just getting back to this after the weekend. I’ve searched for this Refresh All node and can’t find any nodes with that in the name.

Never mind, I just reinstated another boolean node before the Springs.Collector.CurrentSelection node on the 2nd branch and everything finally works.

Thank again

1 Like

image

Interesting. This is what I get:

You need to install the SpringsUI package :slight_smile:
image

Yeah I just noticed that, thanks :+1:

I’ve tried testing the refresh node but it doesn’t seem to do anything (but perhaps I’m not using it correctly?). Using the graph shown in the images I attached previously, how should I be integrating that node?

Whilst my existing method is working, it does not feel as smooth as it should be.

To clarify here are the problems I currently have with it:

  1. Doesn’t work with Dynamo player i.e. nothing happens
  2. Doesn’t work in the Dynamo editor if views are pre-selected before opening the graph. I need to have something other than views selected in the project browser ( e.g. Revit Links)
  3. Isn’t fully automated and still requires manual input After selecting the views I want to process, I have to toggle the first boolean (to increment the number and apply the temporary string) and then toggle the second boolean (to remove the temporary string).
  4. Unable to continually increment within the same Dynamo session i.e. After renaming the views, I was expecting continual toggling of the booleans to further increment the numerical counter of the view name but it does (perhaps the SpringsUI.Refresh can solve this but it didn’t in my tests)

I used to do a bit of VBA programming for MicroStation and I’m curious to know if how I would approach sequencing operations in that can similarly be applied to Dynamo to remove as much .

  1. Create a global variable(boolean) and assign it starting value e.g. False or 0

  2. In a procedure, reassign the variable the starting value once more (so that if the procedure is run more than once it reverts to the correct value without needing to restart the app)

  3. Do stuff in the procedure and once complete, change the value of the global variable to True or 1

  4. In second procedure, check the value of the global variable and if it’s true/1 proceed with the rest of the code else exit the procedure and the project.