Stop multisave from popping up after each file closes

Hi Guys,

I am using an automated process (attached) to close Rhino and grasshopper 20s second after a process complete but unfortunately every time the multi-save dialogue pops up. How do I prevent this from happening. I’ve attached a simplified version of the process. Thanks.

Best,
Kevin

Auto_close_Rhino_grashopper.gh (17.6 KB)
multisave

If you have automated way to save your file and you are sure it saves your file then kill Rhino.exe process instead of suggesting unsafe approach for all other users who like that feature of GH.

Btw, this message appears if you have a timer in your definition, or a self updating/expiring component. Maybe you should come with a solution to halt updating components before saving (and exiting) then your file will be up to date whenever ‘close’ is invoked and you won’t see that message.

All in all, I do not see this being a problem with the software, rather your approach.

1 Like

Hi Ivec,

I fully agree, my approach is messy and I am open to learning the best practices to achieve the end result. Unfortunately, I am running multiple iterations of rhino/GH and have not found a way to uniquely identify them and kill the correct process.

Thanks for the info re the timer. My definition has become very large and finding the component at fault has been difficult. Can you suggest any alternative to the timer to delay close (it ensures all files have a window to save and update). Thanks for your reply. (If you feel the timer _end exit approach I attached is a bad practice I can edit my post to remove it. (I’m operating beyond my skill level one this one)

Beat regards,
Kevin

I usually create a script to NULL-ify the input of a self-updating components but since you do not know just disable your canvas upon save/close

1 Like

Thanks for the suggestion. I did some google searching but wasn’t able to find a method of enabling/disabling the full canvas in one go. Is there a procedure for this? Can it be done programmatically? Thanks.

Best,
Kevin

@DavidRutten, is this possible?

1 Like

Btw, another thing you can do @kevs3dhub, is to create a script with a toggle input that disables all components on the canvas. That should also allow the save/close without triggering that message.

1 Like

I’ve played around with doing this through Metahopper but ended up going back to visit alternative approaches (I probably could have given it more time). Is that the approach you would recommend or would it be a scripting exercise? Thanks

Kevin

I would recommend you rethink your approach. Without more details and seing the code what kind of automation you do I cannot recommend anything.

Maybe your GH definitions could be replaced by a single Rhino.Python script and you wouldn’t need GH at all. I don’t know.

I have thought answering to this thread before, but I didn’t since I’m not going to write a script for that. The way you can approach is to decompile Grasshopper, finding the place where this window pops up and override any state responsible for this before attempting to close. Usually this is not exposed to public, but can easily triggered by using a mechanism called Reflection (which is really simple to use).
Another option is to find the button handle responsible for aborting, or you do this by autoclicking based on the window screen coordinates using Windows User32.dll. A third option is code injection to simply replace the default behaviour of the popup.
For someone with no to limited knowledge about coding all three approaches are not easy to implement, but at least these are three options to solve the problem.

1 Like

And a bit too invasive, bordering “terms of agreement” violation. :wink:

1 Like

Hi @kevs3dhub,

You can set the IsModified flag of the GH_Document you are operating on. If this flag is set to False Rhino won’t ask to save any changes on the gh file.

The line I added should to the trick, I don’t have your plugIn so i can’t test

5 Likes

Tom, thanks for your reply, as you mentioned this may be out of my wheel house but knowing more about the problem i’m trying to solve will help me find the right person (freelancer) for the solution. So I greatly appreciate your input.

Many Thanks,
Kevin

Hi Lando,

That done the trick! I was playing around with this before but I wasn’t obviously doing something stupid. I also used data dams instead of timers thanks to @ivelin.peychev for his suggestion. (I think the timer changes the flag instantly and they just loop over and back) . Now I just need to solve the breakpoints issue which @ivelin.peychev has also shed some light on.

Best,
Kevin

1 Like

Hi Guys,

Great news, the mutisave is working fine, unfortunately I can’t get my head around the breakpoints issue. I would really appreciate if some one could give me a better understanding:

I am using two scripts:

##Clears the command line and saves Rhino
if x==y:
rs.Command(‘EnterEnd’)
rs.Command(’
-Save’ + ’ Enter’)

##Resets modified GH flag and closes the Doc to avoid multisave popup
if x==y:
###########
ghenv.Component.OnPingDocument().IsModified = False
###########
rs.application.Exit()

For my testing I am using a simple GH

Once this GH successfully closes without multi-save it delivers a break point notification for each component.

If rs.application.Exit() is closing the application and the solution has reached that far why is a break point triggered when the application closes. Surely the solution is completed if it has reached the end? If anyone has a better understanding of this It would be greatly appreciated.

Breakpoint_example.gh (6.5 KB)

Do you mean to close Rhino or the document that’s opened in Rhino?

1 Like

I need to close both, as I am using a batch file to open Rhino and grasshopper. Similar to the process found here. Its uses a file patch as an argument for a .stl and the Grasshopper processes.

As there may be multiple iterations of rhino running at once, I have opted to end Rhino from inside grasshopper to avoid closing the wrong process.

I’ve been working on this for a few months and unfortunately this is the last sticking point.

Best regards,
Kevin

Do you mind sharing or explaining what kind of operations do you do with grasshopper?
I’m asking because since you do not need user interaction, and since pretty much everything that GH does can be scripted. You may as well use just Python for all that using Rhino3dm and RhinoCompute modules. Doing geometry calculations without launching Rhino/GH.

1 Like

Hi Ivelin,

The operational make customises .stl files using Voxel based Boolean using the Dendro plugin (as well as identifying the initials from the file name and saving a screenshot for review. It has become rather complicated.

How open is Rhino3dm and RhinoCompute to 3rd part plugins. The big question for me would be what is the conversion process like for someone who knows what they are doing. Is it a significant time investment? Doing the calculation without launching would be the best scenario.

Best Regards,
Kevin

Since you need Dendro and taking screenshots Rhino3dm will not help.
However, that should be feasible with RhinoPython script using NodesInCode. Then you do not need to launch grasshopper and script closing GH and Rhino but instead simply scripting opening and closing 3dm files.

For that question you may have to provide a simple example of stl file and the expected result. If the operation is the same for each STL file then that could give you clear idea what productivity you can expect from the process.

  • Launching Rhino just once.
  • Loading GH libraries just once.

These two alone will give you productivity boost.

  • Opening/Closing only 3dm files (no GH) files would give you even more.
1 Like