I am building my first script for work and decided to build one that takes you straight to a 3D view of any 2D view that you are in at that moment.
Everything is working perfectly, except for the cropping of the section box on to the 2 view crop region.
I am using the SetSectionBox(my3Dview, boundingBoxXYZ) method, my problem is that I can’t seem to find anything that returns a boundingBoxXYZ that is usable in my script.
Please see my code below for reference:
"""Create 3D view from current view""" from pyrevit import revit, DB, UI from pyrevit import forms from pyrevit import script #Create new 3D view with name of current user, cropped to the active view def new_view(view, user): if type(view) == revit.DB.View3D: forms.alert("Please use a 2D view") else: with script.revit.Transaction("Create View"): newThreeDee = revit.create.create_3d_view(user + " temp") revit.UI.UIDocument.RequestViewChange(revit.HOST_APP.uidoc, newThreeDee) revit.DB.View3D.SetSectionBox(newThreeDee, revit.DB.View.getBoundingBox(view, view)) # print(type(revit.DB.View.GetCropRegionShapeManagerForReferenceCallout(revit.HOST_APP.doc, revit.DB.View.CropBox(newThreeDee)))) originalView = revit.active_view #Check if active view is a 3D view #Return false if view is 2D get_view_type = type(originalView) == revit.DB.View3D #Gets the name of the user currently active get_current_user = revit.HOST_APP.username new_view(originalView, get_current_user)```