Liviu Petreus Posted January 4, 2023 Posted January 4, 2023 Hi all, Can someone help me with a programming solution for the loop below? I am trying to change the values "L1", "L2" and "L3" in a repeatable loop as seen in the image. Below I put a part of the program that refers to my problem, but, as you can see, it doesn't work. Thanks for the help. (defun loop () (setq iTXT 1) (while (< iTXT 4) (setq aTXT (strcat iTXT)) (setq iTXT (+ iTXT 1)) (princ) (setq bTXT (itoa aTXT)) (setq lTXT (strcat "L" bTXT ",N,PE")) ) (entmake (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 np7) (cons 40 75) (cons 41 0.0) (cons 71 5) (cons 50 0.0) (cons 1 lTXT) (cons 7 "Standard") (cons 8 "E__TAB") ) ) Quote
mhupp Posted January 4, 2023 Posted January 4, 2023 This will allow you to pick multiple text at once. so pick all the ones you want to start with L1, then L2 and so on. (defun c:FOO () (vl-load-com) (setq i 1) (while (< i 4) (prompt (strcat "\nPick L" (rtos i 2 0))) (if (setq ss (ssget '((0 . "TEXT")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (vla-put-textstring (vlax-ename->vla-object ent) (strcat "L" (rtos i 2 0) ",N,PE")) ) ) (setq i (1+ i)) ) (princ) ) Quote
Liviu Petreus Posted January 4, 2023 Author Posted January 4, 2023 Thanks for the promptness. Can the program code be made so that I can select all the texts "Lx,N,PE" and change them automatically using a multiple of 3 (L1, L2 and L3) and select the text that starts with L1? Many thanks. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.