Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Converting polylines to 3d polyines - with a twist

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
tcapmusic
9334 Views, 8 Replies

Converting polylines to 3d polyines - with a twist

I need to be able to convert "polylines" (as opposed to "2d polylines") to 3d polylines. Here is the issue: the polylines that I want to convert have object data attached to them and they are at the proper Z elevation. When I use the "Convert 2d to 3d polyline" function, the conversion does take place, but all of my object data is removed from the object. And since one of my attributes reflects the overall elevation of the object (which all of the verticies will be the same elevation - even though it will be a 3d polyline), there are too many objects to individually update the attribute information when I am pressed for time.
I am working in Civil 3d 2010. Any way to do this using Civil 3d? (AutoMap is included in the program) Any .lisp routines out there that can help out?
Thank you for your time.

8 REPLIES 8
Message 2 of 9
_Tharwat
in reply to: tcapmusic

How attributes are attached to a polyline ? are they xdata or what ?

Message 3 of 9
tcapmusic
in reply to: _Tharwat

Thanks for your reply. Each line has 7 items from the object data table that is attached to it. I have not heard the term "xdata", so forgive me for asking what that means. The reason for having 3d polylines is that the program that I am uploading to requires all lines to be 3d polylines - with object data attched to each line. I had to use the MAPEXPORT and MAPIMPORT to populate the object data, but the import brings them back as polylines. I hope that helps a little...sorry that I don't have a more direct answer you your question.

Message 4 of 9
jdvillarreal
in reply to: tcapmusic

You can thank Joe Burke for his ConvTo3d routine. Had i used "Convertplines", the command line would be flooded.

I only modified Joe's routine to be used as a function and removed some unecessary code for your purpose.

Besides that, I just added a small routine at the end to extract the table/fields using some old code I wrote a couple years ago.

Sorting through the object data using lisp takes a lot of time but is much less time consuming then your current process i'm sure..If you wanted to speed the routine up a little more (probably not by much), the help docs state that utilizing ade_odgetrecord is generally faster than any other means of extracting the field data.

In addition, to help ease the pain of waiting, I added a grtext call to display how many entities have been converted on the status line.

 

Just Enter C3D at the command line and go get a cup of coffee or something. lol.

 

Note: This routine will only function in AutoCAD map products.

Message 5 of 9
jdvillarreal
in reply to: jdvillarreal

Even though your polylines are already elevated, I thought i'd share this routine. It's similar enough to post in the same thread.

 

After importing your contours into map, this routine will elevate and separate the major and minor contours according to a user selected field through a dialog. I don't know your current process but this one has saved me a lot of time. This code was put together a  couple years ago when i was starting to learn lisp so it can definitely be improved.

 

Note: This routine will only function in AutoCAD map products as well.

Message 6 of 9
tcapmusic
in reply to: jdvillarreal

Thanks again for the Lisp routine. It took a while due to the size of the drawing file, but it did accomplish what I needed to do.

Message 7 of 9
jdvillarreal
in reply to: tcapmusic

Thanks to Vovka @ theswamp.org for pointing me to Autodesks sample file function (Copy_Data).

Here's the final routine.

Message 8 of 9
tcapmusic
in reply to: jdvillarreal

Thanks again for all of your research and help. It is well appreciated.

 

Gaster Firrie,

Indianapolis, Indiana

Message 9 of 9
jdvillarreal
in reply to: tcapmusic

You're welcome.

I can't edit my previous post anymore, but you can erase this line of code from the routine:

(if fieldnames (setq fieldnames (reverse fieldnames)))

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

Post to forums  

Autodesk Design & Make Report

”Boost