Hi,
is it possible to construct a mechanism to a gh-file that when opened, would automatically disable the solution? Like a small script that would somehow run in the beginning, and effectively stop the solution calculation.
I would use it as a safety mechanism on heavy scripts.
Thank you for the suggestion. It’s a bit heavy-handed, though, as otherwise I am not using Ladybug on anything else. It could be possible to construct a small script with similar functionality. But this would also mean that this script needs to be added as a flow-through component into the script’s process - and the user would need to locate and activate the component from the script. Not really, what I’m looking for.
I actually asked a similar question on this forum before, where I got no good answer either.
I turned out figuring things out on my own.
There are several ways of getting to what you want, but all involves rewriting the whole script.
One thing I learnt from ladybug is that you could make all the parameters “sticky” in python. Before you press that button and activate all the “sticky” variables, the whole script doesn’t run.
I ended up using the false-start toggle which is also a great way of deactivating the script by default. You can drag the component to the a place where you add scribbles and frames to make a good stylized UI.
Not the same, but related: I assigned F7 to disable GH. I tend to just use that before loading a script. In general you either know if the script is slow or fast, or you have no idea (when the script is from 3rd party) in which case disabling first is good practice anyways.
I have, for instance, fabrication data tool that generate fabrication data based on an image. The data is quick to generate, only minute or so, but the 3d preview using booleans takes about 5-30mins (based on image and size of course; and this is even when using parallel computation script on the boolean process).
When opening the file, I or other users have to remember to disable the solution so the file opens in a reasonable time frame. Sometimes you forget - and then you either wait it out, or force shutdown/restart, before trying again. And then start to modify the tool for the next work.
This is why, I would like to have a built-in method in the file itself - because there is no use-case where one would open the file with the solution enabled.
The more I read your request, the more I think FalseStartToggle is what you want. Have you looked into it?
If you don’t want to install ladybug, here is the standalone compiled plugin.
Example DisableSolver()
With this inserted script, global solver gets automatic disabled.
If solver is enabled, definition compute one pass and solver gets aggain disabled.
@Wiley
Problem with compiled definition, it must be distributed and installed.
@eddi
Excellent, thank you. I was searching through Gh API, but could not find anything.
I’ll give this a try if I can figure a solution to open file without the one pass. Something like hitting Esc on the keyboard, that stops the solver…