Jump to content

Coordinates and line ID (hyperlink)


djurk_haas

Recommended Posts

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: [url]http://www.dotsoft.com[/url]
; ----------------------------------------------------------------------
; 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  ","
                              (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)
)[/size][/font]
[font=Calibri][size=3](princ "\nPoint Export loaded, type PTEXPORT to run.")
(princ)

Thanks a lot

Edited by fuccaro
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...