RVT20_Placing Centered Views on Sheets

Hello everyone, I am fairly new to Dynamo but I’ve created a script that lets me create levels views and sheets as well as place views on sheets but my problem is that I cannot get the views to be in the center.

I am using revit 2020 so i cannot use a function for 2021 “Sheet.ByNamaeTitleBlock”. So I am just wondering if there are any ways I could do this. I’ll attach a picture of my coordinate views script as well as ill attach the whole script if anyone wants to take an in depth look.

Thanks!


Processing: DynamoScript_CreatePlans and Sheets + Views.dyn…

*New user’s cant upload attachments :frowning:

What is the error and output of the final move node?

My initial thought is that you need to manage the timing between the sheet+view placement and the relocation with a transaction.

Thanks for the quick response Robert. I will be honest, I have no clue what you said haha.

I’ll try to answer as best as I can, the last node error was just fixed by closing and opening Dynamo again. It said something along the lines of “Model outside Dynamo” something like that.

But not sure what you mean by managing the timing bw sheets and views.

That sounds like a geometry scaling issue, but if the issue resolved itself on reopen I suppose you’re good to go.

By timing I’m referring to transactions - you have a passthrough node midway that basically does the same thing. Generally Dynamo will try to execute everything in one transaction, but if you need to get information on something that was generated/modified in order to drive another part of the script, you often need transactions to say “Let all of this script happen first, then start doing this next script”.

So I’ve changed scripts a bit. Attached is an image of the end of the new script. I think this will give dynamo run all of the in one single go.

I can’t get it to work due to having the “views” input into different nodes. Do you see any work around for this?

The way I’m reading this you’re trying to place the same views into sheets that already contain the views (albeit in a fixed location), as you’re sourcing from the same list.

You either need to create an empty sheet + add view after, or create the sheet with the view + move the view.

1 Like

I see, thank you Robert!

UPDATE:

I still cannot find a solution to this. If anyone can please let me know on how to center my views I’d really appreciate it!

210818_DynamoScript_CreatePlans and Sheets + Views.dyn (394.7 KB)

this is in REVIT 2020 BTW

1 Like

Could you please Zoom in and take the photo again? If your zoomed too far out the node information is not readable.

1 Like

Hey Sean, sorry about that. I’ve zoomed in a bit. Hope this helps



My confusion is that it appears these two nodes are both trying to place the same view on the same sheet. Either create the sheet with the view, or use a node that doesn’t need a view. Then create the viewport. Keep in mind that viewports are placed by their center point and. It bottom left.

Gotcha! I’ve been trying to find a node that doesnt need a view but have not had any success. Let me know what options are out there. thanks!

If your open to some python, it’s a pretty straight forward to create a sheet without needing a view.
https://www.revitapidocs.com/2015/bc9e8be3-f3fd-97c2-2709-1d6eea3db775.htm

1 Like

I can’t remember what the specific node is called, but I’m 99% sure there’s a generic sheet creation node in the Rhythm package that just needs a title block as input

2 Likes


Hamish, are you talking about this one?

I’m trying to understand how i could make the sheet number,name, and place the views on there just like the “sheet.bynamenumberandtitleblockandview”

sorry I’m new to dynamo and I’m having a hard time trying to understand which nodes to use.

Sadly I do not know any python :frowning:

I know python would definitely be the answer to this script but sadly I do not know it :frowning:

I wrote a script that creates sheets from an excel file. I found out that this is a pretty complicated task. I ran into the same problem that you describe and I chose to solve it by first creating and naming every necessary view first, and then using the Out-of-the-Box nodes (Sheet.ByNameNumberTitleBlockAndView, Sheet.ByNameNumberTitleBlockAndViews) to place them on the sheet.

In my case, any sheets that contain multiple views must be created by this node:
Sheet.ByNameNumberTitleBlockAndViews
So, I had to separate sheets with only a single view and send that data to this node:
Sheet.ByNameNumberTitleBlockAndView

After the views are placed, the script then turns off all annotation categories in all the views, then moves all views to the origin. You must turn off all annotations because the viewports are placed by the bottom left of the bounding box of the viewport. The bounding box is drawn around any annotations that extend outside the view crop region, so any 2d elements that stick out of the view crop will affect the placement of the viewport. (If you don’t have any annotations in the view, then I suppose you don’t need to worry about this)

After annotation categories are hidden, I use Element.MoveByVector to move the viewport into the correct location on the sheet. When the viewports are placed correctly, I then show all annotations again. My script does not automatically center the viewport on sheet like you are trying to do, but it might help you get closer to your goal.

If you want to center the views, I would suggest that you find the viewport BoxCenter of all viewports after they are placed on the sheet. Are you trying to center a single viewport per sheet? If so, that would be much simpler. You could find the viewport box center like this:


Then just set the box center to be equal to the titleblock center.

If you are trying to center multiple viewports, you could find out which min point is the closest to the origin, and which max point is farthest. This would give you a bounding box around the group of viewports, from which you could find the center of the group. Then you could find the center of the titleblock, and move all views by the vector from the group center to the titleblock center.

This is just a rough outline of how you could solve the problem. I expect you will need some clarification to understand what I mean, so feel free to ask. Here is my sheet creation script if you want to inspect closer: SHEET CREATION_R2020 v5.dyn (386.3 KB)

2 Likes

Yeh, that looks like it. You can just use a SetParameterByName node to assign names/numbers after creating them. There’s also a node for creating viewports, the Viewport.Create node you’ve used in a snip above further.

1 Like

Frank, thank you so much for this valuable information. I will definitely be taking some time and reading it closely trying to understand all of it. I will let you know if I have any questions, thank you!

Thanks Hamish, I will take another stab at it. Thank you