Anyone know how I would get the Crop box rotation of one view and apply it to another?
I can get the crop region (with the rotated boundary) from one view and apply to another but I can’t rotate the actual view to match the crop region. Not sure what I am missing, maybe @Kulkul or someone can help.
Dynamo 2.0.2 + Revit 2018:
vanCropRegions.dyn (5.8 KB)
# Enable Python support and load DesignScript library import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument # Functions. def tolist(_list): if isinstance(_list,list): return UnwrapElement(_list) else: return [UnwrapElement(_list)] # The inputs to this node will be stored as a list in the IN variables. getviews = tolist(IN) setviews = tolist(IN) # Start Transaction TransactionManager.Instance.EnsureInTransaction(doc) for getview, setview in zip(getviews, setviews): # Get crop shape from first view getCropManager = getview.GetCropRegionShapeManager() getShape = getCropManager.GetCropShape() # Enable cropbox on second view setview.CropBoxActive = True setview.CropBoxVisible = True # Set crop shape on second view setCropManager = setview.GetCropRegionShapeManager() setCropManager.SetCropShape(getShape) # End Transaction TransactionManager.Instance.TransactionTaskDone() # Assign your output to the OUT variable. OUT = "success"
In one of the Building Coder’s example, he would manually rotate the cropview element but that requires knowing the rotation first, which I don’t know how I would get reliably.