Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Finding direction at point

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
joantopo
417 Views, 5 Replies

Finding direction at point

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.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
5 REPLIES 5
Message 2 of 6

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

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 3 of 6

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
Message 4 of 6

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. 

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 5 of 6

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
Message 6 of 6
joantopo
in reply to: joantopo

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

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes

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

Post to forums  

Rail Community


Autodesk Design & Make Report