LDD station to xy

Discussion in 'AutoCAD' started by David Urban, Mar 29, 2005.

  1. David Urban

    David Urban Guest

    is there a command in LDD that I could give the station of an alignment
    and have it return the xy of that station?

    David Urban
     
    David Urban, Mar 29, 2005
    #1
  2. Hi David,

    You can create a point relative to an alignment and get the coordinates of
    the point.

    After that you need to write program - or have someone post one.

    How do you want the point data ?
    - to a file
    - to the command line
    - as input to another command
    - do you want it for the current alignment - or any alignment with you
    selecting the alignment as part of the process?
    Once you start programming all the above are easy, but the programmer needs
    to know what you want.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Mar 29, 2005
    #2
  3. David Urban

    David Urban Guest

    what i am really wanting is a routine to find the crossing of two
    alignments. I have one using the align.lineintersect but it doesn't
    work if the crossing point is in a curve. I was wanting to break the
    curve up into smaller points by getting the xy point for each station on
    a curve then test the lineintersect to see if it crossed my other alignment.

    Thanks

    David Urban
     
    David Urban, Mar 30, 2005
    #3
  4. Align.PointLocation station,offset,px,py,direction

    Just feed it a station number (a double) and an offset = 0.0
    PX and PY should have the values you need after the call
     
    Jorge Jimenez, Mar 30, 2005
    #4
  5. David Urban

    David Urban Guest

    Thats what I am looking for. I was having a mental block and could not
    locate it in the help.

    thanks

    David
     
    David Urban, Mar 30, 2005
    #5
  6. Hi David,

    I would do a PointLocation, then do a StationOffset with the point data on
    the other alignment. Use the Offset value to adjust the initial Station and
    cycle again. This will be more elegant than the line crossing process and
    most likely be far quicker as in many cases the adjustment by offset will
    get you quite close - particularly if you adjust the Offset first by
    dividing it by the sin of the difference between the Azimuths of the
    alignments.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Mar 30, 2005
    #6
  7. David Urban

    David Urban Guest

    Laurie

    I am alittle confused by your suggestion. here is what I came up with.
    I works great if the current alignment crosses the curve or if it ends
    on the inside of the curve but not on the outside of the curve. let me
    know what you think. This code is alittle/alot slow.

    thanks

    David

    the curve is the curve on the intersecting alignment ie align2.
    align is the current alignment and is a global variable.

    Private Function curveintersection(curve As AeccAlignCurve, align2 As
    AeccAlignment, crossing As Variant) As Boolean
    Dim dStart(2) As Double, dEnd(2) As Double
    Dim StaOffDirS(2) As Double, Polarpt As Variant
    Dim crossings As Variant, xy(2) As Double
    ReDim crossing(3)
    Dim x As Integer

    On Error Resume Next
    For x = curve.StartingStation To curve.EndingStation + 1 Step
    curve.length / 10
    align2.PointLocation x, 0, dStart(0), dStart(1), 0
    align2.PointLocation x + 1, 0, dEnd(0), dEnd(1), 0
    crossings = align.LineIntersection(dStart(0), dStart(1), dEnd(0),
    dEnd(1))
    If Err.number = 0 Then
    Err.clear
    align2.StationOffset crossings(2), crossings(3), StaOffDirS(0),
    StaOffDirS(1), StaOffDirS(2)
    xy(0) = crossings(2): xy(1) = crossings(3)
    Polarpt = pUtil.PolarPoint(xy, crossings(1), StaOffDirS(1))
    xy(0) = Polarpt(0): xy(1) = Polarpt(1)
    align.StationOffset xy(0), xy(1), StaOffDirS(0), StaOffDirS(1),
    StaOffDirS(2)
    If Err.number = 0 Then
    If Abs(StaOffDirS(1)) < 0.1 Then
    crossing(0) = StaOffDirS(0): crossing(1) =
    StaOffDirS(1): crossing(2) = xy(0): crossing(3) = xy(1)
    curveintersection = True
    Exit For
    End If
    End If
    End If
    Err.clear
    Next x


    End Function
     
    David Urban, Mar 30, 2005
    #7
  8. David, if what you need is the intersection
    why not search for the intersection
    between each entity of Align1 and all entities of Align2
     
    Jorge Jimenez, Mar 30, 2005
    #8
  9. David Urban

    David Urban Guest

    Jorge

    I am doing that and only works when all of my entities are straight
    lines. I need a way to search when align2 entity is a curve. That is
    when I started to write this function. I have a much longer one but it
    has its limitations also so I was trying a more crude method.

    David
     
    David Urban, Mar 30, 2005
    #9
  10. Hi David,

    Start with this. It's not tested, but shows what I meant.
    Note that it is totally independent of whether either alignment is or isn't
    curved at the intersection point.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au

    Sub CrossingAlignments()
    Dim oAlign1 As AeccAlignment
    Dim oAlign2 As AeccAlignment
    Dim dChn1 As Double
    Dim dChn2 As Double
    Dim dOff1 As Double
    Dim dOff2 As Double
    Dim dAzi1 As Double
    Dim dAzi2 As Double
    Dim dEast As Double
    Dim dNorth As Double

    ' Use what ever suitable method you have to set the two alignments
    Set oAlign1 = AeccApplication.ActiveProject.Alignments.Item(0)
    Set oAlign1 = AeccApplication.ActiveProject.Alignments.Item(1)

    ''' Set chn1 to a reasonable value here
    On Error GoTo ErrorHandler
    oAlign1.PointLocation chn1, dOff1, dEast, dNorth, dAzi1
    oAlign2.StationOffset dEast, dNorth, chn1, dOff2, dAzi2

    Do While dOff2 < 0.001 ' Or whatever tolerance you want
    dOff2 = dOff2 / Sin(dAzi1 - dAzi2) ' You might want to sketch the
    geometry to confirm my guesswork
    chn1 = chn1 + dOff2 ' Since I haven't tested this you may need to
    replace the "+" with a "-" or allow for both
    oAlign1.PointLocation chn1, dOff1, dEast, dNorth, dAzi1
    oAlign2.StationOffset dEast, dNorth, chn1, dOff2, dAzi2

    Loop

    ErrorHandler:
    MsgBox "Possibly the alignments don't intersection in the vicinity of the
    starting chainage"
    End Sub ' CrossingAlignments
     
    Laurie Comerford, Mar 30, 2005
    #10
  11. No need to complicate things
    just use standard math to figure
    the intersection between the entities

    For example, if the entities are
    AlignCurve and AlignTangent
    just look for the intersection between
    the line and a circle (the aligncurve object
    will have radius and center point properties
    allready setup for you)
     
    Jorge Jimenez, Mar 30, 2005
    #11
  12. David Urban

    David Urban Guest

    Thanks Laurie

    I think your method and my method are similar. I take the offset and
    direction and find a polar point at the distance of the offset at the
    direction and it comes close.

    Thanks for the mental exercise and the quick response after hours in the US.

    David Urban
     
    David Urban, Mar 30, 2005
    #12
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.