Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Batch change polylines elevations

81 REPLIES 81
Reply
Message 1 of 82
Anonymous
7498 Views, 81 Replies

Batch change polylines elevations

Hi there,
I have a certain task I need to do and trying to figure out the fastest way to do it. Lets say I have several dozen polylines and I need to add certain elevation to each one. I would use them as contours in the next step for creating surface. Trouble is that I will have to change elevations to the whole set of polylines dozen of times. Is there way to get some sort of table which would list all of my polylines with column stating their elevation and where I would be able to change elevation to whole set of polylines by copy/pasting column with values from excel for instance?
Thanks in advance !
81 REPLIES 81
Message 21 of 82
Anonymous
in reply to: Anonymous

Neil, thank you for your kind help. No, it is not late and I would be thankful if we resolve this because I know I will need it often on the future projects as well. So, when you get the time, it would be of a great help if you figure it out. Yes I have MS Access available but never have used it. But I will learn what needs to be learned. Thank you.
Dario
Message 22 of 82
Anonymous
in reply to: Anonymous

Considering you have no experience with Map, I'm afraid the process will
require too much explanation/documentation to teach you via the forum, but
if you want to figure it out on your own, here are the steps:

1) In Map, create an Object Data table consisting of a single field for your
contour ID's. This ID can be the station of each contour if that is how you
identify them in your river modeling software. See the Map Help system for
Object Data.
2) Attach the object data to your contours and assign the ID value to each
contour that corresponds to your river modeling software.
3) Create an Excel table from your modeling software output (you don't need
to create an Access table as I thought earlier). The table must have at
least the Contour ID and it's Elevation for each contour. You can convert an
ASCII text file to an Excel table.
4) Create an ODBC connection to your Excel table using the Microsoft ODBC
driver. See the Windows Help Sytsem for creating ODBC connections.
5) Connect the Excel table to the drawing containing your contours using
dbConnect in Autocad.
6) Link the records in the Excel table to your contours using the contour ID
field for the links. Save the drawing.
7) Open a new drawing and, using Map's tools, attach the drawing containing
the contours to your new drawing. (See the Map help for attaching drawings).
8) Define a query to bring in the contours from the attached source drawing.
For the query definition, use the Alter Properties option to assign the
queried contour elevations from the values from the linked Excel table. (See
the Map help system for defining Map queries).
9) Run the query to bring the contours into your host drawing. They will be
at the elevations from the Excel table.
10) Use the queried contours to build a C3D surface and use that to derive
the flood boundaries using gradings from feature lines draped on the
perimiter of the surface.

You can create an Excel output table for each river study and link each
output table to the contours (you can link each contour to multiple tables)
and run the query above for each table to make surfaces for each study
model, or you can just use one table and overwrite the values for each run.
Whenever you overwrite or update your tables, you'll need to go back to the
host file, remove the old queried contours from the drawing, re-run the
query to bring in the contours with the new elevations from the Excel tables
and add them back into your surface model(s) to generate the new flood
boundaries.

I regret that I can't work through this with you, but trying to do it
through the forum is just not practical. If you have access to training from
your reseller you might be able to arrange for a session to work though
this. Any knowlegable Map user will understand the concept if you provide an
outline of your goal.



__________ Information from ESET NOD32 Antivirus, version of virus signature database 5139 (20100523) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Message 23 of 82
williewilbers6534
in reply to: Anonymous

Why not use Excel to create a script file of all the polylines and just paste it into the command line to draw the polylines for each scenario?
Message 24 of 82
Anonymous
in reply to: Anonymous

Thank you a lot for the steps. I think I can figure it out on my own from the instructions you provided. I will let you know how it goes.
You have been of a great help.
Dario
Message 25 of 82
Anonymous
in reply to: Anonymous

I'd be interested in seeing how your idea works Willie. Can you outline the
steps?
Message 26 of 82
williewilbers6534
in reply to: Anonymous

See the attached Excel file.

I am assuming the following:
1 - The position of the contours won't change - only the Z values.

My workflow would be something like this
1 - Change all the Z values of the polylines in Excel - Do all your calculation in Excel.
2 - Delete any contours in Excel that have been used to create the surface.
3 - Delete the contour definitions in Surface Properties, Definition tab.
4 - Paste the script into the command line to create new contours with different Z values.
5 - Add the new contours to the Surface Definition.
Message 27 of 82
Anonymous
in reply to: Anonymous

This looks like a good solution Willie. How did you get the polylines into
the spreadsheet?



