View Full Version : Using MText command inside a routine, display Editor instead of command line version
paulmon
2007-02-26, 12:57 AM
I'm creating a program to setup standard text style and layer from dialog box menu. At the end of the lisp program I'm using "Mtext" command to created the text entity.
((vl-cmdf "-mtext")
(while (not (zerop (getvar "cmdactive")))
(command pause)
)
When I call the Mtext command inside AutoLisp the Text option tool bar does not show up in the graphic screen. I can only enter the text string from the command prompt. Any suggestion on working around this issue will be appreciated. You can reach me at paulmon@sympatico.ca
Best Regards,
Paul Mon
I'm creating a program to setup standard text style and layer from dialog box menu. At the end of the lisp program I'm using "Mtext" command to created the text entity.
((vl-cmdf "-mtext")
(while (not (zerop (getvar "cmdactive")))
(command pause)
)
When I call the Mtext command inside AutoLisp the Text option tool bar does not show up in the graphic screen. I can only enter the text string from the command prompt. Any suggestion on working around this issue will be appreciated. You can reach me at paulmon@sympatico.ca
Best Regards,
Paul Mon
Hi Paul,
I haven't used vl-cmdf, so I don't know how to get there using it, but maybe this using the command function will help:
(defun c:test ( / ocmd)
(setq ocmd (getvar "cmdecho"))
(setvar "cmdecho" 1) ;so the standard prompts show up
(initdia) ;Tells the interpeter you want to use the dialog box in the next command
(command "mtext") ;notice no dash
(while (not (zerop (getvar "cmdactive")))
(command pause)
)
(setvar "cmdecho" ocmd) ;set cmdecho back as it was before
(princ)
)
HTH
paulmon
2007-02-26, 03:24 AM
Thanks Tim!
It works just the way I wanted.
Best Regards,
Paul Mon
Thanks Tim!
It works just the way I wanted.
Best Regards,
Paul Mon
You're welcome; I'm glad it worked for you.
:beer:
Thanks Tim!
It works just the way I wanted.
Best Regards,
Paul Mon
I started thinking about it, and I don't think you need the cmdactive while loop for this to work:
(defun c:test ()
(setq ocmd (getvar "cmdecho"))
(setvar "cmdecho" 1)
(initdia)
(command "mtext")
(setvar "cmdecho" ocmd)
(princ)
)
Should work.
Give it a try and see.
paulmon
2007-04-22, 09:59 PM
Hi Tim,
I really appreciated your helpful suggestion. It work fine initially. Just recently I've added a few module to my program and complied the program into vlx. No when I run the program I get:
"no function definition: INITDIA"
I compile the code with the code with Standard mode
One module for each file.
I compiled the following into vlx as a single module and it run fine.
(defun c:LMTEXT ( / ocmd)
(setq ocmd (getvar "cmdecho"))
(setvar "cmdecho" 1) ;so the standard prompts show up
(initdia) ;Tells the interpeter you want to use the dialog box in the next command
(command "mtext") ;notice no dash
(while (not (zerop (getvar "cmdactive")))
(command pause)
)
(setvar "cmdecho" ocmd) ;set cmdecho back as it was before
(princ)
)
I've spend half a day checking through my other code and still don't have any idea on what cause this problem. Any suggestion will be appreciated.
Hi Tim,
I really appreciated your helpful suggestion. It work fine initially. Just recently I've added a few module to my program and complied the program into vlx. No when I run the program I get:
"no function definition: INITDIA"
I compile the code with the code with Standard mode
One module for each file.
I compiled the following into vlx as a single module and it run fine.
(defun c:LMTEXT ( / ocmd)
(setq ocmd (getvar "cmdecho"))
(setvar "cmdecho" 1) ;so the standard prompts show up
(initdia) ;Tells the interpeter you want to use the dialog box in the next command
(command "mtext") ;notice no dash
(while (not (zerop (getvar "cmdactive")))
(command pause)
)
(setvar "cmdecho" ocmd) ;set cmdecho back as it was before
(princ)
)
I've spend half a day checking through my other code and still don't have any idea on what cause this problem. Any suggestion will be appreciated.
That's something I haven't run into, but try adding (vl-arx-import ’INITGET) as the first line of the file you are trying to compile. I can't test it at the moment, so let me know. Or I'll test it tomorrow.
HTH
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.