Hi Everyone,
Does anyone have a lisp to change the oblique angle (to 30 or whatever) inside a block that contains Text AND Mtext. I've been coming up dry on my searches. Thanks in advance!!
I've attached a block I would like to use it on....
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Hi erickson123,
mtext is formated in the text string, not a propertie from the object.
Just a starting point.
(vl-load-com) (defun c:demo (/ attlst hnd i lst obj str ss) (if (setq ss (ssget '((0 . "INSERT") (66 . 1)))) (progn (repeat (setq i (sslength ss)) (setq hnd (ssname ss (setq i (1- i))) attlst nil obj (vlax-ename->vla-object hnd) attlst (vlax-invoke obj 'GetAttributes) ) (foreach att attlst (if (= (vla-get-MTextAttributeContent att) "") (vla-put-ObliqueAngle att (* pi (/ 30.0 180.0))) (vla-put-TextString att (strcat "\\Q30.0;" (vla-get-TextString att))) ) ) ) ) ) (princ) )
Henrique
I'm not a lisp writer, but this is how the lisp in the other message changed for our needs. We use it to change text in topo maps from 'straight' to a 30deg slant.
(defun C:TX30 (/ ans text_entities mtext_entities)
(vl-load-com)
;---------------------------------- TEXT & MTXEXT ---------------------------------------------
(command "STYLE" "SIMPLEX S" "SIMPLEX" (* 0.00 (GETVAR "DIMSCALE")) "1.0" "30" "No" "No" "No")
(setq text_entities
(ssget "X"
'((0 . "TEXT")(410 . "Model")
(-4 . "<NOT")
(-4 . "<OR")
(8 . "*NA-SCALE*")(8 . "*STREET*")
(-4 . "OR>")
(-4 . "NOT>")
)
)
)
(setq mtext_entities
(ssget "X"
'((0 . "MTEXT")(410 . "Model")
(-4 . "<NOT")
(-4 . "<OR")
(8 . "*NA-SCALE*")(8 . "*STREET*")
(-4 . "OR>")
(-4 . "NOT>")
)
)
)
(if text_entities
(command "Optchprop" text_entities "" "t" "SIMPLEX S" "")
);endif
(if mtext_entities
(command "Optchprop" mtext_entities "" "t" "SIMPLEX S" "")
);endif
;--------------------------------- BLOCK ATTRIBUTES --------------------------------------------
(if (setq ss (ssget "X" '((0 . "INSERT") (66 . 1)(410 . "Model"))))
(progn
(repeat (setq i (sslength ss))
(setq hnd (ssname ss (setq i (1- i)))
attlst nil
obj (vlax-ename->vla-object hnd)
attlst (vlax-invoke obj 'GetAttributes)
)
(foreach att attlst
(if (= (vla-get-MTextAttributeContent att) "")
(vla-put-ObliqueAngle att (* pi (/ 30.0 180.0)))
(vla-put-TextString att (strcat "\\Q30.0;" (vla-get-TextString att)))
)
)
)
)
)
(princ)
);defun