Grasshopper

algorithmic modeling for Rhino

Does anyone know of a way to use a timer inside a cluster? As soon as it is inside a cluster it stops working, even when the cluster itself has a timer attached to it.

I use a timer a lot to create dynamic file names with the date and time and would love to save the components in a small cluster, but the timer prevents it.

Maybe someone knows a way to get the current time without using a timer!?

I really wish clusters worked like nested documents for organizing and not just as containers for small parts of a file as they do now. For large patches it doesn't make sense to basically just operate on one level for everything. Fingers crossed we get some proper clustering for GH2.

Views: 1405

Attachments:

Replies to This Discussion

Sorry to say i don't have an answer to your question as to how to make a timer work in a cluster, but i have worked with datetime in python before so have been able to code up your cluster in a single python component with a few lines of code. One working with a Button input and the other a Timer. 

Attachments:

Thanks Matt, that seems like what I need. I noticed the Button Update one is red when you first open it and only turns grey after hitting the button once. I'm sure its a simple fix. But I that it uses strftime, so I can enter my desired format :)

Ah good to know, thanks. I did not get that red component error as not opened a fresh file.

There maybe a better way to write it as currently it checks every-time if the key exists. 

Updated code attached. 

Attachments:

Building on your script, I have played around and somehow managed to add a Format input, which lets you input the date format, so you dont have to edit the code directly. If no Format is supplied it reverts to the standard format (minus the th endings on the date).

Empty:

ps: current limitation and way outside my python "skills": You cant have more than one instance of it in the document. But for what I am using it, its enough..

Attachments:

Clusters are documents, however documents decide whether or not to run depending on their context. Typically only the document currently loaded in the canvas will run solutions and use up processing power.

Do you want to get the current date/time whenever a solution runs, or do you want to run a new solution every second? 

Thanks for clarifying. I am sure there is a lot of thought in what documents run and which dont to cover the most common scenarios. I for one would like to have nested documents, with the ability to have multiple windows open at the same time and being able to recalculate globally without having to leave a cluster. For smaller things the current system is great, but once you get larger files it would be nice to not have those limitations.

I need to get the current time with a trigger, ie. when I write a file from within GH I want it to make the current date and time part of the filename.

I am always kind of surprised that the Clock component cant be updated with a timer, or simply has an option to have it running with the current time. That would be handy AND look good! :) Or Construct Time could just have an update pin, as it already has the "Update Date" and "Update Time" functionality, so just needs 2 boolean inputs. Leaving them at 1 would just update the time every second.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service