Hi, all I want to do is create an icon, in a new ribbon tab, that sets the layer to text, and launches the mleader command - so the user can create their mleader on the correct layer. I already have this functionality using the tool palette, but wanted to add it to the ribbon as well.
So I figured the easiest way to do it would be write a little lisp routine that makes the layer, then launches the mleader command. I could then call the routine from my icon on the ribbon.
It was all going well until the mleader command ran, and I couldn't add the text on-screen, like I normally would - it switched to the command line, and everytime I press space it finishes the command - no good.
My attempt:
(defun c:ml01(/ ml01)
(command "cmdecho" "0")
(command "-layer" "m" "text" "c" "4" "" "" )
(command "cmleaderstyle" "text")
(command "cmdecho" "1")
(command ".mleader" pause)
(princ)
)
Any ideas?
Thanks.
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Something like this perhaps
(defun c:ml01 () (setvar 'CMDECHO 0) (command "-layer" "m" "text" "c" "4" "" "" "cmleaderstyle" "text") (setvar 'CMDECHO 1) (command ".mleader") (while (> (getvar 'cmdactive) 0) (command pause) ) (princ) )
HTH
Henrique
@Anonymous wrote:
That does the same thing. It only lets me enter text at the command line, and when I press space it finishes the command.
Sorry, I didn't understood properly, try this revised code
(defun c:ml01 () (setvar 'CMDECHO 0) (command "-layer" "m" "text" "c" "4" "" "" "cmleaderstyle" "text") (setvar 'CMDECHO 1) (initcommandversion) (command ".mleader") (while (> (getvar 'cmdactive) 0) (command pause) ) (princ) )
HTH
Henrique
Henrique
This is a great routine! I have multiple MLeader Styles and was hoping you could expand on your lisp. If you could PLEASE help and add another line to Set Current a pre-formatted ML Style, that would be great! Thanks and good work
Just alter "text" to whatever your mleader style is called.
(command "-layer" "m" "text" "c" "4" "" "" "cmleaderstyle" "text")
...if I understand your needs correctly 🙂
cmleaderstyle = current mleader style.
Incidentally, do you know how to add a background mask, at 1.5 and a specific colour, to the mleader at the same time?
@Anonymous wrote:
Incidentally, do you know how to add a background mask, at 1.5 and a specific colour, to the mleader at the same time?
Attach a sample dwg with the "before and after" MLeader...
Henrique
@Anonymous wrote:
Hi Henrique, I've attached a sample of what I was after.
Hi borderliner,
the attached code uses two sub-functions from Lee Mac's MaskV1.lsp (Thanks Lee)
It should work as expected, minimally tested...
HTH
Henrique
Hi Henrique, as ever - fantastic.
Hopefully I'll be able to brutalize it to do what I want, but it definately looks like it's 99% the way there already.
Thank you very much.
Are you addicted to kudos?
@Anonymous wrote:
I spoke too soon, how do I change the colour of the text mask from 200,200,200?
I think I've found everything else, it's just that.
Thanks.
From 200,200,200 to?
Henrique
We have a couple of dozen different mleader styles, many have their own colours, so I was wondering what controls the mask colour.
Thanks
@Anonymous wrote:
We have a couple of dozen different mleader styles, many have their own colours, so I was wondering what controls the mask colour.
From the code:
(cons 091 -1027028792)
-1027028792 is the color, to get the color number this post may be useful, see phanaem's or Lee's code...
HTH
Henrique
Thanks man.
I'd manged to work out the codes for the other things.
I found a neat little lisp called color converter that lets you select an other in ACAD, and it list the RGB and true colour codes.
...I was just reading your link - now it makes a little more sense, it's not a true colour value 420. More reading is called for.
Who knew I'd be diggin' around in this on Monday.
Thanks again, you've been a huge help. I'm sure you've got better things to be doing.
Holy cow, that was like pulling teeth - I've had more fun at the dentist.
But I've got it now, using phanaem's code to convert the numbers (thanks phanaem).
Have to remember to save it somewhere.