After much searching I found something on another site that is close to what I need. But the insertion point, which works perfectly with the original lisp (txttoblk1), does not come in exactly in the txttoblk2 lisp:
Code:
(defun c:txttoblk2( / ss e)
(vl-load-com)
(setq blk "TREE") ; Put block name here, with directory if block is not already in drawing
(setq ss (ssget "X" '((0 . "TEXT")(1 . "N"))))
(if ss
(progn
(setq ss (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
(mapcar '(lambda (x)
(setq e (entget x))
(entmake
(append
(list (cons 0 "INSERT") (cons 100 "AcDbEntity") (cons 100 "AcDbBlockReference")
(cons 410 (cdr (assoc 410 e)))
(cons 8 (cdr (assoc 8 e)))
(cons 2 blk)
(cons 10 (cdr (assoc 10 e)))
(cons 41 (* (/ 0.0912 3) (cdr (assoc 40 e))))
(cons 42 (* (/ 0.0912 3) (cdr (assoc 40 e))))
(cons 50 (cdr (assoc 50 e))))
)
)
(entdel x)) ss)
)
(princ "\nNo text entities found.")
)
(princ)
)
So I tried to combine the first lisp, that the insertion point worked in, with the second lisp, that worked with placing the block at a specific size relating to the text size. But somewhere I messed up combing the two and cannot get it to work. Can anyone see where this problem lies?
My combined file (#3):
Code:
(defun c:txttoblk3( / ss)
(vl-load-com)
(setq blk "TREE") ; Put block name here, with directory if block is not already in drawing
(setq ss (ssget "X" '((0 . "TEXT")(1 . "N"))))
(if ss
(progn
(setq ss (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
(mapcar '(lambda (x) (vl-cmdf "-insert" blk (cdr (assoc 10 (entget x))) 1 1 (* (/ 180 pi) (cdr (assoc 50 (entget x)))))
(entmake
(append
(list (cons 0 "INSERT") (cons 100 "AcDbEntity") (cons 100 "AcDbBlockReference")
(cons 410 (cdr (assoc 410 e)))
(cons 8 (cdr (assoc 8 e)))
(cons 2 blk)
(cons 10 (cdr (assoc 10 e)))
(cons 41 (* (/ 0.0912 3) (cdr (assoc 40 e))))
(cons 42 (* (/ 0.0912 3) (cdr (assoc 40 e))))
(cons 50 (cdr (assoc 50 e))))
)
)
(entdel x)) ss)
)
(princ "\nNo text entities found.")
)
(princ)
)
Including drawing that I have been testing with.
Thanks,
-Bob