Force Autosave timer to run always


#1

My small business uses Rhinocam to program our machine tools. We have found that even if autosave is enabled, it does not run when creating toolpaths in Rhinocam because Rhino does not recognize the Rhinocam work as a change to the file.

What can we do to work around this? We have lost many hours of toolpath creation time due to this issue.


#2

I have tried created a script that saves the file. The script works but I can’t seem to find a way to make it run every 15 minutes. The idle processor won’t work either because it only runs once.


#3

OK so I set my RhinoPython script to run in the idle processor. I have also added this to the code:

setModified = Rhino.RhinoDoc.Modified.SetValue(Rhino.RhinoDoc.ActiveDoc, True)

This will flag the document as modified and trigger the autosave one more time after the idle processor runs. Still not a perfect solution but better than what we had.

Is there any way to reset the idle processor timer in my script so it runs more than once? That would solve my issue completely.


#4

In Grasshopper with Timer / Boolean / Command Component

Tested in RVB as a loop, but lames Rhino.

Option Explicit

Call SaveByTick()

Sub SaveByTick()

Dim TSt, Tn, Tic, Tac, Mis
Mis = 1
TSt = Timer
Tac = 900 '900sec = 15min

Do While Tac < 7205 '2 hours limit
	
	Mis = Mis + 1
	If Mis > 10 Then
		Call Rhino.Sleep(0)
		Mis = 1
	
		Tn = Timer
		Tic = Tn - TSt
	
		If Tic > Tac Then
			'Save statement region here
			Rhino.Print("Bum")
			Rhino.Print(Tac)
			'Save statement region end
			Tac = Tac + 900 'Add next 900sec/15min
		
		End If
		
	End If

Loop

End Sub

#5

And other problem, what save when cnc calculation is not complete and running.
I think that must also be examined by
Python: http://developer.rhino3d.com/api/RhinoScriptSyntax/win/#application-InCommand
RVB: http://developer.rhino3d.com/api/rhinoscript/application_methods/incommand.htm


#6

I thought about using Grasshopper like in your example, but I think it may be a bit tedious for all employees to keep grasshopper running in the background across multiple instances of Rhino/RhinoCam. Is there any way to do this with RhinoPython?

" And other problem, what save when cnc calculation is not complete and running.

Thanks that’s a Good point. This I did not think about. I tested my script with RhinoCam menus open and it functioned with no issues, but if RhinoCam is simulating a toolpath when the idle processor triggers the script I may have some issues.


#7

I think, You have to look deeper into IronPython modules.
There you can find infinitely many Timers/Schedulers procedures and Events…
Time, DateTime, Sched, from System.Diagnostics Stopwatch, Timer from Threading ect…

Quick DirtyTimer

import time

def TicTac():
    ticStart = time.time()
    ticControl = 900 # Save every seconds
    while True:
        tacDif = time.time()
        toc = tacDif - ticStart
        if toc > ticControl:
            print 'Save work' # If ticControl period is reached, save ....
            ticControl = ticControl + 900 # Add next control period
            if ticControl > 7200: break # Limit time exit loop
TicTac()

#8

I have tried timers, but every time I do something like this it hangs the command line. Is there a way to make it run in a separate thread?


#9

Another strange thing I noticed is when I use my “Save file” script with the idle processor, It works fine on my machine but it gets stuck on repeat on a different machine that is out in our shop. It just saves over and over non-stop until you move the mouse or rotate the view. I am thinking maybe because the machine out in the shop has a wireless connection so it takes longer to access the server. Not sure why that would cause a broken record scenario but it’s the only thing I can think of.


#10

I see that,
I’m still working in Rhino v4, so without IPython, i help myself:

  • Timer from Grasshopper, that executes command if not “InCommand”
  • Timer within RhinoScript for the calculation and new Rhino instance for working
  • External timer, which hooks into Rhino all (N) times[quote=“beezerlm, post:8, topic:45277”]
    Is there a way to make it run in a separate thread?
    [/quote]

At this point no idea, I think new thread inside “Script Interpreter”, runs in the same problem


#11

Wow that is quite a setup you have there. You use this timer for saving work?