This is an attempt to shrink grids using a shrunk bounding box (0.9 of the original).
Before running the script:
Notice that I am using the shrunk boundingbox (a new box) to intersect with grids to generate a series of new ends, not actually apply the new box to the view.
I was wondering why Grid class has just a SetVerticalExtent() without a SetHorizontalExtent().
But the method I need reside in its base class which has a SetCurveInView(). Since the method requires curves, I was thinking about generating new curves for grids using dynamo lines and turn them to Revit lines but it throw an “Not Coincident with Original Grid Line” exception when applied them to SetCurveInView(). After excluding reasons stated in exception message, I think it could be precision issue. So I just use dynamo to calculate the difference between the orginal curves and new curves.
Getting the original curves from GetCurvesInView(), shrinking it with the difference.
About SetCurveInView(), DatumExtentType.ViewSpecific is another key to this case since I think as long as it is ViewSpecific, change happend in the current view won’t affect other views. It makes sure that grids on other views still “remain unsolved” instead of having a new length due to the changes in current view. So the “0.9” theory still holds true for the rest of views.
The .dyn just operate on a single view, the next step is to propagate it to all views / viewports on sheets. Have not tested it though, I hope nothing goes wrong when it comes to batch process.
Shrink_Grid.dyn (25.8 KB)
ShrinkGrid.rvt (3.0 MB)