Can't pass necessary values to a MULTILEADER through VLisp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Bellow you will find attached a sample of an AutoCAD file, with some samples to which a command must be applied.
Let's assume that I want to performe on the middle sample my funcation "RN" (short for ReNumber).
If I hit "D", and select Multileaders from bottom to top, I get the sample from left.
It works fine.
Now, my intention is to run the command on the sample from left, and hit:
RN - R
After selecting Multileader I wish to get the variant from middle.
My 2nd intention is to run the command on the sample from left, hit
RN - U
After selecting Multileaders I wish to get the variant from right.
This is the part of code, that I'm talking about.
"DSE" is an abbreviation for company, with whose style I'm working.
((= comp_indx "DSE") (initget 7 "F D U R") (setq rn_mode (getkword "\nChoose numbering mode: [Floor-view/Details/Unnumber/Reset]")) (if (= rn_mode "F") (progn (initget 7 "Y N") (setq rn_mode (getkword "Do you wand to use prefix ? [Yes/No]")) ) ) (if (= rn_mode "Y") (progn (initget 7) (setq prefix (getstring "Indicate prefix to be added to rebar-position: ")) ) ) (if (= rn_mode "D") (progn (initget 6) (setq st_letter (getstring "\nIndicate the start letter: <a>")) (if (= st_letter "") (setq st_letter "a") ) ) ) (if (and (= rn_mode "D") (= (strlen st_letter) 1) ) (setq ch_indx (- (ascii st_letter) 98)) (if (and (= rn_mode "D") (= (strlen st_letter) 2) ) (setq ch_indx (+ (* (- (ascii (substr st_letter 1 1)) 96) 26) (- (ascii (substr st_letter 2 1)) 98) ) ) ) ) (setq ss (ssget '( (-4 . "<or") (0 . "multileader") (0 . "TEXT") (-4 . "or>") ) )) (setq indx 0) (setq ch_num 97) (repeat (sslength ss) (setq ch_indx (1+ ch_indx)) (setq el (entget (ssname ss indx))) (setq acadObj (vlax-ename->vla-object (ssname ss indx))) (setq reb_pos (vl-string-subst (cond ((= rn_mode "R") (strcat "(-)") ) ((= rn_mode "U") (strcat "") ) ((= rn_mode "D") (strcat "(" (if (>= (/ (/ ch_indx 1.0) 26) 1) (chr (+ (fix (/ (/ ch_indx 1.0) 26)) 96)) (chr 0) ) (chr (+ 97 (rem ch_indx 26))) ")" ) ) ((= rn_mode "Y") (strcat "(v" prefix (rtos (1+ indx)) ")" ) ) ((= rn_mode "N") (strcat "(v" (rtos (1+ indx)) ")" ) ) (t) ) (substr (vla-get-TextString acadObj) (1+ (vl-string-position 40 (vla-get-TextString acadObj))) (1+ (- (vl-string-position 41 (vla-get-TextString acadObj)) (vl-string-position 40 (vla-get-TextString acadObj)) )) ) (vla-get-TextString acadObj) ) ) (vla-put-TextString acadObj reb_pos ) (if (= (cdr (assoc 0 el)) "MULTILEADER") (progn (vla-put-TextLineSpacingStyle acadObj 2) (vla-put-TextLineSpacingFactor acadObj 1) ) ) (vlax-release-object acadObj) (setq indx (1+ indx)) ) )
But in cases of RN-R and RN-U, I get errors, which I can't get rid off.
My "debugging" method is to run pieces of code step by step in Model-space. And the code works well enough step by step. But when I run the command, I get errors.
*** ERROR: bad argument type: numberp: nil ***