Divide curve based on scale factor

Hi there

I am trying to divide a curve into segments by using a scale factor. If for example my scale factor is set to 1.25 and the first line segment is from point (0;0;0) to point (1;0;0) then the next line segment will be from point (1;0;0) to point (2.25;0;0) and so forth.

What I’m aiming at is a parametric way of determining:

  • the number of line segments
  • the length of the last line segment

based on:

  • the length of the first line segment
  • the scale factor
  • the total length of the curve

I have been trying to figure this out for a while, but haven’t found any sensible solution yet. I have tried to write the idea out using standard Grasshopper components, which will hopefully make it clearer than the explanation above. I have no experience in writing code.

Hope it made sense and that someone may have a great idea with which I can move forward.

Scale Iteration.gh (16.4 KB)

Hi Jonas,

I made a python component that works as described ( I did it quickly so please test)
I’m short in time so I just drop it here without explanation, but if you have more questions just ask.


Scale Iteration_WD.gh (21.0 KB)

-Willem

One way is creating series and then use your massaddition on a subset of those series:

addition.gh (7.4 KB)

You can also use this

Hi,

it is not code, but vanilla GH. The only thing that should be checked is the count in Series component so evaluated points go beyond end point of curve. On that purpose i have set large number of 100.

Scaled Segments.gh (9.4 KB)

Hi Willem

Thanks for the effort - that’s nice of you. Unfortunately I get an error message from the python node. Would love to test it out though.

Hi Jakinta

Thanks for the reply!

I’m not looking for code or anything like that, so standard Grasshopper is great :slight_smile:
I have been fooling around for a while with a solution as you describe it. However, I would like to have a workaround in regards of the Series component, so that I don’t have to set any steps. What I’m looking for is a way for Grasshopper to determine the number of steps on its own based on start segment length, scale factor and total curve length. I guess setting a higher step number and then use a cull pattern to remove any segments above the total length is a solution for now.

You can do that with components or python

What message do you get?
It might be the input is different.
-Willem

hey, it seems i have manage somehow to apply while loop with Hoopsnake…it seems it gives desired result…

Scaled Segments-V2.gh (15.7 KB)

But of course, coded solutions above are better.