.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GetParameterAtDistance not working - bug?

2 REPLIES 2
Reply
Message 1 of 3
Sinc
434 Views, 2 Replies

GetParameterAtDistance not working - bug?

I'm having issues with the Curve library. The GetDistanceAtParameter function does not seem to return the correct value. It seems to be using the 3D distance along the Curve, whereas the other routines in this library use the 2D distance along the Curve. This yields inconsistent results. For example:

param = curveItem.GetParameterAtDistance(dist1);
dist2 = curveItem.GetDistanceAtParameter(param);

In this example dist1 should equal dist2, and it does if the linework is flat, but not if the linework is 3D.

On the other hand, dist1 is equal to dist2 in the following example, in both 2D and 3D linework, so it seems to be a valid work-around:

point = curveItem.GetPointAtDist(dist1);
param = curveItem.GetParameterAtPoint(point);
dist2 = curveItem.GetDistanceAtParameter(param);
Sinc
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Sinc

Hi Sinc,
I know where you are trying to use this so it got me thinking......I don't
like the results.......

I drew a Featureline, 1000 feet long, with elevations of 0 at the start and
1000 at the end. I used this code:

double param = oCrv.GetParameterAtDistance(600.00);
double dist2 = oCrv.GetDistanceAtParameter(param);
ed.WriteMessage("\nDistance1 was 600.00, distance2 is " + dist2);

Here's the result:
Select curve:
Distance1 was 600.00, distance2 is 529.193302862288

I then exploded the Featureline which converts it to a 3dpolyline. Same
code, here's the result of that:

Select curve:
Distance1 was 600.00, distance2 is 600

So it appears that the GetDistanceAtParameter function works correctly for
the base Acad objects, but not for our Aecc objects.

So much for my workaround.....


wrote in message news:5499165@discussion.autodesk.com...
I'm having issues with the Curve library. The GetDistanceAtParameter
function does not seem to return the correct value. It seems to be using
the 3D distance along the Curve, whereas the other routines in this library
use the 2D distance along the Curve. This yields inconsistent results. For
example:

param = curveItem.GetParameterAtDistance(dist1);
dist2 = curveItem.GetDistanceAtParameter(param);

In this example dist1 should equal dist2, and it does if the linework is
flat, but not if the linework is 3D.

On the other hand, dist1 is equal to dist2 in the following example, in both
2D and 3D linework, so it seems to be a valid work-around:

point = curveItem.GetPointAtDist(dist1);
param = curveItem.GetParameterAtPoint(point);
dist2 = curveItem.GetDistanceAtParameter(param);
Message 3 of 3
Sinc
in reply to: Sinc

This one's annoying, but it's not as bad as the others.

I finally figured out why SecondDerivative wasn't working - it only works when the feature line has flat elevations. So it works for 2D linework. But if the feature line has some vertical in it, the SecondDerivative always returns (0,0,0), which makes it useless for 3D work.

This basically means that both the Bulge and the SecondDerivative are unavailable to us. That makes automation significantly more difficult. But I've made signficant progress on that point, and will get the results posted to the thread in the Swamp shortly.
Sinc

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost