It looks like you're new here. If you want to get involved, click one of these buttons!
I'm trying to write a LISP that will gather attributes from multiple blocks and construct a specific format Mtext field for inclusion in a Mleader. I don't know how to go about including multiple instances of the selection set and retain the correct formatting for the Mleader command without writing multiple instances of TX for 1,2,3,4,5 etc pipes. How do I go about repeating the RPT section of the code to compile a text body of nTX's?
varopen/close just set the system variables and return them to drafting defaults and GA goes and gets the attributes and insertion point of the blocks. I get how this code is just rewriting the TX for RPT number of times instead of compiling a full list, but I don't know whether to princ out to a 'temp file' and read the text back in or if you can change the current LISP to accommodate mutiple instances of attribute text.
(defun c:MULTITAG ( / )
(setq DEPTH () CODE () ELEVATION () SIZE () MATERIAL () NOTE () FLOW () )
(setq RPT (getint "\nEnter Number of Pipes : ")) (repeat RPT (setq Blname (car(entsel "\nSelect Survey Points for attributes:"))) (GA Blname) (setq coord (cdr(assoc 10 (entget blname)))) (setq A (rtos (nth 0 coord) 2 3)) (setq B (rtos (nth 1 coord) 2 3)) (setq C (rtos (nth 2 coord) 2 3)) (setq Si_dia (strcat flow " - " Size "%%c")) (if (= material "UKN") (setq Si_dia_mat Si_dia) (setq Si_dia_mat (strcat Si_dia " " Material)) ) (setq ELEVATIONN (atof C)) (setq DEPTHN (atof DEPTH)) (setq y (- ELEVATIONN DEPTHN)) (setq x (rtos y)) (setq D DEPTH) (setq Tx (strcat si_dia_mat " (" CODE ")" "\n\ RL OF INVERT: " x "m" "\n\ TAPE DEPTH: " D "m" "\n" ))) (princ) (setq Blname2 (car(entsel "\nSelect Survey Point for leader insertion:"))) (GA Blname2) (setq coord2 (cdr(assoc 10 (entget blname2)))) (COMMAND "-LAYER" "M" (strcat lay "_txt") "") (COMMAND "_MLEADER" coord2 PAUSE TX)) (Varclose) (prin1)