Working with view UV points


Dear fellow dynamo users,

Because i came across some restrictions using the cropbox boundingbox wich retreives a boundingboxXYZ element i started using the outline function. But this will return a BoundingBoxUV instead of XYZ. As there are no units attached to the UV min/max points, is there a way to convert a UV point to millimeters/XYZ point? I have invested a lot of time in searching for a valid solution for my problem but with no succes so far…

my goal is to gather width and height of all view types (floorplan, legend, callout, etc) and not all of them have a crop box to work with, so this seemed the right way to go for me. If you have any other suggestions i would love to hear them!

Attached is a picture with my code and output: top is Outline(UV), bottom is CropBoX(XYZ).

Kind regards,



why didn’t the bounding box work?


Hi Jacob,

thank you for your response. i finally got it working with a cropbox boundingboxXYZ.
trial and error was the key to succes in my case! This is the result for other people to enjoy!
it tests views for titleblock size and creates a list with titleblock types parallel to the view list.
a great result for my first script!

`import System
from System.Collections.Generic import *

import clr
import RevitServices
from RevitServices.Persistence import DocumentManager

from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

views_single = UnwrapElement(IN[0])
titleblock_family = UnwrapElement(IN[1])
t_height = UnwrapElement(IN[2])
t_width = UnwrapElement(IN[3])

titleblock_type_id = titleblock_family.GetFamilySymbolIds()
titleblock_types_tosort = [doc.GetElement(i) for i in titleblock_type_id]

titleblock_height_us = [float(i.LookupParameter(t_height).AsValueString()) for i in titleblock_types_tosort]
titleblock_width_us = [float(i.LookupParameter(t_width).AsValueString()) for i in titleblock_types_tosort]

sheet_surface = [i*j for i, j in zip(titleblock_width_us, titleblock_height_us)]

titleblock_types = [i for j, i in sorted(zip(sheet_surface, titleblock_types_tosort))]
titleblock_height = [float(i.LookupParameter(t_height).AsValueString()) for i in titleblock_types]
titleblock_width = [float(i.LookupParameter(t_width).AsValueString()) for i in titleblock_types]

cropbox_minmax_vs = [[i.CropBox.Min, i.CropBox.Max] for i in views_single]
cropbox_vs =
for i in cropbox_minmax_vs:
cropbox_vs.append(abs(i[0].X - i[1].X)*304.8)
cropbox_vs.append(abs(i[0].Y - i[1].Y)*304.8)
cropbox_vs = [cropbox_vs[i:i + 2] for i in xrange(0, len(cropbox_vs), 2)]
view_scale_vs = [i.Scale for i in views_single]
cropbox_dim_vs =
for i, j in zip(cropbox_vs, view_scale_vs):
for k in i:
cropbox_dim_vs = [cropbox_dim_vs[i:i + 2] for i in xrange(0, len(cropbox_dim_vs), 2)]

titleblock_list_vs =

for i in cropbox_dim_vs:
n = 0
if (i[0]) >= titleblock_width[-1] or (i[1]) >= titleblock_height[-1]:
while (i[0]*1.2) >= titleblock_width[n] or (i[1]*1.2) >= titleblock_height[n] and n < (len(titleblock_types)-1):
n += 1

OUT = titleblock_list_vs`