TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Artisan on September 08, 2004, 08:24:09 AM
-
I was hoping to find a text lisp that allows me to select a text string and change the justification from it's current setting to center. I am always having to bring up the properties box to do this and I have always wondered about a lisp that would do it for me.
**edit: This thread has been moved due to the fact that the Show your stuff forum is for offering up code, and the intent of this thread is clearly a call for help. -DCR
-
You could use something like this.
(defun chg_align_pt (obj align / int_pt)
(setq int_pt (vlax-get-property obj 'InsertionPoint))
(vlax-put-property obj 'Alignment align)
(vlax-put-property obj 'TextAlignmentPoint int_pt)
)
;;; changed selected DTEXT to middle alignment
(defun c:cdt2mid (/ ent obj)
(cond ((setq ent (car (entsel "\nSelect DTEXT to modify: ")))
(setq obj (vlax-ename->vla-object ent))
(if (vlax-property-available-p obj 'Alignment T)
(progn
(chg_align_pt obj acAlignmentMiddle);[1]
(vlax-release-object obj)
)
(alert "Un-able to change that text")
)
)
)
)
;;; [1] alignment options
;;; acAlignmentCenter
;;; acAlignmentRight
;;; acAlignmentMiddle
;;; acAlignmentTopLeft
;;; acAlignmentTopCenter
;;; acAlignmentTopRight
;;; acAlignmentMiddleLeft
;;; acAlignmentMiddleCenter
;;; acAlignmentMiddleRight
;;; acAlignmentBottomLeft
;;; acAlignmentBottomCenter
;;; acAlignmentBottomRight
-
Here are macros that I use, just assign them to a button and off you go.
Middle Centre Justify
^C^C_justifytext;\;mc;
Middle Left Justify
^C^C_justifytext;\;ml;
Middle Right Justify
^C^C_justifytext;\;mr;
-
I like that even better. :D
-
Here are macros that I use, just assign them to a button and off you go.
Middle Centre Justify
^C^C_justifytext;\;mc;
Middle Left Justify
^C^C_justifytext;\;ml;
Middle Right Justify
^C^C_justifytext;\;mr;
That's what I use. I used to use the CHT lisp, but that was before we had the justifytext command. I still like to use the cht routine if I WANT to move the text, but the other has pretty well taken over.