Rflash25
(Jerry)
September 1, 2025, 2:34pm
1
Hi,
I’m going through an exercise to review all the reference callout on a lot of sheets, so I’m trying to generate a list of reference callout on views. However I can only find the ‘real’ callouts, is there an API that I miss that I can get reference ones.
Thanks,
J
Jean-Marc
(Jean-Marc Couffin)
September 2, 2025, 7:07am
2
Rflash25:
I’m going through an exercise to review all the reference callout on a lot of sheets, so I’m trying to generate a list of reference callout on views. However I can only find the ‘real’ callouts, is there an API that I miss that I can get reference ones.
Have a look at ReferenceableViewUtils
a bit of AI + some love:
# encoding: utf-8
from pyrevit import DB, HOST_APP, script
output = script.get_output()
doc = HOST_APP.doc
def viewports_on_sheet(sheet):
return [doc.GetElement(vpid) for vpid in sheet.GetAllViewports()]
def placed_view(vp):
return doc.GetElement(vp.ViewId)
def referenced_view_id(ref_elem_id):
return DB.ReferenceableViewUtils.GetReferencedViewId(doc, ref_elem_id)
data = []
for sheet in DB.FilteredElementCollector(doc).OfClass(DB.ViewSheet):
for vp in viewports_on_sheet(sheet):
parent_view = placed_view(vp)
for rid in parent_view.GetReferenceCallouts(): # << key call
ref_view = doc.GetElement(referenced_view_id(rid))
# find if referenced view is placed, and on which sheet/detail number
vp_of_ref = list(DB.FilteredElementCollector(doc).OfClass(DB.Viewport).ToElements())
host_vps = [x for x in vp_of_ref if x.ViewId == ref_view.Id]
if host_vps:
host_vp = host_vps[0]
host_sheet = doc.GetElement(host_vp.SheetId)
detail_no = host_vp.get_Parameter(DB.BuiltInParameter.VIEWPORT_DETAIL_NUMBER).AsString()
sheet_num = host_sheet.SheetNumber
else:
detail_no = ""
sheet_num = "(unplaced)"
data.append([sheet.SheetNumber, sheet.Name, parent_view.Name, ref_view.Name, sheet_num, detail_no])
output.print_table(data, columns=["Sheet Number", "Sheet Name", "Parent View Name", "Ref View Name", "Ref View Sheet", "Ref View Detail No"])
Rflash25
(Jerry)
September 5, 2025, 2:17pm
3
Sorry for the late reply, this is exactly what I’m looking for, cheers.
2 Likes