Message 1 of 4

Not applicable
01-26-2017
07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've found this code from 2012 for aligning text to a user-selected line here: http://forums.autodesk.com/[...]/3480202
And see the portion where TopCenter alignment is called.
Does anyone know of a way to remove the TopCenter align and make it keep the alignment of the source text objects?
Already tried hiding the (progn it falls under, but it still TopCenter aligns somehow.
We would like to use this code for Cable Block Diagram labeling.
Aside from my own added notes and a command name change, here is the code.
; USE THIS COMMAND TO ALIGN TEXT BY ITS INSERTION POINT (defun c:MT1 (/ l ss i sn v p e) (vl-load-com) ;;; Tharwat 31. May. 2012 ;;; (if (and (setq l (car (entsel "\n Select Line :"))) (eq (cdr (assoc 0 (entget l))) "LINE") (progn (prompt "Select texts to move to selected line") (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT")))) ) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq v (vlax-ename->vla-object sn)) (setq p (vlax-curve-getclosestpointto l (cdr (assoc 10 (entget sn))) ) ) (if (eq (cdr (assoc 0 (setq e (entget sn)))) "MTEXT") (progn (entmod (subst (cons 71 2) (assoc 71 e) e)) (vla-put-insertionpoint v (vlax-3d-point p)) ) (progn (vla-put-alignment v acAlignmentTopCenter) (vla-put-TextAlignmentPoint v (vlax-3D-point p)) ) ) ) ) ; (prompt "MT1.lsp loaded") (princ) )
Thank you!
Solved! Go to Solution.