Threw this together, did not test, but should get you started.
Read the help file on the (polar pt ang dir) function
Code:
(defun c:flst (/ angb angd cecho clay datalist file filename orgos startpt x)
;; save enviornment
(setq clay (getvar "clayer")
angd (getvar "angdir")
angb (getvar "angbase")
orgos (getvar "osmode")
cecho (getvar "cmdecho")
)
;; set enviornment
(setvar "cmdecho" 0)
(command "units" "2" "256" "8" "2" "0" "0" "N")
(setvar "angdir" 0)
(setvar "angbase" 0)
(setq filename "c:\\columns.txt")
;; must have items before the circles can be created
(if (and (setq startpt (getpoint "\n Pick the start point... "))
(setq filename (findfile filename))
(setq file (open filename "r"))
(setq datalist (read_file file))
(setq datalist (mapcar '(lambda (x) (sparser x ",")) datalist))
)
;; datalist at this point is
;; (("C1" "8" "STEEL")("C2" "10" "STEEL") (.....))
(foreach itm datalist
;; not nil, is a list, & length of 3 or more
(if (and itm (listp itm) (> (length itm) 2))
(progn ; ready to go
;; more error testing could be needed for each item
;; add circle, override osmode
(command "circle" "non" startpt (atof (cadr itm)) "")
;; add text, you should test for text height when using command
;; as the order of entry changes if not zero height
(command "text" "non" startpt "1" "0" (caddr itm) "")
;; reset the start point, look up the polar function
(setq startpt (polar startpt 0.0 (* (atof (cadr itm)) 2.0)))
)
)
)
)
;; restore enviornment
(setvar "clayer" clay)
(setvar "angdir" angd)
(setvar "osmode" orgos)
(setvar "angbase" angb)
(setvar "cmdecho" cecho)
(command "units" "2" "256" "8" "2" "0" "0" "N")
(command "graphscr")
(princ) ; exit quietly
) ; end of file
;; text file structure
;|
Not sure what you are trying to do here ???????????????
?? , diameter, text
C1,8,STEEL
C2,10,STEEL
C3,11,CONC
C4,12,CONC
C5,13,CONC
C6,14,CONC
|;
;; phraser by CAB
(defun sparser (str delim / ptr lst)
(while (setq ptr (vl-string-search delim str))
(setq lst (cons (substr str 1 ptr) lst))
(setq str (substr str (+ ptr 2)))
)
(reverse (cons str lst))
)
;; read file, return list for each line in file
(defun read_file (fn / stream result)
(while (setq stream (read-line fn))
(setq result (cons stream result))
)
(close fn)
(reverse result)
)