Grasshopperplayer unlocking the solver too early

Hi,

I guess grasshopperplayer code goes like this:

-1. Activate grasshopper and unlock the canvas
-2. Open the grasshopperplayer file and execute it

But this is annoying when a gh file is opened and locked: launching a grasshopperplayer file will also unlock and compute your current file.
Would it be possible to reverse step 1 and 2 so that the current opened file won’t compute when launching a grasshopperplayer file?

GrasshopperPlayer is intended to run from Rhino without grasshopper open.

SelectGeometry

I don’t think you can “reverse steps 1 & 2” since a Grasshopper file cannot be opened prior to all of the Grasshopper libraries, etc. being loaded (which is what happens in step 1). Why would you want to use the Grasshopper player with the solver locked? Nothing would happen.

Hi @Japhy and @AndyPayne,

Let me explain the problem as I encounter it:

I am using a grasshopper definition for my project. Lets call this file “A”.
At some point I need to lock my grasshopper definition so that it does not recompute (i.e. imagine that this definition is slow to recompute and I am doing manual changes in rhino which would trigger the gh file to recompute, so I just lock the solver for a while to not loose time)
Then, I need to launch a grasshopperplayer to help me in my rhino modeling. Lets call this file “B”. At this point, I would expect this:

  1. open “B” in the background
  2. unlock the solver to compute “B”
  3. re-lock the solver
  4. show “A”, still locked and not recomputed

But, what happens instead is the following:

  1. unlock the solver. At this point “A” is recomputed: THIS IS THE PROBLEM
  2. open “B” in the background and compute
  3. re-lock the solver
  4. show “A”, still locked and but recomputed. However, I never asked to recompute it!

Hmm. It seems like there could be two options which might help here. Is it possible to break your definitions down into smaller sub-definitions? That way you’re not waiting for all of “A” to recompute. Maybe you could build up a specific sequence of steps (or definitions) that need to be loaded before moving to the next step. Would that help in this situation? Right now, you seem to be switching back and forth between definitions which I don’t think will work well with the GH Player since it’s going to run a definition to the end of the command and then load a new definition when you launch a new command.
Alternatively (or maybe together), have you considered using a Stream Filter component linked to a boolean input which is controlled via the GH Player? If it’s “False” or “Zero” then nothing is output from the output side of the filter (and thus the rest of your definition is not computed). If you input a boolean of “True” or “One” then the data you want to pass on gets returned from the filter and the rest of your definition continues the computation? Would that work?

Yes I know definitions can be optimized in many ways, but my point was that grasshopper has a locker which is a great GH feature. I use it very often to switch between files just to explore them but not compute anything, or to prevent GH to re-compute when I modify inputs from rhino, or to pause iterative processes like kangaroo, etc. It is the most generic way to ask GH not to compute.

Usually when the solver is locked and i want to open and compute another GH file, I will first open this other file and then unlock the solver. I don’t find any logic to unlock first and then open my file.

So, I don’t see any reason why the opening sequence of GH-player is to unlock first and then open.

I usually circumvent this by having several Rhino+GH sessions opened at the same time, but I guess this wouldn’t work for you because both the GH script and the GHplayer script leverage the very same Rhino file?

would the cachecontent battery work here?

Yes it actually works and I do the same, but sometimes I forget to switch to a light file before running a GH-Player command, and BAM I get the locker to unlock and my currently opened file to compute before that the GH-Player file gets opened.

Of course it is not such a big deal, but I just find it illogical and annoying