10-Mile Radar Pre-Flight Check

Hello,

As I’m wrapping up my work for the pre-flight check hackathon, I’m excited to share my tool plan. I’m refining the script for the November 1st deadline and would love your feedback.

Name of the preflight check : 10-Mile Radar
Issue: Positioning model extents beyond 10 miles from the project’s internal origin can cause issues with accuracy, tolerance, performance, and viewport display.

Objectives:

  1. A quick tool to detect objects that extend beyond Revit’s 10-mile limit from the internal origin.
  2. Design the tool to be as generic as possible, making it usable for every discipline.
  3. Ensure the tool runs as fast as possible and provides clear information about the model’s current status.
  4. Utilize bounding boxes for views, sacrificing some accuracy for speed, rather than relying on the object’s geometry.

General Approach
1- To maintain a fast preflight check, this tool uses the view bounding box instead of the actual element location, significantly reducing the need for slow element filtering or looping. In this case, I create an isometric view with the parameters below

  • The latest phase with a phase filter set to show complete
  • All worksets are set to be visible in the visibility/graphics.
  • All Objects and Links are visible
  • Section box is enabled
  • I have no idea how to cycle through design options on a view3D class, but since usually design options contains minimal objects I think it is still possible to operate a filteredelementcollector and report the bounding boxes of all elements in each design options. I welcome your feedback.
def create_3d_view():
    view3Dtypes = DB.FilteredElementCollector(doc).OfClass(DB.ViewFamilyType).WhereElementIsElementType().ToElements()
    view3dtype = [v for v in view3Dtypes if v.ViewFamily == DB.ViewFamily.ThreeDimensional][0]
    view = DB.View3D.CreateIsometric(doc, view3dtype.Id)
    worksets = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset).ToWorksets()
    for ws in worksets:
        view.SetWorksetVisibility(ws.Id, DB.WorksetVisibility.Visible)
    view.IsSectionBoxActive = True
    return view

def get_bounding_box(view):
    bb = view.GetSectionBox()
    bb.Enabled = True
    bbox = bb.Bounds
    min = bbox[0]
    max = bbox[1]
    return bb, min, max

2- To create the view and obtain the bounding box of the 3D view, use a temporary transaction and then dispose of it instead of committing it.

t = Transaction(doc, 'Create 3D View')
t.Start()
# get all design option Objects
dobjects = getalldesignoptionobjects()
if dobjects:
    for do in dobjects:
        print(do.Min, do.Max)
tempview = create_3d_view()
tempview
tempbbox = get_bounding_box(tempview)
t.Dispose # cancel the transaction


pt1 = (tempbbox[1].X, tempbbox[1].Y, tempbbox[1].Z)
pt2 = (tempbbox[2].X, tempbbox[2].Y, tempbbox[2].Z)

# calculate distances
dis1 = calculate_distance(pt1, originpt_tuple)
dis2 = calculate_distance(pt2, originpt_tuple)

3- Determine if the view bounding box extends beyond the 10-mile distance. If it does, proceed to the following steps; otherwise, terminate the script.

if dis1 > 5280 or dis2 > 5280:
    print ("The Radar Box is larger than 10 miles, Additional Analysis Required")

4- If objects are found to extend beyond the 10-mile limit, conduct additional bounding box analysis as follows:

  • Priority 1: Determine the placement of the Project Base Point/Survey Point relative to the internal origin. Report if any of these points are located more than 10 miles away.
  • Priority 2 : Collect RVT links and determine the extent of their bounding boxes. Report objects using Linkify.
  • Priority 3: Collect CAD links/imports and determine the extent of their bounding boxes. Report objects using Linkify.
# Functions Pending

5- If objects still exceed the limit, a slower filtering process may be necessary to identify which ones are located that far out.

# Functions Pending

I welcome any feedback as I can slowly progress towards the deadline and hopefully I’ll generate a pull request by end of next week, I haven’t started on the front end of the script and looking to incorporate forms, output and linkify in the final script.

5 Likes