Anyone have a lisp routine that will rotate Mtext to the same angle as the angle of a selected line and the allow you to place the mtext object where you wish.
I know there is an lisp out there called RTL that will allow you to do this with regular or Dtext, but I will not work with Mtext.
Solved! Go to Solution.
Solved by Ajilal.Vijayan. Go to Solution.
Try this.
I modified the code from here
;; Text Rotated to the selected object angle (defun c:TRA() (c:TextRotate2Angle)) (defun c:TextRotate2Angle (/ ss lst pt ang obj get_pt_and_angle ) (vl-load-com) ;; User selection of curve object ;; return pick point & average angle of curve at pick point (defun get_pt_and_angle (prmpt / ent p@pt parA parB pt ang) (if (and (setq ent (entsel prmpt)) (not (vl-catch-all-error-p (setq pt (vl-catch-all-apply 'vlax-curve-getClosestPointTo (list (car ent) (cadr ent)) ) ) ) ) ) (progn (setq ent (car ent) p@pt (vlax-curve-getParamAtPoint ent pt) parA (max 0.0 (- p@pt 0.05)) parB (min (+ p@pt 0.05) (vlax-curve-getEndParam ent)) ang (angle (vlax-curve-getPointAtParam ent parA) (vlax-curve-getPointAtParam ent ParB) ) ) (list pt ang) ) ) ) ;; Get Text to align & object to alignment angle ;; Text is not moved, just rotated to the alignment angle ;; Object must have curve data (prompt "\nSelect text object to align.") (if (and (or (setq ss (ssget "_+.:E:S" '((0 . "Text,Mtext")))) (prompt "\n** No Text object selected. **")) (or (setq lst (get_pt_and_angle "\nSelect point on object to label.")) (prompt "\n** Missed or no curve data for object.")) ) (progn (setq pt (car lst) ;; ang (FixTextAngle (cadr lst)) ang (cadr lst) obj (vlax-ename->vla-object (ssname ss 0)) ) (vla-put-rotation Obj ang) (vla-put-InsertionPoint Obj (vlax-3D-point pt)) ) ) (princ) )
Please click the "Accept as solution" button if your issue was solved by the post.
Just lets the browsers know what needs to be worked on still and what's already been finished.
Plus it gives ajilal a little bit of recognition for producing the code for you to use..
True solution right here. LISP for something so straightforward? come on!
Though, I must assume it didn't work with MTEXT as stated, back in 2013.