← All posts
WRITTEN POST
Dec 2020
Match View's cropbox shape
CropBox
Here is a simple way to get Match your CropBox to another view. Also it's good to know that CropBox has a class of BoundingBoxXYZ.
You just need to provide 2 views in this function to match CropBox.
There is a method view.GetCropRegionShapeManager() that allows us to .GetCropShape() and to SetCropShape().
python
def match_cropbox_shape(source_view, view):
# type: (View, View) -> None
"""Function to match cropbox shape outline from source view to another view."""
source_CropManager = source_view.GetCropRegionShapeManager()
source_CropShape = source_CropManager.GetCropShape()
CropManager = view.GetCropRegionShapeManager()
CropManager.SetCropShape(source_CropShape)
pyRevit MCP: Connect ANY AI Agent to Revit (Full Setup Guide)
The Full pyRevit Course for Beginners (Setup → Your First Button)