Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"CMDECHO" nil

2 REPLIES 2
Reply
Message 1 of 3
Oak3s
295 Views, 2 Replies

"CMDECHO" nil

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)
)
2 REPLIES 2
Message 2 of 3
EC-CAD
in reply to: Oak3s

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
Message 3 of 3
EC-CAD
in reply to: Oak3s

BYW,
add the .dcl file to the .zip.
Bob

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost