Copy cropbox from one view to another

I’m trying to use one view as a template to make other views of the same area and need to copy the cropbox, and apply it to another view. I’m using the code from this topic as an example:

The GetCropShape function seems to be spitting out four curveloops, which I can’t figure out how to combine into a single closed curveloop, which is what 'SetCropShape` is looking for. Trying to append the different sections throws an error: “Expected curve, got curveloop”

In addition to spitting out separate curveloops, it’s only giving four, when I would expect either one or six given the view shape shown.

Any thoughts would be appreciated.

There are a few snippets in your code that seem odd.

  • On line 37 I would replace the part between parenthesis with the ‘loop’ you created on line 30
  • On line 32 you should uncomment the ToRevitType() part and also put it between the parenthesis

Alternatively you could take a look at the code in these nodes from the MEPover package:

3 Likes

I think these nodes will do exactly what I need. Thanks!

1 Like

@stevenmathias1
Just wondering - Any particular reason why Scope Box is not being used to control the View crop?
That way, if it’s already applied, copying from one view to another would be straight forward…
Again, that is because I don’t know coding &/or Python!!

Scope boxes van only be rectangular, so for any non-rectangular shape you need a cropview

1 Like

@T_Pover
Thanks for pointing it out!
Didn’t look at it that way :slight_smile: