Ad

Wednesday, October 29, 2008

Expressions - Radians

This is it my 200th post and a reminder to myself that when using angle values in expressions they are in radians. A complete circle is 2pi. A half a circle is pi.

An example how this can used may be found in this link. http://style.civil3dreminders.com/checkrightorleft

This example uses expressions to indicate if the curve at the PI goes to the right or the left.

Tuesday, October 28, 2008

Civil 3D User Group Meeting in SLO

There is going to be another SLO Civil 3D user group meeting on November 12. This link has the information: http://fredbobchris.googlepages.com/SLO-Nov122008.pdf

If you do attend, I'm going to attempt to give away my signed copy of Mastering AutoCAD Civil 3D 2008 again. If you see me and I'm holding the book just ask for it and its yours. I've got to make space for my 2009 version of the book.

Monday, October 27, 2008

Elevation Analysis - VBA Style

One of the items you can't seem to store in your template is how the Elevation analysis is applied to a surface. If you find yourself always changing the values to a default, this post may help you become more productive.

The first thing we need to do is select a surface. This is how I did it:

image

Once we have a surface then you can create the elevation analysis regions you want to the surface. This routine assumes that one has not been applied yet. If you already have created one, you may want to remove the existing one first or modify it.

image

In the sample above the code is creating 2 regions. If you want more just change the value. Once the regions are created we can change the properties of them. We do this by creating a new SurfaceElevation object. Next we have to set the values that we want to use for the regions. Here is the code to do it.

image 

Follow the pattern and do the same for additional regions. Like most of the examples on this site, no error catching has been added, such as On Error Resume Next line to get rid of an error message if the user didn't select an object. Have fun.

Wednesday, October 22, 2008

HEC-RAS Extension - Bonus Feature

Autodesk has provided the HEC-RAS export report for subscription members, now get the Civil3D Reminders Bonus Feature for the extension. Sure you have to do most of the work yourself, but you don't need to fork over money to get it (unless you want too, I won't say no).

In the current report you only get to have the flow direction of the stream go one direction, from a lower station to a higher station value. With the Civil 3D Bonus Feature you get to choose if you want the stream to go the opposite direction. The first step is to add a CheckBox to the AlignToHECRAS form. To open the form double click it in the Project list on the left side of the screen. Then use the Toolbox to add a CheckBox, it fits conveniently below Reach Alignment box. Change the name of the CheckBox in the properties area under (Name) and enter a caption that indicates that the flow direction of the stream will be reversed if the CheckBox is checked.

image

Now that we have created the CheckBox we can modify the code to reverse the information that is written to the report. HEC-RAS determines the flow based on how stream is drawn. It assumes the first point is upstream and the rest are downstream from it. The code below reverses the information, moving the first point to the back and the last point to the front.

image

Once the code is finished you are ready to run the report. Once imported you will want to check the data, in accordance to the HEC-RAS user manual, especially to see if the sections are drawn correctly. If they are not use the Reverse Stationing tool to reverse the cross section. HEC-RAS assumes the cross sections are entered from left to right looking downstream. If after using the tool the cross sections are backwards, let me know and I'll see about modifying the code to get them to come in correctly.

image

Here are the results of running the revised code with the CheckBox checked and unchecked from HEC-RAS:

image image

Sunday, October 19, 2008

Tc Inquiry - VBA

One of the tasks engineers have to do is Tc calculations. While Civil 3D lets you use label the overall length of a feature line/3DPolyline it does not let you have access to the start and end point elevation of the line. If access was allowed to the start and end point elevations you could use an expression to do the Tc calculations. This post covers how you can calculate the Tc using VBA. The code adds a text label with the Tc value.

The first thing we need to do is to have the user select a 3DPolyline. The code to do this is shown in the picture below.

image

Now that we have the 3DPolyline we can process it to get the required information from it.

image

As shown above getting the ending a starting points is rather easy. The vertices information for a 3DPolyline is contained in the Coordinates part of the object, which is an array type object that starts at 0. The starting elevation is the second value since 0 corresponds to the X value of the first vertex, 1 corresponds to the Y value of the first vertex and 2 corresponds to the Z value of the first vertex. To the the last vertex information we need to determine the number last value in the array. The Ubound() provides that information by giving the number of the last value in the array. The length value of the 3DPolyline is the actual length of the 3DPolyline. Since most methods of Tc was created before widespread use computers the length needed is the 2D length of the line. To get this we need to make a copy of the 3DPolyline and then set all of the Z values in the coordinates array to 0. There may be a better way to do this, but this is the way I thought to do it. If you think you should use the 3D length you skip adding the code below.

image

The code takes all of the vertices and adds it to an array then sets the Z values of the vertices to 0. If you can follow patterns you should recognize that every third value is the Z value for a vertex. So that is why at the For i = 2 part of the code it starts at 2 and then process every third value. The Next adds 1 and the i = i +2 has the code move every third value.

So now that we have modified the vertices we need to set the vertices of the copied 3DPolyline to the modified values. The change is done below and the length is gotten and then the copied 3DPolyline is deleted.

image

Now we need to calculate the slope, but before we do that we need to make sure we get a positive slope (unless you have water that goes up hill). The if then statement does this in the code below. The Tc value is then calculated.

image

The Tc formula may not be the one you use, or you may have to use different constants contained in the 0.0078 value. So make sure the Tc formula is the one you have to use.

So now that we have a Tc value lets add it to a text label and place it where the user selected the 3DPolyline. The code to do that is below.

image

The text height is hard coded in the above example, so if you want it to be something else go ahead and change it.

This example assumes you use the waterdrop feature in Civil 3D to generate the line so you can ensure that the 3Dpolyline slopes from a high point to a low point. If you use an alternative method to create the 3DPolyline you may want to add a check to make sure the 3DPolyline slopes in one direction (such as drawing a polyline and then using the surface drape tool). You can also add the other information used in the calculations to the label or export the information to an Excel spreadsheet.

A copy of the completed code may be found on this page of the style site.

Tuesday, October 14, 2008

Giveaway Conclusion

Cathy gave the correct answer to the Giveaway. The correct answer was Branch Street in Arroyo Grande, CA.

Cathy has declined the prize, so know I have to figure out what to do with the box of stuff, autographed copy of Mastering Civil 3D 2008 and a bag of Belly Flops.

Thanks to all that participated.

Monday, October 13, 2008

Change the State Storage Extension to Acre-Feet

Brian requested in the last post regarding the Stage Storage Extension to have the report be changed to Acre-Feet instead of cubic feet. The easy way to do this is to employ the same strategy as the last post and do a find of cft and replace it with AF (or what ever other abbreviation you want). Next we'll have to change the math to include the conversion from cft to acre-feet. Use the Find, choosing the Current Project search option again, to look for:

An1 = CA(1, i)

Once you find it you should be in the module for UserForm2, ProcessPlines macro. It should look like the picture below.

image

Go ahead and make the changes as shown below, make sure you like the conversion rate.

image

If you don't mind your newly created acre-feet values rounded to the nearest whole number you can quit and move on with your life. If you want it rounded to a different value you'll have to do another step. Scroll down a bit from the changed code above to what is what is shown below:

image

This code formats the values into a whole number. Make the change below to have the numbers formatted to two digits.

image

If you want a different format, go ahead and change it. The formats shown in Excel tend to be the same as what is used for this VBA function.

The changes to the code for this extension are just quick fixes to get the results you want. Ideally the code would be revised to let the user select the units or pull the unit settings Civil 3D.

Friday, October 10, 2008

Changing the Stage Storage Extension to Meters

The Stage Storage Extension provided to subscription users uses feet and cubic feet as the units it shows. Since the program just does basic arithmetic and doesn't change the units it is fairly easy to change it over to metric.

The first step is to load the report using vbaload from the command line. The vba program is located at:

C:\ProgramData\Autodesk\C3D 2009\enu\Data\Reports\vba\SST.dvb (at least in Vista)

Next we need to look for all of the instance of ft or feet and change them to m or meter. To do this go to Edit menu and choose Replace. In the dialog enter in the find what box ft and in the replace box m. Press the find next button to find all of the instance of ft to replace with m. Make sure you use the Replace and Find Next buttons to select the instances that show up in the report. Next do the same, only using feet and meter instead. Now all of the output should be in the correct units.

Next we need to modify the dialog boxes. To do this expand the forms folder as shown in the picture below and double click on the UserForm1 and then change the Contour Area to the correct units.

image

image

This is the quick and easy way to do it. If you wanted you could have it read the units from the drawing and automatically use the correct units, but that's a little more complicated than what can fit in this post.

Wednesday, October 08, 2008

Isn't that the Point?

Read an article that lawmakers were angry after they learned that AIG execs went on a retreat after the Government provided $85 billion dollars to prevent the company from collapsing. Sure the company shouldn't waste money, but they also need to spend money to help Main Street. Congress telling financial companies that they shouldn't spend money is counterproductive. Maybe I'm mistaken, but I never thought of flight attendants, masseuses, porters, gate attendants, desk help, housekeepers, groundskeepers, etc. as rich. This money went to support the existence of their jobs. If financial companies don't spend money on retreats then all you are doing is hurting the people that rely on this discretionary spending, further hurting the economy. They had these events before the financial turmoil they should have them afterwards to support the people who provide those services. Discouraging this type of expenditures also hurts the Civil Engineering profession through less tax revenue for transportation projects (airports and roads). Way to go Congress for looking out for the little guy again.

Tuesday, October 07, 2008

Two Excel Windows

If you double click on an Excel file while a current Window of Excel is running it will open in the current running version of Excel instead of opening a new Window. I like having to have two distinct Windows of Excel running. To do this go to start and open a new instance of Excel (or use a desktop icon).

Monday, October 06, 2008

Surface Boundary

Did you know you can use parcels objects as a boundary? I didn't so I decided to play around with it. I found adding parcels objects didn't quite work as I expected. You can only select one parcel object, which I find a great limitation. When you select a parcel label the boundaries of the parcel are highlighted. I would expect the ability to select the parcel label and have the boundary of the parcel added as a boundary or when you select multiple parcel objects, have the computer see if they made a closed shape and add the resulting closed area as a boundary.

You can also use a polygon as a surface boundary, though I haven't quite figured out what that means. The help just mentions polygon without indicating what type of object they are referring to and the Developer's Guide gives an example of a circle. I did try using AECPOLYGONs and MPOLYGONs as a surface boundary and both didn't work. I used the polygon command, but that just creates a polyline.

Another thing abound surface boundaries I learned is that the parcels objects, polygon or polyline doesn't need to be closed. The program will automatically close the boundary by connecting the beginning and ending points of the added boundary.

Thursday, October 02, 2008

Jelly Belly

The Giveaway is still on. Even if you don't know the answer you could still win. Just email christopher@Civil3DReminders.com. In addition to the box of stuff and autographed copy of Mastering Civil 3D 2008 I'm throwing in a 2# bag of Belly Flops. Belly Flops are just like Jelly Belly Beans, just didn't make the cut in the size department (either too big or too small). They don't tend to last long in the free candy dispenser at work.

When ever I'm in Fairfield, CA I try to stop at the factory and take the tour. You get free samples and see how they make the candy.

LinkWithin

Blog Widget by LinkWithin

Ad