Hi.
About this topic:
http://blog.civil3dreminders.com/2011/03/alignmentfinding-direction-at-point.html
Are there anything newer?
What was PointLocationEx method?
I can get points (STATIOn 50) and point (station 50.01), and then calculate direction between two points.
Are there some method to calculate direction with two point2d?
Thanks.
Solved! Go to Solution.
Solved by joantopo. Go to Solution.
It was a method for the COM alignment object. An alignment has all of the Curve methods and properties so we can use the Curve.GetFirstDerivative method to get the information you desire. This forum post has more info: http://forums.autodesk.com/t5/net/direction-of-curve/td-p/4345515
It seems that Alignment.PointLocation has overloaded methods. There are 2.
One of them is:
PointLocation(Double, Double, Double, Double, Double, Double) | Given station and offset values, returns the easting, northing, and bearing values at that point on the Alignment. |
But I want North azimuth instead of Bearing.
Can I convert bearing to North azimuth?
Thanks.
I'm fairly certain that the call returns Radians and that would need to be converted into the Bearings or Azimuth values. If you look in the Civil 3D Reports code that ships with Civil 3D you will see how to convert the value to any type you want that you can find in Civil 3D.
You will find the code here on your install: C:\ProgramData\Autodesk\C3D 2014\enu\Data\Reports\Net\Source
Replace the year with your version of Civil 3D.
Well, I use my own function to calculate North Azimuth. It works right.
For example:
station : 5000---> align.PointLocation to get coordinates. (P1)
tolerance:0.001
station:5000.001---align.PointLocation to get coordinates. (P2)
public static double acimut(double x1,double y1,double x2,double y2) { //devuelve el acimut en centesimales double acimut=0; double Ax = x2 - x1; double Ay = y2 - y1; if (Ax > 0) { if (Ay > 0) //si el punto está en el primer cuadrante(+x +y) { acimut = radgrad(System.Math.Atan(Ax / Ay)); } if (Ay < 0) //el punto en el segundo cuadrante (+x -y) { acimut = radgrad(System.Math.Atan(Ax / Ay)) + 200; } if (Ay == 0) { acimut = 100; } } if (Ax < 0) { if (Ay > 0) //el punto está en el cuarto cuadrante (-x +y) { acimut = radgrad(System.Math.Atan(Ax / Ay)) + 400; } if (Ay < 0) //el punto está en el tercer cuadrante (-x -y) { acimut = radgrad(System.Math.Atan(Ax / Ay)) + 200; } if (Ay == 0) { acimut = 300; } } if (Ax == 0) { if (Ay > 0) { acimut = 0; } if (Ay < 0) { acimut = 200; } if (Ay == 0) { //no es pot donar pq fem que no es poguir repetir base y estacio que sigui lo mateix a la hora d´introduir } } return acimut; }
// IT RETURNS IN GRADIANS (GRAD).
With FirstDerivate method, you get the unit vector, I think. You could calculate North azimuth with origin (0,0) and second point from that vector.
Alignment.PointLocation(station,offset,Tolerance,ref East,ref North,ref bearing)
It includes Tolerance. (distance between station and next station).
If we have:
Azimuth: 86.53574 g. (grads) then , we have bearing: 1.359300