PDA

View Full Version : 3d polyline to polyline



daiharv
20th Jan 2006, 11:40 am
Is there a way of converting 3d polylines to polylines with an elevation?

I have a dwg of contour information, the contours are 3d polylines, because they are contours the z value is constant all along the line, so there no question what the elevation of the polyline would need to be.

I need to do this as I then need to import the dwg into a GIS programme called MapInfo whch doesn't read 3d polylines.

I have access to AutoCAD 2004 or 2005LT.

Any ideas?

rkmcswain
20th Jan 2006, 02:04 pm
Is there a way of converting 3d polylines to polylines with an elevation?

I have a dwg of contour information, the contours are 3d polylines, because they are contours the z value is constant all along the line, so there no question what the elevation of the polyline would need to be.


Interesting. What kind of program creates 3Dpolylines for contours?

Oh well, Toolpac from http://www.dotsoft.com includes this tool among its 650+ tools.

If it's worth your billable time to find a freebie - start here : http://management.cadalyst.com/cadman/article/articleDetail.jsp?id=101136

CarlB
20th Jan 2006, 07:10 pm
Another site is http://www.4d-technologies.com/polyline_specialist/
It has a 30 day free evaluation.

You might be able to find a freeware program for this, such as at http://members.bellatlantic.net/~vze2vjds/free.htm

Joro--
23rd Jan 2006, 11:39 am
Actually I think you might develop a lisp or VBA application to take the coordinates of vertices of all the 3D polylines in the drawing, make new 2D polylines usind "x" and "y" coordinates only, then move to the deasired height and delete the old 3D polyline....

rkmcswain
23rd Jan 2006, 02:05 pm
Actually I think you might develop a lisp or VBA application to take the coordinates of vertices of all the 3D polylines in the drawing, make new 2D polylines usind "x" and "y" coordinates only, then move to the deasired height and delete the old 3D polyline....

That's fine if you know lisp and you get paid to churn out lisp code. Most production drafters/designers fit neither category.

Joro--
24th Jan 2006, 02:31 pm
May be I could write a VBA routine for you to substitute 3D polylines with 2d ones and each polyline elevation will be equal to the Z-coordinate of the first point of the old 3D polyline. If that is what you need drop a line... and send me your e-mail address

CarlB
24th Jan 2006, 05:45 pm
Joro-
No need to write it, Tony T. wrote one years ago, it's free at the link I posted above.

OK, here's the direct link - http://members.bellatlantic.net/~vze2vjds/free.htm

Well that code is kinda scrambled. below is partly formatted code that I got to work:


