Jump to content

NO MATTER WHAT I DO, i can't import my coordinates with my numbers and labels on them.....lisp, excel, txt. PLEASE HELP. lol


james jr

Recommended Posts

I have done cad for surveying for a long time...using R14 TO todays......ive always only had 5000 5000 coord, or angles distances.   now i have to have the coordinates with the labels and numbers on them.  i have looked at the youtubes for excel.....txt.......lisp, i have never used a lisp, and have no clue what it is...i did download lee mac's lisp and uploaded it, but don't even know what that means.

lol

 

Link to comment
Share on other sites

LISP is a programming language.  Lisp routines help automate a series of commands making life easier for the CAD technician.  Which Lee Mac lisp routine did you download?

Link to comment
Share on other sites

This was supplied last night via PM. Tested on data supplied.

 

(defun c:james ( / csv lst fname pt) ; rename to something else 
; lisp program by lee-mac 
; it looks for the comma its character 44 in the ascci key codes space is 32 A is 65

(defun csv->lst ( str / pos ) 
(if (setq pos (vl-string-position 44 str)) ; 44 is comma returns the postion of "," like 9.
    (cons (substr str 1 pos) (csv->lst (substr str (+ pos 2)))) ; cons build a LIST of the variables at every ","
    (list str)
    )
)


(setq csv (getfiled "Select CSV File" "" "csv" 16)) ; as name implies get a file 
(setq lst '()) ; create a blank sleection set to add more to
(setq fname (open csv "R"))  ; open the file to read its contents
(while (setq newline (read-line fname)) ; while you can read a line form the the file it stops when no more lines
(setq lst (cons (csv->lst newline) lst)) ; make a list of each line read in pt X Y Z description
)
(setvar "textstyle" "Standard") ; set text to Standard
(setq lst (reverse lst)) ; reverse the list as it has 1st entry as last line
(setvar 'pdmode 34) ; sets the "POINT" style 
(setvar 'pdsize 2) ; sets the point style
(foreach pt lst ; a loop to go through each line pulls each line out
(command "point" (list (atof (nth 1 pt))(atof (nth 2 pt))(atof (nth 3 pt)))) ; the nth looks at each item in the line starts at item 0 not 1
(command "TEXT" (list (atof (nth 1 pt))(atof (nth 2 pt))) 2.5 0.0 (nth 4 pt)) ; draw text
; could do add pt number here
)

(princ)
)
(c:james) ; run the program remove if want to run manually load program then type james 
 

image.png.77249b8f78fe3f2486b06e48b152331f.png

 

Edited by BIGAL
Link to comment
Share on other sites

If your coordinate information is in Excel, you can export (Save As) that data to a CSV file. The LISP function Big Al gave you should let you import the CSV data as points and text.

 

For more help, give us more information about what you're trying to do.

 

Welcome to the forum.

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