See the top rated post in this thread. Click here

Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Nested commands, command during point input

  1. #11
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Nested commands, command during point input

    OK, I moved it back. Please be specific in what you want and how the command should work. One of the first things you do in programming is come up with a flow chart or at least a word version of one. For example,

    • start the command
    • prompt for options, default to point input.
    • If input equals option A, then do X
    • prompt for second point
    • add line to database






    It wouldn't be efficient to allow just any kind of input. It should be limited to what is appropriate.
    C:> ED WORKING....

  2. #12
    Login to Give a bone
    0

    Default Re: Nested commands, command during point input

    Fair enough . . .

    I would like to issue the "Line" command. Then when AutoCAD awaits a point input I would like the user to be able to type "Hello". Then I would like a message box (or something similar) to pop up and say "Hello World" back. To extend the functionality a little more if I typed "Circle" instead of "Hello" I would like AutoCAD to quit the line command and start the "Circle" command without an {esc} key or something similar. To extend the functionality even further it would be nice if the "Hello" and "Circle" could be typed any time AutoCAD was awaiting a point input (Line, Circle, Rectangle, Copy, Move, etc.)

    To recap:
    -Issue "Line" command.
    -While AutoCAD awaits point input be able to either provide a point input or type text such as "Hello" or "Circle".
    -If the user provides a "point input" have AutoCAD proceed as normal (I.e. ask for second point).
    -If the user typed "Hello" or "Circle" instead of providing a point input AutoCAD would message box back with "Hello World" or automatically start a "Circle" command depending on what was entered by user.

    Additionally:
    The user could enter "Hello" or "Circle" anytime AutoCAD is awaiting a point input. (Event handler?)

    Note:
    AutoCAD currently does handle certain keyboard inputs while awaiting a point input . . . such as {esc}, {F8}, etc. . .

  3. #13
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    1

    Default Re: Nested commands, command during point input

    Its possible to watch for commands that are being entered, but not while a command is active. For example, you could watch for the LINE command to execute and then run your own code instead. You would have to redefine each of the commands that you want to accept different input. As you noted, AutoCAD limits input during a prompt for a point and that is as-designed. The intended behavior for 'changing your mind' when a command is active is to simply cancel the command and then do what you want. There are no hooks into a command while it is in-progress. You have to code your own command. Which is easier, replacing numerous commands or hitting the escape key? I understand your desire. I've written commands that only save a keystroke or two, but your broader request of allowing multiple options for multiple commands doesn't make sense...if it were possible.
    C:> ED WORKING....

  4. #14
    Login to Give a bone
    0

    Default Re: Nested commands, command during point input

    1. So lets start down this road . . . how do I "watch for the LINE command and then execute my own code?
    2. How do I make my own code accept a either a point or some text?

  5. #15
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Nested commands, command during point input

    First, I recommend you download the ObjectArx SDK from here. You will need it's dll's. The \docs folder has help files. You will need these, especially arxmgd.chm. Here is a file I translated for Giles that helps you create a VS template for starting an AutoCAD solution. It references the necessary dll's from the ObjectArx dev package.

    It isn't really necessary to watch for the LINE command to start. You can just start your own MyLine command. But if you want to, you use the Document.CommandWillStart event.

    The way you allow for multiple inputs is to properly set up a prompt using keywords according to AutoCAD's standard prompt system. You would first prompt the user: "Create a line. [optionA optionB]<Select start point>: ".

    The first text is an instruction prompt. The text in [] are options and the capital letters indicate the key the user can use to select the option. The text in <> is the default option. A user would pick a point or hit A or B. You set this up using Autodesk.AutoCAD.EditorInput.PromptKeywordOptions. Then you test the return of the prompt. If its optionA, do X. If it's a point, store that and issue the prompt for the end point.

    That's all the time I have for now. Gotta get back to work.
    Last edited by Ed Jobe; 2020-06-11 at 03:49 PM.
    C:> ED WORKING....

Page 2 of 2 FirstFirst 12

Similar Threads

  1. 2014: DWG Nested Inside Detail Comp. > Nested Inside Profile > Nested Inside Window
    By edu.rocha.tavares in forum Revit Architecture - Families
    Replies: 5
    Last Post: 2013-11-26, 06:46 PM
  2. CV104-1P: One Point, Two Point, Red Point, Blue Point
    By Autodesk University in forum Civil Infrastructure
    Replies: 0
    Last Post: 2013-05-05, 03:17 AM
  3. CV12-4: One Point, Two Point, Red Point, Blue Point
    By Autodesk University in forum Civil Infrastructure
    Replies: 0
    Last Post: 2013-04-17, 04:50 AM
  4. Running Object Snap Lost During Dimension Input
    By cadjockey in forum AutoCAD General
    Replies: 0
    Last Post: 2012-11-29, 01:16 PM
  5. Pressing and holding the shift, ctrl and alt keys during commands
    By rmejia in forum Revit Architecture - Wish List
    Replies: 2
    Last Post: 2007-07-31, 05: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
  •