明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2505|回复: 5

我下面这段代码在R14中好用,可到了R15中却不出对话框?请帮忙看看!!谢谢!!

[复制链接]
发表于 2002-12-8 21:00:00 | 显示全部楼层 |阅读模式
;这是一个基于AutoCAD 14.0下关于图框的插入的程序
;它可以插入A0-A4的图框;同时删除以前的图框
;本程序作者b.w
;本程序无偿使用
;如有更好建议,请联系b.w
;版本:1.1.00
;日期:27/12-2001

  (cond
     (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.

     (  (not (findfile "ai_utils.lsp"))                     ; find it
        (ai_abort "DDMODIFY"
                  (strcat "Can't locate file AI_UTILS.LSP."
                          "\n Check support directory.")))

     (  (eq "failed" (load "ai_utils" "failed"))            ; load it
        (ai_abort "DDMODIFY" "Can't load file AI_UTILS.LSP"))
  )

(defun B_DRAWING_HILITE
  (
  B_drawing_tile
  /
  )
  (if (/= B_drawing_last_slide B_drawing_tile)
     (progn
        (mode_tile B_drawing_tile 4)
        (if (/= B_drawing_last_slide nil)
           (mode_tile B_drawing_last_slide 4)
        );end-if
     );end-progn
  );end-if
  (setq B_drawing_last_slide B_drawing_tile)
);end-B_DRAWING_HILITE

(defun B_DRAWING_STAR;启动幻灯片
  (
  /
  )
  (foreach B_DRAWING '("B_DRAWING_A4" "B_DRAWING_A3" "B_DRAWING_A2" "B_DRAWING_A1" "B_DRAWING_A0" "B_DRAWING_A4_ZP" "B_DRAWING_A3_ZP" "B_DRAWING_A2_ZP" "B_DRAWING_A1_ZP" "B_DRAWING_A0_ZP"
    );对幻灯片库中的各幻灯片建立图象
    (start_image B_DRAWING)
    (slide_image 0 0 (dimx_tile B_DRAWING) (dimy_tile B_DRAWING) (strcat "B_DRAWING("B_DRAWING")")
    );end-silde_image从幻灯片库中调入幻灯片
    (end_image)
  );end-foreach
);end-B_DRAWING_STAR

