Like AlongCrv, but different


#1

Hello,

this a strange task.
It can be done manually with no problems, but shall be automatic.

The goal is to get evenly spaced points on a contour.
_ArrayCrv is the wrong tool, it produces even distance along the curve.
I need the same distance between the points.

Ideas how to manage it?

Thanks,
-C-H-A-R-L-E-S-


Uniform Curvature for Grasshopper
(John Brain) #2

You could do it using grasshopper with a couple of clicks - have it even interactive with distance or points amount and circle diameter etc…

EDIT - hmm or maybe not - what I now see is taht your distance is linear regardless of the curvature… This would need some fiddling with…

Regards,
Mac


#3

Yes, true unfortunately.

Rough idea:
Get the start point of the curve (= last good point)

Make a circle radius = desired distance, center = last good point
Get intersection point from circle/curve
Test, if the intersection is on the curve (in most cases this will be 2 points)
Add the int point to a collection, only if the point was not already there
If success, make the int point the last good point
Start over until no point could be added to the point collection

I still believe there must be an easier way…

-C-H-A-R-L-E-S-


(Tom) #4

Hello,

use pythonscript:
divideByLength.py (437 Bytes)

import rhinoscriptsyntax as rs

Get radius

radius = rs.GGetReal(“type in radius”)

Make sure its positive

radius = abs(radius)

Get geometrical object

obj = rs.GetObject(“Select a curve to divide”)

if obj is curve

if rs.IsCurve(obj):
# divide by length, geet points
pts = rs.DivideCurveLength(obj,radius,False,True)
# create circles out of pts
for pt in pts:
rs.AddCircle(pt,radius)


#5

TomTom,

this doesn’t result in equal distances between the points…
I mean the length of a line point to point.

-C-H-A-R-L-E-S-


#6

I found this script
https://wiki.mcneel.com/developer/scriptsamples/divideequidistance


#7

Wow, that’s exactly as wanted!
And from what I see similar to my fantasy logic…

Thank you,
-C-H-A-R-L-E-S-


(Tom) #8

oh, okay my fault

now its even more simple :
divideEq.py (382 Bytes)

[…]
rs.DivideCurveEquidistant(obj,radius,True,False)

T-O-M-T-O-M :slight_smile:


#9

Doesn’t Rhino have a command for this?

Is there something I am not getting?

«Randy


(Pascal Golay) #10

Hi Randy - that divides by arc-length along the curve, Charles was looking for even linear distance.

-Pascal


#11

@pascal I see, just rereading this on my dinner break. That is more difficult.


(Pascal Golay) #12

Yeah - RhinoScript has a method just for that - DivideCurveEquidistant().

-Pascal


#13

Thanks TomTom,

I think simpler is not possible…
…great

CharlesCharles :slight_smile: