Problems using View.SetCropBox

Hello,
So, I’m trying to do a routine that:

  1. Take my current view

  2. Take the selected views

  3. Make the Crop View of the selected views change and be the same as the Crop View of the current views.
    But I’m having trouble making two things work:

  4. the Collect.CurrentSelection node is apparently not refreshing itself without changing the toggle.

  5. I don’t know why, but the View.SetCropBox node, even with the Inputs working correctly, does not modify the SetCropBox.

  6. These blue lines began to appear in the Crop format that I ran the routine in other views, but I was not even able to select them to understand what it is.

I tried with several other nodes and simpler crop formats too but I always get the same results:


Document.ActiveView

Hi luupieper,

I don’t have a view selection package installed, but I tried it quickly and everything works fine for me.
Blue lines are a geometry crop selection and should disappear when the dynamo closes.

Hi @Mo_Ody , thanks for replying
I researched some more to try to understand the problem and found this:

I managed to make the setCropBox work by modifying the nodes that define the view with the “original crop”.

But for the Refresh issue I couldn’t find SpringsUI.Refresh in the current Springs package. DateTime.Now with execution mode as periodic dindn’t work (I want my colleagues to be able to use this routine via Dyno Browser or at least dynamo Player).
For now I made a UI with Data shapes …

First, you must reload the dynamo script each time the inputs change.
Periodic mode will not work here because you need to separate the inputs as
doc.ActiveView and selected views

I looked closer at your problem and I found out that the problem was selecting the ActiveView. If the user is clicked in project browser window Revit returns “Project View” as active. So you need to be clicked in model space to return the correct view,which is quite difficult when you also need to choose views to crop

So I’ve created a script that warns user that he is clicked on in the project browser window. if he runs the program clicked correctly then he can select the views and finish it with the OK button.
But of course Data shapes are also great solution.

CropViews.dyn (16.0 KB)

1 Like

Hey, thanks for your attention!
For now my Script works like this:


I think it would already work well like this, but selecting things in the browser really seems a little more practical. I’ll take a look at your Script to inspire me to adapt this part of the Script.