Ad

Friday, February 27, 2009

Convert Point Text File to SHP File

There is probably a better way to do this, but I wasn't able to find a better way.

  • Import the points into the drawing as Civil 3D Points.
  • Set the Point Style to have an AutoCAD point for the marker.
  • Explode the Civil 3D Points to be points.
  • Go to

image

  • Create a New Table with the fields you want to use with the correct format you want.

image

For my purposes I'm going to have PointNum as Integer, Desc As Character and Picture As Character.

  • Next attach Object Data to the points created.

image

Make sure that the Correct Table is selected (Easting and Northing are not used).

image

  • Now Export the points to a Shape file using the Map > Tools > Export from the menu, making sure to select the Object Data from the Data Tab.

image

  • If you are using Office 2003 you can use Excel and open the dbf file that accompanies the shape file and overwrite the data with the data from the text file and save the file as a dbf file. Excel 2007 doesn't let you do this so you will have to use Microsoft Access. To use Microsoft Access open the program and then import the DBF file.

image

Make sure you use the Link to data source to ensure any changes are saved to the dbf file.

  • Now delete all of the rows of records by selecting all of the rows and deleting them.
  • Next save the text file as an Excel file and put the same headings as the dbf file as the headings, deleting the X, Y values we don't need.

image

  • So now import the Excel data into the Table in Access.

image

image

Follow the prompts and make sure how the Excel file is being imported makes sense.

  • Now export the Table as a dBASE file to a location you can find.

image

  • Now delete the original .dbf exported and replace it with the Exported dbase file from above. Make sure the you change the name of the file to match the original one, including capitalization of the file name.
  • Now import the data to check the data, making sure to assign the Object Data (Map > Tools > Import).

image

  • So when you look in the Properties Palette you will see the imported information.

image

Saturday, February 21, 2009

Toggle TIN Triangle Visibility

I've been working on surfaces lately, hence the series of Parking Lot Surface posts from last week. I've noticed the need to turn on and off triangles for a surface, either by changing the surface style or changing the style of the surface to show triangles, quite often. It takes about 3 or 4 steps to change it. I thought that was about 2 to 3 clicks too many so I decided to create a VBA routine to cut those steps down.

The first thing to do is create a new VBA file from the VBAMAN dialog box.

image

Once created press the SaveAs button and save it to a location of your choosing. Next open the Visual Basic Editor and a new module from the Insert Menu and set the references for the Civil 3D Land Modules.

Next add Option Explicit and name the Sub what you want it to be.

image

Next we need to create some variables and prompt the user to select a surface object.

image

Now that we have the surface we need to make sure the user selected a surface.

image

If the user selected a surface we need to set the surface equal to a surface type variable and then check to see if the triangles are showing. If they are the code will turn them off, and if they are showing the code will turn them off.

image

So now just add some error catching to it, maybe an "On Error Resume Next" at the top of the macro or have the user try again at selecting a surface. So that's how I'm going to be toggling the tin triangles for a Surface Style while doing surface design.

Thursday, February 19, 2009

Parking Lot Surface V

Using the TIN Triangle catches works great until a contour goes through it. As indicated in the picture below we can see that the contour is bending around the curve.

image

The contour is bending around the curve because the surface was modeled with a straight grade from the BCR and ECR. The surface spot elevation label shows that the temp surface and the parking lot surface are not the same. The difference between the midpoint elevation of the Parking Surface and Temp Surface is not that large, but greatly changes the appearance of the contour. Depending on the length of the curve and the slopes of the parking lot the difference will be either greater or smaller than the one shown. To get rid of the curved contour we will need to add some PVI points to the curve to better approximate the grades of the parking lot. The number of PVI points is dependant on the length of the curve. The picture below shows the affect of adding a PVI at the midpoint.

image

Both of the quarter points added.

image

So we can see that the contour doesn't follow the curve and provides a nice straight contour.

Related Posts:
Parking Lot Surface I
Parking Lot Surface II
Parking Lot Surface III
Parking Lot Surface IV
Parking Lot Surface V

Wednesday, February 18, 2009

Parking Lot Surface IV

In this post I'll add some feature lines and change the supplementing distance factors. The feature lines added are shown below.

image

Then I'll add the curbs, corner cleanup and added feature lines using the supplementing factors. The supplementing factors enable adding PI or elevation points without actually adding them to the feature lines.

image

Once added we get a nice symmetrical look to the surface TIN Triangles.

image

Related Posts:

Tuesday, February 17, 2009

Parking Lot Surface III

In this post I'll remove on of the low points I don't want. I really don't want to have a second low point if I don't need to have it. I'll remove it by directing water around the landscaped area that juts out into the parking area.

image

I find it quicker to delete the top of curb if I need to make any changes rather than trying to remember what PVI's I've changed and which ones I haven't. After deleting the top of curb I use the Quick Elevation edit to change the slope of the feature line.

image

I'm using the corner cleanup as the starting elevation and going 2% up from that on both corners. Once I have the grades adjusted I offset it to get the top of curb.

image

Since I like symmetry I'll add some more feature lines to make the TIN Triangles look symmetrical and it also helps when the surface parking lot is more complicated than this example.

image

Related Posts:
Parking Lot Surface I
Parking Lot Surface II
Parking Lot Surface III
Parking Lot Surface IV
Parking Lot Surface V

Monday, February 16, 2009

Parking Lot Surface II

The last post we set up the surface and indicated a problem with the mid-ordinate distance when adding breaklines to the surface. In this post I'll investigate the problem further. First I'll re-add the breaklines to the surface with a smaller mid-ordinate distance.

image

We can see from the picture below that with the smaller mid-ordinate distance the contour follows the curb better, but also causes problems in the surface with the contours not exactly being where they need to be.

image

A larger view of the surface showing the problem.

image

To clean up the surface I'm going to create a corner to catch all of the smaller triangles around the curb radius. This will prevent the triangles from going place we don't want them to go.

image

We can see TIN surface collecting all of the TIN Triangles from the radius curve.

image

In the next post I'll modify part of the surface to remove one of the two low points.

image

Related Posts:
Parking Lot Surface I
Parking Lot Surface II
Parking Lot Surface III
Parking Lot Surface IV
Parking Lot Surface V

Sunday, February 15, 2009

Parking Lot Surface I

This post demonstrates one way to create a parking lot surface. The 2D linework for a partial parking lot is shown below.

image

The first step is to create a feature line at zero slope. The cross slope will be determined by the angle of the line to the low point. The small white square is the planned inlet location. A grading object is then created using the grade to distance option. The grading object will be used to derive elevations for the feature lines for the curb outline.

image

So now that the temporary grading object is created, the curb outlines will be turned into feature lines and the elevations assigned from the grading object or associated surface to the grading object. Make sure the curb outline feature lines are assigned to a different site than the grading object to remove the interaction between them. When assigning the elevation make sure that the Insert Intermediate grade break points is unchecked. If you want an elevation point at a specific point add a PI or elevation point.

image

So now create a surface and add the curb feature line to it. Later I'll check out the other options, but for this time I'll use the default settings.

image

Looking at the image below we can see that the grading object's surface and the parking surface contour's are the same which is good kind of. We still need to offset the curb outlines to model the top of curbs will cause problems since we used the default value of 1.000'.

image

The pictures below show the top of curbs created and added to the surface. As you can see the contours doesn't follow the curb like it should if it is modeled more correctly. Can't really say it's wrong because we indicated to the program that this is the way we want it modeled.

image

In a follow up post I'll go over how using a smaller Mid-ordinate distance can cause problems and ways we can model the surface to alleviate some of these problems.

Related Posts:
Parking Lot Surface I
Parking Lot Surface II
Parking Lot Surface III
Parking Lot Surface IV
Parking Lot Surface V

