Apply Scope Box to Specific Views

I’m trying to apply a scope box to specific views. Actually, in the end it would be nice to be able to have all my views to automatically get scope boxes applied to them. Also, I need the script to also turn off the “Crop Region Visible” parameter as well. I have gotten to the very end of this. But, its shooting back NULL at me with no results. Any direction would be great. Attached the dyn file.
APPLY VIEW TEMPLATES TO VIEWS.dyn (12.3 KB)

Thanks.

Pretty straight forward parameter setting. Just make sure you give the scope box element, not the name.

1 Like

I’m get Null results at the Element. SetParameterByName.

Can you show the error?

If your Revit parameter is a YES/NO parameter (infered by your use of false), you need to input an integer, not a boolean. In Revit it uses 0 = False, any other integer = True. If this is the case, set the value to 0 and it should work. The other issue, at a guess, is possibly caused by a View Template assigned to your active view.

EDIT: True and False will also work! There’s only one error to resolve…

So, I made a couple edit. I’m almost getting the results I need. Still at the end it goes null.
APPLY VIEW TEMPLATES TO VIEWS 2.dyn (11.6 KB)

What view are you using?
I only used ActiveView as an example. You need to pass the correct view into SetParameterByName. I’m guessing you’re active view can’t take a scope box.

@timmyt21, this works for me:


The first SetParameterByName sets the scope box, the second one turns off the crop region.

(Added): it turns out that when you modify the sketch of your crop region, the Scope Box parameter becomes read-only. This is why some views return the “null” values.

This string gives an error at the list.getitemallindex node.

I’m trying to apply the “Area A” scope box to all dependent views that have “Dependent 1” in the view name and turn off the “Crop Region Visible” parameter for the views. Everything works great until the first “Element.SetParameterByName” node.

@timmyt21, Get Item At Index expects the Number, not the String: remove the quotes from the input (“0”)
I’m talking about this guy:

You’re also feeding the view name into the SetParameter node, not the actual element. You want to use FilterByBoolMask on the AllElementsOfType node.

This part of your code doesn’t work, because you’re using the wrong input.

1 Like

YES! Thank you. That seems to have fixed the issue.

Gah, new job linked to my autodesk account! Not right! Oh well, lol

I’m working on setting some scope boxes as well, but on my Element.SetParameterByName, I keep getting “Parameter Storage Type” is not a string when I try to write my Scope box names to the “Scope Box” parameter, not sure why as the examples above are doing the same thing.
dynamo1ss

feed scopebox into the value. it should work

did you ever get this to work? I having the same frustration right now

@scrowe, as @karthi1015 said…

feed scopebox into the value

(not the name of the scope box)

Hope that helps,

Mark

So this works for me… kind of. It lists all 4 views I am trying to select correctly. But it only lets me select one scope box from the list and it makes all selected views that scope box. What I really need is Area A to be applied to the FINISH - Area A plan, Area B to be applied to the FINISH - Area B plan and so on.

image

Whats the best way to achieve this functionality?

Thanks!

Create a Dictionary: keys = strings [“A”,“B”,“C”,“D”]. values = your 4 scope boxes.

Get your views. Get the last character in the view name. Get Dictionary Value by Key, feed those characters into the Key. Assign the resulting Scope Box to the views.