I’m trying to place views on top of existing viewports. The existing viewports are demolition views and the views I’m trying to place are existing room name views (they are just room tags of the existing rooms with nothing else on the view). Each corresponding view has the same scope box as the viewport it is being placed on top of.
The workflow is:
Find the center of the existing viewport
Place the existing room name view on top of that viewport in the same location.
This is what I thought I’ve done, but every time I run it the existing room name views are slightly off-center to the left of the original views. The vertical position is correct. Am I doing something wrong when finding the center of the existing viewport?
Ignore all the frozen nodes off to the right. I’ll refine that and get it to set the viewport types after I’ve fixed this issue.
Thanks for the suggestion, but that node didn’t solve the issue. Annotation crop may be impacting it, I’m not sure honestly. The existing room name views all have the same crop region/scope box as the view they will be overlayed on.
There’s a comment down at the bottom that points out that view origins are different. So maybe that’s the problem? I have no idea how to incorporate his solution though.
I can make a dummy RVT to recreate the problem later today possibly. I have looked into this more just by looking at viewport properties and I’m not sure if I’ll be able to solve it. I recreated the process, but did everyting manually:
Duplicate a view
Rename the view by adding a suffix
Place the duplicated view directly on top of the existing view on a sheet.
Then I observed the properties of the views and viewports using “Viewport.LocationData”. The properties don’t match even when the views are aligned on the sheet. Maybe it has something to do with how views are duplicated in Revit. I’m not sure how I would be able to get those coordinates without first aligning the views manually.
I am thinking that is your problem. There is some kind of annotation element in your original view that is resulting in the ViewPort’s Box center being different.
To summarize:
For viewports we have to use something called “ViewPort Box Center” that is essentially the centroid of the bounding bax that circumscribes all of the elements in the view.
When you duplicate without detailing, I bet you are tossing out something in the new view and not realizing it. Or the crop region (maybe annotation) is changing between the duplicate in your file, I have no way of knowing this at the moment.
I followed your exact steps in a completely blank file
File New > No Template (Imperial)
Draw walls to have something in the view “Level 1”
Duplicate the view (without detailing since I have no detailing in theview)
Place both views on a sheet manually
Aligned them with Viewport.SetLocationBasedOnOther
And I receive exactly aligned views.
In order to efficiently troubleshoot what you have going on, we absolutely need a sample file from you that demonstrates what you are running into. Recreating the steps myself yielded expected results, so that is our only option.
Okay I’ll work on getting together a sample file when I can. I appreciate you going through all that effort. I’ll also quickly try duplicating with detailing and see if that fixes the issue.
My issue was the annotation crop. I changed the order my script worked to get things working. My order of operations before was:
Duplicate views.
Apply an “Existing Room Name Views” view template.
Tag rooms and attempt to place views on sheets.
This method didn’t work because when I applied the “Existing Room Name Views” view template, it was set to remove all existing detailing and only include existing rooms from the linked Architecture model. When that happened, it changed the size of the view, so the views could no longer be lined up by placing their centers on top of each other.
The new (working) process is:
Duplicate views with detailing.
Place new views directly on top of the views that were duplicated.
Then apply the view template and manipulate the views/viewports however needed. Thank you @john_pierson for your help.