Textmask Help

Textmask Help

Anonymous
Not applicable
2,191 Views
12 Replies
Message 1 of 13

Textmask Help

Anonymous
Not applicable

I need help figuring out what's not right with this routine

I'm trying to create a textmask but it's not working

If I don't use the routine and draw some MTEXT, then type "TEXTMASK" and type "L" for last; the mask works fine, but not in the routine

I'm hoping someone can let me know what I'm doing wrong

 

(SETQ P1(GETPOINT "\n<center point>: "))
(SETQ TAGNUM(GETINT "\n<enter tag number>: "))
(COMMAND "CIRCLE" P1 "4")(SETQ G1(ENTLAST))
(COMMAND "MTEXT" P1 "H" "4" "R" "0" "J" "MC" "W" "0" TAGNUM "")(SETQ G2(ENTLAST))
(COMMAND "TEXTMASK" "L" "" "")
(SETQ G3(SSADD))(SSADD G1 G3)(SSADD G2 G3)
(SETQ BNUM(GETVAR "USERI5"))
(SETQ TGNAME(STRCAT "_Tag"(ITOA BNUM)))
(SETVAR "USERI5"(+ BNUM 1))
(COMMAND "BLOCK" TGNAME P1 G3 "")
(COMMAND "-INSERT" TGNAME P1 "" "" 0)

 

Thanks in advance,

Larry

0 Likes
Accepted solutions (1)
2,192 Views
12 Replies
Replies (12)
Message 2 of 13

ВeekeeCZ
Consultant
Consultant

It does not work like that. TEXTMASK is a "command" from Express Tools. It behaves like any other LSP.

(see c:\Program Files\Autodesk\AutoCAD 201x\Express\textmask.lsp )

 

Look up on the web to find some other way make mask.

0 Likes
Message 3 of 13

Kent1Cooper
Consultant
Consultant
Accepted solution

