Placing Views on a Sheet and Creating New Sheets Once That Sheet Is Full

I built a code that would pull existing drafting views from a Revit file into a new Revit project, create a sheet, and put those drafting views onto a sheet. Each drafting view has a border and they currently come in a variation of 4 different sizes (260Wx118D, 520Wx118D, 260Wx236D, 520Wx236D). I started trying to map out the coordinates, but realize it’s not smart enough for what I need.

The other issue is currently my “Sheet Creation” node is only set up for 1 sheet to be created; I don’t even know where to begin to have Dynamo recognize a how many sheets need to be made.

I manually assembled this sample sheet to reflect what I’m looking for as a result from the code.

Hi @mcampbell6AG35 ,

To make life easier let’s say you have to place 35 drafting sheets with a height of 10.
Let’s also assume a sheet can fit up to a height of 100.

To figure out how many sheets we need we just need to do something like this:
35 * 10 / 100 = 3.5 sheets. Using Math.Ceiling you can determine it has to be 4.

To then determine how many pages you need per page you could use Math.Sum cumulative to calculate when the height would be higher than 100. (or multiples of using %).

For horizontal & vertical positioning the same workflow could be used (and probably has to be).

Here is a possible way how what I explained abovecould be done through Dynamo:

2022-05-30 Chop by cumulative length.dyn (31.6 KB)

Hi @Daan,
I appreciate the help, this did help figure out how many sheets it would need to create.

I’ve had some more time to play with the code and finally got most of what I want it do to work. The last bit of locating and stacking the views how I want them to look is giving me trouble. I’ve found it works sometimes, but other times, some of the views (depending on their area and where they were in the sequence of selected views) would break the last bit of the code for locating the views.

What I find odd is if I just select the “right” views, it will do exactly what I want it to do. It will create new sheets, add those views onto the new sheets, and stack them how I want them to stack. Also, if I added the view that broke the code previously in Test A’s batch of views into Test B’s batch of views (different set of views being selected in each test), it would either work or a different view would break the location part of the code.