Consecutive (but not joined) polylines from excel

Consecutive (but not joined) polylines from excel

Anonymous
Not applicable
3,336 Views
24 Replies
Message 1 of 25

Consecutive (but not joined) polylines from excel

Anonymous
Not applicable

Hi all

I have a set of coordinate data from excel with road conditions in another column.

I'm looking to import these into Civil 3D in their respective 100m sections and color coded as per condition of same.

All polylines are to be separate regardless of condition and the start of polyline 2 must be at the end of polyline 1 etc etc

Is there are lisp or workflow out there that can do this?

Photos attached

Thanks in advance

 

 

0 Likes
Accepted solutions (1)
3,337 Views
24 Replies
Replies (24)
Message 2 of 25

tcorey
Mentor
Mentor

You would make it easier to test if you would post the text file, not just the png. I want to help you but am not willing to sit here and type in the test data by hand. 😉



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 3 of 25

Anonymous
Not applicable

Hi Tim

 

Thanks for the reply

I suppose that would have been a good idea to start with!

Please find attached 😃

0 Likes
Message 4 of 25

Kyle-L
Advocate
Advocate

Funny enough I just helped someone with a similar request this morning. See this post: https://forums.autodesk.com/t5/civil-3d-forum/drawing-multiple-lines-when-given-start-and-end-points... 

 

If you follow the other post and change the formula to the below it should work as you want.

 

Paste this formula in the last column (starting at the second point) and drag down (see image below):

 

=CONCAT("PL ", D2, ",",E2," ",D3,",",E3," ")

 

HimKyle_0-1614938164373.png

HimKyle_1-1614938515590.png

 

 

What you can do to account for the condition is set the active layer (or colour) to the condition you want in Civil 3D and then in excel filter the condition column and then copy and past just those entries into Civil 3D. You will need to do this for each rating, so only 5 times.

 

 

Message 5 of 25

Joe-Bouza
Mentor
Mentor

script file from excel

 

layer set condition1

 

pline x,y

x,y

x,y

x.y

 

layer set condition2

 

pline x,y

x,y

x,y

x.y

 

Joe Bouza
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 6 of 25

Anonymous
Not applicable

Hi all thanks for the help so far. Easy when you think outside the box!

Last bit I hope... How do I cancel out of the command in excel after setting the layer to the condition rating?

I've looked at the forums and tried command, exit, escape, ^c^c but nothing works. Operator error I fear!

I note that the conditions need a pair of odometer readings to work but I'll sort that out if I can get the right script.

Revised CSV attached

Thanks

0 Likes
Message 7 of 25

Kyle-L
Advocate
Advocate

Not sure of a simpler way, but try changing the command to this (without the square brackets):

 

[(command "-layer" "set" "VERY_GOOD")(command) PLINE 569309.712,836642.717 569408.593,836625.364 ]

0 Likes
Message 8 of 25

Anonymous
Not applicable

Sorry... didn't work. Tried your text and multiple variations of it

0 Likes
Message 9 of 25

Joe-Bouza
Mentor
Mentor

Not sure who you are replying to; you replied to yourself

Joe Bouza
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

0 Likes
Message 10 of 25

tcorey
Mentor
Mentor

Firstly, if the layer doesn't exist, you can't "Set" it, you have to "Make" it. That will create the layer and set it current.

 

Your other line, about (command) Pline... Proper syntax would be (command "pline"......)

 

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 11 of 25

Anonymous
Not applicable

The layers do exist in the drawing. The first bit of the code works to set the required layer in the drawing. The second bit works to draw the individual polylines. Its when joining the codes , civil 3d wont read the intention to cancel out of setting and new layer current and proceed with polyline command.

0 Likes
Message 12 of 25

Anonymous
Not applicable

Sorry hit wrong reply button.. In an case, civil 3d doesn't recognise the intention to cancel out of the layer command.

Both bits of code work independently of each other but when I join them, it doesn't work

0 Likes
Message 13 of 25

Joe-Bouza
Mentor
Mentor

 The script has do exactly what would be done at the keyboard. You most likely need two blank lines in the script to end the layer and pline command each time.

 

to better understand the required format of the script do a simple layer set followed by a pline (two point will suffice) DO NOT USE THE ESCAPE KEY command line commands only

Joe Bouza
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

0 Likes
Message 14 of 25

Anonymous
Not applicable

Yes I have that so... my code would look like this for command line entries:

 

-LA S VERY_GOOD (COMMAND) (COMMAND) PL "COORDINATES REQUIRED" (COMMAND) (COMMAND)

REPEAT

Command is needed twice for me for some reason to cancel out of commands.

0 Likes
Message 15 of 25

tcorey
Mentor
Mentor

I thought you were going for LISP. You're building a script. My bad.

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 16 of 25

Anonymous
Not applicable

No probs. I just want to be able to have 5 concatenated formulae in the csv that I can copy and paste into Civil 3d to replicate the condition and length of each segment tested.

I'm not having much success!

0 Likes
Message 17 of 25

Kyle-L
Advocate
Advocate
Accepted solution

I just tried my previous suggestion and it works for me, but maybe I am not understanding what you want to achieve. So to clarify, you want to draw a polyline between 2 points (say Odometer reading 0 and 100) and you want that polyline to go on an existing layer with the same name as the Rating column. If that is correct, below is the formula you can use in excel:

 

=CONCAT("(command ""-layer"" ""set"" """,B3,""")(command) PLINE ",D2,",",E2," ",D3,",",E3," ")

 

It results in this text (without the square brackets. The square brackets are there so you can see the final blank space in the line):

 

[(command "-layer" "set" "NA")(command) PLINE 569309.712,836642.717 569408.593,836625.364 ]

 

I will break down the line.

 

[(command "-layer" "set" "NA")] - Sets the current layer to B3, which is the Rating.

[(command) ] - Escapes out of the layer command

[PLINE 569309.712,836642.717 569408.593,836625.364 ] - draws the polyline and escapes the polyline command (could also be written as [(command "pline" "569309.712,836642.717" "569408.593,836625.364") ]

 

Below is the formula in Excel and the result in Civil 3D

HimKyle_0-1615184461884.png

HimKyle_1-1615185172043.png

 

 

Message 18 of 25

Anonymous
Not applicable

That my friend is what I was looking for... Thanks so much!!

0 Likes
Message 19 of 25

Pointdump
Consultant
Consultant

James,
I've been following this with interest. The Solution from @Kyle-L is definitely first choice.

Another way would be to turn that CSV into a Shapefile in QGIS, then use MAPIMPORT to put "Rating" into different layers.

 

Slow_1.png

 

Slow_2.png

 


Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2027
Message 20 of 25

Anonymous
Not applicable

Hi Dave

 

Thanks for the reply. That is a good solution too with less room for error (potentially).

One question though... in your shapefile, when I mapimport it, it is strung.

When I try to do this on the main contract information, it comes in as points only.

Is there a setting in the shapefile generation or import that I can force it to string?

 

 

0 Likes