Viewport Location is incorrectly being reported - Revit 2020

Revit 2020: I am making a script that takes the location of a plan view on a sheet from one mode (eg: the Architectural model) writes that to excel, then using another script reads the excel to generate a similar plan for another discipline in another model (eg: the interiors model).

What is happening is that when i place the viewport on the sheet, it is not in the correct location, but it is reporting its location(x,y) to be correct. However when I access the same viewport location with a separate script than the one that created the viewport, it is reporting its location ‘accurately’. If I then run a separate script to move the location based on the excel, it works perfectly. In order for this script to be useful for my firm, all this needs to happen in one script, not by running 2 separate scripts.

Here are some screenshots that illustrate the problem:
in the excel file, note the following - AE101 is at 1.012 and 1.302 - in this example it will be ‘copied’ to sheet AF501 (so AF501 should be at 1.012 and 1.302)

note the following in the image below: the item[0] is AF501, and is being shown at 1.012 and 1.302. so everything seems correct, except the viewport is visibly in the wrong spot on the sheet. (also a side note: i used a python script as well to create and place the viewports, and i have the exact same results. so i dont thinks its the viewport.create node that’s the issue??)

BUT its completely in the wrong spot on the sheet! It’s visibly way off.

so i got to thinking, and troubleshooting, and then i made a completely separate script that all it did was report back the viewport location, and look at what its saying - (top image is where its putting it for my workstation, and bottom image is where its putting it on our VDI machine) - this x,y location is where its actually appearing on the sheet, not the false location that its reporting in the original script.

If i add in the viewport.setboxcenter to move the viewport inside this new script, and tell it to put it at at 1.012 and 1.302, it properly locates and reports the viewport on the sheet.

Any ideas what is going on?

What I think is different in my case than what you shared in your link is in my case both views have the same view scale, the same scope box, and the same size viewport. In fact when I use the viewplan.getoutline for both AE101 and AE501, they are in the same place and the same size in the dynamo preview.

When I use a Viewport.LocationData node, and have it show both AE101 and AF501 in the Dynamo window, it is showing them in separate locations. See the image below showing how they are in different places, even though they are reporting the same location when the script is first run.

Once i run the script to move them from a separate script, it lines them up perfectly.

It would be helpful if you can post all your graphs here.

Use Transaction.End and Transaction.Start I’d you need to move them once placed in the same graph.

Use Transaction.End and Transaction.Start

this did it! thanks everyone.

1 Like