Crop Region Size Parameter Edit by view

revit

#1

i`m trying to edit the parameters so as to make all the views with 3 mm annotation crop for example !!
is there any way ?


How do i Resize a Crop Box
#2

Hi @Ahmed_Salah1

There is a node from @T_Pover MepOver package called View.SetCropBoxCurves you could use that to set.


#3

@Kulkul the crop region i dont want to change im controlling it through scope box i want to change all the annotation crop offset only to be for example 3 mm !


#4

@Ahmed_Salah1 Sorry i thought your looking to set view crop boundary. You need to access revit api
http://www.revitapidocs.com/2017/d815093f-0331-76c9-7607-67e62f9f2c9b.htm



#5

@Kulkul Thanks but i dont think i can write a code yet im still learning , so i will wait someone to help me but Thank you to provide half of the solution .


#6

Hi Ahmed,

You can use this code to set the annotation crop size:

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

import clr
clr.AddReference('RevitAPI')
import Autodesk.Revit.DB

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

clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

#The inputs to this node will be stored as a list in the IN variables.
if isinstance(IN[0], list):
	views = UnwrapElement(IN[0])
else:
	views = [UnwrapElement(IN[0])]
size = IN[1]
	
listout = []
for view in views:
	regionMan = view.GetCropRegionShapeManager()
	TransactionManager.Instance.EnsureInTransaction(doc)
	try:
		regionMan.BottomAnnotationCropOffset = size
		regionMan.LeftAnnotationCropOffset = size
		regionMan.RightAnnotationCropOffset = size
		regionMan.TopAnnotationCropOffset = size
		listout.append(view)
	except:
		listout.append("failed")
	
	TransactionManager.Instance.TransactionTaskDone()


#Assign your output to the OUT variable.
OUT = listout

The size must be supplied in feet, so if you’re a metric guy (like me) then divide by 304.8 like in this example:


#7

@T_Pover you helped me twice this morning , Thanks


#8

Thank you T_Pover, for this piece of code


#9

This just saved me several hours worth of work. Thank you!