Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

One button changing text base point to be "Middle Center"

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
lai
Advocate
3882 Views, 13 Replies

One button changing text base point to be "Middle Center"

Hi, wonder if anyone know how to make a toolbar button so that when i click it and select a few single text, it will automatic change the text base point to be at "MIDDLE CENTER"....

 

At the moment, i use to create a button with macro of  " ^C^C_text;j;mc "....But the problem is whenever i use this button, i still need to type "MC" at the command prompt.. Any idea how to make it so that after i click the button, all i need to to is just select the text..

13 REPLIES 13
Message 2 of 14
Lee_Mac
in reply to: lai

If you are looking to change the justification of EXISTING text, try using the TJUST command.

 

If you want a macro for creating NEW Text with MC Justification, try:

 

^C^C_.dtext;_j;_mc;

 

Message 3 of 14
lai
Advocate
in reply to: Lee_Mac

Well, actually i thought of creating a button that will automatic change selected text to be at Middle Center...If to use the text justification command, i still need to type "MC" after select text that need to be rejustify.

Message 4 of 14
pbejse
in reply to: lai

^C^Cselect \Tjust previous ;mc;

 

BTW; you can still use this

^C^C_Tjust;mc; :

IF you select the entities with grips (note: pickfirst value 1) then click the button

 

Message 5 of 14
lai
Advocate
in reply to: pbejse

Thanks for the help.. i am more prever with this macro "  ^C^Cselect \Tjust previous ;mc;  "

Message 6 of 14
lai
Advocate
in reply to: lai

hi pbejse,

Just wonder if can modify abit on this matter.

At current, if i select text first and then use the macro, the text base point won't change..i wish to modify it so that either i click the text or macro first also can change the text base point.any possible? Please advise.

Message 7 of 14
pbejse
in reply to: lai


@lai wrote:

hi pbejse,

Just wonder if can modify abit on this matter.

At current, if i select text first and then use the macro, the text base point won't change..i wish to modify it so that either i click the text or macro first also can change the text base point.any possible? Please advise.


I'm not sure if it can be done as simple as we had it before,

Tjust is already a lisp code (R 2009 that is).

 

You could try this

 

^C^C(if (setq ss (cadr (ssgetfirst)))(command "_select" ss "")(command "_select")) \Tjust previous ;mc

 

HTH

Message 8 of 14
lai
Advocate
in reply to: pbejse

Well, i just give it a try..guess still the same as before...think need to stick to activate the macro first,then only can select text..Cause i always tend to select the text first before click the macro button.

Message 9 of 14
pbejse
in reply to: lai


@lai wrote:

Well, i just give it a try..guess still the same as before...think need to stick to activate the macro first,then only can select text..Cause i always tend to select the text first before click the macro button.


Worked fo me here Lai

check pickfirst value.. should be 1


 

Message 10 of 14
lai
Advocate
in reply to: pbejse

Hi, i have try and check the pickfirst value is equal to 1..then i try again with your command, still need me to select the text first, else will give me error as i attach..

Message 11 of 14
pbejse
in reply to: lai


@lai wrote:

Hi, i have try and check the pickfirst value is equal to 1..then i try again with your command, still need me to select the text first, else will give me error as i attach..


Now thats odd, it works for me 100% of a time.

 

Okay once and for all:

 

(defun c:MC (/ ss)
  (if (setq ss (ssget "_:L" '((0 . "*TEXT"))))
    (command "_.justifytext" ss "" "_MC")
  )
  (princ)
)

 

Macro

 ^C^CMC

 

HTH

Message 12 of 14
lai
Advocate
in reply to: pbejse

Hmm, weird...Which version of autodesk you were testing previously? Me currently using Autocad 2012..Anyway, i use lisp for it. thanks alot for it..

Message 13 of 14
lai
Advocate
in reply to: lai

Hi pbejse,

Just to share something with you..Just now i try to use back your previous given macro " ^C^C_Tjust;mc; "...I notice that with this command, i can select text first,then click this macro button, it will autochange. But if i click the macro button first and then select text, it woul request me to type MC or just right click mouse button for enter..Guess that after all, no need lisp also can.

 

Just don't know why how come previously when i text it didn't notice it.

Message 14 of 14
pbejse
in reply to: lai


@lai wrote:

Hi pbejse,

Just to share something with you..Just now i try to use back your previous given macro " ^C^C_Tjust;mc; "...I notice that with this command, i can select text first,then click this macro button, it will autochange. But if i click the macro button first and then select text, it woul request me to type MC or just right click mouse button for enter..Guess that after all, no need lisp also can.

 

Just don't know why how come previously when i text it didn't notice it.


i see, gald you figure out a solution.

 

Cheers Lai

 


 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost