明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2093|回复: 8

那里错了…………[求助]

[复制链接]
发表于 2003-2-16 19:05:00 | 显示全部楼层 |阅读模式
(defun c:aw (/ dcl_id n x y
I:Path name ai_nam ai_dwg| ai_sld|
show_titer getinf lib_dwg blk_sld jdcad_blk
current_line all_dwg_list all_sld_list
)
(defun show_titer ()
(if (not (setq filename (findfile "jdcad.blk")))
(setq filename "jdcad.blk")
)
(if (setq jdcad_blk (open filename "r"))
(progn
(setq current_line (read-line jdcad_blk))
(while (and (/= "" current_line)
(/= nil current_line)
(/= ":" (substr current_line 1 1))
)
(setq current_line (read-line jdcad_blk))
(while current_line
(setq name (substr current_line 10))
(setq all_dwg_list (cons name all_dwg_list))
(setq all_lib_list (cons name all_lib_list))
(setq current_line (read-line jdcad_blk))
(while (/= ":" (substr current_line 1 1))
(setq lib_dwg (cons (read current_line) lib_dwg))
(setq current_line (read-line jdcad_blk))
)
(set (read (strcat "ai_dwg|" name))
(reverse lib_dwg)
)
(setq lib_dwg '())
(setq current_line (read-line jdcad_blk))
(while
(and current_line
(/= ":" (substr current_line 1 1))
)
(setq current_line (read-line jdcad_blk))
(< (length all_dwg_list) (getvar "maxsort"))
)
(setq all_dwg_list (acad_strlsort all_dwg_list))
)
(start_list "blk_path")
(mapcar 'add_list all_dwg_list)
(end_list)
(set_tile "blk_path" "0")
(close jdcad_blk)
)
)
)
(if (not (setq filename (findfile "jdcad.blk")))
(setq filename "jdcad.blk")
)
(if (setq jdcad_blk (open filename "r"))
(progn
(setq current_line (read-line jdcad_blk))
(while (and (/= "" current_line)
(/= nil current_line)
(/= ":" (substr current_line 1 5))
)
(setq current_line (read-line jdcad_blk))
(while current_line
(setq name (substr current_line 10))
(setq all_sld_list (cons name all_sld_list))
(setq current_line (read-line jdcad_blk))
(while (/= ":" (substr current_line 1 1))
(setq blk_sld (cons (read current_line) blk_sld))
(setq current_line (read-line jdcad_blk))
)
(set (read (strcat "ai_sld|" name))
(reverse blk_sld)
)
(setq blk_sld '())
(setq current_line (read-line jdcad_blk))
(while
(and current_line
(/= ":" (substr current_line 1 5))
)
(setq current_line (read-line jdcad_blk))
(< (length all_sld_list) (getvar "maxsort"))
)
(setq all_sld_list (acad_strlsort all_sld_list))
)
(start_list "sld_path")
(mapcar 'add_list all_sld_list)
(end_list)
(set_tile "sld_path" "0")
(close jdcad_blk)
)
)
)
)
(defun getinf (/ x y FIL)
;;(setq X (dimx_tile "show tit")
;;Y (dimy_tile "show tit")
;;)
(setq FIL (findfile "*.sld"))
(if (>= n 5)
(setq n 1)
)
(cond
((= n 1)
(start_image "show_tit")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y "tk0")
)
((= n 2)
(start_image "show_tit")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y "tk1")
)
((= n 3)
(start_image "show_tit")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y "tk2")
)
((= n 4)
(start_image "show_tit")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y "tk3")
)
((= n 5)
(start_image "show_tit")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y "tk4")
)
((= n 6)
(start_image "show_tit")
(fill_image 0 0 x y 0)
(slide_image 0 0 x y "tk5")
)
(t nil)
;;(setq n (+ n 1))
)
)
(mapcar 'setvar '("cmdecho" "blipmode") '(0 0))
(setq dcl_id (load_dialog "tmp.dcl"))
(if (not (new_dialog "aw" dcl_id))
(exit)
;;(progn
;;(start_image "show tit")
;;(fill_image 0 0 (dimx_tile "show tit") (dimy_tile "show tit") 0)
;;(slide_image 0 0 (dimx_tile "show tit") (dimy_tile "show tit")
;;"acad.slb(1)"
;;)
;;)
)
;;(set_tile "path" I:Path)
(setq show_tit "show_sld")
(setq X (dimx_tile "show_tit")
Y (dimy_tile "show_tit")
)
(start_image "show_tit")
(slide_image 0 -10 X Y "ydblk.sld")
(end_image)
(action_tile "show_tit" "(getinf)")(mode_tile "show_tit" 2)
(start_dialog)
(unload_dialog dcl_id)
)
(princ "\n欢迎浏览图库!")
(princ)
;;;=========================================================================
//对话框的文件名假设为d:/tmp.dcl
aw : dialog {
label = "浏览";
: concatenation {
: text {
label = "名称:";
fixed_width = true;
}
: text {
//label = " ";
key = "blk_name";
width = 20;
}
: text {
label = "序号:";
}
: text {
//label = " ";
key = "blk_path";
width = 20;
}
: text {
label = "幻灯:";
}
: text {
//label = " ";
key = "sld_path";
width = 20;
}
}
: boxed_column {
label = "图块";
: image_button {
key = "show_tit";
height = 30;
width = 60;
color = -2;
}spacer;
}spacer;
ok_only;
}
//=============================================================================
/// jdcad.blk -- Do not edit this file.
/// 第一行存图块中文名称
/// 第二行存图块编号名称
/// 第三行存图块幻灯名称
///=============================================
:ai_nam|单开门
:ai_dwg|tk0
:ai_sld|tk0
:ai_nam|双开门
:ai_dwg|tk1
:ai_sld|tk1
:ai_nam|旋转门
:ai_dwg|tk2
:ai_sld|tk2
:ai_nam|自动门
:ai_dwg|tk3
:ai_sld|tk3

