Jump to content

LSP file application for EASTING,NORTHING with HEIGHT Coordinate?


Recommended Posts

Posted

Is any body has LSP file application for EASTING,NORTHING with HEIGHT Coordinate?

 

Needed it right away...my boss tell me on this...I dont have any solutions.......

Posted

You do not say what you want the Lisp to do.

 

But assuming that you want to input from a coordinate listing into AutoCAD, I can warmly recommend a visit to Lee Mac's web site

Posted (edited)

I have one with point numbers

Show me the first 2 lines of your points / data file

 

This lisp is just for tab delimited file with data in every line

like this: NUMBER X Y Z

etc

 
(defun C:PPT (/ file file-to-list p points split-string txt)
  ;; local defuns
   (defun file-to-list (filename / file result line)
 (if (findfile filename)
   (progn (setq file (open filename "r"))
   (while (setq line (read-line file))
     (setq result (cons line result))
   )
   (close file)
   (reverse result)
   )
   (alert (strcat "File " filename " not found!"))
 )
)
(defun split-string (str delim / pos)
 ;; Splits a string into a list of strings at every
 ;; occurrence of the delimiter (single-letter string).
 (setq pos (vl-string-position (ascii delim) str))
 (if (null pos)
   (list str)
   (cons (substr str 1 pos)
  (split-string (substr str (+ pos 2)) delim)
   )
 )
)

   ;; main part 
   (setq file (getfiled "Select points file:" "" "CSV;TXT" 4))
   ;; text file is tab delimited, values are in order of: Number[TAB]X[TAB]Y[TAB]Z

  ;;(setq file (findfile "C:\\Test\\FORUM.csv"))
 (setq points (file-to-list file))
 (setq points (mapcar '(lambda (p)(mapcar 'atof (split-string p (chr 9))))points))
 (foreach pt points
   (setq txt (rtos (car pt)2 0)
   pt (cdr pt))
 (entmake (list '(0 . "POINT")
  '(8 . "0")  ; <-- layer 
  (cons 10 pt)
  '(50 . 0.0)
  '(210 0.0 0.0 1.0)
   ) ;_ end of list
 ) ;_ end of entmake
   (entmake
     (list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(8 . "0")  ; <-- layer 
'(100 . "AcDbText")
(cons 10 pt)
(cons 11
      (list (car pt)
     (+ (cadr pt) (/ (getvar "dimtxt") 2))
     (caddr pt)
      ) ;_ end of list
) ;_ end of cons
(cons 40 (getvar "dimtxt"))
(cons 1 txt)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "Standard")  ; <-- text style 
'(71 . 0)
'(72 . 0)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 2)
     ) ;_ end of list
   ) ;_ end of entmake
)
(princ)
   )

Edited by fixo

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...