I am trying to modify this script to work with multiple views and multiple curves. I’ve spotted your comment that if this was wrapped in a custom node, this would be possible. I’ve been learning a bit of Python (mostly on a high level) not really dynamo specific. - but hopefully not too far off.
I’ve had a stab at modifying the python script to place everything within a for loop, but I can’t get it quite worked out. Could you give me a bit of advice, or if it would be easier wrapped in a custom node, what that would entail.
My fumblings are shown below:
import clr clr.AddReference('RevitNodes') import Revit clr.ImportExtensions(Revit.GeometryConversion) clr.ImportExtensions(Revit.Elements) clr.AddReference('RevitAPI') import Autodesk from Autodesk.Revit.DB import * clr.AddReference('RevitServices') import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument #prepare input views = UnwrapElement(IN) curves = IN curvelist = viewlist =  #Create curveloop TransactionManager.Instance.EnsureInTransaction(doc) for curve,view in curves, views: loop = CurveLoop() for c in curves: loop.Append(c) #Set cropregion in Transaction view.CropBoxActive = True view.GetCropRegionShapeManager().SetCropRegionShape(loop) viewlist.append(view) TransactionManager.Instance.TransactionTaskDone() OUT = view
I’m getting the error as shown …
this came out of the discussion Find Bounding Boxes of Multiple Scope Boxes