Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 1 of 14 (674 Views)
Accepted Solution

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

674 Views, 13 Replies
08-23-2011 10:04 PM

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..

^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

 


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

*Expert Elite*
Lee_Mac
Posts: 1,178
Registered: ‎12-29-2009
Message 2 of 14 (662 Views)

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

08-24-2011 02:11 AM 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;

 

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 3 of 14 (660 Views)

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

08-24-2011 02:30 AM 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.

*Expert Elite*
pbejse
Posts: 2,467
Registered: ‎11-24-2009
Message 4 of 14 (654 Views)

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

08-24-2011 02:51 AM 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

 

Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 5 of 14 (643 Views)

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

08-24-2011 03:23 AM in reply to: pbejse

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

Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 6 of 14 (561 Views)

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

03-21-2012 11:40 PM 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.

*Expert Elite*
pbejse
Posts: 2,467
Registered: ‎11-24-2009
Message 7 of 14 (551 Views)

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

03-22-2012 01:33 AM 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

Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 8 of 14 (548 Views)

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

03-22-2012 01:39 AM 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.

*Expert Elite*
pbejse
Posts: 2,467
Registered: ‎11-24-2009
Message 9 of 14 (546 Views)

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

03-22-2012 01:48 AM 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


 

Distinguished Contributor lai
Distinguished Contributor
lai
Posts: 123
Registered: ‎08-15-2011
Message 10 of 14 (522 Views)

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

03-22-2012 08:22 PM 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..

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.