Remove/Replace Viewport on Sheet

We have an issue with Keynotes not appearing on sheets at random. The keynote is empty and the note does not appear in the schedule. The only work around we have found is to manually remove the viewport containing the keynote and then just add it back. The notes appear and the schedule is updated. I am trying to implement Dynamo to automate this task. I have a script (attached) that finds the viewport center which I intend to save, remove the viewport and replace it at the point saved. So, my question is since I haven’t been able to find it via google or forum search, is there a way to remove a viewport from a sheet? I am filtering this in the attached script to a single sheet since I have several and it’s not productive to wait on the long run for all sheets.

I should have specified that the keynotes disappearing and reappearing are User Keynotes.

There are nodes for viewport management in SteamNodes, Archi-Lab Grimshaw, Rhythm, Data-Shapes and Bakery…

These nodes do not allow for the removal of a viewport from a sheet. I am looking for an implementation of the ViewSheet.DeleteViewPort() from the API.

…could possibly be done with Element.Delete from Archi-Lab Grimshaw, for instance

Ok. I have succeeded in extracting the views from the respective sheets and the points where the view was placed. Now I have removed the view using Element.Delete. When I read in the previous element ID of the view and attempt to replace it on the sheet from which it was removed I get the message from Tool.PlaceViewsOnExistingSheets that the view is already placed. I have restarted Dynamo and Revit between deleting the view from the sheet and the script to replace the view.
Any ideas?

I have updated the script to use the View Name instead of the ID. No change. Tool still returns the view is already placed.

I can’t imagine any simple solution to this issue. Maybe bimorph.DuplicateSheets from BimorphNodes would help. Here is also a thread concerning ID’s:

You might want to try Clockwork’s passthrough node. It allows the output to be executed after the waitFor input.

Jesse -

I’ve got the following script to run. Note the directions in the pink group, I had to disconnect the element delete node to populate views and coordinates then reconnect to run. If you have Dynamo player you can create a step 1 and step 2.

Good luck!

@blazzeri Could you please upload image again. It is not readable. Thanks :slight_smile:

Just added two shots zoomed in. Thanks!

1 Like

@blazzeri The script worked on the project in question with the exception the views replaced were not in the original position from where they were removed by the Element.Delete. The key notes did repopulate.

Did the View.ViewPort Box Center node populate coordinates?

Yes, the views were populated and the ViewPort Box Center has coordinates

We’ve been having the same issue with key values disappearing from the view and schedule.
I’ve noticed that adjusting the crop region, modifying the view range, and even hiding/unhiding elements seem to “refresh” the view and allow the keynotes to repopulate.

Just something to keep in mind.

Hmm… mine are not having that issue. Are you running the script in the two part series? I was only able to get it to work if I ran the coordinates and views first and delete/replace views second.

Nick, I think you are right. We are only having this issue with cropped dependent views. Do you have any Dynamo solutions for adjusting crop regions or view ranges to help streamline this “refresh” process?

Thank you!

A quick solution, if your dependent views are using scope boxes, is to try adjusting the scope boxes manually so all dependent views are forced to refresh.

As for Dynamo solutions - I’ve tried a few different angles. The problem is that they all can take a while when running on a larger projects because it’s just a brute force approach at that point. I started out hiding then unhiding grids in all placed views. I then moved on to adjust view range (and again moving it back) which seemed to be a little quicker. You’ll have to find what works best for you, but there definitely are options.