Jump to content

Text Justification Lisp


ibanez_222

Recommended Posts

I had an idea for a justification lisp that if someone was bored and wanted to try, because I wouldn't know where to begin, I'm still new to lisp. I think if some one would make a lisp that would divide a box into 9 sections around a piece of text for top center, top right, top left, middle left, bottom right, bottom center, bottom left, middle right and middle center. When you would click in these areas it would make the text that justification, if that makes any sense to anyone. I find myself changing justification a lot and i think on the fly this would be a nice routine if you were to add a ctrl+J or something key shortcut with. Don't know if this is something hard or not but if someone agrees that this would be nice and would want to try that would be cool. Thanks.

Link to comment
Share on other sites

;; Justification Macros
;; Alan J. Thomspon

(defun _justifyIt (justify title / ss)
 (princ (strcat "\nSelect *Text to " title " justify: "))
 (if (setq ss (ssget "_:L" '((0 . "ATTDEF,MTEXT,TEXT"))))
   (command "_.justifytext" ss "" justify)
 )
 (princ)
)

(defun c:JC (/) (_justifyIt "_MC" "Middle Center"))
(defun c:JL (/) (_justifyIt "_ML" "Middle Left"))
(defun c:JR (/) (_justifyIt "_MR" "Middle Right"))
(defun c:BC (/) (_justifyIt "_BC" "Bottom Center"))
(defun c:TC (/) (_justifyIt "_TC" "Top Center"))

Link to comment
Share on other sites

I do like that lisp. I added the top right/left and bottom right/left to it though, because I use all of them a lot. I am just trying to find the fastest way to do this, because in a lot of cases I change the justification a lot. Thanks for the help Alan. Here is what I added and it works great:

 

 
;; Justification Macros
;; Alan J. Thomspon
(defun _justifyIt (justify title / ss)
 (princ (strcat "\nSelect *Text to " title " justify: "))
 (if (setq ss (ssget "_:L" '((0 . "ATTDEF,MTEXT,TEXT"))))
   (command "_.justifytext" ss "" justify)
 )
 (princ)
)
(defun c:ML (/) (_justifyIt "_ML" "Middle Left"))
(defun c:MR (/) (_justifyIt "_MR" "Middle Right"))
(defun c:BC (/) (_justifyIt "_BC" "Bottom Center"))
(defun c:TC (/) (_justifyIt "_TC" "Top Center"))
(defun c:BR (/) (_justifyIt "_BR" "Bottom Right"))
(defun c:BL (/) (_justifyIt "_BL" "Bottom Left"))
(defun c:TL (/) (_justifyIt "_TL" "Top Left"))
(defun c:TR (/) (_justifyIt "_TR" "Top Right"))
(defun c:MC (/) (_justifyIt "_MC" "Middle Center"))

Edited by ibanez_222
Link to comment
Share on other sites

I do like that lisp. I added the top right/left and bottom right/left to it though, because I use all of them a lot. I am just trying to find the fastest way to do this, because in a lot of cases I change the justification a lot. Thanks for the help Alan. Here is what I added and it works great:

Good to hear you found something that works. BTW, you didn't copy everything - look at last line.

Link to comment
Share on other sites

Good to hear you found something that works. BTW, you didn't copy everything - look at last line.

 

Your quick, I didn't get to fix it before you replied, but it's right now. Thanks.

Link to comment
Share on other sites

Your quick, I didn't get to fix it before you replied, but it's right now. Thanks.

FYI, you're defining the same option (middle center, etc.) twice - once with some of my macros and another with yours.

Link to comment
Share on other sites

FYI, you're defining the same option (middle center, etc.) twice - once with some of my macros and another with yours.

 

Yea I noticed that, and edited it again, and used mine. I don't know if there was a special reason for the JC, JR, JL, instead of MC, MR, and ML? I assumed it was because you already had those used up.

Link to comment
Share on other sites

Yea I noticed that, and edited it again, and used mine. I don't know if there was a special reason for the JC, JR, JL, instead of MC, MR, and ML? I assumed it was because you already had those used up.
Correct.

I generally only use JC/JR/JL, so it initially started out as Justify[name].

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...