| Author |
Message |
David Urban
Guest
|
Posted:
Wed Mar 30, 2005 3:29 am Post subject:
LDD station to xy |
|
|
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
|
|
| Back to top |
|
 |
Laurie Comerford
Guest
|
Posted:
Wed Mar 30, 2005 3:52 am Post subject:
Re: LDD station to xy |
|
|
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
"David Urban" <Durban@huffcut.com> wrote in message
news:4249d6e4$1_1@newsprd01...
| Quote: | 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 |
|
|
| Back to top |
|
 |
David Urban
Guest
|
Posted:
Wed Mar 30, 2005 6:33 am Post subject:
Re: LDD station to xy |
|
|
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
Laurie Comerford wrote:
| Quote: | 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.
|
|
|
| Back to top |
|
 |
Jorge Jimenez
Guest
|
Posted:
Wed Mar 30, 2005 7:04 am Post subject:
Re: LDD station to xy |
|
|
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
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
"David Urban" <Durban@huffcut.com> wrote in message
news:4249d6e4$1_1@newsprd01...
| Quote: | 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 |
|
|
| Back to top |
|
 |
David Urban
Guest
|
Posted:
Wed Mar 30, 2005 7:07 am Post subject:
Re: LDD station to xy |
|
|
Thats what I am looking for. I was having a mental block and could not
locate it in the help.
thanks
David
Jorge Jimenez wrote:
| Quote: | 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
|
|
|
| Back to top |
|
 |
Laurie Comerford
Guest
|
Posted:
Wed Mar 30, 2005 8:21 am Post subject:
Re: LDD station to xy |
|
|
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
"David Urban" <durban@austin.rr.com> wrote in message
news:424a09eb$1_3@newsprd01...
| Quote: | Thats what I am looking for. I was having a mental block and could not
locate it in the help.
thanks
David
Jorge Jimenez wrote:
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
|
|
|
| Back to top |
|
 |
David Urban
Guest
|
Posted:
Wed Mar 30, 2005 8:36 am Post subject:
Re: LDD station to xy |
|
|
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 |
|
| Back to top |
|
 |
Jorge Jimenez
Guest
|
Posted:
Wed Mar 30, 2005 8:47 am Post subject:
Re: LDD station to xy |
|
|
David, if what you need is the intersection
why not search for the intersection
between each entity of Align1 and all entities of Align2
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
"David Urban" <durban@austin.rr.com> wrote in message
news:424a1ebd$1_3@newsprd01...
| Quote: | 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 |
|
|
| Back to top |
|
 |
David Urban
Guest
|
Posted:
Wed Mar 30, 2005 8:52 am Post subject:
Re: LDD station to xy |
|
|
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
Jorge Jimenez wrote:
| Quote: | David, if what you need is the intersection
why not search for the intersection
between each entity of Align1 and all entities of Align2
|
|
|
| Back to top |
|
 |
Laurie Comerford
Guest
|
Posted:
Wed Mar 30, 2005 8:59 am Post subject:
Re: LDD station to xy |
|
|
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
"David Urban" <durban@austin.rr.com> wrote in message
news:424a1ebd$1_3@newsprd01...
| Quote: | 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 |
|
|
| Back to top |
|
 |
Jorge Jimenez
Guest
|
Posted:
Wed Mar 30, 2005 9:26 am Post subject:
Re: LDD station to xy |
|
|
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)
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
"David Urban" <durban@austin.rr.com> wrote in message
news:424a2281$1_1@newsprd01...
| Quote: | 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
Jorge Jimenez wrote:
David, if what you need is the intersection
why not search for the intersection
between each entity of Align1 and all entities of Align2
|
|
|
| Back to top |
|
 |
David Urban
Guest
|
Posted:
Wed Mar 30, 2005 8:45 pm Post subject:
Re: LDD station to xy |
|
|
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
Laurie Comerford wrote:
| Quote: | 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.
|
|
|
| Back to top |
|
 |
|
|
|
|