I am trying to place a co-ordinate system along a bspline curve. I need to use "by incremental distance along curve" as the spacing varies and I need to use "chord length" for my purposes. I am finding that if I use the "chord length" option I get an error saying the "curve must be planar", but if I use "by spacing along a curve" using "chord length" it works? this also occurs with points? these errors do not occur if I use the "arc length" option.
Hi All,
For those who are interested, one of the reasons the lines could turn back on the line is the way I wrote the function.
It created circles based on the previous point to generate the next point which is handy but does give you 2 points in most cases so it is a matter of choosing which point to use index [0] or [1]. I think in my example it was set to MyNextPoint = MyNextIntPointCount[1];
Thinking that as the intersecting points are created point[0] would be closest to the start of the BSpline. But this is not always the case.
I should include some checking to determine which point to use but at this stage you can just change the value to [0] and it will all work :)
ThanksWayne
hi Wayne, I am finding that incremental distance routine is returning back on itself along the line, then continue on to the end. eg.
CS5[10] has CS5[12] on top of it and CS5[11] has CS5[13]. so the line starts ok but then is going back and fourth and then continues on to the end. which explains why I am getting too many lengths at the end?
I have set MyNextPoint = MyNextIntPointCount[0]
Hi Richard,
I am guessing that it could change indices as it moves along for some reason. So it may not be the best approach to rely on MyNextIntPointCount[0] or MyNextIntPointCount[1].
Is there some other way to check if it is [0] or [1]. For example does it continue in the x direction or y direction. You could then do a test if MyNextIntPointCount[0].X is greater or less than MyNextIntPointCount[1].X ?
Then you could use which ever is greater as the next point.
That might be a good way of error checking.
Thanks
Wayne
thanks for your reply Wayne. The next point will always be a greater value than the previous because it runs along a line that starts at zero (chainage) and increases as it moves along the line (bspline). the line can go either way in the X or Y direction.
So as it can not be defined as increasing in X or Y (could go either way). I had a bit of a dig around in the debug window and found I think what you need. Even though the points are generated as AtCurveSurfaceIntersection the distancealong value is 0.
But...
Looking a bit further at the values for the MyNextIntPointCount in the function and the 2 points it has contained.
The points have a T value. Which look suspiciously like a parameter along curve. Looking at the 2 values for MyNextIntPointCount [0] and MyNextIntPointCount [1]
They do seam to align generally with the intersection points along the curve. I suspect they are rounded a little so as long as you are not asking it for a fine step it should be ok.
So the you just need to add an additional if statement to check which one is next along the bspline.
if (MyNextIntPointCount.Count > 1) { if (MyNextIntPointCount[0].T > MyNextIntPointCount[1].T) { MyNextPoint = MyNextIntPointCount[0]; } else { MyNextPoint = MyNextIntPointCount[1]; } }
I think that should work.
Give it a try. I have updated the script in the attached file.
6012.Incremental_Distance.dgn