LDD FGprofiles problems

LDD FGprofiles problems

Anonymous
Not applicable
162 Views
1 Reply
Message 1 of 2

LDD FGprofiles problems

Anonymous
Not applicable
I am writing a program for LDD that will find points on two profiles then draw my results on both profiles. I am working on drawing curb returns between two streets. I have the stations for both points on the two alignments and the program works fine the first time but when I loop through it the second time I get an error of "Method 'elevationAt" of object "IaeccFGProfile" Failed". it seems to loose track of the 1st FGprofiles after you define a second instance and I cannot use the first one. The strange part is if I debug it and open the alignment and PVI in the alignment then it won't fail on me when I step through it. Because this is not very self contained code and requires LDD with defined alignments and FG Profiles I can't send a good example but here is some similar to what I am doing. Any help from LDDers would be great. Sub two profiles() Dim align As AeccAlignment, aligns As AeccAlignments Dim xalign As AeccAlignment Dim FGprof As AeccFGProfile, xFGprof As AeccFGProfile Dim Elev1, Elev2, station As Double, xstation As Double Dim x As Integer, grade As Double, xgrade As Double Dim diff As Double, xdiff As Double Dim alg As String, xalg As String Set aligns = AeccApplication.ActiveProject.Alignments alg = "ST Evening Star" 'alignment that I am working with xalg = "ST Star Meadow" 'intersecting aligment Set align = aligns.Item(alg) Set xalign = aligns.Item(xalg) For x = 1 To 2 station = 100 'can be any station xstation = 200 'can be any station Set FGprof = align.FGProfiles.Item(0) Elev1 = FGprof.ElevationAt(station) '<-errors here 2nd time FGprof.InstantGrade station, grade, diff Set xFGprof = xalign.FGProfiles.Item(0) Elev2 = xFGprof.ElevationAt(xstation) xFGprof.InstantGrade xstation, xgrade, xdiff Debug.Print "alignment 1 elev " & Round(Elev1, 2) & " at station " & _ Format(station, "0+00.00") & " with a grade of " & Round(grade, 2) & "%" Debug.Print "alignment 2 elev " & Round(Elev2, 2) & " at station " & _ Format(xstation, "0+00.00") & " with a grade of " & Round(xgrade, 2) & "%" Next x End Sub
0 Likes
163 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
David, Try moving your 'Set FGprof=' and 'Set xFGprof=" statements outside (ahead) of the For x loop. sc "David Urban, P.E." wrote in message news:4055da8a_1@newsprd01... > I am writing a program for LDD that will find points on two profiles > then draw my results on both profiles. I am working on drawing curb > returns between two streets. > > I have the stations for both points on the two alignments and the > program works fine the first time but when I loop through it the second > time I get an error of "Method 'elevationAt" of object "IaeccFGProfile" > Failed". it seems to loose track of the 1st FGprofiles after you define > a second instance and I cannot use the first one. > > The strange part is if I debug it and open the alignment and PVI in the > alignment then it won't fail on me when I step through it. > > Because this is not very self contained code and requires LDD with > defined alignments and FG Profiles I can't send a good example but here > is some similar to what I am doing. > > Any help from LDDers would be great. > > > Sub two profiles() > Dim align As AeccAlignment, aligns As AeccAlignments > Dim xalign As AeccAlignment > Dim FGprof As AeccFGProfile, xFGprof As AeccFGProfile > Dim Elev1, Elev2, station As Double, xstation As Double > Dim x As Integer, grade As Double, xgrade As Double > Dim diff As Double, xdiff As Double > Dim alg As String, xalg As String > Set aligns = AeccApplication.ActiveProject.Alignments > > alg = "ST Evening Star" 'alignment that I am working with > xalg = "ST Star Meadow" 'intersecting aligment > > Set align = aligns.Item(alg) > Set xalign = aligns.Item(xalg) > > For x = 1 To 2 > > station = 100 'can be any station > xstation = 200 'can be any station > > Set FGprof = align.FGProfiles.Item(0) > Elev1 = FGprof.ElevationAt(station) '<-errors here 2nd time > FGprof.InstantGrade station, grade, diff > > Set xFGprof = xalign.FGProfiles.Item(0) > Elev2 = xFGprof.ElevationAt(xstation) > xFGprof.InstantGrade xstation, xgrade, xdiff > > Debug.Print "alignment 1 elev " & Round(Elev1, 2) & " at station " & _ > Format(station, "0+00.00") & " with a grade of " & Round(grade, 2) & "%" > > Debug.Print "alignment 2 elev " & Round(Elev2, 2) & " at station " & _ > Format(xstation, "0+00.00") & " with a grade of " & Round(xgrade, 2) & > "%" > > Next x > End Sub > > >
0 Likes