I am trying to grab the boundary of a view (not a viewport) in order to find the center of the view.
This Python Script works to find the Revit.DB.Lines of a view’s crop but balks at views with Scope Boxes. I thought I might set the View’s Scope Box to None and then change it back when the definition is done but I can’t seem to figure how to set it to None since it’s technically not a type and doesn’t seem to have an ID. I could also modify the script if I knew where the problem lay.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
views = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)
for item in views:
cLines = item.GetCropRegionShapeManager().GetCropRegionShape()
TransactionManager.Instance.TransactionTaskDone()
OUT = cLines
Also, how do I turn the Revit.DB.Lines into Dynamo geometry so I can work with them. Right now I’m converting them to Detail Lines and then pulling the curves off these. I figured I’d delete them later but that there’s got to be something I’m missing… probably pretty easy.