Circles from list file

Circles from list file

Philip-John
Advocate Advocate
843 Views
3 Replies
Message 1 of 4

Circles from list file

Philip-John
Advocate
Advocate

I found a lisp by Lee Mac to draw circles from a list file (visit link below).

visit link

Can anybody modify the same to insert serial number also inside the drawn circle.

 

0 Likes
Accepted solutions (1)
844 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant

Not really sure why you won't ask there, but since you didn't post some example of a source txt file and a dwg of desired output.

0 Likes
Message 3 of 4

dbhunia
Advisor
Advisor
Accepted solution

Try with this......(It will insert number with default text style)

 

(defun c:circlesfromfile ( / i file line )
    (if
        (and
            (setq file (getfiled "Select Data File" "" "txt" 16))
            (setq file (open file "r"))
        )
        (progn
            (setq i 0)
            (while (setq line (read-line file))
                (if
                    (and
                        (setq line (LM:str->lst line " "))
                        (= 3 (length line))
                        (setq line (mapcar 'distof line))
                        (vl-every 'numberp line)
                        (setq i (1+ i))
                    )
                    (entmakex
                        (list
                            (cons 0 "CIRCLE")
                            (list 10 (car line) (cadr line) 0.0)
                            (cons 40 (/ (caddr line) 2.0))
                        )
                    )
		)
		(command "text" "J" "MC" "_none" (list (car line) (cadr line) 0.0) "" "" i);It also can be done with entmake
            )
            (setq file (close file))
            (princ (strcat "\n" (itoa i) " Circle(s) Created."))
        )
    )
    (princ)
)
;;-------------------=={ String to List }==-------------------;; ;; ;; ;; Separates a string into a list of strings using a ;; ;; specified delimiter string ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2010 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; str - string to process ;; ;; del - delimiter by which to separate the string ;; ;;------------------------------------------------------------;; ;; Returns: A list of strings ;; ;;------------------------------------------------------------;; (defun LM:str->lst ( str del / pos ) (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (LM:str->lst (substr str (+ pos 1 (strlen del))) del)) (list str) ) )

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 4 of 4

Philip-John
Advocate
Advocate

Thanks dbhunia..

That is what I requested..

0 Likes