CMDECHO error in dialog box

Discussion in 'AutoCAD' started by Oak3s, Mar 3, 2004.

  1. Oak3s

    Oak3s Guest

    AutoCAD2000
    winXP

    i am working on a dialog box that can be used to change the grid settings and the snap settings. i have the dcl file looking right. what i dont have is the lisp working. it starts to run like it wants to open the dialog but then it errors out. can someone offer any advice. attached is the dcl if needed.
    thanks in advance

    ;;SnapGrid dialog box
    ;;dcl file name is SnapGrid.dcl

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

    ;;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

    (setq gridmode (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, Mar 3, 2004
    #1
  2. Oak3s

    ECCAD Guest

    Oak3s,
    In your .lsp:
    Change:
    (set snapmode (getvar "snapmode"))
    To:
    (setq snapmode (getvar "snapmode"))

    And, in the .dcl:
    Change:
    lable
    To:
    label
    (several places).

    Bob
     
    ECCAD, Mar 3, 2004
    #2
  3. Oak3s

    Oak3s Guest

    not a trick question. im not real familiar with lisp. im going out of a book and i cant get it all from there. sorry if it was a waste of time to anyone. im a newbie. thanks for the help anyway. i will see if it works. thanks again
    Jeremy
     
    Oak3s, Mar 3, 2004
    #3
  4. Oak3s

    ECCAD Guest

    Ya, it will work.
    Bob
     
    ECCAD, Mar 3, 2004
    #4
  5. Oak3s

    Oak3s Guest

    hey thanks for picking up those errors. it works. thanks again
     
    Oak3s, Mar 3, 2004
    #5
  6. Oak3s

    ECCAD Guest

    Cheers.

    Bob :))
     
    ECCAD, Mar 3, 2004
    #6
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.