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

make and fit the background mask in mtext

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
msarqui
3232 Views, 7 Replies

make and fit the background mask in mtext

 

Hello,

I found two amazing routines to make and fit the background mask in mtext.

The Txtboxwidth.lsp I found here :
http://autocadtips.wordpress.com/2011/08/13/autolisp-text-box-width/

The MtextMask.lsp I found here :
http://www.cadtutor.net/forum/showthread.php?42622-Text-mask-wipeout-replacement-by-background-mask

 

The Txtboxwidth.lsp make the bounding box fit to the text.
The MtextMask.lsp put a background mask in the select mtext with a prompt to choose settings like the color and the offset of the border.
Both are perfect if used separate but my issue is to merge this two routines. I have a very, very basic knowledge of the lisp so I tryed this:

;------------------------------------
;shortcut
(defun c:MMT ()
(setvar 'pickfirst 1)
(c:TxtBoxWidth)
(c:Mtm)
)
;------------------------------------

but I have been prompted two times to select the same mtext.

I would like to select the mtext just one time.

Could someone please merge this two routines in only one?

 

Thanks.

7 REPLIES 7
Message 2 of 8
dicra
in reply to: msarqui

You are having two different selection sets, this is the reason why you have to select "MTEXT" entities two times.

 

I think that the easiest way (not the best)  to combine these two, is to set selection set from the first one to be the second one.

But be careful because selection sets are set to be local variables, or at the end of the routine are set to be nil.

And you will probably need to set selection sets to nil after combining them...

 

I hope this will give you a hint,

you can find a lot of explanations how to use selection sets on this forum, or in autocad help.

Message 3 of 8
msarqui
in reply to: dicra

Hi dicra,

 

Thanks for your time but, as I said, my knowledge of LISP is very, very basic and I have no idea how to do what you are saying. Sorry...

Message 4 of 8
pbejse
in reply to: msarqui


@msarqui wrote:

 

Hello,

I found two amazing routines to make and fit the background mask in mtext.

The Txtboxwidth.lsp I found here :

The MtextMask.lsp I found here :

 

I would like to select the mtext just one time.

Could someone please merge this two routines in only one?

 

Thanks.


   
No need to merge: 
(defun c:wrap ()
      (C:TXTBOXWIDTH)
      (sssetfirst nil (ssget "_P"))
      (C:MTM)
      )

 

Make sure PICKFIRST is set to 1

 

HTH

 

Message 5 of 8
msarqui
in reply to: pbejse

Hi pbejse

 

This is pretty good. It works nice and fine.

Thank you very much!

Message 6 of 8
pbejse
in reply to: msarqui


@msarqui wrote:

Hi @pbejse

 

This is pretty good. It works nice and fine.

Thank you very much!


Glad i could  help msarqui

 

Cheers

 

Message 7 of 8
222seeker
in reply to: msarqui

Hello,

 

I see this problem has been solved and you are able to both shrink wrap and mask mtext in one step, however I am not versed enough in lisp to understand how to implement the stated solution.  Would either of you be willing to share the new corrected lisp(s) or further explain exactly where/how the solution lisp code should be inserted and into which lisp routine?

 

Thank in advance!

Message 8 of 8
222seeker
in reply to: 222seeker

Nevermind, I see now that it is it's own lisp routine that references the others.  Once it's loaded it works like a charm, thanks!

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

Post to forums  

Autodesk Design & Make Report

”Boost