__________ Information from ESET NOD32 Antivirus, version of virus signature database 5142 (20100524) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Message 28 of 82
Anonymous
in reply to: Anonymous

One issue worth noting is that it would be a labor intensive process to
update the spreadsheet with new elevations from the modeling software. This
is because in the spreadsheet each polyline is defined by one row per
vertex, whereas the output from the modeling software is one row per
polyline. Thus it would be a manual process to copy the elevation from the
model output to the many rows of the spreadsheet. However, by setting up the
spreadsheet with a lookup table for the vertex elevations the process could
be greatly simplified. By referencing each vertex elevation cell to a single
lookup cell, all the vertices could be updated by updating one cell. Also,
by using named ranges the copy and paste process could be simplified as
well.



__________ Information from ESET NOD32 Antivirus, version of virus signature database 5142 (20100524) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Message 29 of 82
williewilbers6534
in reply to: Anonymous

I use LIST to get coordinates of polyline to Excel or download Cadtools from [http://www.glamsen.se/CadTools.htm|http://www.glamsen.se/CadTools.htm] . Cadtools has a command to export polyline coordinates to excel.

It's freeware and has some handy tools.
Message 30 of 82
Anonymous
in reply to: Anonymous

Ok. A Map report query will generate the vertices in a CSV file as well, so
there are a few approaches. I'll work through a test run when I can get to
it.



__________ Information from ESET NOD32 Antivirus, version of virus signature database 5142 (20100524) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Message 31 of 82
Anonymous
in reply to: Anonymous

OK, I have been following your steps and got stuck at the step no. 6. When I try to do the linking of records in Excel table(called visine) to contours, I get the attached dialogue saying "Database has no tables" Do you have an idea what could be a problem? Thanks !
Message 32 of 82
Anonymous
in reply to: Anonymous

Hi Willie,

Thanks for your suggestion too. I have been using Cadtools for couple of years so I am familiar with how to get coordinates from polyline. However - how does pasting excel lines in autocad command line draws them? What exactly should I paste?
I am following Neil`s method at the moment and am close to having it working I think but am curious how this thing can work as well. So maybe it will be handy too on some problem.
Message 33 of 82
Anonymous
in reply to: Anonymous

In the Excel table you have linked, try making a new sheet in the workbook
and give it a name you will recognize. Then see if the new sheet shows up as
a table in your Datasource connection.
Message 34 of 82
Anonymous
in reply to: Anonymous

I'll need to re-evaluate the workflow as I may need to modify it. I'm a bit
rusty at setting up links to Excel tables. In the meanwhile you might try
willies approach as it is simpler to set up. I'll repost once I get the bugs
out of the Map workflow.
Message 35 of 82
Anonymous
in reply to: Anonymous

From willie's spreadsheet, you need to paste Column H into the Autocad
command line. Note that Column H has the command 3DPoly preceeding each set
of polyline vertices. There are 3 polyline sets, each preceeded by a 3DPoly
command. When you paste column H into Autocad, it initiates the 3DPoly
command and then draws the vertices from the table. If you paste the entire
column, Autocad will draw all 3 polylines, there is no need to paste the
polyline sets individually.

With this approach you would need to edit the elevations of the polylines in
the spreadhseet using the values from your river study and then re-create
the polylines in Autocad by pasting the new versions. It is a simple,
straight forward approach.
Message 36 of 82
AllenJessup
in reply to: Anonymous

If multiple runs in the hydrology software could be output to CSV files they can be converted to script files easily. Then each iteration could be drawn on a separate layer and a surface created from each.
You would need to have 3dpoly on the first lin of the file, 2 blank lines between each set of coordinates defining the polyline and one blank line at the end of the file. The blank lines represent Enters.
Allen

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 37 of 82
Anonymous
in reply to: Anonymous

The problem is Map just does not play will with Excel links. We'll have to
use an Access database. Here is what you need to do:

1) Create a new Access database file for your study. Just right click in a
folder and select the New/Microsoft Office Access Application option in the
popup.

2) Open the new Database. You will see some icons for creating tables, etc.
We will create a new table by importing your spreadsheet. Go to the File
pull down and select File/Get External Data/Import. Select your spreadsheet
with contours. The import wizard will walk you through the import process.
You will use your contour ID field as your index, so don't let the wizard
create a new index. You should see the new table for your contours when
finished. DBL click it to review the contents. You can edit the values in
the table by clicking in a field.

3) We now will create a datasource driver so Map can communicate with your
new .MDB file. Go to Windows Control Panel/Administrative tools/Data Sources
(ODBC) and on the User DSN tab pick the add button. Pick the "Microsoft
Access Driver (.mdb)" in the list.There are versions for different languages
so make sure to pick the generic one I just specified. Give it a name such
as River Study. Pick the Select button and browse to and select your new
.MDB file. Pick OK. You should see the new Datasource in the list of User
Sources. Close the data source dialogue.

4) We need to set up the data source in Map so we can link your contours to
the new datasource. Open your drawing with the contours. Select the
Toolbased Geospatial workspace. This will put you in a Map work environment
which has the tool bars you will need.. Type Mapwspace on the command line
and select the On option. This will open the Map Task Pane. Select the Map
Explorer tab on the task pane. Pick the Datasources folder, Right Click and
select configure. We need to create a Map Datasource file (UDL) to link to
the ODBC datasource we created earlier. In the dialogue type a name for your
new datasource, such as River Study. Pick OK. In the DataLink properties
dialogue, select Microsoft OLE DB Provider for ODBC drivers. Pick Next. For
Use datasource name, pick the drop down and select the ODBC connection you
made in step 3 (i.e. River Study). Jump down to item 3. and use the drop
down to pick your MDB file for the initial catalogue. Pick OK. In the Map
Task Pane, Rt click on Data Sources and pick Attach. Choose the UDL you just
created. You should see your Datasource in the Task Pane with the Contour
table listed in the Tables tree. You can view the table by double clicking
it.

5) Now we can link your contours to the database. Assuming you have created
an object data table and assigned ID's to your contours, we can
automatically link them to the database table. In the pull down menu above
the ribbon (turn it on if you don't see it), select the Setup/Convert Object
Data to Database Links. In the dialogue make sure your contour ID Object
Data table is selected in Source Object Data Table selector. Under Target
Link Template, select the Link Object data to database radio button, then
pick the Define button. The dialogue should populate with the contour ID
field fomr the Object Data table. Accept the settings and return to the
previous dialogue. Under Object Selection, choose to slect your cross
section polylines manually or use the Automatic option with a filter to
select them. Proess Proceed. Your Cross Sections should now be linked to the
table, assuming there were no mismatches between the ID numbers in yor
Object Data vs. the database table.

To check your links, dbl click the contour table to open it. Go to the
Highlight pull down and Toggle the 1st three options. This will make Autocad
zoom and pan to the cross section when you select one in the table. Try
picking a record in the contour table and see that Autocad zooms and pans to
the cross section and highlights it.

With the cross sections linked, you can now proceed to set up the query as
outlined in my previous post.

There is a major advantage to using the MBD vs. XLS file. Map wont let you
edit an XLS if it is in use in C3D, whereas you can with MDB. Thus when you
set up the query you can instantly update your cross sections with new
values from the MDB by re-running the query. You won't have to erase and
recreate them. In other words, when you add them to a C3D surface, you can
instantly update the surface with new data from the MDB for as long as you
keep the drawing open. Just re-run the query and the cross sections will
update which will in turn update the surface and gradings. However once you
close the drawing you will have to recreate the cross sections by erasing
the old and re-running the query.

One more thing to watch for..When you query the cross sections into your
surface drawing, Map will ask if you want to save the updates to the source
drawing when you close. I suggest you NOT save the edits if you want to
preserve your source cross section data as is.
Message 38 of 82
Anonymous
in reply to: Anonymous

And here is a screen recording showing the ends results in action.
http://screencast.com/t/NDNiMGU4

Note that I can edit the values in the attached contour table inside
Autocad. As I edit the values, I re-run the query which updates the
polylines which in turn updates the surface.

As you run your river models you can add the results as new tables in the
.MDB and link all the each tables to your cross sections or you can just use
the single table and over write the elevations. In either case you can
update the values in the tables by pasting from river study the text files.
By creating tables for each output, you can set up a query for each study
and run each one to update the cross sections and see the results. The
queries can be saved for re-use any time.
Message 39 of 82
Anonymous
in reply to: Anonymous


Yes, the script approach is very capable and much
simpler for users not familiar with Map. Map does have advantages which will
make it more efficient when applying updates. It's a trade-off between set
up time vs.processing efficiency. If you know how to set it up
in Map it's probably worthwhile.
Message 40 of 82
AllenJessup
in reply to: Anonymous

Now that I've read your posts I will know how! I know map generally but the only .mdb files I have experience with are using FDO to bring in personal geodatabases.
I'm going to copy your steps to save for later and I want to watch the screecast as soon as I have time at home.
Allen

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report