Results 1 to 4 of 4

Thread: "Fast keys," aliases, native commands, and -_

  1. #1
    Member
    Join Date
    2013-07
    Posts
    7
    Login to Give a bone
    0

    Default "Fast keys," aliases, native commands, and -_

    I've written up some shortcut commands that I've been referring to as my "fast keys." After re-reading a thread that I created on this board several months ago I discovered they're actually called "aliases." Funny how I didn't read that the first go around. Anyway, here are a few examples of what I've written.

    Code:
    (defun C:ri () (setvar "CMDECHO" 0)(command ".ribbon")(prin1))
    (defun C:ric () (setvar "CMDECHO" 0)(command ".ribbonclose")(prin1))
    (defun C:7 () (setvar "CMDECHO" 0)(command ".osmode" "7")(prin1))
    So these are "aliases?" I've written them into a .lsp that is part of my startup suite.

    I also recall reading that the period before the command tells autocad that this is a "native" command. What does this mean exactly? I'm assuming less graphical user interface? Also what's with the underscore before a command? And what about the dash underscore?

    I'm probably coming off like a little kid with these never ending questions but I'm just curious. I'd appreciate any help and/or direction. I've been using CAD for several years now, am currently using Civil 3D, and I'm very eager to learn more about programming. Thanks again!

  2. #2
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: "Fast keys," aliases, native commands, and -_

    Quote Originally Posted by bbarron281406214 View Post
    I've written up some shortcut commands that I've been referring to as my "fast keys." After re-reading a thread that I created on this board several months ago I discovered they're actually called "aliases." Funny how I didn't read that the first go around. Anyway, here are a few examples of what I've written.

    Code:
    (defun C:ri () (setvar "CMDECHO" 0)(command ".ribbon")(prin1))
    (defun C:ric () (setvar "CMDECHO" 0)(command ".ribbonclose")(prin1))
    (defun C:7 () (setvar "CMDECHO" 0)(command ".osmode" "7")(prin1))
    So these are "aliases?" I've written them into a .lsp that is part of my startup suite.

    I also recall reading that the period before the command tells autocad that this is a "native" command. What does this mean exactly? I'm assuming less graphical user interface? Also what's with the underscore before a command? And what about the dash underscore?

    I'm probably coming off like a little kid with these never ending questions but I'm just curious. I'd appreciate any help and/or direction. I've been using CAD for several years now, am currently using Civil 3D, and I'm very eager to learn more about programming. Thanks again!
    With your third example you will reset your osmode EVERY time you hit the "7" key - do you want that? Why not call it "OSM7"?

    The leading period calls the command as originally programmed by AutoDesk even if the command name has been redefined to do something different. It's nothing to do with graphics.
    The leading underscore is really only relevant if you are using (or worrying about) non-English language versions of the programme. [I'm counting American as English - but so do AutoDesk. ]
    A leading dash often (but not always) turns off any dialogue box associated with the command and puts it into "command line mode". [That's where the "less graphical user interface" comes in.]

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: "Fast keys," aliases, native commands, and -_

    Actually defun defines a function. In newer versions of AutoCAD typing ri on the command line pops up nine ribbon commands you can simply pick the one you want. On the Tools panel of the Express Tools ribbon tab selecting Command Aliases brings up a dialog box for adding removing and editing Command Aliases. They're actually stored in the acad.pgp file, but the Express Tool is the easiest and safest way to modify it. It will not do multiple commands like ".osmode" and "7" though. You can add a Command Alias for ".osmode" and enter 7 afterwards, extra step that gives you more options. I normally go with "2125" most of the time. I recommend leaving the standard ones alone and adding new ones.

    In the CUIx Shortcut Keys & Temporary Override Keys are under Keyboard Shortcuts. They're worth studying, if you want to use the keyboard more. $(if,$(=,7,$(getvar,osmode)),!.)EndMidCen could be added as a macro in the Object Snap Cursor Menu down the road after you get familiar with the CUIx.

    Good Luck,

  4. #4
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: "Fast keys," aliases, native commands, and -_

    If you create an alias (as opposed to writing a function as above), you put it in the pgp file as Tom said; always add your own aliases at the end of the "command aliases" section of the file, do not erase existing entries.
    An alias looks like -
    Code:
    3A,        *3DARRAY
    If you create a new alias as "3A" and add it to the end of the section, typing "3A" will activate your alias instead of the original.

Similar Threads

  1. Replies: 0
    Last Post: 2012-06-06, 11:54 AM
  2. Keyboard Shortcuts - OSNAP commands with the "F" keys
    By mvanstone in forum AutoCAD CUI Menus
    Replies: 5
    Last Post: 2005-12-21, 04:04 PM
  3. Fast searches for posts in the last "X" days
    By Steve_Stafford in forum Forum Tips & Tricks (Read only)
    Replies: 2
    Last Post: 2005-02-24, 05:04 AM

Posting Permissions

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