Make a slider run with timer without saving frames for making layers

Hello!

I want to open a little discussion.

I have a kind of “layer machine” done with Human for a thesis project, that it has a lot of layers and sublayers.

What I’m doing first is to make all the layers and then bake my geometry. BUT, here’s the thing, i have to make 100 layers, so it’s kind of boring to being clicking over a over the slider, so is there a way to make the slider run by itself with a timer WITHOUT saving frames?

if someone knows how, i appreciate it.

gracias!

In before C# & python solutions:
Generation has a few counter objects which loops through numbers using the timer compontent.

1 Like

(a bit late… anyway…)

You can have a “automatic slider” by doing something like this:
counter

Or with c#… I’ve put this up from other similar stuff:
run_slider
run_slider.gh (7.1 KB)
(I’ve tested it a bit and it seems stable, but beware anyway…)

3 Likes

okey i’m trying the script. how can i control the interval?

Why do you need a slider at all for creating layers? Instead of providing a single value, can’t you provide a list to make them all at once? It would help if you upload an example file.

1 Like

What do you intende with “interval”?
(I’m continuing this for the sake of the “automatizing” of a slider, but @dharman point is good)

@maje90 with interval i intended like, controlling every how many n seconds it moves. With the C# script that you did, there’s no option to decide that like in the first definition that you pictured.

and about @dharman question, because it’s linked with a excel file that structures the name of layers and sub layers. my model (an architectural project) is structured by steps because i have to show to my profesor how it is generated, step by step. they assign us this layers structure and here’s the best way i could find to generate them. every step has this group of sublayers and as you can see, they are a lot.

meanwhile in grasshopper, every step is divided by a square group, structured as “number imput”, “geometry imput”, “generation of the step”, “number output”, “geometry output”, “step to bake in color”, "step to bake in black (to show the generation)

here’s a video about it

bake%26layer%20machine

Removed internal expiring solution and added a timer…
run_slider_V1.1.gh (8.1 KB)

I didn’t get at all what you explained about layers, but i’m pretty much sure you could do that in a more elegant way, and with much less components…

i know haha. it’s complicated to explain, i tried my best! i’m the third person of my thesis group that tried to do this “bake&layer machine” for everyone to use.

the only thing that i can say is that if i generate every layer by once, my computer dies haha, cause they are hundreds of layers.

gonna try that script! thank you for the help.

this statement suggest to me that your question is more about mass layer creation than slider automation. Is that right?

well, yeah, but i just thought about the slider automation…

Are there any way to do this in python?

This might help:

1 Like

Thank you can i record the position? may be in ‘b’.

import Grasshopper as gh
import Rhino.Geometry as rg

def updateComponent(interval):
    
    """ Update this component similar to using a grasshopper timer """
    
    def callBack(e):
        ghenv.Component.ExpireSolution(False)
        
    ghenv.Component.OnPingDocument().ScheduleSolution(interval,
    gh.Kernel.GH_Document.GH_ScheduleDelegate(callBack))

a = rg.Point3d(0,0,0)

# Instantiate or reset persistent counter variable
if "count" not in globals() or not Run:
    count = 0

# Update the variable and component
if Run:
    if count < Target:
        count +=1
        updateComponent(Interval)
    elif count == Target:
        count = 0

# Output counter
Counter = count

b = []
vector = rg.Vector3d(Counter,Counter,0)
a = a + vector
b.append(a)

Sure, one method would be to record point positions by adding them to a persistent polyline. See this post for an example:

1 Like

thank you very much. Is it possible for me to know where I am doing the mistake.

import Grasshopper as gh
import Rhino.Geometry as rg

def updateComponent(interval):
    
    """ Update this component similar to using a grasshopper timer """
    
    def callBack(e):
        ghenv.Component.ExpireSolution(False)
        
    ghenv.Component.OnPingDocument().ScheduleSolution(interval,
    gh.Kernel.GH_Document.GH_ScheduleDelegate(callBack))

a = rg.Point3d(0,0,0)
b = []

# Instantiate or reset persistent counter variable
if "count" not in globals() or not Run:
    count = 0

# Update the variable and component
if Run:
    if count < Target:
        count +=1
        vector = rg.Vector3d(count,count,0)
        a = a + vector
        b.append(a)
        updateComponent(Interval)
    elif count == Target:
        count = 0

# Output counter
Counter = count

i want to append the updated positions to b. Thanks

I’m not on my computer, but have a look at the attached file here, it should get you going:

Edit: That might not actually be very helpful, but good fun though. Try moving the instantiation of the a and b variables here (i.e. which will make them persistent):

# Instantiate or reset persistent counter variable
if "count" not in globals() or not Run:
    count = 0
    a = rg.Point3d(0,0,0)
    b = []
1 Like

Thank you.

The code which I have placed above is running, but am not able to append or record the position in b. I will try with the one you have shared.

Have a look at this code, it should explain the mechanisms you’ll need:


230505_DynamicPointsGeneration_00.gh (7.1 KB)

1 Like

Thank you.