Moving a point in an arc (precise measurement)

#1

Hi forum. I am trying to find a way of placing a point in an arc, for ex 1 mm from the beginning of the arc.
So far I have been using “array on curve”. The problem is that this gives me unwanted points.

I was wondering if its any function to place one point 1 mm from the starting point of the line .

Thanks :slight_smile:

0 Likes

(Pascal Golay) #2

Hello - in V5, use SubCrv, Copy=Yes, snap to the end of the arc and then type in ‘1mm’ and Enter, that will make a short arc, 1mm long that you can use as a marker,

-Pascal

1 Like

#3

Hello Bruno,

You could use Grasshopper to achieve this as well (Curve/Analysis/Evaluate Length component), just bake the evaluated point to your Rhino document and that’s it.

@pascal
At first I wanted to suggest to use the Evaluate Curve component, but then I realised it gives a different result for curves not having a constant curvature. Could you explain what is going on? I imagined the curve domain to be homogeneous, e.g. if I want to evaluate a curve at length “a”, then t = a / L if the curve is reparameterized would do the job, but this is certainly not the case.

Thanks!

Please take a look at the attached files:

point at given distance.3dm (3.1 MB)
point at given distance.gh (19.2 KB)

0 Likes

(Pascal Golay) #4

Hello - parameterization is not necessarily even along the curve - try rebuilding one of your input curves to say 50 points. Or make a Nurbs curve from one of the arcs (ToNurbs)

Here’s a python that will do what I think you want:

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs


def MarkDistanceFromEnd():
    
    info = rs.GetCurveObject("select a curve near one end.", preselect=True)
    if not info: return

    id = info[0]
    pres = info[1]
    par = info[4]
    crv = rs.coercecurve(id)
    dom = crv.Domain
    if par> dom.Mid:
        crv.Reverse()
    dist = 1
    if sc.sticky.has_key('DISTANCEFROMEND'):
        dist = sc.sticky['DISTANCEFROMEND']
    dist = rs.GetReal("Distance from end", dist, 0, crv.GetLength())
    if not dist: return
    sc.sticky['DISTANCEFROMEND'] = dist
    
    rs.AddPoint(crv.PointAtLength(dist))
    
    
if __name__ == '__main__':MarkDistanceFromEnd()

-Pascal

0 Likes

#5

Thank you!

I did some testing and yes, the script does what the initial question requested.
I got that parametrisation is not even along the curve, but I still would like to understand how it goes, and I failed to find literature on the topic.

Rebuilding the curve with more and more control points converges the difference to 0 between the resulting points coming from evaluating the length or the domain, but isn’t an exact solution. For editing needs, I would prefer to keep the point count as low as possible.

0 Likes

#6

Thanks so much for this trick !

0 Likes

#7

Thanks! I am trying to avoid the use of GH for such a specific action.
I am not a GH experienced person, but I can say that to make a GH file for that action could be too much/

What do you think?

0 Likes

#8

Kinda late to the party, but here is a Python script that might help…
OffsetPointsAlongCrv.py (3.7 KB)

0 Likes

#9

Hi Bruno,

In my opinion it is good practice to extend your workflow with such small scripts – they are quite fast to make, reusable, and a fun way to introduce yourselves with Grasshopper. At least that’s what I’m doing and so far I’m convinced, that this is a viable way to go. As a next step I would like to do scripting as @Helvetosaur helped you, but that is beyond me at the moment.

0 Likes

#10

Thanks for your answer

0 Likes

#11

Unfortunately I am not that advance in this aspect of rhino. I would not know where to place this file :frowning:

0 Likes

#12

Save the file anywhere you like - then to run occasionally, type RunPythonScript and browse to its location. If you want to create an alias for more regular use, you can use _-RunPythonScript "full path to file" - where the ‘full path to file’ includes the file name and is enclosed in quotes. Don’t forget the -dash in front of _-RunPythonScript.

HTH, --Mitch

0 Likes