Ad

Thursday, April 23, 2009

Modifying Station Increment Report

If you run the Station Increment Report from the Toolbox you will get station information at the increment interval specified in the dialog box.

image 

If you have Station Equations included in the alignment you may get results that you don’t necessarily want since the data won’t be returned at even station values.

image

This post will show how you can modify the VBA report to print even stations. This math would also apply to .net report, some of the code would be slightly different. To edit the VBA report you will need to vbaload the project, the file is located here on a Vista OS:

C:\ProgramData\Autodesk\C3D 2010\enu\Data\Reports\vba\Report_AlignStaInc.dvb

The location for XP is similar as well as for other versions of Civil 3D. The code that needs to be changed is shown below.

image

The first thing that needs to be added are the variables used.

image

Next code is added to adjust the curStation value to output the correct station equation value to get an even station value.

image

The code does a Do Loop until bTest is equal to False. bTest was set to True in the code above. It then checks to see if the number of station equations is exceeded, if it is the Do Loop is exited and the code is run regularly. If there are station equations then the code proceeds and checks to see if a station equation is applied between the current station and the station interval before it. If it is, the code adjusts the current station to account for the station equation. As it goes through the Do Loop if there are not station equations in the range or if all of the ones in the range have been gone through then the Do Loop is exited by setting bTest = False. I probably could have removed the bTest check and used Exit Do instead. The code then runs through the code as normal, except now the report returns at even stations, most of the time.

image

I said most of the time because the Station Equation may skip an even station, in which you will get a random station before the even station.

image

I only tested the changes on when data set, so I may not have gotten all of the bugs and as always you should verify the report is outputting the correct values.

7 comments:

Anonymous said...

can you think of a way to find the next full station, in this case 11.00 to the first full station, then the value in the spacing would work for all other as long as it includes the last station.

I was trying the same thing in a custon vb routine where you get the start value find the remander to the next station but I was having trouble with the test finding what range to test depending on the user start station and the combobox value.

say I use 152.35 and want to test 50 ft station. next station is 200, so 47.65 is the dist to the first full station, abd the routine would pick up the 50 ft station until the end station. problem I was having was depending on the start value how could I test to find the value 200 in all cases. so is the user changed the sampling to 25 the 200 value would be 175. any ideas on how to build a test for this.

john coon

Christopher Fugitt said...

You could take the result for the oAlignment.GetStationString and parse out the + to get a number value. Using this value (Station) you could determine how far you are from the next interval station.
Diff = (Int(Station/g_staInt) * g_staInt) - Station
You'd have to check to see if the even station you want exists (a station equation may skip it).

Anonymous said...

Christopher,

Thanks, I'll give that a try. Looks like that would work with the alignment. I'll try the same approach with a user entered station value from textbox. I was trying a stand alone routine without C3D.

Questons:

Does your civil 3d vba ebook show how to create a surface from 3d polyines? that is where I'm having trouble.

Do you plan on doing a ebook with .net and civil 3D

john Coon

Christopher Fugitt said...

You can find an example that adds 3D Polylines in the Surfaces Sample code that ships with the program. The eBook contains about 90% of the Methods and Properties for Civil 3D Objects with examples of at least one way to get them to work.
No plans on .net and Civil 3D. I don't quite have enough experience with .net.

Anonymous said...

Chris, I am not good with editing vba. Can you edit the Corridor Slope Stake report to fix the Station Equation problems that you just mentioned above.

Thanks
Colton

renzex07 said...

I have the same problem with the section report corridors help

renzex07 said...

I have the same problem with the section report corridors

LinkWithin

Blog Widget by LinkWithin

Ad