Copy the cropbox

Hello everyone,

I am working with a graph made by sixtysecondrevit to align views. It works very well until the crop lines are different. Is there a way to copy the crop lines between viewports?

What does your codeblock error say? You’re probably on a newer version that requires two inputs for Flatten.


This is the error msg that I get

Can you show the node preview for all your nodes? I’m guessing there’s either an issue with your selected viewports or the GetCropBox node doesn’t accept viewports.

You are right, the GetCropBox node is the issue.

Yeah. I think you need to get the View from the Viewport.

1 Like

Capture

Do you have any suggestions for how to translate the views into viewports?

Thanks =)

I looked at this post but they didn’t have a solution either.

You could get a viewport from a view by reading its relative sheet number:

Although this method would need another level of filtering if there were more than one viewport on the sheet.

Rhythm has a Viewport.GetView node that should be exactly what you’re looking for. You just need to make sure you’re supplying the View where the View is required and the Viewport where the Viewport is required. Something like this:

1 Like

Woah that is an older graph with some out-of-date nodes. Apologies for that. Some of the additional issues with it might be the fact that steamnodes is outdated and some of my original nodes in the graph are as well.


Here is how I would actually go about doing that these days:

  • Get viewports with ordered selection (to separate the main from the subsequent viewports)
  • Turn off all categories except for a consistent one (Project Base Point is decent)
  • Set the box centers with the newer Rhythm node. (Viewport.SetLocationBasedOnOther)
  • Reset the temporary hide/isolate of the project base point.

and the graph in action:
ViewportCenteringDemo

and the graph itself:
ViewportCentering.dyn (39.9 KB)


Aside from that thought process I would maybe consider having a “Viewport Centering Scope Box” in my project and set all the views crop region to that Scope Box prior to running. That is probably the most stable and consistent way to handle this.

2 Likes

Thank you for your help but the ViewportCentering graph does not work when the crop box is different.

I tried this graph, it sets the crop line successfully but I still can’t get the location to match.

1 Like

Maybe try a transaction.end node after the setcropbox curves?

Although, manipulating the actual cropbox curves makes me nervous. I would honestly do the following:

  • Place a scope box in my project first.
  • Assign that (temporarily) to all the views in Revit that I want to box center (not Dynamo) so their bounding is exactly the same.
  • Run the graph to set the locations of the viewports (without the crop region modification)
  • unassign the scope boxes when done.

The scope box is a much better idea, thank you so much!

1 Like