lisp initiation from menu.

Discussion in 'AutoCAD' started by Kevin Nehls, Jul 25, 2003.

  1. Kevin Nehls

    Kevin Nehls Guest

    I've made mine into command line commands:

    (defun c:dszoom ()
    (c:ds_zoom coord_set)
    (princ)
    )

    then just use this in the menu:
    [Zoom to City]^C^CDSZOOM;

    BTW, you may want to think about either renaming the (c:ds_zoom) function so
    that it doesn't have the C: prefix or making it so you don't have to pass it
    an argument, then you could just call DS_ZOOM from the menu and be done with
    it ;)
     
    Kevin Nehls, Jul 25, 2003
    #1
  2. Kevin Nehls

    Bob Basques Guest

    All,

    What's the best way to:

    1.) make a chunk of lisp, in a menu item, transparent on the command line.

    (<function name> <parameters>)

    Here is what I have in the MENU:

    [Zoom to City]^C^C(C:DS_ZOOM COORD_SET);

    2.) To make the command react like a typical autocad command on the commandline in that hitting a return will start the
    command again.


    These seem like a real easy things to do, but I don't think I've ever needed to do this before.



    Thanks

    bobb
     
    Bob Basques, Jul 25, 2003
    #2
  3. Kevin Nehls

    Bob Basques Guest

    I was wondering about a command alias as well.


    I was trying to make a generic routine for many uses. This is the reason for the parameters.

    I suppose I can take the route of simply keeping the coord_set value current and use this approach.

    Thanks



    bobb
     
    Bob Basques, Jul 25, 2003
    #3
  4. Kevin Nehls

    Bob Basques Guest

    This is what I ended up with, I think it will give the most flexibility over the long run:

    (defun DS_ZOOM (BBOX / )
    (setq cur_cmdecho (getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (command "zoom" "window" (car BBOX) (cadr BBOX))
    (setvar "CMDECHO" cur_cmdecho)
    (princ)
    );DEFUN

    (defun C:DS_ZOOM_CITY ( / ) (DS_ZOOM coord_set))


    Thanks Kevin.

    bobb


    P.S. Now to figure out how to throw a comment show a valid completion of operation on the end of the function. :c)
     
    Bob Basques, Jul 25, 2003
    #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.