Set Crop Region

Hello !!
I am trying to set a crop region by curves, and am trying both with curves and bounding box, but non of them are working, and it’s not giving any warning, so I don’t know what I am doing wrong.
Any idea?
Thanks

Maybe you can show us your method - how are you trying to set it?
One possibility is that you set the cropBox correctly but you don’t make it active.

I don’t have at the moment solution for curves (can try later) - but this works for a bounding box:

import clr

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

clr.AddReference("RevitNodes")
import Revit
from Revit.Elements import *

clr.ImportExtensions(Revit.GeometryConversion)

doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
view = UnwrapElement(IN[0])
bb = UnwrapElement(IN[1])


TransactionManager.Instance.EnsureInTransaction(doc)

view.CropBox = bb.ToRevitType()
view.CropBoxActive = True

TransactionManager.Instance.TransactionTaskDone()

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

Oh sorry, I forget to upload.

For the bounding box part - I think the node is expecting a bb list and you give a single bb.
As for the byCurves path - have you tried inputing a list of curves instead of a polycurve? The node might also be expecting a list of lists (of curves). One curve list for one view.

Do you want to set the same cropBox for all the inputted views by the way?

No, I didn’t try with list, so I will work on it.
For now, I am trying to set for all views, but then I will change it to Current Selection with boolean.
Thank you a lot.

Take a look at this link and see if it can help. I think the MEPOver package may have nodes to help.

Thank you SeanP.
Now, I am very close to a solution, but have one problem.


I can not understand why, but this script is working for only one view and no for any other.
When I am trying to select another view, it’s not working.
And it’s totally not working when I am selecting several views.

Maybe I have to try without boolean.

@TomArchitect
The View.GetCropBoxCurves works only for ONE View unlike the View.SetCropBoxCurves (which works for multiple Views).

I ran into similar (a) problem(s).

I am looking for a solution to get the Crop Regions from MULTIPLE Views.