mickydee81 Posted August 11, 2015 Posted August 11, 2015 (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 August 17, 2015 by mickydee81 code tags Quote
Dadgad Posted August 11, 2015 Posted August 11, 2015 (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. Edited August 11, 2015 by Dadgad Quote
SLW210 Posted August 11, 2015 Posted August 11, 2015 Please read the Code posting guidelines and edit your post to include the Code in Code Tags. Quote
jonathann3891 Posted August 11, 2015 Posted August 11, 2015 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)))) ) ) ) ) Quote
mickydee81 Posted August 17, 2015 Author Posted August 17, 2015 (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 August 17, 2015 by mickydee81 code tags Quote
tombu Posted August 18, 2015 Posted August 18, 2015 (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 August 19, 2015 by tombu entlast added Quote
mickydee81 Posted August 19, 2015 Author Posted August 19, 2015 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 Quote
tombu Posted August 19, 2015 Posted August 19, 2015 Sorry hadn't tested that code before, works now on my PC. Fixed code in previous post. Quote
mickydee81 Posted August 20, 2015 Author Posted August 20, 2015 Thanks for that Tombu works perfectly. Have a good day all and thanks for all the help. Cheers Quote
tombu Posted August 20, 2015 Posted August 20, 2015 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. Quote
Recommended Posts
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.