Grasshopper

algorithmic modeling for Rhino

Hi all!

Im recording a walking point with rec

this actually is a list.

there is a new point just moving the walker point

by the other hand there is a curve wich I need to divide in my code.

questions :

it is possible to regulate the timelapse between new walking point instances?

it is possible to add a new point with an event?( not just moving)

and

knowing  that the code will be executed each time I move the walking point 

what could I do to divide the curve just one time?

Views: 840

Attachments:

Replies to This Discussion

I don't understand what you're after. Can you elaborate, perhaps with pictures?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

sorry

Ill try to be more explicit.

in the attached  definition there is a point in a 2d slider

collect the positions with rec.

each time I move the point there is a new point colected  with rec.

stored in a list

related to the rec

question 1: a new point in the list depends of the slider movement?

question 2 : there is a timelapse between new appearances if I practice a non stop movement?

question 3: in that case it is possible to regulate this timelapse?

related to the code interface:

the code bubble I attach  to rec , as far as I understand, should be executed each time I move the 2d slider and produce a new point.

then

the code I want to be excuted each time  rec adds a new point to the list  should be in the "main" side of the interface

the declarations I just need to do once should be in the " custom aditional code"

but..

where I could write code to execute once?

( example: to divide the curve just one time , and not each time I add a new point)

my intention is to produce new points with a regulated timelapse or with an event, like for example the right click of the mouse moving the 2d slider

...

and write code to be executed just once.

GH is an event based interface. So what happens is this:

  1. You move the mouse.
  2. Windows detects that Grasshopper is the currently active window and it send a message containing the details of the mouse movement to the Grasshopper message queue.
  3. Whenever Grasshopper falls idle it starts to process messages from the queue. Mostly there are none, but every now and again there's a message in there that says something like "Hey! the mouse moved from A to B" or "Hey! the user pressed the Escape key"
  4. If there's a mouse move message and GH knows that the grip in the 2D slider was currently selected then it will move the grip to the new location. This will cause the MD slider and all objects downstream of it to expire.
  5. Grasshopper then determines that a new (partial) solution is called for so it triggers the solver. This will eventually result in a new point being added to the RECORD object.

There's no 'sampling frequency' that determines at what interval GH tests the mouse cursor. It handles all events as quickly as it can. There's obviously no way to speed it up as it is already happening as fast as possible, though theoretically it is possible to slow it down.

Instead of using the RECORD object, you could start recording data yourself in a C# component and refuse to add a record if it's too soon after the newest record.

It's an odd thing to want to accomplish though, people are rarely looking to slow things down. What actual problem are you trying to solve?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

so far, so clear, so good

What do you mean by "just once"?

  • Just once, ever, in the entire history of space and time?
  • Just once for every session of Rhino and Grasshopper?
  • Just once every time you open the GH file containing the script?
  • Just once every time the script component participates in a Solution?
  • ...?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

From looking at your code I think what you want to achieve is to cache the division points of the DivideByLength method so you only compute these points once for every curve. Is that correct?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I attached a file which only computes the DivideByLength() once. However it will not update even when you change the curve. I don't think we have a good mechanism in RhinoCommon to test whether a curve is exactly the same as some other curve which is what you'd need in this case.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

your solution is enought for me,

I could try an "interruptor" as a reset function to load again the base curves...

lot of points to learn from your piece of code.

thanks a lot!

youre right

still ambiguous,

just once  you open the file and make the point moves,

so I think is your last option.

Hola,

Maybe this is what you are looking for. This will add a new point every second while the slider is moving instead of at every component update.

I deleted the attachment apparently.

Attachments:

Hi! What's the difference with the Data Dam component?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service