# Detail Number by Title Block Grid

**URL:** <https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [September 26, 2023, 5:31pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068 "2023-09-26T17:31:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![curtisridenour](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@curtisridenour](https://forum.dynamobim.com/u/curtisridenour)\
**Post date:** [September 26, 2023, 5:31pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/1 "2023-09-26T17:31:28Z")

</div>

I have found a script on [Reddit](https://www.reddit.com/r/Revit/comments/13ptywm/renumber_viewports_based_on_location_on_sheet/) that was able to renumber all the views on the current sheet. I stood on this individuals shoulders and set it up to run across all the sheets in the model.

I have run into a few issues.

1. Legends dont have detail numbers.
2. Some views are set to No Title
3. The title block grid definitions need to be specified within the project units (feet for us imperial idiots)
4. The script only runs with one title block size/grid system.
5. Some views have their View Title within the same grid on the same sheet.

I have solved 1&2 in the script. I can ignore 3&4 because all our projects are in the same units and use only one title block.

But 5 is being a real bugger. I am trying to isolate the views that would be on the same sheet and also be within the same grid. I can find them but I don’t know how to put in a dummy variable and have the code explain which ones.

Maybe i need to write a separate script that can look for these duplicate views and remedy the problem before running the Renumbering script.

_ **Beware that one time I was mucking around with the script and it deleted all the viewports in the project.** _

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/4/f48ec8e3f0c188d6cd83cceca5c286aa50bf0d03.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/a/aa92432f043643bb358fd60a9acd7d895a5f0440.jpeg)

[Renumber Views\_R23.dyn](https://forum.dynamobim.com/uploads/short-url/1TFux62PbE54ps7cQNOqMGJ7VsD.dyn) (141.7 KB)  
[TBLK VA E1 30x42\_v19.rfa](https://forum.dynamobim.com/uploads/short-url/sXqcfGpkcXXg74eFyM3q3SOpjjJ.rfa) (1008 KB)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 26, 2023, 6:48pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/2 "2023-09-26T18:48:12Z")

</div>

> [@curtisridenour](#):
>
> Some views have their View Title within the same grid on the same sheet.

When this happens, what would your ideal solution be? Personally I dislike this numbering style, but I get the desire. Getting the viewport center and building a vector from the lower left corner of the TB to that point does allow grouping and sorting by the rounded X value and then sorting by the Y value before renumbering, allowing easy numbering by ‘relative position’ on the sheet, even if 10 views fit in the same sheet. When duplicate number values are produced you can always append a suffix, or sort by element ID.

---

<div class="post-metadata">

**Author:** ![curtisridenour](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@curtisridenour](https://forum.dynamobim.com/u/curtisridenour)\
**Post date:** [September 26, 2023, 7:18pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/3 "2023-09-26T19:18:05Z")

</div>

I believe the ideal solution would be to alert the user to the sheet and location where the offending duplicates live. Then they manually adjust the sheet and rerun the renumbering script.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 26, 2023, 7:26pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/4 "2023-09-26T19:26:38Z")

</div>

> [@curtisridenour](#):
>
> Then they manually adjust the sheet and rerun the renumbering script.

What if you want say an area plan overlaid on the life safety plan though?

---

<div class="post-metadata">

**Author:** ![curtisridenour](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@curtisridenour](https://forum.dynamobim.com/u/curtisridenour)\
**Post date:** [September 26, 2023, 7:38pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/5 "2023-09-26T19:38:30Z")

</div>

then one of them has “No Title” set as the viewport type and is filtered out so that it does not count as a duplicate and it remains as is.

---

<div class="post-metadata">

**Author:** ![curtisridenour](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@curtisridenour](https://forum.dynamobim.com/u/curtisridenour)\
**Post date:** [September 26, 2023, 8:05pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/6 "2023-09-26T20:05:48Z")

</div>

I feel i am close with one of these methods.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/8/3879b64290ba38031dc2a511003c85c9c73886f5.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/5/c57bcf92f2dec44c62262cd10ec761180e5a7de5.png)

---

<div class="post-metadata">

**Author:** ![curtisridenour](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@curtisridenour](https://forum.dynamobim.com/u/curtisridenour)\
**Post date:** [September 26, 2023, 11:35pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/7 "2023-09-26T23:35:41Z")

</div>

I have a working solution. I added a new list combining the sheet number and the detail number values (prior to setting them in the project). I then looked for duplicates and used an IF node to use the list of sequential numbers instead of the alphanumeric grid values if there are duplicates.

This will set all the views in the project to sequential numbers and report the sheet number and grid locations of all the conflicts in the model. If you manually remedy the viewport conflicts, you can then run the script and it will set all the viewport detail numbers to the grid locations.

 ![Renumber Views_R23](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0e2405f49d18ba7f6f61555ed515e843fe2f2b91.png)  
[Renumber Views\_R23.dyn](https://forum.dynamobim.com/uploads/short-url/dlfxsRpQFgVvF0enuLOxUEoOtA7.dyn) (132.7 KB)

---

<div class="post-metadata">

**Author:** ![curtisridenour](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@curtisridenour](https://forum.dynamobim.com/u/curtisridenour)\
**Post date:** [October 16, 2023, 8:38pm UTC](https://forum.dynamobim.com/t/detail-number-by-title-block-grid/94068/8 "2023-10-16T20:38:42Z")

</div>

This script only works in Revit 2022 and newer.