发表于 2003-2-17 15:29:00 | 显示全部楼层

请问你觉得有什么问题,这样让别人比较容易找出错些...

首先指出一点,因为你的文件不在CAD的搜索目录里,所以在加载这些文件时应写上文件的完整路径。
发表于 2003-2-17 15:32:00 | 显示全部楼层

回复

正在读ing
发表于 2003-2-17 16:32:00 | 显示全部楼层

回复

(while (and current_line (/= ":" (substr current_line 1 5)) ;)这里多了一个括号
            (setq current_line (read-line jdcad_blk))
            (< (length all_sld_list) (getvar "maxsort"))
       )
       (setq all_sld_list (acad_strlsort all_sld_list))
)
不知道找的地方是否正确,不过发现了一些重复的地方,如果有需要,请将详细的说明文件和程序发往superleon100@163.net.我帮你修改.别忘了还有幻灯片。
发表于 2003-2-18 10:53:00 | 显示全部楼层

重写,可能不是你要的!!!!

本帖最后由 作者 于 2003-2-18 10:53:41 编辑

;;重写,可能不是你要的!!!!
(defun C:AW (/                  DCL_ID       AA            BB
             WHAT_NEXT          ALL_NAME_LIST                    ALL_DWG_LIST
             ALL_LIB_LIST
            )

  (defun DCL_IMAGE (DCL_KEY IMAGE_NAME)
    (start_image DCL_KEY)
    (setq IMG_WIDTH  (dimx_tile DCL_KEY)
          IMG_HEIGHT (dimy_tile DCL_KEY)
    )
    (fill_image 0 0 IMG_WIDTH IMG_HEIGHT -2)
    (slide_image -8 -13 IMG_WIDTH IMG_HEIGHT IMAGE_NAME)
    (end_image)
  )

  (defun SHOW_TITER (/ FILENAME JDCAD_BLK CURRENT_LINE NAME DWG LIB)
    (if        (setq JDCAD_BLK (open (findfile "jdcad.blk") "r"))
      (progn
        (setq CURRENT_LINE (read-line JDCAD_BLK))
        (while (= "/" (substr CURRENT_LINE 1 1))
          (setq CURRENT_LINE (read-line JDCAD_BLK))
        )
        (while CURRENT_LINE
          (setq NAME (substr CURRENT_LINE 9))
          (setq ALL_NAME_LIST (cons NAME ALL_NAME_LIST))
          (setq CURRENT_LINE (read-line JDCAD_BLK))
          (setq DWG (substr CURRENT_LINE 9))
          (setq ALL_DWG_LIST (cons DWG ALL_DWG_LIST))
          (setq CURRENT_LINE (read-line JDCAD_BLK))
          (setq LIB (substr CURRENT_LINE 9))
          (setq ALL_LIB_LIST (cons LIB ALL_LIB_LIST))
          (setq CURRENT_LINE (read-line JDCAD_BLK))
        )
        (close JDCAD_BLK)
      )
    )
    (setq ALL_NAME_LIST (reverse ALL_NAME_LIST))
    (setq ALL_DWG_LIST (reverse ALL_DWG_LIST))
    (setq ALL_LIB_LIST (reverse ALL_LIB_LIST))
  )

  (defun SHOW_LIST ()
    (start_list "blk_name")
    (mapcar 'add_list ALL_NAME_LIST)
    (end_list)
    (start_list "blk_path")
    (mapcar 'add_list ALL_DWG_LIST)
    (end_list)
    (start_list "sld_path")
    (mapcar 'add_list ALL_LIB_LIST)
    (end_list)
   )

  (defun SHOW_LIST1 ()
    (set_tile "blk_name" (itoa (- BB 1)))
    (set_tile "blk_path" (itoa (- BB 1)))
    (set_tile "sld_path" (itoa (- BB 1)))
  )

  (defun GETINF        ()
    (if        (= BB (length ALL_LIB_LIST))
      (setq BB 1)
      (setq BB (+ BB 1))
    )
    (setq AA (nth (- BB 1) ALL_LIB_LIST))
    (DCL_IMAGE "show_tit" AA)
  )

  (setq DCL_ID (load_dialog "aw"))
  (if (not (new_dialog "aw" DCL_ID))
    (exit)
  )
  (SHOW_TITER)
  (setq AA (nth 0 ALL_LIB_LIST))
  (setq BB 0)
  (SHOW_LIST)
  (SHOW_LIST1)
  (GETINF)
  (setq WHAT_NEXT 5)
  (while (< 2 WHAT_NEXT)
    (action_tile "show_tit" "(getinf)(show_list1)")
    (action_tile
      "blk_name"
      "(setq bb (atoi $value))(getinf)(show_list1)"
    )
    (action_tile
      "blk_path"
      "(setq bb (atoi $value))(getinf)(show_list1)"
    )
    (action_tile
      "sld_path"
      "(setq bb (atoi $value))(getinf)(show_list1)"
    )
    (action_tile "accept" "(done_dialog 4)")
    (setq WHAT_NEXT (start_dialog))
    (cond
      ;;((= WHAT_NEXT 3)
      ;;(GETINF)
      ;;)
      ((= WHAT_NEXT 4)
       (setq WHAT_NEXT 1)
       (done_dialog)
       (unload_dialog DCL_ID)
      )
    )
  )
  (princ)
)
(princ "\n欢迎浏览图库!")
(princ)



//对话框的文件名假设为d:/tmp.dcl
aw : dialog {
        label = "浏览";
        : concatenation {
                : text {
                        label        = "名称:";
                        fixed_width  = true;
                        }
                : popup_list {
                        key          = "blk_name";
                        width        = 20;
                        }
                : text {
                        label        = "序号:";
                        }
                : popup_list {
                        key          = "blk_path";
                        width        = 20;
                        }
                : text {
                        label        = "幻灯:";
                        }
                : popup_list {
                        key          = "sld_path";
                        width        = 20;
                        }
                }
        : boxed_column {
                label = "图块";
                : image_button{
                        key = "show_tit";
                        height = 32;
                        width = 90;
                        color = -2;
                        }spacer;
                }spacer;
        ok_only;
        }

[此贴子已经被作者于2003-2-18 10:12:13编辑过]




[此贴子已经被作者于2003-2-18 10:17:58编辑过]
发表于 2003-2-18 08:55:00 | 显示全部楼层

回复

同意龙龙仔的修改。不过龙仔只考虑了文件jjdcad.blk的规律性,没有考虑它的无限性。我觉得他这个文件决不是这么简单的几行,最起码他的幻灯文件名
都没写全。
 楼主| 发表于 2003-2-21 14:59:00 | 显示全部楼层

谢意

谢谢各位大侠,按龙龙仔的回复实现了,弹出列表框与图像按钮斗正确了;
如果要在对话框中用 text 动态的显示列表的内容(字符串)用什么命令?
发表于 2003-2-21 17:11:00 | 显示全部楼层

动态的显示列表的内容!!!說詳細點!!

 楼主| 发表于 2003-2-21 22:53:00 | 显示全部楼层

随幻灯显示相关名称、序号,实际就是将前面的弹出列表的内容在text显示

[此贴子已经被作者于2003-2-21 22:53:03编辑过]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 05:37 , Processed in 0.184296 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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