help with a custom move command...?

Discussion in 'AutoCAD' started by C Witt, Nov 3, 2004.

  1. C Witt

    C Witt Guest

    I have attached my custom version of the "move" command.. but I need
    some help with it..

    the point of this lisp version is to allow for imerial distances when in
    a metric drawing.. and it almost works 100% of the time..

    when in a metric drawing and you enter an imperial distance in polar
    format (@1'<45) the lisp dies.. and it also dies if you enter in
    relative format (@1',1').

    There must be a way to alow for this type of input (without having to
    toggle the drawing units from metric to imerial)..

    HELP!?

    (defun c:move (/ mset Perror dimset tarunit mp1 mp2 mp1dist 1evom 2evom mp2dist)
    (setvar "cmdecho" 0)
    (setq PERROR *error*)
    (setq *error* ETRAPMO)
    (setq dimset (CDR (ASSOC 1 (dictsearch (namedobjdict) "XRECLIST"))))
    (if (= dimset nil)
    (if (= (getvar "lunits") 2)(setq tarunit 25.4)(setq tarunit 1))
    (if (= (substr dimset 4 1) "M")(setq tarunit 25.4)(setq tarunit 1))
    )
    (= (SETQ MSET (SSGET)) NIL); Select objects (use currently selected objects):
    (while (/= 1evom 1)
    (initget 128)
    (setq mp1 (getpoint "\nSpecify base point or displacement: "))
    (cond
    ((= (type mp1) 'LIST)
    (setq 1evom 1)
    )
    ((= (type mp1) 'STR)
    (progn
    (SETQ mp1dis (distof mp1 4))
    (if (/= mp1dis nil)
    (progn
    (setq 1evom 1)
    (setq mp1dis (* tarunit mp1dis))
    (setq mp1 mp1dis)
    )
    )
    )
    )
    )
    )
    (while (/= 2evom 1)
    (initget 128)
    (setq cgrips (getvar "grips"))
    (setvar "grips" 0)
    (sssetfirst mset mset)
    (setq mp2 (acet-ss-drag-move mset mp1 "Specify second base point of displacement or <use first point as displacement>: " highlight 0))
    ; (setq mp2 (getpoint mp1 "Specify second base point of displacement or <use first point as displacement>: "))
    (sssetfirst)
    (setvar "grips" cgrips)
    (cond
    ((= (type mp2) nil)
    (progn
    (setq 2evom 1)
    (setq mp2 mp1)
    )
    )
    ((= (type mp2) 'LIST)
    (setq 2evom 1)
    )
    ((= (type mp2) 'STR)
    (progn
    (SETQ mp2dis (distof mp2 4))
    (if (/= mp2dis nil)
    (progn
    (setq 2evom 1)
    (setq mp2dis (* tarunit mp2dis))
    (setq mp2 mp2dis)
    )
    )
    )
    )
    )
    )
    (command ".move" mset "" mp1 mp2)(princ)
    (setvar "cmdecho" 1)(princ)
    )

    (defun ETRAPMO (msg)
    (setvar "cmdecho" 0)
    (if (or (= msg "Function cancelled") (= msg "quit / exit abort"))
    (princ)
    (princ (strcat "\nError: " msg))
    )
    (setq 1evom nil)
    (setq 2evom nil)
    (setq mset nil)
    (setq mp1 nil)
    (setq mp2 nil)
    (prompt "\n")
    (setq *error* PERROR)
    (setvar "cmdecho" 1)
    (princ)
    )
     
    C Witt, Nov 3, 2004
    #1
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.