generative modeling for Rhino
There are two computers I'm using, one using bootcamp on imac, with 32 win7, another 64 pc with win7.
I created a simple definition, say read in a text file with a data "1", increase it by 1, drag the output to a panel and stream the content to the same file. On the 32 win7 the definition will stop here until I plug in a timer to the file path component, then the number will increase at the interval I set. But on the 64 win7 once I made the panel stream the content to the same file, it would start the cycle automatically without me plug in a timer at all, which quickly resulted in freezing of the whole program.
I'm intended to use the same logic to create some real time form finding definition, but with the 64 win7(which is my laptop at home) keep doing that, I'm wondering if anyone would know what's causing the issue.
Thank you so much.
it's most likely a timing issue. If the event I get from Windows telling me the file has changed happens during a grasshopper solution, I ignore the change. If however the event comes just after the solution completes, I respond then resolve. It sounds like the 64-bit windows version either solves the solution faster or delays the file event (it could be a minimal difference).
A virus scanner could delay file events as it intercepts file changes and checks them for suspicious signatures first, is there a difference in virus scanner software on both machines? Of course this is all speculation, I'm just saying it might explain what you are seeing.
The more serious issue here is that the behaviour you're trying to get rid of is the behaviour one would ideally expect in this situation. If your algorithm is triggered by a file change, and you change that file from within the algorithm, of course you're going to lock up.
I very much think you need to stop using FileWatcher to get the contents of the file and use a VB/C# script instead. It's very easy to write such a component. I attached a ghx file with two file reader scripts. One reads the complete content of a file as a single piece of text, the other reads individual lines.
lol, it's funny how the definition is written in 0.80007.
Just got the cycle working with a timer, thanks so much David!
You can assign a timer to the VB component, then it will reread the file content and the panel can then rewrite the file content. After the solution completes, the timer will kick in and trigger another solution. This is a much safer approach.