TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: dkh007 on August 31, 2008, 09:43:19 PM
-
I'm trying to put together an annotative keynote using MLeader with a block. The MLeader command is always triggered last so I can't change the block attribute after I place the MLeader. I have snipped out the core of the routine that is giving me the problem. Any suggestions on a different approach or am I missing something? Attached is the block for use with the routine shown below...
(defun c:keynote ()
(if (>= (substr (getvar "acadver") 1 4) "17.2")
(initcommandversion 2)
)
(setvar "cmdecho" 1)
(command "_.mleader" "O" "C" "B" "key_h" "X")
(while (> (logand (getvar "CMDACTIVE") 0) 1)
(command pause )
)
(command "_ddedit" "l")
(princ)
)
-
Welcome to the Swamp. :-)
Have you tried
(command "_attedit" "l")
-
Here are some useful links:
http://www.theswamp.org/index.php?topic=10028.0
http://www.theswamp.org/index.php?topic=8246.0
-
Hi Daniel, Welcome to the Swamp!
I wonder what you're trying to do with the (undocumented) function (initcommandversion)... This should only be needed where you need a macro to use a new version of a command, and that's not the case here, because there exists only one version of the MLEADER command.
A usefull example for (initcommandversion) could be:
(setq ss (ssget))
(sssetfirst ss ss)
[color=blue](initcommandversion 2)[/color]
(command "_.explode")
In this case pickfirst will work, because you use the right version of the EXPLODE command.
If you modify this code (http://www.theswamp.org/index.php?topic=22949.msg276576#msg276576) a bit, you can use it also for mleaders with blocks.
-
Welcome to the Swamp. :-)
Have you tried
(command "_attedit" "l")
Thanks for the Welcome! Because the block is part of a MLeader, _ATTEDIT doesn't work. No matter where the MLeader command is in the LISP, it always excutes last. I also posted this in the ACAD customization group and the suggestion of using "cmdnames" instead of "cmdactive". That seems to have done the trick.
(defun c:keynote ()
(if (>= (substr (getvar "acadver") 1 4) "17.2")
(initcommandversion 2)
)
(setvar "cmdecho" 1)
(command "_.mleader" "O" "C" "B" "key_h" "X")
(while (/= (getvar "cmdnames") "")
(command pause)
)
(command "_ddedit" "l")
(princ)
)
-
Hi Daniel, Welcome to the Swamp!
I wonder what you're trying to do with the (undocumented) function (initcommandversion)... This should only be needed where you need a macro to use a new version of a command, and that's not the case here, because there exists only one version of the MLEADER command. <SNIP>
You are correct in this usage of MLeader it appears I don't need to use (initcommandversion). It was left over from my MLeader with MText, which is different in 2008 & 2009. This has allowed for backwards compatability of the routine.
-
Daniel,
What are you trying to accomplish here? When I use the last version you posted, it inserts the mleader and continues to prompt for attrib input?
Ron
-
Daniel,
What are you trying to accomplish here? When I use the last version you posted, it inserts the mleader and continues to prompt for attrib input?
Ron
Hi Ron,
I was just updating the forum with a solution of having the MLeader in the middle of a LISP and continuing through with other commands. The final will actually use a dialog for entering the attribute first. But I have already worked through that part of the LISP. The first post was just a simple example of something that did not work, similar to what I was trying to accomplish. Hope that clears things up.