# Generate a New Sheet Number from Existing Sheet Numbers and Align View to Center

**URL:** <https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744>\
**Category:** Revit\
**Created:** [November 21, 2018, 9:33am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744 "2018-11-21T09:33:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 9:33am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/1 "2018-11-21T09:33:36Z")

</div>

Hi,

I’m trying to use dynamo for our office Level and View Standard.

Using Dynamo via Dynamo Player, I want to create a way in which a User Creates a Level with Elevation, Name and Dynamo Automatically Duplicates the View, and Place them on a New Sheet for Every Time a New Level is created.

The issue I’m having is how to generate a new sheet number for every time a new Level is created and also how to center the View on the sheet.

Would need some help with that. Thanks

 ![Capture_1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0e59a68f1a772a92ac8c4680c35074e582afe74a.png)

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 10:58am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/2 "2018-11-21T10:58:05Z")

</div>

Hey,

Looks good so far 🙂

You obviously know what you’re doing, so I’ll just give a couple of pointers…

For the sheet number, I would presume that for the Level 3 you are showing, your sheet will be numbered something like… 2030 (20 = Presentation, 3 for level, 0 first sheet), so if you extract the last 1 or 2 indexes from the name, turn it into a number and combine it with a prefix defined in your view type, you’re good to plug it in.

As to centering the view on the sheet, there are other methods, but if your sheet is A2 landscape, then you will know that the placement of the view is 210 by 297. @Greg_McDowell talks of a method here [Finding the Center of a View... not a Viewport](https://forum.dynamobim.com/t/finding-the-center-of-a-view-not-a-viewport/6346/8) he can share? It would take me a bit of time to recreate the worflow described in the post, but I can have a go if he’s not around 🙂

Hope that helps,

Mark

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 11:07am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/3 "2018-11-21T11:07:29Z")

</div>

Thanks for your response and Pointers.

Here’s the thing.

I want for every Level Created, Like Level 3, A presentation View is created LEVEL 3 PRESENTATION, the presentation view is now placed on a created Sheet say P03 if P02 was the last on the Sheet Group, and then the View would be on the Center of the Sheet Created.

I’ve been trying to wrap my head around this…

Attached is the script in case anyone want to help out… thankyou

[Create Levels and Duplicate Views.dyn](https://forum.dynamobim.com/uploads/short-url/dYey1cRYOg7KlvI21zOrdSeoFLn.dyn) (90.5 KB)

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 11:14am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/4 "2018-11-21T11:14:07Z")

</div>

Hi,

Sorry I’m not sure I understand…

The nice thing about your system is that the if someone makes a new level, the P03 is going to be the first sheet, so you don’t need to worry about clashing numbers with other sheets…

Otherwise, if you are just following on from sheet numbers already created, you need the current list of sheet numbers and you are adding one on the end?

Cheers,

Mark

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 11:17am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/5 "2018-11-21T11:17:41Z")

</div>

Yes, yes… that’s what I want to do… I want to limit user’s Input as much as possible so the Sheet Number would be called up from the list of already created sheets +1 so as to avoid clashing numbers.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 11:21am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/6 "2018-11-21T11:21:29Z")

</div>

Like this?  
Edit:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/9/f9dde4acd35e33d0263e8ab373cb2803e5fb798c.png)

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 11:24am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/7 "2018-11-21T11:24:17Z")

</div>

Exactly.

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 11:24am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/8 "2018-11-21T11:24:46Z")

</div>

Great 🙂

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 11:41am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/9 "2018-11-21T11:41:31Z")

</div>

Here’s what I’m attempting, but then I’m stuck… I cant convert string to Number…

 ![Capture_2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/6/06230b4c2689a21a7a25723f08e02f5e4ddd6099.png)

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 12:02pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/10 "2018-11-21T12:02:42Z")

</div>

Yeah, it’s a bit unfortunate, you’ll obvs not be able to make something with D in it a number… it needs to be split, converted, added, converted back and recombined… Complete faff… if you use node to code or make a custom node, it will make your graph easier to read…  
[SheetNumber.dyn](https://forum.dynamobim.com/uploads/short-url/8wzBIXKmT6zGgrWVsXgcbKKNyxd.dyn) (10.1 KB)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/4/143b5a39ac546c28921878639658097dba95f3a0.png)

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 12:55pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/11 "2018-11-21T12:55:56Z")

</div>

Thank you very much for the help… I owe you lots…

Here’s what Ive been able to do with it and it works.

Now it’s to get the View to be located at the center of the sheet…

I hope that’s possible also…

 ![Capture_3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/e/7e513492c410b3f234e6cf6399f84dde43e71008.png)

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 1:06pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/12 "2018-11-21T13:06:18Z")

</div>

Another Error I’m getting is After Creating the First Level,

When I run the script again, Dynamo automatically renames the previous level created and then is unable to create a new number for the New Sheet, cant figure out why I’m getting such errors

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 1:25pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/13 "2018-11-21T13:25:25Z")

</div>

It sounds like Dynamo hasn’t refreshed properly…

If you run, then close dynamo and reopen, does it still happen? Or are you running through player?

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 1:32pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/14 "2018-11-21T13:32:27Z")

</div>

Yes, it does the same thing both manually and via Player… Just tried it now and it did the same thing…

Have any Idea why that is happening?

Here’s the script

[Create Levels and Duplicate Views.dyn](https://forum.dynamobim.com/uploads/short-url/tYEDmy7n5m8Y8ZvQzlpUGIqaJ1B.dyn) (187.6 KB)

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 3:24pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/15 "2018-11-21T15:24:42Z")

</div>

Unfortunately my dynamo 2 has gone screwy and is refusing to recognise any titleblocks exist in my project…!

Maybe someone else can help you better…

From staring at your graph, my guess is that the problem is here? ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/1/413d8ad48d0d15b25e7372a74ef8610b2405f6d9.png)  
You are getting the first sheet number? I don’t know why you wouldn’t get the last sheet number?  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/1/c112477dfac5d2e93adf619d6d4826ea6ab60e5e.png)  
If you get the first one, then everytime you add a sheet it is trying to use a number you already have…

Hope that helps,

Mark

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 3:35pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/16 "2018-11-21T15:35:20Z")

</div>

Okay, Let me try the Last Item and see if that works

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 21, 2018, 4:12pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/17 "2018-11-21T16:12:09Z")

</div>

Still getting Same error…

Level still gets overwritten and views on sheet too

---

<div class="post-metadata">

**Author:** ![Mark.Ackerley](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mark.ackerley/32/79310_2.png) [@Mark.Ackerley](https://forum.dynamobim.com/u/Mark.Ackerley)\
**Post date:** [November 21, 2018, 4:46pm UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/18 "2018-11-21T16:46:34Z")

</div>

Could you drop a few more screen grabs?

It’s hard to know whether it’s a simple fix (maybe you just put the same height in again) or something fundamental (a node isn’t functioning as we’d expect)

Unfortunately, as I said, I’m not going to be too much more help with my Dynamo not working.

Apologies,

Mark

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 22, 2018, 8:35am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/19 "2018-11-22T08:35:55Z")

</div>

Thank you for your response and help so far.

I’ll be posting a few more screen Grabs Shortly

---

<div class="post-metadata">

**Author:** ![Xtopher123](https://avatars.discourse-cdn.com/v4/letter/x/ba8739/32.png) [@Xtopher123](https://forum.dynamobim.com/u/Xtopher123)\
**Post date:** [November 22, 2018, 9:38am UTC](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744/20 "2018-11-22T09:38:01Z")

</div>

See the Error Im getting together with a snapshot of my script…

Please anyone else can help

 ![Capture_4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/b/8b59cfdc4c77c95fdbfb432d91d1d54b5ccb1c92.png)  
 ![Capture_5](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/6/86f8f587cedb89a99cfbd4371a7af6f29824a10b.png)  
 ![Capture_6](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/5/e5d7c42deb8afc5b279cd082f0395bbc8091b050.png)

[Next page](https://forum.dynamobim.com/t/generate-a-new-sheet-number-from-existing-sheet-numbers-and-align-view-to-center/28744.md?page=2)
