Announcements
Welcome to the Revit Ideas Board! Before posting, please read the helpful tips here. Thank you for your Ideas!
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Propagate Extents - Scope Box Applied Views

Propagate Extents - Scope Box Applied Views

Please allow propagate extents to multiple views using the same scope box for view extents. This would obviously exclude views without scope boxes applied.

 

Currently the workflow is as follow:

1) Correct datum of grids for the scopebox view to desired

2) Remove Scope Boxes to all views being applied to + uncheck crop view

3) Select grids - propagate - select de-scopeboxed views

4) Reapply scope boxes.

 

I understand that this cannot be universally applied, but surely it is logical to apply scope box extents to other views with the same scope box applied?

 

An even better workflow would be to add a parameter to set distance of grid datum from the crop region. This allows global updating of grid heads on views for a neater finish.

7 Comments
pieterdewaal
Advocate

As an update: I have developed a Dynamo script to calculate the view crop region dimensions and automatically extend the grid heads, with a set distance, to the crop region. This is not ideal; however, a valid workaround. Having such built-in functionality would be much appreciated.

Felipe.Reyes1337
Explorer

Care to share such a Dynamo-script with a fellow Reviter? 🙂

pieterdewaal
Advocate

Sure!

 

Please see the below.

 

"Crid to Crop Region" Node code:

 

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DSGeo
from Autodesk.DesignScript.Geometry import *

#import Revit API
clr.AddReference('RevitAPIUI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

def createDatumLine(boundLines, grid):
    gridLine = None
    curveG = grid.Curve.ToProtoType()
    vectGrid = curveG.Direction 
    ptmid = curveG.PointAtParameter(0.5)
    lstPtToLine = []
    for lineBound in boundLines:
        lineBoundDs = lineBound.ToProtoType()
        ptmid = DSGeo.Point.ByCoordinates(ptmid.X, ptmid.Y, lineBoundDs.StartPoint.Z)
        interResultA = ptmid.Project(lineBoundDs, vectGrid)
        interResultB = ptmid.Project(lineBoundDs, vectGrid.Reverse())

        if len(interResultA) > 0:
            lstPtToLine.append(interResultA[0].ToXyz())
        if len(interResultB) > 0:
            lstPtToLine.append(interResultB[0].ToXyz())            

    if len(lstPtToLine) == 2:
        gridLine = Autodesk.Revit.DB.Line.CreateBound(lstPtToLine[0], lstPtToLine[1])
    return gridLine

                    
def getBoundLines(bbx, Zvalue = 0😞
    lstPt = []
    lstLine = []
    lstPt.append(XYZ(bbx.Min.X-IN[1], bbx.Min.Y-IN[1], Zvalue))
    lstPt.append(XYZ(bbx.Max.X+IN[1], bbx.Min.Y-IN[1], Zvalue))
    lstPt.append(XYZ(bbx.Max.X+IN[1], bbx.Max.Y+IN[1], Zvalue))
    lstPt.append(XYZ(bbx.Min.X-IN[1], bbx.Max.Y+IN[1], Zvalue))
    for idx, pt in enumerate(lstPt):
        if idx == 0:
            lstLine.append(Line.CreateBound(lstPt[- 1], pt))
        else:    
            lstLine.append(Line.CreateBound(lstPt[idx - 1], pt))            
    return lstLine        

activView = doc.ActiveView
cropBox = activView.CropBox 

fecGrids = FilteredElementCollector(doc, activView.Id).OfClass(DatumPlane).ToElements()
cutOffset = fecGrids[0].GetCurvesInView(DatumExtentType.ViewSpecific, activView)[0].GetEndPoint(0).Z
fecGrids = [x for x in fecGrids if isinstance(x, DB.Grid)]

outLst = []
boundLines = getBoundLines(cropBox, cutOffset)


TransactionManager.Instance.EnsureInTransaction(doc)
for grid in fecGrids:
    newGLine = createDatumLine(boundLines, grid)
    if newGLine and True:
        grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
        outLst.append(newGLine)

TransactionManager.Instance.TransactionTaskDone()

OUT = outLst

 

Node layout:

 

Grid to Crop Region_2023-06-14_09-38-26.png

Felipe.Reyes1337
Explorer

Thank you very much Pieter!

 

Appreciate the quick response even though the post is two years old.

 

Wish you the best of luck,

 

/Felipe

Thanks for sharing! @pieterdewaal 

 

In which dynamo package can i find "Grid Bubble Distance" and "Revit Unit Conversion Factor"?? Can't seem to find them..!

pieterdewaal
Advocate

@Nicolina.AndrenJakobsson 

 

The unit conversion is just a code block. Double click and type the number followed by ;. This only exists as dynamo works in feet by default (or I just haven't figured out how to set it to metric).

 

The grid bubble node is the python code. Simply double click a code block and paste the python code.

pieterdewaal
Advocate

@Nicolina.AndrenJakobsson 

 

Correction: the grid bubble distance node is just a default out of the box slider.

 

Apologies, I didn't check the image again before commenting.

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Autodesk Design & Make Report