I have lots of views and due to different dimension placement on each the bounding box (the one marked with RED corners) is different sizes from viewport to viewport.
I have made a working script that takes example sheet and places views based on where the views are located in example sheet. But due to irregular sizes of bounding boxes the view placement isn’t consistent. Is there a way to place views drawing coordinates from crop region (marked with green corners). Or any other way so that placement is more consistent?
I also struggled with viewport sizes when placing views on sheets, there is only one real solution. You have to hide all annotation categories in the view. Then the viewport will have a consistant distance of exactly 0.01ft from the cropbox.
Later you can activate annotations again.
Unrelated question - where can I find those commands that you use in code blocks (Views.HideElements (v,e) in this case). They seam very useful maybe there are materials about them?
This is the working code I use in my graphs, revit 2022.
Do you get an error?
# Written by Frank Loftus. This code sets the "AreAnnotationCategoriesHidden" property to 1(true).
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
Input = UnwrapElement(IN[0])
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
TransactionManager.Instance.EnsureInTransaction(doc)
viewsOut = []
if isinstance(IN[0], list):
for View in Input:
View.AreAnnotationCategoriesHidden = 1
viewsOut.append(View)
else:
Input.AreAnnotationCategoriesHidden = 1
viewsOut.append(Input)
TransactionManager.Instance.TransactionTaskDone()
OUT = viewsOut
No error. It runs and returns the out, but it doesn’t do anything to the view. I may mess with it some more, but since the code blocks work, that will do for now.