See the top rated post in this thread. Click here

Results 1 to 2 of 2

Thread: Sending Commands to Command Line From Modal Form

  1. #1
    Login to Give a bone
    1

    Lightbulb Sending Commands to Command Line From Modal Form

    Hi everyone,

    If you have ever tried to create a modal form and then send commands to the autocad command line and not succeeded, this is the way to do it:

    Code:
    Form myform=new Form();
    Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(myform);
    //After the last line is executed the autocad command line is disabled, until
    //the form is closed. The way to keep the form open and still invoke commands is:
    Editor current=Autodesk.AutoCAD.ApplicationServices
    .Application.DocumentManager.MdiActiveDocument.Editor;
    EditorUserInteraction interaction=current.StartUserInteraction(myform);
    //after the last command is executed the form is hidden and
    //commands can be send to the command line
    //send commands MdiActiveDocument.SendStringToExecute(params)
    //when you are done
    interaction.End();//that restores your modal form, and the command line is blocked again
    I really wish I had figured this one out long time ago. It would have saved me a lot of wasted time. Hoping someone else would find this useful.

    P.S. This code is valid for AutoCAD 2009. I am not sure if it applies for older versions of AutoCAD.

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Smile Re: Sending Commands to Command Line From Modal Form

    Thanks for posting this. I'm sure others will find it useful.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

Similar Threads

  1. Non-Modal Form dissapearing
    By B_Roche in forum VBA/COM Interop
    Replies: 0
    Last Post: 2009-08-28, 05:16 PM
  2. command line commands
    By dawn-jones164 in forum AutoCAD Map 3D - Data Connect (FDO)
    Replies: 1
    Last Post: 2009-05-14, 03:07 PM
  3. Repeat command line commands
    By Tim K in forum AutoCAD Customization
    Replies: 4
    Last Post: 2008-01-04, 12:45 PM
  4. Command Line Feedback on obsolete commands
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2006-07-05, 05:06 PM
  5. show user form from a command line argument
    By lambertm in forum VBA/COM Interop
    Replies: 1
    Last Post: 2004-11-30, 09:36 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
  •