Since TEXTMASK is an Express Tool, it can't be used in a (command) function, which can only recognize native AutoCAD command names.  Try this:

 

  (load "textmask"); [somewhere before you use it, in case it hasn't yet been used in the current drawing]

 

and later, to make the mask, instead of in (command), assuming you do it similarly right after drawing the thing to have the mask applied, try:

 

  (acet-textmask-make-wipeout (entlast) 0.2); <-- EDIT mask type & offset distance as desired

 

You may also want to incorporate, somewhere, something like this:

 

  (command "_.wipeout" "_frames" "_off"); <-- or "_on" if desired

Kent Cooper, AIA
Message 4 of 13

dbroad
Mentor
Mentor

Don't use textmask with mtext.  Select the text and in the properties palette, select background mask and turn it on.

 

There is a routine that works in this thread. See the attachment on the original poster.

 

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/make-and-fit-the-background-mask-in-m...

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 5 of 13

hmsilva
Mentor
Mentor

@Anonymous wrote:

Don't use textmask with mtext...


1+

 

 Hi bdsmls,

I would suggest to change your code, instead of

(COMMAND "TEXTMASK" "L" "" "")

try

 

(vlax-put (vlax-ename->vla-object G2) 'backgroundfill 1)
(setq ent (entget G2)
      ent (subst (cons 45 1.1) (assoc 45 ent) ent);change 1.1 if necessary
      ent (subst (cons 421 256) (assoc 421 ent) ent)
)
(entmod ent)

(vl-load-com), if Visual LISP extensions not loaded yet.

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 6 of 13

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

Don't use textmask with mtext.  Select the text and in the properties palette, select background mask and turn it on.

....


[... in new-enough versions -- it hasn't always been an option ....]

Kent Cooper, AIA
0 Likes
Message 7 of 13

Anonymous
Not applicable

Thanks Kent

As always your solution worked perfectly.

 

Regards

0 Likes
Message 8 of 13

Anonymous
Not applicable
@Kent1Cooper wrote:

Since TEXTMASK is an Express Tool, it can't be used in a (command) function, which can only recognize native AutoCAD command names.  Try this:

 

  (load "textmask"); [somewhere before you use it, in case it hasn't yet been used in the current drawing]

 

and later, to make the mask, instead of in (command), assuming you do it similarly right after drawing the thing to have the mask applied, try:

 

  (acet-textmask-make-wipeout (entlast) 0.2); <-- EDIT mask type & offset distance as desired

 

You may also want to incorporate, somewhere, something like this:

 

  (command "_.wipeout" "_frames" "_off"); <-- or "_on" if desired


I know its a little old thread but still hoping to get some help...

 

I also have similar problem as that of  bdsmls but in my case I want to text mask all the mtext available in model. I have written small routine (I'm novice) to create the selection filter (which seems to be working fine) but note sure how to use that selection set further.. Smiley Frustrated

 

Below is the code:

(defun c:test(/ sset )
 (setvar "cmdecho" 0)
  	(load "textmask")
	(setq sset (ssget "_X" '((0 . "MTEXT,TEXT") (410 . "Model") ))) ;Select mtext from model only
	(acet-textmask-make-wipeout ( sset ) 0.2)
	(command "_.wipeout" "_frames" "_off")
 (setvar "cmdecho" 1)
 (Princ)
 )

I have even tried making selection set global instead of local since textmask is diff. lisp routine but didn't get the results..Smiley Mad

 

Would really appreciate any helpSmiley Happy

0 Likes
Message 9 of 13

ВeekeeCZ
Consultant
Consultant

hello @Anonymous, good try!

 

I've made a quick look on your code, there are two problems.

First, minor syntax problem, is since you're replacing function (entlast) with sset variable, you shouldn't use the parenthesis (acet-textmask-make-wipeout sset 0.2). But anyway its wrong because...

 

...the second problem, big one, is problem that subfunction requires to be supplied with single entity, not whole selection set.

If you feeling about to learn how to step thru the selection set to get entity names, look HERE for many examples how to do that - most favorite method around here is 2a.

 

If not, look below, where I've rewrote to code... (usage of method 2a)

  (if (setq sset (ssget "_X" '((0 . "MTEXT,TEXT") (410 . "Model"))))
    (repeat (setq i (sslength sset))
      (acet-textmask-make-wipeout (ssname sset (setq i (1- i))) 0.2)))

Message 10 of 13

Anonymous
Not applicable

 

(defun c:das(/ sset i e)
 (setvar "cmdecho" 0)
  	(load "textmask")
	(if (setq sset (ssget "_X" '((0 . "MTEXT,TEXT") (410 . "Model"))))
		(repeat (setq i (sslength sset))
		(setq e (ssname sset (setq i (1- i))))
		(command "Zoom" "Object" e pause)
		(acet-textmask-make-wipeout e 0.2) )
	)
  (command "_.wipeout" "_frames" "_off") ;or "_on" if desired
 (setvar "cmdecho" 1)
 (Princ)
 )

 

Anyways learned few more new things thanks to you. Heart

 

0 Likes
Message 11 of 13

ВeekeeCZ
Consultant
Consultant

It might be possible to exclude them. Post some dwg with some good and bad texts to test.

0 Likes
Message 12 of 13

Anonymous
Not applicable

Wish I could upload file here for testing but due to my company's policy, it can't be uploaded.. sorry Smiley Sad

 

Btw I tried to textmask the problematic text directly from express tools and it failed there too.. so the problem is not with the routine we have created but with the text. The only thing above routine lags is it can't skip the problematic text & move to next text. (smillar to excel VBA "On Error Resume Next")

0 Likes
Message 13 of 13

ВeekeeCZ
Consultant
Consultant

You can't upload dwg with couple of texts with non meaningful content just to see its definition?? Geee....

 

Whatever. Try this.... but I don't use such thing.

(ssget "_X" '((0 . "MTEXT,TEXT") (410 . "Model") (210 0 0 1)))

0 Likes