Raising a Pipe Run

Sometimes it's interesting, to me at least, where this blog site is linked from. Recently I saw a link coming from ww3.cad.de, which is the "largest and most active German-speaking community for CAD-CAM-CAE and EDM / PDM / PLM and other interested users on the Internet." It also hosts the AUGCE message board. The question one user had was how to raise (or lower) a run of pipes based on the ending invert elevation. In the list of options on how to accomplish the task was a link to the Pipe Slope Along a Run post and creating your own program to do it.

This post will take the post referenced and modifying it to raise the pipe run a set amount. It won't affect any branch runs, so you will have to adjust them by running the command again. If you want to follow along download the previous code at this link. Type VBALOAD at the command line to load the file and VBAIDE to open the Visual Basic Editor, enable Macros if it asks. Next create a new module and name it PipeAdjustRun (you can do that in the Properties Window).

image

Next copy the code from the Sub PipeSlopeRun and paste it into the new module, adding Option Explicit to the top of the code and renaming the sub PipeAdjustRun.

image

Next change the dSlope to something that makes more sense for this code, such as dElevDiff. Do a find and replace for the current module and it will change all of the instances of dSlope to dElevDiff.

We want the code to work in the same manner so most of the code will remain the same, but we do want the user to tell us what elevation difference they want to apply. So change the user prompt to ask for the elevation change.

image

Now the math portion of the code needs to be revised to adjust the pipe's elevation values. The portion of code that needs to be revised is shown below:

image

And the revised code is shown below:

image

And that should raise or lower a selected pipe run a specific amount. This code revisions comes with the usual disclaimers, not a whole lot of error checking has been done, check the program to make sure it is working as you expect and if you want some basic error catching add On Error Resume Next at the top of Sub, otherwise an error message will pop. You may have noticed I added the modified code at this link to save you some typing.

Thursday, February 12, 2009

Angle Between Lines

Just some reminders to myself. VBA.

Dim dPt1(0 To 2) As Double
Dim dPt2(0 To 2) As Double
Dim dAng As Double

Pi equation
Dim pi
pi = 4 * Atn(1)

dPt1(0) = oStructure.ConnectedPipe(i - 1).StartPoint.X
dPt1(1) = oStructure.ConnectedPipe(i - 1).StartPoint.Y
dPt2(0) = oStructure.ConnectedPipe(i - 1).EndPoint.X
dPt2(1) = oStructure.ConnectedPipe(i - 1).EndPoint.Y
dPt3(0) = oStructure.ConnectedPipe(j).StartPoint.X
dPt3(1) = oStructure.ConnectedPipe(j).StartPoint.Y
dPt4(0) = oStructure.ConnectedPipe(j).EndPoint.X
dPt4(1) = oStructure.ConnectedPipe(j).EndPoint.Y

Make sure the lines/points start at the same point to make sure the angle calculated is correct. Absolute in case the angle is negative. 2pi - dAng to get the other angle associated. Much easier than

If dPt1(0) = dPt3(0) And dPt1(1) = dPt3(1) Then
dAng = Abs(ThisDrawing.Utility.AngleFromXAxis(dPt1, dPt2) - ThisDrawing.Utility.AngleFromXAxis(dPt3, dPt4))
ElseIf dPt2(0) = dPt3(0) And dPt2(1) = dPt3(1) Then
dAng = Abs(ThisDrawing.Utility.AngleFromXAxis(dPt2, dPt1) - ThisDrawing.Utility.AngleFromXAxis(dPt3, dPt4))
ElseIf dPt2(0) = dPt4(0) And dPt2(1) = dPt4(1) Then
dAng = ThisDrawing.Utility.AngleFromXAxis(dPt2, dPt1) - ThisDrawing.Utility.AngleFromXAxis(dPt4, dPt3)
ElseIf dPt1(0) = dPt4(0) And dPt1(1) = dPt4(1) Then
dAng = Abs(ThisDrawing.Utility.AngleFromXAxis(dPt2, dPt1) - ThisDrawing.Utility.AngleFromXAxis(dPt3, dPt4))
End If

Tuesday, February 10, 2009

Split TIN Triangle - Elevation Range Point

In the last post I showed a snippet of code to calculate the area of a TIN Triangle for the entire triangle. This post will show a way to calculate the point where the elevation range splits a side of a TIN Triangle. The code checks both cases of the elevation range splitting the triangle length. The If Then statement checks the item in brackets first and then compares the Or statement.

Dim dPt(0 to 2) As Double ' X,Y,Z

Dim dElev As Double

dElev = 38

' Check to see if the TIN Triangle sides are split by an Elevation Range.

If (dOT(i + 2) > dElev And dOT(i + 5) < dElev) Or (dOT(i + 2) < dElev And dOT(i + 5) > dElev) Then

dPt(0) = dOT(i) - ((dOT(i + 2) - dElev) * (dOT(i) - dOT(i + 3)) / (dOT(i + 2) - dOT(i + 5))) ' X
dPt(1) = dOT(i + 1) - ((dOT(i + 2) - dElev) * (dOT(i + 1) - dOT(i + 4)) / (dOT(i + 2) - dOT(i + 5))) ' Y
dPt(2) = dElev ' Z

End If
...

The equations show the first side of the triangle, the other two sides are similar. To help you out here are the equations reduced to X,Y,Z notation.

If (Z1 > dElev And Z2 < dElev) Or (Z1 < dElev And Z2 > dElev) Then

X' = X1 - ((Z1 - dElev) * (X1 - X2) / (Z1 - Z2))
Y' = Y1 - ((Z1 - dElev) * (Y1 - Y2) / (Z1 - Z2))
Z' = dElev ' Z

End If

So that's one way to calculate the point where the elevation range crosses the TIN Triangle. If you do use the code you'll want to make sure that the denominator does not equal to 0, since it isn't possible.

Monday, February 09, 2009

2D Area of a TIN Triangle

This post is a snippet of code that calculates the 2D area of a TIN Triangle. This is helpful to know if you want to calculate Elevation ranges for a TIN surface.

dOT is an array of TIN Triangle points for the entire surface using the OutputTriangles Property for an AECTINSurface.

For i = 0 to Ubound(dOT) Step 9

dArea = dArea + 0.5 * Abs(dOT(i)*dOT(i+7)-dOT(i)*dOT(i+4)+dOT(i+3)*dOT(i+1)-dOT(i+3)*dOT(i+7)+dOT(i+6)*dOT(i+4)-dOT(i+6)*dOT(i+1))

Next

This is just part of the area calculations needed. You would also need to calculate the area of the triangle if it is split by an elevation range or ranges.

Civil 3D 2010 - 64 Bit?

We'll if you've watched the 2010 AEC Product Launch Webcast, you'll notice that one of the questions was unable to be heard. The question I'm referring to is:

Q: If Map 3D 2010 supports 64-bit operating systems, will Civil 3D 2010 also support 64-bit systems instead of running as a 32-bit program in 64-bit environment?

Now this question is of interest to me because I use Vista as a 64-bit Operating System at home. I was a bit disappointed that the answer indicated that it wasn't going to be included in this release.

A: Civil 3D 2010 does not take full advantage of 64-bit systems at this time however it is a high priority for future releases

Hopefully 2011 will bring a Civil 3D that runs natively on a 64-bit system.

If your looking for more information on Civil 3D 2010 I'd start looking for other blogs posts later this evening. I suspect James over at Civil3D.com will be one of the first with posts regarding the new product.

Saturday, February 07, 2009

AutoCAD 2010: Polylines

I've decided to blog some more about AutoCAD 2010 and ignore Civil 3D 2010 (probably for the next two months). One of the new features I think is cool and will improve productivity is the following two features (taken from Between the Lines):

  • Polylines can now be sub-selected i.e. segments of plines (also called as sub objects) can be sub selected using CTRL key
  • Users can sub select the segments of Polylines during 2D editing commands such as move, rotate etc.

It's kind of hard to read those two features and get what you can actually do with it. So in this post I'm going to explore what you can do with these new features. First as the feature says you can select a sub object or multiple sub-objects of a polyline.

image

I was thinking it would be cool to select the segment and delete it, but you can't. You can grip edit one of the grips and when using the stretch grip edit it moves the whole segment keeping it as the same angle and adjusting the adjoining segments.

image

So in the above picture I'm extending the line to the right using polar and the two adjoining segments are getting longer. As the feature list indicated the other grip options also work as shown in the picture below.

image

I've just shown the new feature with one segment selected. You can also grip edit more than one segment at a time. For instance in the picture below I've extended the vertical lines to the west of the previously modified segment to the east.

image

You can even select segments from two different polylines and modify them. Hopefully you can see why I think this is a good new feature in AutoCAD 2010.

So why no Civil 3D 2010 related posts? Because I think I should test drive the new feature before blogging about the feature. I have confidence you can read press releases or view videos and me blogging about the features that I don't really know about doesn't benefit me or you. I currently don't have access to Civil 3D 2010 and don't expect to get it until the free trial download is available. I do have access to AutoCAD 2010, so that's why I feel comfortable blogging about those new features.

Friday, February 06, 2009

BE Communities

I did do a few posts in the past regarding Microstation, I did learn some of the program but I never did get much work to do with it. Some people in the office did get to do some work with it, I just wasn't one of them.

I did get an email from Bentley regarding recently regarding their BE Communities site. It has a bunch of information regarding their products. It seems a lot easier to find information about the products compared to the last time I looked for stuff. They even have a place to create a blog, although I probably won't be using since you can't link to an outside site.

Thursday, February 05, 2009

Forrest Gump was a Good Movie

"Yes, Mom if everyone else was jumping off the cliff I would also" and with that said I'm going to go along with the marketing blitz and mention that Autodesk announced that AutoCAD 2010 has been released. Not quite sure what released means since you can't yet purchase the program. I guess it means that the masses can learn what's in the 2010 version without worrying about a non-disclosure agreement (NDA).

I'm not sure but the blurb in the press release regarding Civil 3D looks like a typo. I'm thinking it should read AutoCAD Civil 3D 2010 AutoCAD Civil 2010, it looks like the marketing folks are even confused on the versions of the program.

"AutoCAD Civil 2010 AutoCAD Civil 2010 adds a variety of feature enhancements that help civil engineering technicians, drafters, and surveyors complete projects faster including a streamlined user interface, a more complete field to finish surveying workflow, and roadway intersection modeling."

I have seen AutoCAD 2010, but haven't seen much of Civil 3D 2010. The roadway intersection modeling looks intriguing though.

Since I do a lot of posts regarding VBA, it's interesting to see that the AutoCAD product won't be shipped with VBA installed. VBA will be available as a download though. I'm don't know if Civil 3D will be shipped the same way.

image

The parametric tools look promising and I've done a little experimenting with them. I think they may be helpful in revising a portion of roadway, but probably wouldn't work very well to add them to a whole subdivision. Well I guess I should explain what parametric tools are. It's kind of like partbuilder with an easier user interface, just kind of kidding. You are able to have AutoCAD constrain objects to one another. For instance you can make a an arc portion of a polyline remain tangent to the next line portion of the polyline. The images below show two polylines that have parameters applied. Grip editing the top polylines top rightmost grip will adjust the parts of the polyline and the lower polyline.

Before

image

After:

image


To quote Forrest Gump, "That's all I have to say about that."

LinkWithin

Blog Widget by LinkWithin