(defun B_DRAWING_INIT;起动DCL,选择图框并分别赋值
  (
  /
  B_drawing_id
  B_drawing_old_cmd
  stat
  )
  (setq B_drawing_old_cmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq B_drawing_id (load_dialog "B_DRAWING"));装入B_DRAWING.DCL
  (if (not (new_dialog "B_DRAWING" B_drawing_id))
     (exit)
  );end-if
  (B_DRAWING_STAR)
  (setq stat 0)
  (set_tile "B_DRAWING_SCALE_DCL"  (ai_rtos (setq B_drawing_scale 1.0)))
  (set_tile "B_DRAWING_A4" (ai_rtos (setq stat 10104)))
  (action_tile "B_DRAWING_A4" "(B_DRAWING_HILITE B_DRAWING_A4) (setq stat 10104)")
  (action_tile "B_DRAWING_A3" "(B_DRAWING_HILITE B_DRAWING_A3) (setq stat 10103)")
  (action_tile "B_DRAWING_A2" "(B_DRAWING_HILITE B_DRAWING_A2) (setq stat 10102)")
  (action_tile "B_DRAWING_A1" "(B_DRAWING_HILITE B_DRAWING_A1) (setq stat 10101)")
  (action_tile "B_DRAWING_A0" "(B_DRAWING_HILITE B_DRAWING_A0) (setq stat 10100)")
  (action_tile "B_DRAWING_A4_ZP" "(B_DRAWING_HILITE B_DRAWING_A4_ZP) (setq stat 10114)")
  (action_tile "B_DRAWING_A3_ZP" "(B_DRAWING_HILITE B_DRAWING_A3_ZP) (setq stat 10113)")
  (action_tile "B_DRAWING_A2_ZP" "(B_DRAWING_HILITE B_DRAWING_A2_ZP) (setq stat 10112)")
  (action_tile "B_DRAWING_A1_ZP" "(B_DRAWING_HILITE B_DRAWING_A1_ZP) (setq stat 10111)")
  (action_tile "B_DRAWING_A0_ZP" "(B_DRAWING_HILITE B_DRAWING_A0_ZP) (setq stat 10110)")
  (action_tile "B_DRAWING_SCALE_DCL" "(setq B_drawing_scale (distof $value))")
  (action_tile "cancel" "(done_dialog)(exit)")
  (action_tile "accept" "(done_dialog stat)");初始化ACCDPT
  (setq B_drawing_what (start_dialog))
  (setvar "USERR1" B_drawing_scale)
  (cond
    ((= B_drawing_what 10100)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A0")
     (setq B_drawing_date_x (* B_drawing_scale 999.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 10.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10101)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A1")
      (setq B_drawing_date_x (* B_drawing_scale 651.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 10.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10102)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A2")
      (setq B_drawing_date_x (* B_drawing_scale 404.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 10.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10103)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A3")
      (setq B_drawing_date_x (* B_drawing_scale 235.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 5.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10104)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A4")
      (setq B_drawing_date_x (* B_drawing_scale 25.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 5.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10110)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A0_ZP")
      (setq B_drawing_date_x (* B_drawing_scale 999.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 10.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10111)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A1_ZP")
      (setq B_drawing_date_x (* B_drawing_scale 651.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 10.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10112)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A2_ZP")
      (setq B_drawing_date_x (* B_drawing_scale 404.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 10.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10113)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A3_ZP")
      (setq B_drawing_date_x (* B_drawing_scale 235.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 5.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
    ((= B_drawing_what 10114)
      (setvar "USERI1" 1)
      (setq B_drawing_name "*B_DRAWING_A4_ZP")
      (setq B_drawing_date_x (* B_drawing_scale 25.0))
      (setq B_drawing_date (list B_drawing_date_x (* B_drawing_scale 5.0) 0.0))
      (setq B_drawing_x_scale 1)
      (setq B_drawing_y_scale 1)
    )
);end-cond

);end-B_DRAWING_INIT

(defun B_DRAWING_INS;无图框时插入图框
  (
  /
  )
  (if (null B_INITVAR_SYS) (load "B_INITVAR_SYS"))
  (B_INITVAR_SYS)
  (setvar "OSMODE"        0)
  (command "insert" B_drawing_name "0,0,0" B_drawing_scale "0")
  (command "zoom" "e")
  (setvar "ATTDIA"        1)
  (setq B_drawing_date_layer (getvar "CLAYER"))
  (if (tblsearch "layer" "_TEMPLATE")
    (setvar "CLAYER" "_TEMPLATE")
  );end-if

  (command "insert" "B_DRAWING_DATA" B_drawing_date B_drawing_date_scale_x0 B_drawing_date_scale_y0 "0")
  (setvar "CLAYER" B_drawing_date_layer)
  (setvar "OSMODE"        51)
);end-B_DRAWING_INS

(defun B_DRAWING_CHANGE;更改图框
  (
  /
  B_drawing_block_sset
  B_drawing_attrib_ent
  B_drawing_attrib_data
  B_drawing_attrib_list
  B_drawing_dwgset
  B_drawing_attrib_input
  )
  (if (ssget "x" (list (cons 0 "INSERT") (cons 2 "B_DRAWING_DATA")))
    (progn
      (setq B_drawing_block_sset (ssget "x" (list (cons 0 "INSERT") (cons 2 "B_DRAWING_DATA"))))
      (setq B_drawing_attrib_ent (entnext (ssname B_drawing_block_sset 0)))
      (while (/= (cdr (assoc 0 (entget B_drawing_attrib_ent))) "SEQEND")
        (setq B_drawing_attrib_data (cdr (assoc 1 (entget B_drawing_attrib_ent))))
        (setq B_drawing_attrib_list (append B_drawing_attrib_list (list B_drawing_attrib_data)))
        (setq B_drawing_attrib_ent (entnext B_drawing_attrib_ent))
      );end-while取B_DRAWING_DATA块的属性值
      (setq B_drawing_dwgset (ssget "x" (list (cons 8 "_TEMPLATE"))))
      (if B_drawing_dwgset
        (command "erase" B_drawing_dwgset B_drawing_block_sset "")
        (command "erase" B_drawing_block_sset "")
      );end-if
      (setvar "OSMODE"        0)
      (command "insert" B_drawing_name "0,0,0" B_drawing_scale "0")
      (command "zoom" "e")
      (setvar "attdia" 0)
      (setq B_drawing_date_layer (getvar "CLAYER"))
      (if (tblsearch "layer" "_TEMPLATE")
        (setvar "CLAYER" "_TEMPLATE")
      );end-if
      (command "insert" "B_DRAWING_DATA" B_drawing_date B_drawing_date_scale_x0 B_drawing_date_scale_y0 "0")
      (setvar "OSMODE"        51)
      (while B_drawing_attrib_list
        (setq B_drawing_attrib_input (car B_drawing_attrib_list))
        (setq B_drawing_attrib_list (cdr B_drawing_attrib_list))
        (command B_drawing_attrib_input)
      );end-while
    );end-progn
    (progn
      (setq B_drawing_dwgset (ssget "x" (list (cons 8 "_TEMPLATE"))))
      (if B_drawing_dwgset
      (command "erase" B_drawing_dwgset "")
      );end-if
      (setvar "OSMODE"        0)
      (command "insert" B_drawing_name "0,0,0" B_drawing_scale "0")
      (command "zoom" "e")
      (setvar "attdia" 1)
      (setq B_drawing_date_layer (getvar "CLAYER"))
      (if (tblsearch "layer" "_TEMPLATE")
        (setvar "CLAYER" "_TEMPLATE")
      );end-if
      (command "insert" "B_DRAWING_DATA" B_drawing_date B_drawing_date_scale_x0 B_drawing_date_scale_y0 "0")
      (setvar "OSMODE"        51)
    );end-progn
  );end-if
  (setvar "CLAYER" B_drawing_date_layer)
  (setvar "attdia" 1)
);end-B_DRAWING_CHANGE

(defun B_DIM_INS;无标注时插入标注
  (
  /
  )
  (B_INITVAR_DIM)
  (setvar "DIMTIH"        1)
  (setvar "DIMTOH"        1)
  (setvar "DIMFIT"        2)
  (command "dimstyle" "S" (strcat B_drawing_dim "$3"))
  (command "dimstyle" "S" (strcat B_drawing_dim "$4"))
  (setvar "DIMFIT"        3)
  (setvar "DIMTIH"        0)
  (setvar "DIMTOH"        0)
  (command "dimstyle" "S" B_drawing_dim)
);end-B_DIM_INS

(defun B_DIM_MAKE;循环更改标注
  (
  B_drawing_den_sset
  B_dim_before
  B_dim_after
  /
  B_drawing_dim_sset_list
  B_dim_repeat_i
  )
  (setq B_dim_repeat_i 0)
  (repeat (sslength B_drawing_den_sset)
    (setq B_drawing_dim_sset_list (entget (ssname B_drawing_den_sset B_dim_repeat_i)))
    (cond
      ((= (cdr (assoc 3 B_drawing_dim_sset_list)) B_dim_before)
        (setq B_drawing_dim_sset_list (subst (cons 3 B_dim_after) (assoc 3 B_drawing_dim_sset_list) B_drawing_dim_sset_list))
      )
      ((= (cdr (assoc 3 B_drawing_dim_sset_list)) (strcat B_dim_before "$3"))
        (setq B_drawing_dim_sset_list (subst (cons 3 (strcat B_dim_after "$3")) (assoc 3 B_drawing_dim_sset_list) B_drawing_dim_sset_list))
      )
      ((= (cdr (assoc 3 B_drawing_dim_sset_list)) (strcat B_dim_before "$4"))
        (setq B_drawing_dim_sset_list (subst (cons 3 (strcat B_dim_after "$4")) (assoc 3 B_drawing_dim_sset_list) B_drawing_dim_sset_list))
      )
    );end-cond
    (entmod B_drawing_dim_sset_list)
    (setq B_dim_repeat_i (1+ B_dim_repeat_i))
  );end-repeat
);end-B_DIM_MAKE

(defun B_DIM_CHANGE;更改标注
  (
  /
  B_drawing_dim_sset
  B_drawing_lea_sset
  B_drawing_tol_sset
  B_dim_repeat_i
  B_drawing_dim_t
  )
  (setq B_drawing_dim_sset (ssget "x" (list (cons 0 "DIMENSION") (cons 3 (strcat B_drawing_dim "*")))))
  (setq B_drawing_lea_sset (ssget "x" (list (cons 0 "LEADER") (cons 3 (strcat B_drawing_dim "*")))))
  (setq B_drawing_tol_sset (ssget "x" (list (cons 0 "TOLERANCE") (cons 3 (strcat B_drawing_dim "*")))))
  (setq B_drawing_dim_t (or B_drawing_dim_sset B_drawing_lea_sset B_drawing_tol_sset))
  (if B_drawing_dim_t
    (progn
      (command "dimstyle" "S" (strcat B_dim_temp "$3"))
      (command "dimstyle" "S" (strcat B_dim_temp "$4"))
      (command "dimstyle" "S" B_dim_temp)
      (if B_drawing_dim_sset
         (B_DIM_MAKE B_drawing_dim_sset B_drawing_dim B_dim_temp)
      );end-if
      (if B_drawing_lea_sset
         (B_DIM_MAKE B_drawing_lea_sset B_drawing_dim B_dim_temp)
      );end-if
      (if B_drawing_tol_sset
         (B_DIM_MAKE B_drawing_tol_sset B_drawing_dim B_dim_temp)
      );end-if
      (command "dimstyle" "r" "STANDARD")
      (command "purge" "d" (strcat B_drawing_dim "$3") "n")
      (command "purge" "d" (strcat B_drawing_dim "$4") "n")
      (command "purge" "d" B_drawing_dim "n")
      (B_INITVAR_DIM)
      (setvar "DIMTIH"        1)
      (setvar "DIMTOH"        1)
      (setvar "DIMFIT"        2)
      (command "dimstyle" "S" (strcat B_drawing_dim "$3"))
      (command "dimstyle" "S" (strcat B_drawing_dim "$4"))
      (setvar "DIMFIT"        3)
      (setvar "DIMTIH"        0)
      (setvar "DIMTOH"        0)
      (command "dimstyle" "S" B_drawing_dim)
      (if (/= B_drawing_lea_sset nil)
        (B_DIM_MAKE B_drawing_lea_sset B_dim_temp B_drawing_dim)
      );end-if
      (if (/= B_drawing_dim_sset nil)
        (B_DIM_MAKE B_drawing_dim_sset B_dim_temp B_drawing_dim)
      );end-if
      (if (/= B_drawing_tol_sset nil)
        (B_DIM_MAKE B_drawing_tol_sset B_dim_temp B_drawing_dim)
      );end-if
      (command "purge" "d" (strcat B_dim_temp "$3") "n")
      (command "purge" "d" (strcat B_dim_temp "$4") "n")
      (command "purge" "d" B_dim_temp "n")
    );end-progn
    (progn
      (command "dimstyle" "r" "STANDARD")
      (command "purge" "d" (strcat B_drawing_dim "$3") "n")
      (command "purge" "d" (strcat B_drawing_dim "$4") "n")
      (command "purge" "d" B_drawing_dim "n")
      (B_INITVAR_DIM)
      (setvar "DIMTIH"        1)
      (setvar "DIMTOH"        1)
      (setvar "DIMFIT"        2)
      (command "dimstyle" "S" (strcat B_drawing_dim "$3"))
      (command "dimstyle" "S" (strcat B_drawing_dim "$4"))
      (setvar "DIMFIT"        3)
      (setvar "DIMTIH"        0)
      (setvar "DIMTOH"        0)
      (command "dimstyle" "S" B_drawing_dim)
    );end-progn
  );end-if
);end-B_DIM_CHANGE


(defun B_DRAWING
  (
  /
  B_drawing_what
  B_drawing_name
  B_drawing_exist
  B_drawing_last_slide
  B_drawing_tile
  B_drawing_date
  B_drawing_scale
  B_drawing_date_x
  B_drawing_x_scale
  B_drawing_y_scale
  B_drawing_date_scale_x0
  B_drawing_date_scale_y0
  B_drawing_date_layer
  B_drawing_dim
  B_dim_temp
  )
  (setvar "ATTDIA"        1)
  (B_DRAWING_INIT)
  (if (null B_INITVAR_DIM) (load "B_INITVAR_DIM"))
  (setq B_drawing_dim "B_DRAWING_DIM")
  (setq B_dim_temp "B_DIM_TEMP")
  (if (= (tblsearch "DIMSTYLE" B_drawing_dim) nul)
     (B_DIM_INS)
     (B_DIM_CHANGE)
  );end-if
  (setq B_drawing_date_scale_x0 (* B_drawing_scale B_drawing_x_scale))
  (setq B_drawing_date_scale_y0 (* B_drawing_scale B_drawing_y_scale))
  (setq B_drawing_exist (tblsearch "BLOCK" "B_DRAWING_DATA"))
  (if B_drawing_exist
    (B_DRAWING_CHANGE)
    (B_DRAWING_INS)
  );end-if
  (setvar "ORTHOMODE"        1)
  (setvar "ATTDIA"        1)
  (princ)
);end-B_DRAWING
发表于 2002-12-12 13:16:00 | 显示全部楼层

B_DRAWING.DCL, *.dwg在那裡,你沒有附上???

发表于 2002-12-13 12:39:00 | 显示全部楼层

我在R15試過了,沒有問題???

 楼主| 发表于 2003-2-18 10:16:00 | 显示全部楼层

re:

可是我怎么试都是出现不了对话框,唉
发表于 2003-2-18 12:37:00 | 显示全部楼层

对话框閃一下不見了or完全不出現???

 楼主| 发表于 2003-7-5 17:34:00 | 显示全部楼层
是出现的命令行,完全没有对话框
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-29 01:41 , Processed in 0.183508 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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