MText Background Mask settings LISP

MText Background Mask settings LISP

Anonymous
Not applicable
5,755 Views
13 Replies
Message 1 of 14

MText Background Mask settings LISP

Anonymous
Not applicable

Hello everyone,

 

Just wandering if you know of a LISP routine to set all mtext to a background mask size of 1.1 rather than the AutoCAD standard 1.5.

 

If anyone has any ideas how to achieve this please let me know.

 

Cheers.

0 Likes
Accepted solutions (2)
5,756 Views
13 Replies
Replies (13)
Message 2 of 14

Jonathan3891
Advisor
Advisor

Here ya go

 

color: 8

border: 1.1 

 

 

(defun c:mblank ( / 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 . 1) (63 . 8) (45 . 1.1) (441 . 0))))
			)
		)
	)
)

 


Jonathan Norton
Blog | Linkedin
Message 3 of 14

Anonymous
Not applicable

Not sure what i am doing wrong but it wont work sorry DSM_dude.

 

Thanks

0 Likes
Message 4 of 14

Anonymous
Not applicable

This is what i get.

 

Command: '_script
Command: (defun c:mblank ( / 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 . 1) (63 . 8) (45 . 1.1) (441 . 0))))
((((_> )
(((_> )
((_> )
(_> )    - It gets stuck here so I press enter then -
C:MBLANK

 

Is there input i meant to be giving?!

 

Thanks in advance.

0 Likes
Message 5 of 14

hmsilva
Mentor
Mentor

@Anonymous wrote:

Not sure what i am doing wrong but it wont work sorry DSM_dude.

 

Thanks


Dustin,

try to load the DSM_dude's code in VLIDE or save the file and load it to test...

 

This Lee Mac's tutorials should be helpful.

How to Run an AutoLISP Program

An Introduction to the Visual LISP IDE

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 6 of 14

Jonathan3891
Advisor
Advisor
Accepted solution

Its working fine on my end.

 

Try this working lisp.


Jonathan Norton
Blog | Linkedin
0 Likes
Message 7 of 14

Anonymous
Not applicable

Sorry mate this Script is still not working correctly.

 

What am I doing wrong?

0 Likes
Message 8 of 14

Jonathan3891
Advisor
Advisor
Accepted solution

After seeing your post above, your trying to load this like a script. This isn't a script and cant be loaded as such.

Use the command APPLOAD and load it through that window.

After its loaded, type "MBLANK"

 

Are you using AutoCAD Lite?


Jonathan Norton
Blog | Linkedin
0 Likes
Message 9 of 14

Anonymous
Not applicable

How you change the color to match the drawing background color?

0 Likes
Message 10 of 14

Jonathan3891
Advisor
Advisor

This will set the color to match the background.

 

(defun c:mblank ( / 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))))
			)
		)
	)
)

Jonathan Norton
Blog | Linkedin
Message 11 of 14

Anonymous
Not applicable

Does this apply to MLEADER as well?

0 Likes
Message 12 of 14

Jonathan3891
Advisor
Advisor

No that code only works for Mtext.

 

If you need something for Mleaders, try this;

(defun c:test (/ ss i)
  (if (setq ss (ssget '((0 . "MULTILEADER"))))
    (repeat (setq i (sslength ss))
      (setpropertyvalue (ssname ss (setq i (1- i))) "MText/BackgroundFill" 1)))
  (princ)
)

Jonathan Norton
Blog | Linkedin
Message 13 of 14

Anonymous
Not applicable

Thank you! This is great. I do have one more request....can you set the background mask offset on the MLEADER to 1.1 (or match the MTEXT)?

0 Likes
Message 14 of 14

calDRPMQ
Community Visitor
Community Visitor

How do you set it to use the drawing background colour?

0 Likes