- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I wonder if it's possible to modify the lisp routine which is from this forum: "Exporting multiple polylines coordinates, with text break".
This lisp with the solution with the text break is almost perfect for me but I am wondering if it's possible to get in the output the "ID" of the polylines?
I have given the polylines an "ID" by filling in the hyperlink field at the properties. Is it possible to adjust this lisp or the one that's below* so that you can see which coordinates belong to which polyline?
*I have found another lisp routine (see below) which exports coordinates of polylines to a csv file (works great) but it also exports one long list of coordinates when you select more than one polyline.
For example this is the current output in the csv:
85790.80773261,-617.56967007,0.00000000 |
7907.16139717,-1476.60439300,0.00000000 |
86419.30065153,-823.03783397,0.00000000 |
87612.15468495,-027.65058909,0.00000000 |
89728.50834951,-886.68531202,0.00000000 |
88240.64760388,-233.11875299,0.00000000 |
And this is the wanted output in the csv:
HL-01 85790.80773261,-617.56967007,0.00000000 |
7907.16139717,-1476.60439300,0.00000000 |
86419.30065153,-823.03783397,0.00000000 |
HL-02 87612.15468495,-027.65058909,0.00000000 |
89728.50834951,-886.68531202,0.00000000 |
88240.64760388,-233.11875299,0.00000000 |
Lisp routine from dotsoft:
----------------------------------------------------------------------
; (Export LWPOLYLINE Vertices & Points to File)
; Copyright (C) 2000 DotSoft, All Rights Reserved
; Website: http://www.dotsoft.com
; ----------------------------------------------------------------------
; DISCLAIMER: DotSoft Disclaims any and all liability for any damages
; arising out of the use or operation, or inability to use the software.
; FURTHERMORE, User agrees to hold DotSoft harmless from such claims.
; DotSoft makes no warranty, either expressed or implied, as to the
; fitness of this product for a particular purpose. All materials are
; to be considered ‘as-is’, and use of this software should be
; considered as AT YOUR OWN RISK.
; ----------------------------------------------------------------------
;;Revised 8/23/07 CAB to report coordinates in current UCS
(defun c:ptexport ()
(setq sset (ssget '((-4 . "<OR")(0 . "POINT")
(0 . "LWPOLYLINE")(-4 . "OR>"))))
(if sset
(progn
(setq itm 0 num (sslength sset))
(setq fn (getfiled "Point Export File" "" "csv" 1))
(if (/= fn nil)
(progn
(setq fh (open fn "w"))
(while (< itm num)
(setq hnd (ssname sset itm))
(setq ent (entget hnd))
(setq obj (cdr (assoc 0 ent)))
(cond
((= obj "POINT")
(setq pnt (cdr (assoc 10 ent)))
(setq pnt (trans pnt 0 1));;**CAB
(princ (strcat (rtos (car pnt) 2 8) ","
(rtos (cadr pnt) 2 8) ","
(rtos (caddr pnt) 2 8)) fh)
(princ "\n" fh)
)
((= obj "LWPOLYLINE")
(if (= (cdr (assoc 38 ent)) nil)
(setq elv 0.0)
(setq elv (cdr (assoc 38 ent)))
)
(foreach rec ent
(if (= (car rec) 10)
(progn
(setq pnt (cdr rec))
(setq pnt (trans pnt 0 1));;**CAB
(princ (strcat (rtos (car pnt) 2 8) ","
(rtos (cadr pnt) 2 8) ","
(rtos elv 2 8)) fh)
(princ "\n" fh)
)
)
)
)
(t nil)
)
(setq itm (1+ itm))
)
(close fh)
)
)
)
)
(princ)
)
(princ "\nPoint Export loaded, type PTEXPORT to run.")
(princ)
THANKS A LOT FOR YOUR HELP
Solved! Go to Solution.