Polycurve point at chord length

Hi
I am trying to divide a polycurve using the Curve.PointAtChordLength but it doesn’t work. I just get ‘parameter at chord length Not Implemented’.

I have also tried ‘Curve.ParameterAtChordLength’ (even though I don’t know the parameter) and that too doesn’t work with polycurves. The only command that seems to work with polycurves as opposed to curves is Curve.PointAtParameter but I don’t know the parameter, I need distance.

As a work around I have even tried to manually work out the point and then to use Curve.SplitByPoints but this explodes the polycurve and returns just one curve before splitting it.

Previous posts have discussed how to do a subdivision on a polycurve using parameters but I need a single points at a fixed chord distance. Any suggestions?

http://dynamobim.org/forums/topic/divide-polycurve-equally/
http://dynamobim.com/forums/topic/how-to-get-the-center-of-polycurve/

Thanks

That’s going to be tricky, probably a bug - even converting to nurbs isn’t implemented (reported on github here )

Here are your options:

Simple solution:

  1. Create a point at the start parameter using the Curve.PointAtParameter method
  2. Create a circle with a radius the same as the length you need
  3. Intersect it with your polycurve to generate the point

Complicated solution (if your only curve is made of nurbs curves, arcs, etc)
In this situation the circle intersection could easily intersect twice or more generating more points than needed which in turn creates the problem of establishing which one is needed. Since we know its the point which is ‘first’ traveling along the length of the line, the following should work:

  1. Follow steps 1 and 3 above
  2. Create ‘sample’ points along the length of the curve closely spaced
  3. (requires coding) Create a loop and iterate through the list of sample points testing the distance to the intersection points
  4. The intersection point needed is the one closest to the sample point with the lowest index number

The above suggestion isn’t bullet proof - for example if your polycurve overlaps where there is an intersection, or of the spacing of the sample points is too great, the test above could return unpredicable/incorrect results. If however thats unlikely, it should work

Hi Paul,

Did you try “Curve.PointAtSegmentLength”?

Hi Thomas
I’ve tried your simple solution as shown in the above image but the problem is then trying to split the curve as previously mentioned.

Hi Kalkul

Yes ‘Curve.PointAtSegmentLength’ works but I need chord length, not length. Any other suggestions?

You need to convert polycurves in to curves. Curve.PointAtChordLength works fine.

I know that this works with curves but my question was if it was possible to work with polycurves. Are you saying the ONLY way to do this is to explode the polycurve and then use Curve.PointAtChordLength?

@Paul_Wintour How about approximating the geometry of the polycurve as a nurbs curve?

1 Like

@Vikram_Subbaiah this won’t work because the polycurve contains lines and arcs. Surely there must be a Dynamo command that allows you to create a point on a polycurve…

Can only suggest another work around.

1 Like

@Paul_Wintour if you’re only getting one curve when you split then your only option left is to reconstruct it (not to be confused with ‘rebuilding with tolerance’). This isn’t trivial as you’ll need to establish any curves that preceded the one being split, and join them back together again to return a new polycurve - once again, will require a bit of coding.

@Paul_Wintour
"curves is Curve.PointAtParameter but I don’t know the parameter, I need distance"

if I understand correctly calculate the parameter: parameters = distance / length polylinea
you can then use the node
Curve.PointAtParameter.

A few years since this issue was raised, it still doesn’t seem to be possible.

Any updates on this @solamour @JacobSmall ?

Just gave it a try in Dynamo for Civil 3D, ended up with Fatal Error.

Also tried it with Arc - it couldn’t even extract geometry from it using Object.Geometry node. But this is off topic.

Would be happy to provide all the necessary examples to demonstrate exact behaviour.

Hello @ValentinB,

We are holistically looking into improving PolyCurves around the board right now so that they will play better with all other geometry types. This will mean things like splitting a PolyCurve into smaller pieces will behave as expected. Currently we have a few cases where that doesn’t work appropriately :frowning:

2 Likes

Likely would not be too hard to write some code which takes the start point of the curve, intersects that with a circle, takes the point with the lower parameter and appends that to the output, splits the curve at that parameter and tosses the first segment. Then loops that process until there are no more segments left.

conversion to nurbs is now supported - so I think thats the simplest way to do this today if those distance methods are still not supported for poly curves.

1 Like

Which version is that in?

2.8:

1 Like