明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4460|回复: 10

[源码] LISP NOT WORKING

[复制链接]
发表于 2013-4-17 19:54:51 | 显示全部楼层 |阅读模式
本帖最后由 sachindkini 于 2013-4-17 19:57 编辑

dear sir
this lisp working in 2011 but not working 2013 (windows 8 64 bit)

  1. Command: BIGBOARD
  2. ; error: bad argument type: FILE nil
复制代码
  1. (defun C:BigBoard ( / userclick dlgname dcl_id  big-board-list _make-dialog)
  2.   ;; bigboard
  3.   (defun _make-dialog ( / fn f dcl )
  4.     (setq fn (strcat (vl-filename-directory (findfile "acad.exe"))"\\$vld$.dcl")
  5.           f (open fn "w")
  6.           dcl
  7.           '(
  8.             "board : dialog {"
  9.             ": list_box {"
  10.             "key = "selections";"
  11.             "multiple_select = true;"
  12.             "height = 19;"
  13.             "allow_accept = true;"
  14.             "}"
  15.             "ok_cancel;"
  16.             "}"
  17.             )
  18.           )
  19.     (mapcar
  20.       (function
  21.         (lambda ( x )
  22.           (princ x f)
  23.           (princ "\n" f)
  24.           )
  25.         )
  26.       dcl
  27.       )
  28.     (close f)
  29.     fn
  30.     )
  31.   (defun setItems (val lst / ret)
  32.     (foreach n (mapcar (function (lambda (n) (- n 48)))
  33.                        (vl-remove 32 (vl-string->list val))
  34.                        )
  35.              (setq ret (cons (nth n lst) ret))
  36.              )
  37.     (reverse ret)
  38.     )
  39.   (setq big-board-list '("Command           Description"
  40.                          "-----------------------------------------------------------"
  41.                          "Co                      Copy"
  42.                          "M                       Move"
  43.                          "Ano                    Automatic Numbering"
  44.                          "Dr                      Door"
  45.                          "Ww                    Window"
  46.                          "Acal                   Area Calulation")
  47.         )
  48.   (setq dcl_id
  49.         (load_dialog
  50.           (setq dlgname (_make-dialog))))
  51.   (if (not (new_dialog "board" dcl_id))(exit))
  52.   (start_list "selections")
  53.   (mapcar 'add_list big-board-list)
  54.   (end_list)
  55.   (action_tile "selections" "(setq strLst (setItems $value big-board-list))")
  56.   (setq userclick (start_dialog))
  57.   (unload_dialog dcl_id)
  58.   (vl-file-delete dlgname)
  59.   (and (= 1 userclick)
  60.        (and strLst (print strLst)))
  61. (princ)
  62. )

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2013-4-17 20:25:16 | 显示全部楼层
本帖最后由 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!
 楼主| 发表于 2013-4-17 21:32:27 | 显示全部楼层
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 v ...

dear sir,
over the head
发表于 2013-4-17 22:07:36 | 显示全部楼层
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.
 楼主| 发表于 2013-4-17 22:46:10 | 显示全部楼层
mccad 发表于 2013-4-17 22:07
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????
发表于 2013-4-18 08:21:58 | 显示全部楼层
Try agan.
  1. (defun C:BigBoard ( / userclick dlgname dcl_id  big-board-list _make-dialog)
  2.   ;; bigboard
  3.   (defun _make-dialog ( / fn f dcl )
  4.     (setq fn (strcat (vl-filename-directory (findfile "acad.exe"))"\\$vld$.dcl")
  5.           f (open fn "w")
  6.           dcl
  7.           '(
  8.             "board : dialog {"
  9.             ": list_box {"
  10.             "key = \"selections\";"
  11.             "multiple_select = true;"
  12.             "height = 19;"
  13. ;            "allow_accept = true;"
  14.             "}"
  15.             "ok_cancel;"
  16.             "}"
  17.             )
  18.           )
  19.     (mapcar
  20.       (function
  21.         (lambda ( x )
  22.           (princ x f)
  23.           (princ "\n" f)
  24.           )
  25.         )
  26.       dcl
  27.       )
  28.     (close f)
  29.     fn
  30.     )
  31. ;  (defun setItems (val lst / ret)
  32. ;    (foreach n (mapcar (function (lambda (n) (- n 48)))
  33. ;                       (vl-remove 32 (vl-string->list val))
  34. ;                       )
  35. ;             (setq ret (cons (nth n lst) ret))
  36. ;             )
  37. ;    (reverse ret)
  38. ;    )
  39.   (defun setItems (val lst / ret)
  40.    (foreach n (read(strcat "(" val ")")) (setq ret (cons (nth n lst) ret)))
  41.    (reverse ret)
  42.   )
  43.   (defun readata ()
  44.    (setq strlst (setitems (get_tile "selections") big-board-list))
  45.   )
  46.   (setq big-board-list '("Command           Description"
  47.                          "-----------------------------------------------------------"
  48.                          "Co                      Copy"
  49.                          "M                       Move"
  50.                          "Ano                    Automatic Numbering"
  51.                          "Dr                      Door"
  52.                          "Ww                    Window"
  53.                          "Acal                   Area Calulation")
  54.   )
  55.   (setq dcl_id
  56.         (load_dialog
  57.           (setq dlgname (_make-dialog))))
  58.   (if (not (new_dialog "board" dcl_id))(exit))
  59.   (start_list "selections")
  60.   (mapcar 'add_list big-board-list)
  61.   (end_list)
  62. ;  (action_tile "selections" "(setq strLst (setItems $value big-board-list))")
  63.   (action_tile "accept" "(readata) (done_dialog 1)")
  64.   (action_tile "cancel" "(done_dialog 0)")
  65.   (setq userclick (start_dialog))
  66.   (unload_dialog dcl_id)
  67.   (vl-file-delete dlgname)
  68.   (and (= 1 userclick)
  69.        (and strLst (print strLst)))
  70. (princ)
  71. )
 楼主| 发表于 2013-4-18 13:13:55 | 显示全部楼层
ZZXXQQ 发表于 2013-4-18 08:21
Try agan.

Dear sir,

Thx for valuable time

lisp not working same error
  1. Command: AP
  2. APPLOAD BigBoard1.lsp successfully loaded.

  3. Command: BIGBOARD1
  4. ; error: bad argument type: FILE nil
复制代码
发表于 2013-4-18 14:21:22 | 显示全部楼层
sachindkini 发表于 2013-4-18 13:13
Dear sir,

Thx for valuable time

Try this:
...
(setq fn  "d:\\$vld$.dcl"
...
 楼主| 发表于 2013-4-18 17:15:39 | 显示全部楼层
Gu_xl 发表于 2013-4-18 14:21
Try this:
...
(setq fn  "d:\\$vld$.dcl"

dear sir,

not working
 楼主| 发表于 2013-4-18 17:46:07 | 显示全部楼层


Dear Sir,
See this image i want this result with double click execute command

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-12-8 04:56 , Processed in 0.193785 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表