"CMDECHO" nil

Discussion in 'AutoCAD' started by Oak3s, Feb 20, 2004.

  1. Oak3s

    Oak3s Guest

    i am trying to write a lisp for a dcl. this is supposed to be able to set the snaps and grid. im still new to lisp. i keep getting this error: "CMDECHO" nil
    coul someone help me out with this
    thanks in advance


    (defun C:snapgrid (/ dcl_id snapmode xsnap ysnap orgsnapunit gridmode gridsnap xgrid ygrid orggridunit
    (setq dcl_id (load_dialog"snapgrid.dcl"))
    (new_dialog"snapgrid"1)

    ;;Get existing value of snapmode and snapunit
    ;;and write those values to the dialog box

    (set snapmode (getvar "snapmode"))
    (if (= 1 snapmode)
    (set_tile "snapon" "1")
    (set_tile "snapon" "0")
    )
    (setq orgsnapunit (getvar "snapunit"))
    (setq xsnap (car orgsnapunit))
    (setq ysnap (cadr orgsnapunit))
    (set_tile "xsnap" (rtos xsnap))
    (set_tile "ysnap" (rtos ysnap))

    ;;Get the existing value of gridmode and gridunit
    ;;and write those values to the dialogbox

    (setgridmode (getvar "gridmode"))
    (if(= 1 gridmode)
    (set_tile "gridon" "1")
    (set_tile "gridon" "0"))
    (setq orggridunit (getvar "gridunit"))
    (setq xgrid (car orggridunit))
    (setq ygrid (cadr orggridunit))
    (set_tile "xgrid" (rtos xgrid))
    (set_tile "ygrid" (rtos ygrid))

    ;;Read the values set in the dalog box and
    ;;then change the associated AutoCAD variables

    (defun setvars()
    (setq xsnap (atof (get_tile "xsnap")))
    (setq ysnap (atof (get_tile "ysnap")))
    (setvar "snapunit" (list xsnap ysnap))
    (if (= "1" (get_tile "snapon"))
    (setvar "snapmode" 1)
    (setvar "snapmode" 0))
    (setq xgrid (atof (get_tile "xgrid")))
    (setq ygrid (atof (get_tile "ygrid")))
    (setvar "gridunit" (list xgrid ygrid))
    (if (="1" (get_tile "gridon"))
    (progn
    (setvar "gridmode" 0)
    (setvar "gridmode" 1))
    (setvar "gridmode" 0)
    ))
    (action_tile "accept" "(setvars) (done_dialog)")
    (start_dialog)
    (princ)
    )
     
    Oak3s, Feb 20, 2004
    #1
  2. Oak3s

    ECCAD Guest

    Oak3s,
    Try placing your code in a .zip, and attach. Maybe someone
    here can fix it. I see a couple of (either bad post or missing characters). For example, end of first line missing a ")", and
    (setgridmode (getvar "gridmode")) .. should begin with "(setq ", not (set.
    Bob
     
    ECCAD, Feb 22, 2004
    #2
  3. Oak3s

    ECCAD Guest

    BYW,
    add the .dcl file to the .zip.
    Bob
     
    ECCAD, Feb 22, 2004
    #3
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.