djurk_haas 发表于 2022-7-5 15:43:51

Coordinates and line ID (hyper

Hello,
I have a found a lisp routine (dotsoft) wich exports coordinates off all selected polylines to an txt or csv file. See code below. But in the generated list you can not see wich coordinates belong to wich line it just becomes one long list of all coordinates.
I give my polylines an "ID" by filling in the hyperlink field at the properties.
Is it possible to upgrade the lisp and add the hyperlink information?
Output now in cvs:
      85790.80773261,-1617.56967007,0.00000000       87907.16139717,-1476.60439300,0.00000000       86419.30065153,-823.03783397,0.00000000       87612.15468495,-2027.65058909,0.00000000       89728.50834951,-1886.68531202,0.00000000       88240.64760388,-1233.11875299,0.00000000    Wanted output in cvs:
      Line_01
85790.80773261,-1617.56967007,0.00000000
       87907.16139717,-1476.60439300,0.00000000       86419.30065153,-823.03783397,0.00000000
Line_02
       87612.15468495,-2027.65058909,0.00000000       89728.50834951,-1886.68531202,0.00000000       88240.64760388,-1233.11875299,0.00000000
The name af the line (Line_01) I have stored in the hyperlink field at the properties of the line.
LISP CODE:
----------------------------------------------------------------------

;             (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 . "")))) (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","                              (rtos (cadr pnt) 2","                              (rtos (caddr pnt) 2 ) 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","                                    (rtos (cadr pnt) 2","                                    (rtos elv 2 ) 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
页: [1]
查看完整版本: Coordinates and line ID (hyper