Alignment.PointLocation on aligment with station equations

Alignment.PointLocation on aligment with station equations

mszanto
Enthusiast Enthusiast
2,095 Views
7 Replies
Message 1 of 8

Alignment.PointLocation on aligment with station equations

mszanto
Enthusiast
Enthusiast

The Alignment.PointLocation method only works with raw stations which presents a problem when the alignment contains station equations.

For example...

 

A 1000' alignment with a start station set to 0.00 will have a raw end station of 1000.
A station equation created at 5+00 with a station ahead set to 20+00 will result in the end station label displayed as 25+00 but the raw end station will still be 1000.

 

I have a routine that prompts the user for a station/offset from which I need to retrieve the actual coordinate. If the user enters 2600 for the station and I use this value in Alignment.PointLocation, it will throw a PointNotOnEntity exception because it expects a raw station between 0 and 1000.

 

Does anyone know of way to retrieve the coordinates of a location along an alignment using station/offset values taking into account station equations?

 

tia,

 

mike

0 Likes
2,096 Views
7 Replies
Replies (7)
Message 2 of 8

hencoop
Advisor
Advisor

These object values will give you the information necessary to calculate what you need:

 

(setq eqlist NIL)
; anobj is the "AeccDbAlignment" object (the Alignment)
(vlax-for item (vlax-get-property anobj 'StationEquations)
  (setq eqlist
         (append eqlist
                 (list
                   (list
                     (vlax-get-property item 'RawStationBack)
                     (vlax-get-property item 'StationAhead)
                     (vlax-get-property item 'StationBack)
                     (vlax-get-property item 'Type)
                   )
                 )
         )
  ); Create list of all station equation objects properties
)
(setq startsta (vlax-get-property anobj 'StartingStation); Store start station
      endsta (vlax-get-property anobj 'EndingStation); Store end station
)
; IAeccStationEquation: IAeccStationEquation Interface
; Property values:
;   RawStationBack = 9722.58
;   StationAhead = 10000.0
;   StationBack (RO) = 9722.58
;   Type = 1

**** The code above was edited to produce the following list structure as intended ****

My alignment data produced this list for my one station equation:

((9722.58 10000.0 9722.58 1))

Each Station Equation is a list of its four values (9722.58 10000.0 9722.58 1)

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes
Message 3 of 8

mszanto
Enthusiast
Enthusiast

Thanks, 


I already came to the conclusion that I would have to get the station equations and reverse calculate the raw stations. I was hoping there was something in the API that was more direct.

 

I know people have requested this in the past from older messages in this forum.

 

 

0 Likes
Message 4 of 8

hencoop
Advisor
Advisor

No problem,

I haven't worked this out for myself before.  Most of what I do uses a custom app for cross country water and sewer pipelines that makes very limited use of AutoCAD Civil 3D Alignments.  I have not had a need to use Station Equations with C3D Alignments.  I fleshed out my code to print out the information I might need and to quickly show whether there are any Station Equations assigned for the alignment.  I've attached it here for those that might have a use for it.

 

AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
                        27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
                        8.6.52.0 AutoCAD Architecture 2024
0 Likes
Message 5 of 8

tdivittis
Advocate
Advocate

Wouldn't GetPointAtDistance get you what you're looking for?  You may have to subtract starting station, I'm not sure.  I haven't messed with RawStation values at all, yet, within Alignments.

0 Likes
Message 6 of 8

mszanto
Enthusiast
Enthusiast

Its far more complicated than that.

 

We were asked by a state DOT to merge all their CL alignments into single alignments while maintaining the original stationing and direction. In order to do this we needed to find all the alignments that had common end points or overlapping segments and merge them together to create extremely long alignments. Because each original alignment was surveyed at a different point in time and had different starting stations and directions it required us to create a station equation at each point where they were merged.

In one example there were 38 original alignments that were merged, resulting in a single alignment 50 miles long with 37 station equations with most station equations increasing and some station equations decreasing. As you can imagine, due to the number of station equations, there will be many duplicate stations along the alignment

 

Fortunately, I was able to develop a robust tool set using the .NET API to automate this process which was a great time saver.

 

Now comes the next phase where we need to develop a tool that allows a user to enter in a station/offset to find that location along the alignment and perform some additional work. Because the station could exist at numerous locations along the alignment (due to station equations) I need a function to return all the possible positions along the alignment for that station so that I can display them to the user from which they can choose the correct location.

 

Here's the rub, I know that this functionality exists in Civil 3D. Just run the command to location point at station/offset along an alignment and a dialog is displayed if more than one exists (see attached).

 

I was hoping that I wouldn't have to write this functionality but in retrospect it was very easy.

 

It works something like this....

 

1. Loop through all station equations and examine each pair of consecutive station equations.

2. If station equation 1 is ascending, determine if the specified station is after the station ahead of equation 1 and before the station back of equation 2.

3. If station equation 1 is descending, determine if the specified station is before the station ahead of equation 1 and after the station back of equation 2.

4. If 2 or 3 is true, get the absolute difference between the specified station and station ahead of equation 1 and add this to the raw station back of equation 1 to get the raw station of the specified location.

 

 

Mike Szanto | Applications Developer

mszanto@microdesk.com

 

0 Likes
Message 7 of 8

tdivittis
Advocate
Advocate

Have you considered using System.DataTables to store your equation information?  It may provide an easier method of filtering, since you can apply a Filter, then read the DefaultView, which would contain the matching data?  (I've done something similar, albeit simpler, at least from the station equation handling perspective.)

0 Likes
Message 8 of 8

NoelRico
Advocate
Advocate

Hi,

 

Does anybody have equivalent solution in C#. Alignment.PointLocation and Alignment.StationOffet give the wrong answer  if there is station equation.

 

Thanks,

 

Noel

0 Likes