Here is a list in the form of:
((First Item . Second Item) (First Item . Second Item) .....)
First Item:
A number in the drawing as text in layer "Numbers". I have the numbers drawn as 1,2,3..... in the dwg.
Second Item:
A number to be placed in the drawing as a text in layer "depths" (near the first text item 1,2...3)
nrlst
((1 . 530.225) (2 . 530.742) (3 . 530.984) (4 . 531.277) (5 . 531.552) (6 . 531.819) (7 . 531.978) (8 . 532.093) (9 . 532.038) (10 . 531.84) (11 . 531.468) (12 . 531.246) (13 . 530.753) (14 . 530.157) (15 . 529.743) (16 . 529.27))
I am iterating through each text object in the drawing & comparing with items of list. If its string equals to first item in the list, then program should extract second item in list & place it as a text in the drawing near current text.
(defun c:test()
(setq sset (ssget '((0 . "TEXT")(8 . "Numbers"))))
(setq len (sslength sset))
(setq cnt 0)
(while (< cnt len)
(setq obj (ssname sset cnt))
(setq data (entget obj))
(setq pt (assoc 11 data))
(setq str (cdr (assoc 1 data)))
(foreach item nrlst
(if (equal str (itoa (car item)))
(progn
(setq elst (list
(cons 0 "TEXT")
(cons 100 "AcDbEntity")
(cons 67 0)
(cons 8 "Junk")
(cons 100 "AcDbText")
(cons 40 1.25)
(cons 1 "junk")
(cons 50 4.03974)
(cons 41 0.4)
(cons 51 0.0)
(cons 7 "Depths")
(cons 71 0)
(cons 72 1)
pt
(list 210 0.0 0.0 1.0)
(cons 100 "AcDbText")
(cons 73 3)
))
(entmake elst)
)
)
)
(setq cnt (1+ cnt))
)
(princ)
)
I have given test string as "junk" for testing purpose.
(cons 1 "junk")
In the place of "junk", second item of list to be replaced.
But I am not getting the any entity drawn in the drawing, though the strings are matching.
Can somebody tell me what is wrong?
Pradeep Hebbar