;; CVPOLY.LSP Copyright 1996, 1997 Tony Tanzillo all rights reserved
;; ;; Converts 3D polylines to 2D polylines that lie on
;; the XY plane of the current UCS.
&#40;setq filter&#58;3dpoly '&#40; &#40;-4 . "<AND"&#41; &#40;0 . "POLYLINE"&#41; &#40;-4 . "&="&#41; &#40;70 . 8&#41; &#40;-4 . "AND>"&#41; &#41; &#41;
&#40;defun get &#40;key alist&#41; &#40;cdr &#40;assoc key alist&#41;&#41; &#41;
&#40;defun UCSZdir &#40;&#41;
&#40;trans '&#40;0 0 1&#41; 0 1&#41;
&#41;
&#40;defun UCSPoint2D &#40;wcspoint&#41;
&#40; &#40;lambda &#40;p&#41; &#40;list &#40;car p&#41; &#40;cadr p&#41; 0.0&#41; &#41; &#40;trans wcspoint 0 1&#41; &#41;
&#41;
&#40;defun mapvertex &#40;e function / e d rslt&#41;
&#40;while &#40;/= "SEQEND" &#40;get 0 &#40;setq d &#40;entget &#40;setq e &#40;entnext e&#41;&#41; '&#40;"*"&#41;&#41;&#41;&#41;
&#41;
&#40;setq rslt &#40;cons &#40; &#40;lambda &#40;function data / e d rslt&#41; &#40;apply function &#40;list data&#41;&#41; &#41; function d &#41; rslt &#41; &#41; &#41; &#40;reverse rslt&#41; &#41;
&#40;defun cvpoly &#40;pline / data ucs&#41;
&#40;setq data &#40;entget pline '&#40;"*"&#41;&#41;&#41; &#40;entmake &#40;subst &#40;cons 70 &#40;logand &#40;get 70 data&#41; &#40;~ 8&#41;&#41;&#41;
&#40;assoc 70 data&#41; &#40;subst &#40;cons 210 &#40;setq ucs &#40;ucszdir&#41;&#41;&#41; &#40;assoc 210 data&#41; &#40;subst '&#40;100 . "AcDb2dPolyline"&#41; '&#40;100 . "AcDb3dPolyline"&#41; data &#41; &#41; &#41;
&#41;
&#40;mapvertex pline '&#40;lambda &#40;data&#41; &#40;if &#40;zerop &#40;logand &#40;get 70 data&#41; 9&#41;&#41;
&#40;entmake &#40;list '&#40;0 . "VERTEX"&#41; '&#40;100 . "AcDbEntity"&#41; &#40;assoc 8 data&#41; '&#40;100 . "AcDbVertex"&#41; '&#40;100 . "AcDb2dVertex"&#41;
&#40;cons 10 &#40;UCSPoint2d &#40;get 10 data&#41;&#41;&#41; &#40;cons 70 &#40;logand &#40;get 70 data&#41; &#40;~ 32&#41;&#41;&#41; &#41; &#41; &#41; &#41;&#41;
&#40;entmake '&#40;&#40;0 . "SEQEND"&#41;&#41;&#41; &#40;entdel pline&#41;
&#41;
&#40;defun C&#58;CVPOLY &#40; / ss i&#41;
&#40;cond
&#40; &#40;not &#40;setq ss &#40;ssget filter&#58;3dpoly&#41;&#41;&#41; &#40;princ "\nNo 3D Polylines selected."&#41;&#41;
&#40;t &#40;setvar "CMDECHO" 0&#41; &#40;command "._UNDO" "_Begin"&#41; &#40;repeat &#40;setq i &#40;sslength ss&#41;&#41; &#40;cvpoly &#40;ssname ss &#40;setq i &#40;1- i&#41;&#41;&#41;&#41; &#41; &#40;command "._UNDO" "_En"&#41; &#41; &#41; &#40;princ&#41;
&#41;
&#40;princ "\nCVPOLY.LSP Copyright 1997 Tony Tanzillo"&#41; &#40;princ "\nCVPOLY command loaded."&#41;
&#40;princ&#41;
;; END CVPOLY.LSP

daiharv
2nd Feb 2006, 05:23 pm
Thanks guys, this works a treat :)

daiharv
9th Feb 2006, 12:43 pm
damn, doesn't quite work a treat.

The LSP does convert all the 3D polylines to 2D polylines but the elevation is zero on all the resultant polylines.

Does anyone know if this LSP could be amneded to retain the height data?

Or is there another LSP out there that dioes this already.

many thanks.

rkmcswain
9th Feb 2006, 02:12 pm
damn, doesn't quite work a treat.

Or is there another LSP out there that dioes this already.

many thanks.

Yes, see my first reply in this thread.

daiharv
9th Feb 2006, 02:47 pm
Have checked the freebies @ dotsoft and LSP routines at CADalyst, but I can't find anything for my needs there.

Follwed your link to the CADalyst site which gives an explanation of how the LSP works, but this LSP gives the 2D polylines no height data, I need it to remember the height data ("a 2D polyline with an elevation").

I don't understand LSP routines enough to amend it myself.

Although in the link you sent it says

"George Anderson of Eugene, Oregon, e-mailed a request to turn 3D polylines into 2D polylines. Several routines he downloaded from the Internet claimed to perform this function, but all failed to set the z coordinate to zero."

I could do with one of these routines I think.


Many thanks.

rkmcswain
9th Feb 2006, 02:59 pm
Have checked the freebies @ dotsoft

Many thanks.

I'm not talking about the freebies at www.dotsoft.com, I'm talking about Toolpac. http://www.dotsoft.com/toolpac.htm

If you spend 2 hours looking for a freebie, you could have already purchased Toolpac. Time is money.

daiharv
9th Feb 2006, 04:09 pm
Fair enough, but if there is anyone out there with a freebie version I'd be glad to hear from you.

MARKOSDIMARKOS
11th Dec 2008, 09:28 am
U Can Use Land Desktop And Go To Terrain ----->contour Utilities ----->convert Polyline And Tara U Got It.

jolopuki
6th Jun 2011, 12:33 pm
explode 3d polyline, and use PEDIT command to join multiple lines. the result is a polyline, wualla! :)

obr1en
15th Jun 2011, 07:57 am
I use a little program quite regulary called Cad Tools. It has quite a few handy items including some convert tools such as 3D Polyline >> Polyline. Also others like Circle >> 3D Polyline.

Heres the link if anybody does'nt already know about it.

http://www.glamsen.se/CadTools.htm

Hope its helpful to someone. Cheers