Divide a curve using equi-distance points


(Emmanuelle Vanhaesendonck) #1

Hi,
I have a curve on a hyperboloïd, and I want to divide the curve in 4 straight lines with the same lenght. With the command divide, I can only divide the curve in 4 same lenghts. I found a plugin that has the command to do this, but it is for Rhino 4, and I tried it, but it doesn’t want to install on Rhino 5. There is an explanation in the link how the plugin would be for Rhino 5, but I have no idea how i can use it.
This is the link:
https://wiki.mcneel.com/developer/sdksamples/dividecurvestraight


Any suggestions how I can use this plugin in Rhino5? Thanks


(Pascal Golay) #2

Hello - this python may do what you want - use RunPythonScript to run it, or

! -RunPythonScript "Full path to py file inside double quotes"

You can add that macro to a button or alias…

DivideCurveEquidistant_03_02.py (1.4 KB)

Hmm - maybe not what you need… I guess you are looking for the number of divisions and not the length, right?

-Pascal


(Emmanuelle Vanhaesendonck) #3

hi, thanks for the pythonscript. I tried it, and it divides the curve in many points. I am looking for the points, on the curve, so that the straight lenghts between them are the same. I should be able to tell Rhino I need 4 parts of the curve.


(Pascal Golay) #4

Yeah, it divides the curve according to the length you set, not according to the number of divisions - that’s harder… I’ll take a look.

-Pascal


(Emmanuelle Vanhaesendonck) #5

Yes, thanks!


(Pascal Golay) #6

Hello - here’s a Grasshopper/Kangaroo solution from @DanielPiker - that is the best bet, I would say.

EqualizeSegments.gh (17.4 KB)

@StructureEmma, I changed the inputs a little to make it clearer (I hope) and updated the file. I also added a polyline as the output, which is what I think you want…

-Pascal


(Emmanuelle Vanhaesendonck) #7

great!! I get some warnings when opening the grasshopper


Do you know if i can download those somewhere, or is it not normal? I am just a beginner with grasshopper… :smile:


(Pascal Golay) #8

Hello - yeah, you need Kangaroo -

I tested this in V6 on Windows, so I am not 100% sure (just noticed we’re on the Mac forum) if that is compatible with the GH you have but I would expect that it is.(btw, I added a polyline as output to the GH file above, so, re-download if you want that.)

-Pascal


(Emmanuelle Vanhaesendonck) #9

Kangaroo installing went well :):sweat_smile:
Can it be the file is heavy to run? When I open the gh now, my Rhino seems to ‘stop working’ (and i have a powerful computer :stuck_out_tongue:)
Thanks!


(Pascal Golay) #10

Hmmm - it is instant here… I hope I did not mess anything up - you can get the original GH from here:

http://www.grasshopper3d.com/forum/attachment/download?id=2985220%3AUploadedFile%3A1456247

-Pascal


(Emmanuelle Vanhaesendonck) #11

This one opens with no problem! Could you send me an image of your gh file? That looked easier for me to understand…


(Pascal Golay) #12

Hello - mine looks like this:

Equalize is the button component, renamed
Divisions is an Integer component, renamed
Crv is a Curve component.
Then I added a Polyline component at the far end.
I think everything else is the same.

-Pascal


(Emmanuelle Vanhaesendonck) #13

If I can annoy you with another question? Now my line is divided with grasshopper in points and lines, is there a way to ‘snap’ on the lines in Rhino? So I can continue drawing in Rhino without gh?


(Pascal Golay) #14

You can ‘Bake’ the lines and or points into the Rhino doc then use these to snap to. If you add a polyline component as I did, you can Bake the polyline directly, with no drawing in Rhino needed. Right-click on a component to bake.

image

-Pascal


(Emmanuelle Vanhaesendonck) #15

Great!! Thanks for your effort, you helped me quite a lot!:tada::tada:


(Pascal Golay) #16

OK, good - I’m curious to know why my tweaks caused trouble though - I guess I’d better launch the Mac and test. Maybe a V6 vs V5 thing.

-Pascal


(Emmanuelle Vanhaesendonck) #17

Yes, I have the same model as you - except the division component, I just filled in the number at the divide component- and this is working. Could it be Mac can not open properly a windows saved version?


(Dale Fugier) #20

I’ve added an item to our issue tracking system to add a EqualChordLength option to the Divide command.

https://mcneel.myjetbrains.com/youtrack/issue/RH-44521

– Dale


#21

Thank you Dale, this will be very handy.


(Emmanuelle Vanhaesendonck) #22

I noticed something while drawing with this method. My model should be exaclty symmetric on some places, and it isn’t. While zooming in the corners, you can see that the division doesn’t go exactly until the corner…
This is an image from 3 curves I divide in 4 parts.


And this is the zoom in the intersection of the 3 curves.
Can I do something to fix that in the grashopper file?
When I draw a line, or arc to divide, i don’t have this problem… This is a projected line on a hyperboloïd surface.
@pascal, do you have this also on windows, that the division doesn’t go till the end of the curve? (I can give you my file to try with my curve to see what it gives…?)