LISP NOT WORKING
本帖最后由 sachindkini 于 2013-4-17 19:57 编辑dear sir
this lisp working in 2011 but not working 2013 (windows 8 64 bit)
Command: BIGBOARD
; error: bad argument type: FILE nil(defun C:BigBoard ( / userclick dlgname dcl_idbig-board-list _make-dialog)
;; bigboard
(defun _make-dialog ( / fn f dcl )
(setq fn (strcat (vl-filename-directory (findfile "acad.exe"))"\\$vld$.dcl")
f (open fn "w")
dcl
'(
"board : dialog {"
": list_box {"
"key = \"selections\";"
"multiple_select = true;"
"height = 19;"
"allow_accept = true;"
"}"
"ok_cancel;"
"}"
)
)
(mapcar
(function
(lambda ( x )
(princ x f)
(princ "\n" f)
)
)
dcl
)
(close f)
fn
)
(defun setItems (val lst / ret)
(foreach n (mapcar (function (lambda (n) (- n 48)))
(vl-remove 32 (vl-string->list val))
)
(setq ret (cons (nth n lst) ret))
)
(reverse ret)
)
(setq big-board-list '("Command Description"
"-----------------------------------------------------------"
"Co Copy"
"M Move"
"Ano Automatic Numbering"
"Dr Door"
"Ww Window"
"Acal Area Calulation")
)
(setq dcl_id
(load_dialog
(setq dlgname (_make-dialog))))
(if (not (new_dialog "board" dcl_id))(exit))
(start_list "selections")
(mapcar 'add_list big-board-list)
(end_list)
(action_tile "selections" "(setq strLst (setItems $value big-board-list))")
(setq userclick (start_dialog))
(unload_dialog dcl_id)
(vl-file-delete dlgname)
(and (= 1 userclick)
(and strLst (print strLst)))
(princ)
)
本帖最后由 Gu_xl 于 2013-4-17 20:25 编辑
It is working well in cad2013 (windows 7 64 bit)!
"error: bad argument type: FILE nil " means the variable f is null! Gu_xl 发表于 2013-4-17 20:25 static/image/common/back.gif
It is working well in cad2013 (windows 7 64 bit)!
"error: bad argument type: FILE nil " means the v ...
dear sir,
over the head Maybe the directory you want to generated DCL temporary file haven't written permission.In WIN8 or WIN7, the “/program files/” directory is read only.
mccad 发表于 2013-4-17 22:07 static/image/common/back.gif
Maybe the directory you want to generated DCL temporary file haven't written permission.In WIN8 or W ...
Dear Sir,
Thx ...
what is another solution???? Try agan.
(defun C:BigBoard ( / userclick dlgname dcl_idbig-board-list _make-dialog)
;; bigboard
(defun _make-dialog ( / fn f dcl )
(setq fn (strcat (vl-filename-directory (findfile "acad.exe"))"\\$vld$.dcl")
f (open fn "w")
dcl
'(
"board : dialog {"
": list_box {"
"key = \"selections\";"
"multiple_select = true;"
"height = 19;"
; "allow_accept = true;"
"}"
"ok_cancel;"
"}"
)
)
(mapcar
(function
(lambda ( x )
(princ x f)
(princ "\n" f)
)
)
dcl
)
(close f)
fn
)
;(defun setItems (val lst / ret)
; (foreach n (mapcar (function (lambda (n) (- n 48)))
; (vl-remove 32 (vl-string->list val))
; )
; (setq ret (cons (nth n lst) ret))
; )
; (reverse ret)
; )
(defun setItems (val lst / ret)
(foreach n (read(strcat "(" val ")")) (setq ret (cons (nth n lst) ret)))
(reverse ret)
)
(defun readata ()
(setq strlst (setitems (get_tile "selections") big-board-list))
)
(setq big-board-list '("Command Description"
"-----------------------------------------------------------"
"Co Copy"
"M Move"
"Ano Automatic Numbering"
"Dr Door"
"Ww Window"
"Acal Area Calulation")
)
(setq dcl_id
(load_dialog
(setq dlgname (_make-dialog))))
(if (not (new_dialog "board" dcl_id))(exit))
(start_list "selections")
(mapcar 'add_list big-board-list)
(end_list)
;(action_tile "selections" "(setq strLst (setItems $value big-board-list))")
(action_tile "accept" "(readata) (done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq userclick (start_dialog))
(unload_dialog dcl_id)
(vl-file-delete dlgname)
(and (= 1 userclick)
(and strLst (print strLst)))
(princ)
)
ZZXXQQ 发表于 2013-4-18 08:21 static/image/common/back.gif
Try agan.
Dear sir,
Thx for valuable time
lisp not working same errorCommand: AP
APPLOAD BigBoard1.lsp successfully loaded.
Command: BIGBOARD1
; error: bad argument type: FILE nil
sachindkini 发表于 2013-4-18 13:13 static/image/common/back.gif
Dear sir,
Thx for valuable time
Try this:
...
(setq fn"d:\\$vld$.dcl"
...
Gu_xl 发表于 2013-4-18 14:21 static/image/common/back.gif
Try this:
...
(setq fn"d:\\$vld$.dcl"
dear sir,
not working
Dear Sir,
See this image i want this result with double click execute command
页:
[1]
2