webster Posted October 12, 2023 Posted October 12, 2023 Hi LISP Experts I have this awesome lsp that allows me to click on a block, and then label that block with a leader using my default selected text style. Works perfectly. Is there any way to tweak the code to also reduce the text width to 0.9 and the text rotation the text to 45 degrees? I'd like to use this function in isometric mode and would love for it to do this automatically if possible (as I'd have hundreds of blocks to label). I am currently editing each label manually after running the lsp. Thank you! Bnamelabel.LSP Quote
exceed Posted October 12, 2023 Posted October 12, 2023 (defun c:BNameLabel (/ ent entl obj objl pt rl ud degset ) (defun dtr (a) (* pi (/ a 180.0))) (cond ((not (setq ent (car (entsel "\nSelect block: "))))) ((not (eq (cdr (assoc 0 (entget ent))) "INSERT")) (princ "\nInvalid object!")) ((setq pt (getpoint "\nSpecify first point: ")) (setq entl (entlast)) (vl-cmdf "_.mleader" "_non" pt "\\") (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (vl-cmdf "")) (if (not (equal entl (setq entl (entlast)))) (progn (vla-put-textstring (setq objl (vlax-ename->vla-object entl)) (vlax-get-property (setq obj (vlax-ename->vla-object ent)) (if (vlax-property-available-p obj 'EffectiveName) 'EffectiveName 'Name ) ) ) (setq coordlist1 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget entl)))) ;edited line (if (> (- (car (car coordlist1)) (car (cadr coordlist1))) 0) (setq rl "right") (setq rl "left") ) (if (> (- (cadr (cadr coordlist1)) (cadr (caddr coordlist1))) 0) (setq ud "up") (setq ud "down") ) (cond ((and (= rl "right") (= ud "up")) (setq degset 45) ) ((and (= rl "right") (= ud "down")) (setq degset 315) ) ((and (= rl "left") (= ud "up")) (setq degset 315) ) ((and (= rl "left") (= ud "down")) (setq degset 45) ) ) (vlax-put-property objl 'textrotation (dtr degset)) (vlax-put-property objl 'textwidth 0.9) ) ) ) ) (princ) ) (vl-load-com) (princ) like this? Quote
webster Posted October 13, 2023 Author Posted October 13, 2023 Hi Exceed Thank you for your efforts on this. Unfortunately, no. This lsp is shortening the entire multileader frame width condensing the text over multiple lines. Ideally, I would like the description to maintain 1 line, however, for the text width to be reduced to 0.9. i.e. the character width. When I have done this manually, I double-click and highlight the text, and then with the 'Text Formatting' dialog popup, I reduce the text width there to 0.9. I am not seeing any rotation on the multileader, it maintains a rotation of 0. Thank you. Quote
Steven P Posted October 13, 2023 Posted October 13, 2023 You can use multileader assoc code 42 to set the angle (in radians) I think with entmod Quote
BIGAL Posted October 14, 2023 Posted October 14, 2023 I tried (entmod (subst (cons 42 1.57) (assoc 42 ent) ent)), ok when you do a check 42 is 1.57 but the text is not rotated same with using property 'TextRotation, it may be my Bricscad V20, I did read a comment that you have to reset the arrow head point, then it changes. I did notice that the end leader line point changes when you manually change the angle so I think that is the answer. Change more than one value. Now where is that landing point value hidden. One suggestion is to use setproperty will try it. 1 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.