Jump to content

Adding Backgroundmask to Rotated Mtext on a Layer


Recommended Posts

Posted (edited)

Hi all,

 

My first Lisp I wrote from a macro I use as a button.

 

(defun c:SWD () (command "-LAYER" "M" "P_SW_DIA" "C" "2" "" "S" "P_SW_DIA" "" "-MTEXT" Pause "R" Pause "J" "BC" "H" "3.5" Pause "%%C???" "")(princ))

 

When I try to add a background mask to the last created object (see below) it doesn't work

 

(defun c:SWD () (command "-LAYER" "M" "P_SW_DIA" "C" "2" "" "S" "P_SW_DIA" "" "-MTEXT" Pause "R" Pause "J" "BC" "H" "3.5" Pause "%%C???" "" "BACKGROUNDMASK" "L")(princ))

 

Any ideas why?

 

Cheers, have a good day

Edited by mickydee81
code tags
Posted (edited)

Are you aware that you can mask your Mtext using regular OOTB functionality?

 

Not quite as quick as a button, just wondered if you knew it was an option.

There is also the ExpressTool command Textmask.

who was that masked man.jpg

Edited by Dadgad
Posted

Here is a lisp that will add background mask to mtext

 

The border is 1.1

The Color is set to background

 

If you wish to have a different color, change:

(90 . 3) to (90 . 1) & 256 to whatever color you want.

 

(defun c:mtm ( / js n dxf_ent)
(setq js (ssget '((0 . "MTEXT"))))
(cond
	(js
		(repeat (setq n (sslength js))
			(setq dxf_ent (entget (ssname js (setq n (1- n)))))
			(entmod (append dxf_ent '((90 . 3) (63 . 256) (45 . 1.1) (441 . 0))))
		)
	)
)
)

Posted (edited)

Hi all,

 

My bad SLW210 I will use the code tags from know on.

 

(defun c:SWD () (command "-LAYER" "M" "P_SW_DIA" "C" "2" "" "S" "P_SW_DIA" "" "-MTEXT" Pause "R" Pause "J" "BC" "H" "3.5" Pause "%%C???" "")(princ))

 

When I try to add a background mask to the last created object (see below) it doesn't work

 

(defun c:SWD () (command "-LAYER" "M" "P_SW_DIA" "C" "2" "" "S" "P_SW_DIA" "" "-MTEXT" Pause "R" Pause "J" "BC" "H" "3.5" Pause "%%C???" "" "BACKGROUNDMASK" "L")(princ))

 

Dadgad I am aware the express tool but I want to use a background mask instead of a wipeout.

 

Jonathann I have s similar lisp that I found on the forums that I use to background mask which I have connected to a button. I just wanted it to be a one step process without having to add the background mask after creating the text.

 

Thanks for the help all,

 

have a good day.

Edited by mickydee81
code tags
Posted (edited)

I use lisp similar to Jonathann3891's that toggles Background mask using drawing color with an offset factor of 1.15

It's also an easy modification as Dadgad pointed out, but not something you can do on the command line inside the mtext command. You could add code to your original macro. That would give you the results you need. Something like:

(defun c:SWD ( / obj) (command "-LAYER" "M" "P_SW_DIA" "C" "2" "" "S" "P_SW_DIA" "" "-MTEXT" Pause "R" Pause "J" "BC" "H" "3.5" Pause "%%C???" "")(setq obj (vlax-ename->vla-object ([b][color="red"]entlast[/color][/b])))(vlax-put-property obj 'BackgroundFill :vlax-true)(princ))

 

Sorry hadn't tested that code before, works now on my PC. Places yellow Ø??? with Background mask.

Edited by tombu
entlast added
Posted

Hi Tombu,

 

Thanks for that, I tried to run code above, I got the text but no textmask.

 

'MText: %%C???

MText:

Command: ; error: bad argument type: lselsetp nil'

 

Thanks for the help, cheers

Posted

Sorry hadn't tested that code before, works now on my PC. Fixed code in previous post.

Posted

Thanks for that Tombu works perfectly. Have a good day all and thanks for all the help. Cheers

Posted
Thanks for that Tombu works perfectly. Have a good day all and thanks for all the help. Cheers

 

Glad I could help. Not sure what you're going to use it for, but since it's a lisp you can use getstring (any word with option of sentence up to 132 characters) or getkword from a preset list that you can select with a single character for the text.

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