nested commands in ACAD 2002

Discussion in 'AutoCAD' started by Steve, May 13, 2004.

  1. Steve

    Steve Guest

    I have a number of custom buttons in R14 that use strings of commands

    eg: ^C^C_change properties la layer2 ;
    will change any selected object to layer 2
    or
    ^C^C_LAYER SET DIMENSION DIMSTYLE RESTORE Section dimlinear
    will first set the dimension layer as current ... then set the dimstyle as
    "section"
    and then prompt me to pick points

    ACAD2002 seems thorougly confused by this .... and just wont play ..
    is there a fundamental syntax change required ?
    TIA
    SR
     
    Steve, May 13, 2004
    #1
  2. Steve

    bob.at Guest

    Steve,

    i think you should finish the commands. When doing change properties you stay in a loop for change multiple properties for the selected objects. This loop you must leave with an additional enter. The same for the layer command.

    ^C^C_change properties la layer2;;
    ^C^C_LAYER SET DIMENSION;;DIMSTYLE RESTORE Section dimlinear

    bob.at
     
    bob.at, May 13, 2004
    #2
  3. Don't you need to have a selection before you give it the Properties option
    in the Change command (even in R14)? When I type in your code at the
    command line, it doesn't accept "properties" in response to Change's
    object-selection prompt.
    e.g. simplest case, if you want to pick a single item:
    ^C^C_change \;properties la layer2 ;

    But I don't understand how it would have worked in R14.

    Put a hyphen before DIMSTYLE so it will take the Restore option from the
    routine, instead of bringing up the dialog box:
    ^C^C_LAYER SET DIMENSION -DIMSTYLE RESTORE Section dimlinear

    Kent Cooper, AIA

    ...
     
    Kent Cooper, AIA, May 13, 2004
    #3
  4. Whoops -- should also have said you need a hyphen before Layer, too. That's
    one of the biggest adjustments I make in updating menus for new releases, as
    more and more commands involve dialog boxes, so lisp routines invoking them,
    that answer prompts for you, need hyphens added to work without dialog
    boxes.

    Also, I would like to amplify on what "bob.at" said on the need to "finish"
    the commands. He put semicolons in place of your spaces, and that should
    make them work, but not because they're needed to finish the commands. It
    happens in these two particular instances that you need to use them, because
    layer names can now include spaces, and both these lines involve feeding in
    layer names. The semicolons are needed to finish the layer names, not the
    command. You need to do the same thing with block names, which also can now
    include spaces. But in most commands in this kind of routine, spaces work
    fine for the purpose of ending them, or for other purposes (like completing
    selection sets, or recalling the last command), and are equivalent to
    semicolons except at the end of a line of code, where trailing spaces are
    ignored. So you could, for example, "finish" the Layer command in your
    second line with a semicolon and a space, like:
    ^C^C_-LAYER SET DIMENSION; -DIMSTYLE RESTORE Section;dimlinear

    Note that I put a semicolon in place of the space to "finish" the -DIMSTYLE
    command here, too, since Dimension Style names are another thing that can
    now include spaces.

    By the way, if you do these things with the underscore preceding the command
    name, and you want the non-dialog-box version, IT MATTERS where the hyphen
    goes. I tried typing in -_LAYER at the Command: prompt, but ACAD (2K at
    least) didn't like it. It accepts _LAYER and gives you the dialog box, and
    it accepts -LAYER and gives you the non-dialog-box prompt on the command
    line, and it accepts _-LAYER likewise, but it doesn't recognize -_LAYER.

    Kent Cooper, AIA


    ...
    ....
     
    Kent Cooper, AIA, May 13, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.