Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello. Im trying to copy the contents of text entities into certain row(s) of blocks, and i got it to work, but i'm trying to modify it to be useable with all of our blocks. The code below works, but not in the most optimal way. After selecting the block i have to select it again, and that is the step i'm trying to skip. I'm sure there is a way to work with a block and its name at the same time. I attached a block for testing. Side note: I have no idea what i'm doing đ
Any help is appreciated! Thank you!
(defun c:DBATT (/ st st2 e e2 ss blkname) (setq blkname (cdr (assoc 2 (entget (car (entsel "\Select a block: ")))))) (cond ((= blkname "N1") (while (if (and (setq st (car (entsel "\nVĂĄlaszd ki az azonosĂtĂłt :"))) (eq (cdr (assoc 0 (setq e (entget st)))) "TEXT") (princ "\nVĂĄlasz ki egy akna blokkot :") (setq ss (ssget "_:S" '((0 . "INSERT") (66 . 1)))) ) ((lambda (i / sn) (while (setq sn (ssname ss (setq i (1+ i)))) (mapcar '(lambda (x) (if (eq (strcase (vla-get-tagstring x)) "LOCATION") (vla-put-textstring x (cdr (assoc 1 e))))) (vlax-invoke (vlax-ename->vla-object sn) 'getattributes)) )) -1) ) ) ) ; end cond 1 ((= blkname "N2") (while (if (and (setq st (car (entsel "\nVĂĄlaszd ki az azonosĂtĂłt :"))) (eq (cdr (assoc 0 (setq e (entget st)))) "TEXT") (princ "\nVĂĄlasz ki egy akna blokkot :") (setq ss (ssget "_:S" '((0 . "INSERT") (66 . 1)))) ) ((lambda (i / sn) (while (setq sn (ssname ss (setq i (1+ i)))) (mapcar '(lambda (x) (if (eq (strcase (vla-get-tagstring x)) "LOCATION") (vla-put-textstring x (cdr (assoc 1 e))))) (vlax-invoke (vlax-ename->vla-object sn) 'getattributes)) )) -1) ) ) ) ; end cond 2 ) ; end cond stmt )(vl-load-com)
Solved! Go to Solution.