Results 1 to 7 of 7

Thread: Using MText command inside a routine, display Editor instead of command line version

  1. #1
    Member
    Join Date
    2005-10
    Posts
    8
    Login to Give a bone
    0

    Default Using MText command inside a routine, display Editor instead of command line version

    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.
    Code:
    ((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
    Last edited by Opie; 2007-04-24 at 08:39 PM. Reason: [CODE] tags added

  2. #2
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Using MText command inside a routine, display Editor instead of command line version

    Quote Originally Posted by paulmon
    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:

    Code:
    (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

  3. #3
    Member
    Join Date
    2005-10
    Posts
    8
    Login to Give a bone
    0

    Default Re: Using MText command inside a routine, display Editor instead of command line version

    Thanks Tim!

    It works just the way I wanted.

    Best Regards,
    Paul Mon

  4. #4
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Using MText command inside a routine, display Editor instead of command line version

    Quote Originally Posted by paulmon
    Thanks Tim!

    It works just the way I wanted.

    Best Regards,
    Paul Mon
    You're welcome; I'm glad it worked for you.


  5. #5
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Using MText command inside a routine, display Editor instead of command line version

    Quote Originally Posted by paulmon
    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:

    Code:
    (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.

  6. #6
    Member
    Join Date
    2005-10
    Posts
    8
    Login to Give a bone
    0

    Question Re: Using MText command inside a routine, display Editor instead of command line version

    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.

    Code:
    (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.
    Last edited by Opie; 2007-04-24 at 08:40 PM. Reason: [CODE] tags added

  7. #7
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Using MText command inside a routine, display Editor instead of command line version

    Quote Originally Posted by paulmon
    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.

    Code:
    (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

Similar Threads

  1. Command Line Version for All Dialog Boxes
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-11-27, 04:32 AM
  2. Check Standards via the command line or a routine
    By cadmancando in forum AutoLISP
    Replies: 6
    Last Post: 2006-05-24, 11:06 PM
  3. Replies: 4
    Last Post: 2006-05-09, 08:57 PM
  4. Replies: 4
    Last Post: 2006-02-03, 07:34 PM
  5. Qleader prompts for MText via command line
    By okonforti.91529 in forum AutoCAD General
    Replies: 8
    Last Post: 2005-09-28, 09:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •