Grid 2D Extent in Sheet Views


#1

Hi.
I am just wondering if we can control the amount the 2D grid Extends out from the scopebox controlling that view.

Ok so basically based on the image Below, Notice how the Grid Bubble goes beyond the Scope box and create the Grid bubble. Now what I want is to control the amount this grid bubble extends. Ideally I would want it to remain somewhere inbetween the Matchline (Dark Line) and the scope Box.
I know there have been Pythonscript through which it has been managed to control the 2D extents of the Grids but I don’t want to go through 400 sheets one by one and do the extents of the grids and rather have a magic number figured out and apply it for all the sheets. Hope it makes Sense and I really hope someone can help me out in figuring how do we get around this problem.


#2

Find some info :point_down:
https://forums.autodesk.com/t5/revit-architecture-forum/grid-extents/td-p/6040550


#3

Hi Jeff,
I did read the forum post you mentioned but the issue is the Propagate Extents works for parallel Views and even if it works (Alas it doesn’t work properly) Ihave some 25 Tiles which means a lot of Manual work.
Have a look at this video

If what they do in the video is possible I am guessing it might be quite possible to change the 2D extents of the Grid based on the nearest matchline or just maybe move the grid bubble by a certain distance parallel to itself in all views selected.


#4

I will look into it, it bothers me for a while as well.


#5

Also maybe have a look at this post from 3 years back. Seems like the exact same request.


#6

To be able to figure out the “magic” value which is sheet-specific or more appropriate viewport-specific, I think we can learn from that plug-in.

I guess it takes a reference plane and finds the intersection between grids and the plane then shrink grids to the individual intersection. But it requires appropriate ref planes locate right at the places where red arrows are pointing at.

how to construct these ref planes at the right place? I guess it won’t be necessary to construct one for every single viewport/view.

I will give it try by scaling down the bounding box to 0.95, see if it intersects with the grids. Then shrink the grids if possible. (Not setting the new boundingbox to the view)


#7

Hi Amrit.

This is an attempt to shrink grids using a shrunk bounding box (0.9 of the original).

Before running the script:

After:

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(). :sweat_smile:
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. :face_with_raised_eyebrow:

Shrink_Grid.dyn (25.8 KB)
ShrinkGrid.rvt (3.0 MB)


#8

Hi Jeff, Firstly thank you so much for spending the time and the effort into this.

Ok so first Jeff I haven’t moved to Revit 2019 so I couldn’t open your sample file so I created another file on version 2018 (Attached Below)
So for me I have 2 issues currently.

  1. When I have Grids that are in different directions, that is horizontal and vertical. the script fails so I think we need to group the Grids based on their angle of plane before doing the intersection. It gives me an error like below.
    image
  2. When I run it with only having grids on one plane it acts strangely as well. Instead of being shorter they tend to extend. Not sure why its happening though. images below
    image

The Grids do work in only the current view and they don’t affect other views so that part works perfectly.
Have a look at the file below.
ShrinkGrid_2018.rvt (364 KB)


#9

I just tested it on a single floor plan view, not looped through every view. And I just tested it on one direction. you can continue developing it. :grinning:

Essentially, I used dynamo to calculate a difference then let the start point and end point plus or subtract that difference (Y coordiante). Plus or subtract depends on how you drew the grids. So in this case, you can open the Python Node, switch " + delta" and “- delta”, then it should be shrunk instead of being extended.

For the other direction, the difference should impact on X coordinate of start and end.


#10

Hi Jeff,
How do you think I should work with the Grids at 45 Degree?


#11

generally, it is about delta x and delta y between original points and new points, 45 degree has them both. :grinning:


#12

I found an irritating issue, I thought the outmost boundary is the cropbox of the view whereas it just the top surface of the cropbox. the real stand-alone surface is from the boundingbox of the “Unknown Element”. I created another topic for this problem. you might want to track that as well. :sweat:


#13

Hi Amrit,

I’m curious about why you need to shrink the grid into the box? The box won’t be visible when you print the sheet. Is it because the grids from different viewports on the same sheet overlap with each other so you have to shrink them in, making them more controllable?

Jeff


#14

Hi Jeff, I was having issues with intersection and getting the exact cropbox aswell. Also the intersection when eventually done for some 700 sheets is going to be very task intensive so I was thinking of other ways to deal with the same issue.
What I was thinking is as follows:
Since from Revit 2016, the Grid class provides the methods GetCurvesInView and `SetCurveInView.
Use GetCurvesInView to get the start point and end points of the Grids in the view. Also get the default 3D start point and end point of the same Grids. If the X,Y of the points coincide we filter out those grids cause they are not being trimmed in view. For all other grids we reduce the the points by a certain distance (Magic No.) using the extend and trim curve by distance option. In theory I think it works.
I am right now trying understand how to use the ‘getcurvesinview’ command for the grids correctly.
I am getting most of the information from the sdk 2018 here (http://thebuildingcoder.typepad.com/blog/2017/05/sdk-update-rvtsamples-and-modifying-grid-end-point.html#4)


#15

I think the outmost frame we need is from view.CropBox, specifically, from the top surface of the CropBox. I tested it on Level 1 and Level 2 which are both floor plan views. Notice that even it’s Level2.CropBox, its MaxPoint still has a zero Z value after converting the box to Dynamo Geometry. (Also notice they both have 10 meters depth, MinPoint.Z = -10000, I thought it’s a view range thing, but it doesn’t change with view range :sweat:)

import clr

# ProtoGeometry (Dynamo)
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# API
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

# RevtiServices
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# RevitNodes, ToDSType method, Geometry conversion
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

# Unwrap views to make it work with Revit API
view_Level1 = UnwrapElement(IN[0])
view_Level2 = UnwrapElement(IN[1])

# View.CropBox returns a boundingboxXYZ, converting them to Dynamo Geometry, ToProtoType() Method 
   
OUT = view_Level1.CropBox.ToProtoType(), view_Level2.CropBox.ToProtoType()

I thought it should be simpler because I used Select Model Element to pick that “Unknown” element as the outmost frame. Its BoundingBox worked well but I still don’t know how to collect all of them.