@Anonymous wrote:
Thanks for the help! It works. But (1)final symbol is get scaled to 0.0394 So again I have to change it's scale to 1. Please refer attached file. Final symbol scale is 0.0394 on this drawing. (2)It doesn't take duplicate number. It keeps only one number if any duplication is there. (3)Is it possible that if my numbers are on another file & I want final symbol on onother file.
Please help.
Hi @Anonymous, I did not understand the part Final symbol scale is 0.0394, explain a bit more. The below code should take care of 2 and 3.
(defun c:somefunc ( / ans curosmode lst pt1 str)
(initget "Yes No")
(setq ans (getkword "\nWill the blocks be inserted in this drawing [Yes / No]: "))
(cond ((wcmatch (strcase "Yes") (strcase (strcat ans "*")))
(setq curosmode (getvar 'osmode))
(getlst)
(setq pt1 (getpoint "\nSelect Insertion Point :"))
(setvar 'osmode 16385)
(mapcar '(lambda (x) (somefuncent x)) (mapcar '(lambda (x) (nth x lst)) (vl-sort-i lst '<)))
(setvar 'osmode curosmode))
(t
(getlst)
(vl-bb-set 'ar.dlist (mapcar '(lambda (x) (nth x lst)) (vl-sort-i lst '<)))
(princ "\nCall \"somefunc2\" in detination file")))
(princ))
(defun c:somefunc2 (/ curosmode pt1)
(setq curosmode (getvar 'osmode))
(setq pt1 (getpoint "\nSelect Insertion Point :"))
(setvar 'osmode 16385)
(mapcar '(lambda (x) (somefuncent x)) (vl-bb-ref 'ar.dlist))
(setvar 'osmode curosmode))
(defun getlst ()
(mapcar '(lambda (x)
(setq str (cdr (assoc 1 (entget x)))
lst (cons (atoi (substr str (+ 2 (vl-string-position (ascii "-") str)))) lst)))
(vl-remove-if-not '(lambda (x) (= (type x) 'ename))
(mapcar 'cadr (ssnamex (ssget '((0 . "TEXT") (1 . "*-*"))))))))
(defun somefuncent (x)
(command-s "._-insert" "60-398-4" pt1 1 1 180)
(entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") (cons 10 pt1) '(40 . 0.135448) (cons 1 (itoa x)) '(50 . 1.5708) (cons 7 "Standard")))
(command-s "._move" (entlast) "" "0,0,0" "-0.03,0.887,0")
(setq pt1 (mapcar '+ pt1 '(0.197 0 0))))