How to Reset Crop view using Dynamo

Could you please show me the input data you have in a screenshot? I can reproduce your inputs to see why it may be failing.

I’ll do that tomorrow or maybe when i get home… Got to run :running_man:

This is working for me with a simulated View structure similar to yours. Without seeing the contents of the Warning message (Hover over the yellow box and screencapture that) i’m unsure what is going wrong.

See working code and context as below:

1 Like

Revit 2021.

My test files
ResetCrop.rvt (404 KB)
ResetCrop.dyn (5.8 KB)

1 Like

Thanks for sending those through - found the culprit :slight_smile: It appears that the check for input data being in a list is failing, and wrapping it one level deeper into a list.

You could use this code, in your scenario, by taking out the following code portion.

if not isinstance(view, list):
	view = [view]

Obviously, that doesn’t help safeguard against lists of different depths, but it’s an unblocking for this problem :slight_smile: The hasattr (has attribute) check does successfully pass though:

if not hasattr(view, '__iter__'):
	view = [view]

And this successfully executes your code in your scenario :muscle:


Thanks for your assistance! @solamour

1 Like

You are most welcome @bvs1982 :slight_smile: