taocad Posted March 23, 2013 Posted March 23, 2013 Hello, I would like to ask if it is possible to plot a matrix of elevation points in Civil 3D? Thanks! Quote
Tyke Posted March 23, 2013 Posted March 23, 2013 The short answer to your question is yes. Check out this link to get you started: http://courses.washington.edu/cive316/labs/Civil3D/ACAD_Points_Manual.pdf and after that Google for AutoCAD Civil 3D Tutorial to get some more help. Quote
taocad Posted March 23, 2013 Author Posted March 23, 2013 Thank you sir but my text file is not in x-y-z format. My data file actually consists of several elevation points on a grid/matrix (1876 columns x 3126 rows). Is it possible to plot this kind of data in AutoCAD? Quote
Murph_map Posted March 23, 2013 Posted March 23, 2013 Thank you sir but my text file is not in x-y-z format. My data file actually consists of several elevation points on a grid/matrix (1876 columns x 3126 rows). Is it possible to plot this kind of data in AutoCAD? Can you share part of that text file? Quote
Tyke Posted March 23, 2013 Posted March 23, 2013 Thank you sir but my text file is not in x-y-z format. My data file actually consists of several elevation points on a grid/matrix (1876 columns x 3126 rows). Is it possible to plot this kind of data in AutoCAD? If you have a text file then please, as Murph_map asked, give us couple of lines of your text file. There are several possibilities how we can help you. Quote
BIGAL Posted March 23, 2013 Posted March 23, 2013 In civil 3D you can just import points and use to create surfaces etc its under the menu "point" "Insert/export" you just nominate how your points are made up eg x y z or P x y zor Z X Y and so on the option has a predefined list of various XYZ ways Quote
taocad Posted March 24, 2013 Author Posted March 24, 2013 (edited) 6.6356 6.4646 5.9604 5.1491 4.0724 2.7858 1.3556 -0.1444 -1.6370 -3.0452 -4.2965 -5.3264 -6.0817 -6.5236 -6.6293 -6.3934 -5.8279 -4.9621 -3.8405 -2.5210 -1.0716 0.4330 1.9153...... Here's a part of the text sir. It's a string of elevation arranged in 3126 rows and 1876 columns. Btw these values are actually instantaneous water surface elevations on a bay; they are projections of trough and crest elevation of waves on a grid. I just need to plot them in 2D. I'm attaching a sample file too. sample.txt I think it's best viewed in Notepad++ Can you share part of that text file? Edited March 24, 2013 by taocad Quote
Tyke Posted March 24, 2013 Posted March 24, 2013 Are the values in your text file just heights? If so what are your matrix spacings? In the text file there are only 12 very long rows or data, but neither the number of rows nor columns are divisible by 12, so how do the number of rows of data in the text file relate to the number of rows and columns. Is the text file only part of your total data file, as there are far fewer data elements than that needed for a 3126x1876 matrix? I think just the first twelve rows of data. You would need a routine to plot your matrix points and to read the heights from your text file and they could be drawn in either 2D or 3D. I see 3D as the better option as you can always reduce a 3D drawing to 2D, but in the other direction it is not possible unless you have a routine to read the heights and pass them on to the point Z values. You are using Civil 3D so you could create a DTM with various display options to aid in making sense of your heights. Quote
eldon Posted March 24, 2013 Posted March 24, 2013 (edited) I got 12 rows with 1876 columns per row when opened in Excel. I would assign a nominal spacing to give x,y coordinates of each value, but I don't think that any programme could plot just from the text file Edited March 24, 2013 by eldon found more columns Quote
Murph_map Posted March 24, 2013 Posted March 24, 2013 If all you have is elevation data and no x,y (lat/lon) where to you want the points to be in relation to each other? You want just 2D yet all you have is the "Z" data? I think I understand what you want, you wany a line going across that zig-zags up and down. What may work is use the find/replace in Notepad to replace the "TAB" with a ,1, so you now have a cvs file like "6.6356,1, 6.4646,1, 5.9604,1, 5.1491," Then use the pline command and paste the coordinates from that file to the command line. Quote
taocad Posted March 24, 2013 Author Posted March 24, 2013 Are the values in your text file just heights? If so what are your matrix spacings? In the text file there are only 12 very long rows or data, but neither the number of rows nor columns are divisible by 12, so how do the number of rows of data in the text file relate to the number of rows and columns. Is the text file only part of your total data file, as there are far fewer data elements than that needed for a 3126x1876 matrix? I think just the first twelve rows of data. You would need a routine to plot your matrix points and to read the heights from your text file and they could be drawn in either 2D or 3D. I see 3D as the better option as you can always reduce a 3D drawing to 2D, but in the other direction it is not possible unless you have a routine to read the heights and pass them on to the point Z values. You are using Civil 3D so you could create a DTM with various display options to aid in making sense of your heights. I'm sorry, I couldn't upload the original text because i think it is too large. Yes, those were just some of the points in my text file. I just didn't know how to present them here. Yes, these values are elevation values referenced from still water level . The number of spacings per column is ten spaces and in 1 row/line of data in the text file, there are actually 1876 elevation values. Ok. So should I first find a way to translate these values into x-y-z coordinates? My idea is to set my x and y axes to be 3126 and 1876 respectively (the actual orientation of the matrix is rotated 90 clockwise. it's a bit hard to explain it here). Quote
taocad Posted March 24, 2013 Author Posted March 24, 2013 (edited) I got 12 rows with 1876 columns per row when opened in Excel. I would assign a nominal spacing to give x,y coordinates of each value, but I don't think that any programme could plot just from the text file In the actual map where i generated these data points, the interval between 2 points is set to 20 meters. So if you multiply the number of columns and rows to the 20 m interval (1876 x 3126) you'll get the actual extents 37500 m x 62500 m. I do have a program to directly plot this type of data. I'm currently using Sigmaplot 11 to process this data. The problem is that the program crashes whenever i try to input points all at once. So I'm looking into Autocad, hoping that it could do the same thing without crashing. Edited March 24, 2013 by taocad Quote
Tyke Posted March 24, 2013 Posted March 24, 2013 Is your first row of data at the top or bottom of your matrix when viewed in plan view? In your Sigamaplot 11 software could you not split your data file down and create several plots that you can fit together? If Sigamaplot has been programmed to work with integer values when reading in data it would have a theoretical limit of around 32,767. Quote
taocad Posted March 24, 2013 Author Posted March 24, 2013 Are the values in your text file just heights? If so what are your matrix spacings? In the text file there are only 12 very long rows or data, but neither the number of rows nor columns are divisible by 12, so how do the number of rows of data in the text file relate to the number of rows and columns. Is the text file only part of your total data file, as there are far fewer data elements than that needed for a 3126x1876 matrix? I think just the first twelve rows of data. You would need a routine to plot your matrix points and to read the heights from your text file and they could be drawn in either 2D or 3D. I see 3D as the better option as you can always reduce a 3D drawing to 2D, but in the other direction it is not possible unless you have a routine to read the heights and pass them on to the point Z values. You are using Civil 3D so you could create a DTM with various display options to aid in making sense of your heights. I'm sorry, i couldn't upload the original file because i think it is too large (about 42mb). The values in the text are heights referenced from still water level. The spacings of the matrix is 10 spaces per column. But if you're talking about the actual interval being represented between two columns or rows, it's 20 meters. So multiplying it to the number of columns and rows (1876x3126), you'll get the actual extents of the matrix to be 37500m x 62500m (the actual number rows are 1875x3175. for some reason the program I used in generating the points produced 1 additional column and row). The values shown here are just a small part of my original data. My data actually has approx. 5M points. Ok. So do I still need to translate these data points into x-y-z coordintes? Quote
taocad Posted March 24, 2013 Author Posted March 24, 2013 Is your first row of data at the top or bottom of your matrix when viewed in plan view? In your Sigamaplot 11 software could you not split your data file down and create several plots that you can fit together? If Sigamaplot has been programmed to work with integer values when reading in data it would have a theoretical limit of around 32,767. Yes i tried doing that and it is still quite cumbersome. The plot it produces is always in semilog so splitting it in rectangular matrix is no good as it would always be warped or distorted. Plus the highest values produced for each subgrid would only be represented with respect to itself, not the whole grid. So let's say this subgrid has a highest value of 6m while another subgrid has only 2m. Those values will thus be represented in color red so i won't be able to distinguish the difference with respect to the whole grid. Well, I am not sure if i could actually set the colors to represent a particular value. I think the program automatically sets it. I haven't quite explored the program thoroughly so I'm looking at Autocad as a much more convenient alternative as i am hoping it could handle a large number of data without crashing and without having to split it into subgrids. Quote
taocad Posted March 24, 2013 Author Posted March 24, 2013 Is your first row of data at the top or bottom of your matrix when viewed in plan view? In plan view, the first row of data is actually y data (latitude). the leftmost column is the bottom of the matrix. Quote
taocad Posted March 25, 2013 Author Posted March 25, 2013 thanks for all the suggestions. i'll try to find a way into translating the data into x-y-z coordinate. i think this could be done with a simple program. Quote
BIGAL Posted March 25, 2013 Posted March 25, 2013 It sounds like two loops are needed the X & Y loop your x is set to 1-1876 which is inside the Y loop of 3126 this will draw a matrix of 5864376 points at a spacing of 20m. A Start something like this (setq fo (open "C:\yourdir\yourdata" "r")) (setq xinc 20) (setq yinc 20) (setq x 0) (setq y 0) (repeat 3126 (setq bigline (read-line fo)) (repeat 1876 (setq Z (lee macs defun find space)) (command "point" (list X Y Z)) (setq x (+ X xinc)) ) (setq x 0) (setq Y (+ Y Yinc)) ) (close fo) Quote
Tyke Posted March 25, 2013 Posted March 25, 2013 (edited) thanks for all the suggestions. i'll try to find a way into translating the data into x-y-z coordinate. i think this could be done with a simple program. Here is a simple VBA macro that will read in your data, insert a point and adjacent to the point it will display your elevation. Option Explicit Sub PointsIn() Dim sFileName As String Dim iFileNum As Integer Dim sBuf As String Dim vString As Variant Dim X As Double Dim Y As Double Dim Z As Double Dim incX As Double Dim incY As Double Dim i As Integer Dim insPos(2) As Double Dim acPoint As AcadPoint Dim vItem As Variant Dim sElev As String Dim oText As AcadText Dim lCol As Long ' set the path and file name sFileName = "c:\temp\sample.txt" iFileNum = FreeFile() i = 0: X = 0: Y = 0: lCol = 1 ' set the matrix size incX = 20: incY = 20 Open sFileName For Input As iFileNum Do While Not EOF(iFileNum) Line Input #iFileNum, sBuf vString = Split(sBuf, " ") i = 0: Y = 0 For Each vItem In vString insPos(0) = X: insPos(1) = Y: insPos(2) = CDbl(vString(i)) ThisDrawing.ModelSpace.AddPoint (insPos) sElev = (vString(i)) insPos(0) = insPos(0) + 1 Set oText = ThisDrawing.ModelSpace.AddText(sElev, insPos, 1) i = i + 1 Y = Y + incY Next 'ThisDrawing.Regen acActiveViewport 'ThisDrawing.Utility.Prompt vbCrLf & "Column " & lCol & " plotted" lCol = lCol + 1: X = X + incX Loop Close iFileNum End Sub From your sample data it took about 2 seconds to read and plot a column of 1876 points.So with your complete data set of almost 6 million points it is going to take around 110 minutes to read and plot the data. Edited March 25, 2013 by Tyke Commented ou the REGEN and Prompt lines to more than double the speed Quote
Tyke Posted March 25, 2013 Posted March 25, 2013 i'll try to find a way into translating the data into x-y-z coordinate. i think this could be done with a simple program. Here is a macro to write a data file with the X,Y,Z coordinates for a single point on a one line. Sub CreateDataFile() Dim sFileNameIN As String Dim sFileNameOUT As String Dim iFileNumIN As Integer Dim iFileNumOUT As Integer Dim sBufIN As String Dim sBufOUT As String Dim vString As Variant Dim X As Double Dim Y As Double Dim Z As Double Dim incX As Double Dim incY As Double Dim i As Integer Dim vItem As Variant Dim sElev As String Dim lCol As Long ' set the paths and file names sFileNameIN = "c:\temp\sample.txt" iFileNumIN = FreeFile() Open sFileNameIN For Input As iFileNumIN sFileNameOUT = "c:\temp\sample.dat" iFileNumOUT = FreeFile() Open sFileNameOUT For Output As iFileNumOUT i = 0: X = 0: Y = 0: lCol = 1 ' set the matrix size incX = 20: incY = 20 Do While Not EOF(iFileNumIN) Line Input #iFileNumIN, sBufIN vString = Split(sBufIN, " ") i = 0: Y = 0 For Each vItem In vString sBufOUT = CStr(X) & " " & CStr(Y) & " " & (vString(i)) Print #iFileNumOUT, sBufOUT i = i + 1 Y = Y + incY Next lCol = lCol + 1: X = X + incX Loop Close iFileNumIN Close iFileNumOUT End Sub Then you will need to read in the data points. Try this macro: Sub PlotPoints() Dim sFileNameIN As String Dim iFileNumIN As Integer Dim sBuf As String Dim vString As Variant Dim X As Double Dim Y As Double Dim Z As Double Dim incX As Double Dim incY As Double Dim i As Integer Dim insPos(2) As Double Dim acPoint As AcadPoint Dim vItem As Variant Dim sElev As String Dim oText As AcadText Dim lCol As Long ' set the path and data file name sFileNameIN = "c:\temp\sample.dat" iFileNumIN = FreeFile() Open sFileNameIN For Input As iFileNumIN Do While Not EOF(iFileNumIN) Line Input #iFileNumIN, sBuf vString = Split(sBuf, " ") insPos(0) = vString(0): insPos(1) = vString(1): insPos(2) = vString(2) ThisDrawing.ModelSpace.AddPoint (insPos) sElev = (vString(2)) insPos(0) = insPos(0) + 1 Set oText = ThisDrawing.ModelSpace.AddText(sElev, insPos, 1) Loop ThisDrawing.Regen acActiveViewport Close iFileNumIN End Sub The macro to write the data file require only a few seconds to do your sample data and the reading in of the points is a little faster than the first macro I posted. Let us know how you get on. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.