找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 569|回复: 1

[求助] [求助]:帮忙看看这个程序错在哪里

[复制链接]
发表于 2006-4-3 11:37:16 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
(defun c:hfbz(/ issbhn drawisyhb ts dcl_id draw_hf isshb1 dcl old_dim dimname
            isxch issbh isyhb isyhbn isyhbn1 iswh isxth edit1 edit2 edit3 edit4
            pt1 pt2 pt3 pt33 pt3a pt3a1 pt3a2 pt3b pt3b1 pt3b2 pt3c pt3c1 pt3c2 pt3d pt3ba pt3b1a
            pt4 pt5 pt6 pt6a pt7 pt7a pt7b pt7c ptxth ang1 pt8 pt8a pt8b x1 y1 x2 y2 ang)
  (setvar "cmdecho" 0)
  (setq issbhn 0.5)
  (setq isyhbn 0.5)
  (setq isyhbn1 0)
  (setq drawisyhb 1)

  (setq ts (tblsearch "layer" "TEXT"))
  (if (null ts)                                            
    (progn                                                
         (prompt (strcat "\nCreating new layer: TEXT" ))     
         (princ "\n")                                      
         (command "_layer" "new" "TEXT" "c" "2" "TEXT" "")  
    )                                                      
  );end text
  (setq ts (tblsearch "layer" "H"))
  (if (null ts)                                            
    (progn                                                
         (prompt (strcat "\nCreating new layer: H" ))     
         (princ "\n")                                      
         (command "_layer" "new" "H" "c" "4" "H" "L" "HIDDEN" "H" "")  
    )                                                      
  )
  
  (dcl_bzhf)
  (prin1)
  )
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(defun dcl_bzhf()
  (setq dcl_id (load_dialog "bzhf"))
  (new_dialog "bzhf" dcl_id)
  (set_tile "jhf" "1")
  (setq draw_hf 1)
  (setq issbh1 1)
  (mode_tile "isyhb" 1)
  (mode_tile "isyhb" 2)
  (mode_tile "text2" 1)
  (mode_tile "edit2" 1)
  (mode_tile "text3" 1)
  (mode_tile "edit3" 1)
  (mode_tile "text4" 1)
  (mode_tile "edit4" 1)
  (set_tile "text1" "焊缝高度a:")
  (set_tile "edit1" "6")
  (action_tile "jhf" "(sub_jhf)")
  (action_tile "shf" "(sub_shf)")
  (action_tile "djh" "(sub_djh)")
  (action_tile "sbvxh" "(sub_sv)")
  (action_tile "dbvxh" "(sub_dv)")
  (action_tile "issbh" "(sub_issbh)")
  (action_tile "isyhb" "(sub_isyhb)")
  (action_tile "accept" "(ok) (done_dialog 1)")
  (action_tile "cacel" "(done_dialog 2)")
  (setq dcl (start_dialog))
  (if (= dcl 1)
      (cond ((= draw_hf 1) (jhf))
            ((= draw_hf 2) (shf))
            ((= draw_hf 3) (djh))
            ((= draw_hf 4) (sv))
            ((= draw_hf 5) (dv))
            (t (exit))
        );end cond
    (exit)
    );end if
  );end dcl_bzhf
************
(defun ok()
  (setq isxch (get_tile "isxch" ))
  (setq issbh (get_tile "issbh"))
  (setq isyhb (get_tile "isyhb"))
  (setq iswh (get_tile "iswh"))
  (setq isxth (get_tile "isxth"))
  (setq iswqht (get_tile "iswqht"))
  (setq edit1 (get_tile "edit1"))
  (setq edit2 (get_tile "edit2"))
  (setq edit3 (get_tile "edit3"))
  (setq edit4 (get_tile "edit4"))
  )
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(defun sub_jhf()
  (set_tile "edit1" "6")
  (mode_tile "isyhb" 1)
  (mode_tile "iswh" 0)
  (mode_tile "issbh" 0)
  (mode_tile "text3" 1)
  (mode_tile "edit3" 1)
  (mode_tile "text4" 1)
  (mode_tile "edit4" 1)
  (set_tile "text1" "焊缝高度a:")
  (setq issbh1 1)
  (setq isyhb1 1)
  (setq draw_hf 1)
)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(defun sub_shf()
  (mode_tile "issbh" 1)
  (mode_tile "isyhb" 1)
  (mode_tile "iswh" 1)
  (mode_tile "text2" 1)
  (mode_tile "edit2" 1)
  (mode_tile "text3" 1)
  (mode_tile "edit3" 1)
  (mode_tile "text4" 1)
  (mode_tile "edit4" 1)
  (set_tile "text1" "焊缝高度")
  (set_tile "edit1" "6")
  (setq issbh1 0)
  (setq isyhb1 0)
  (setq draw_hf 2)
)
!!!!!!!!!!!!!!!!!!!!!!!!
(defun sub_djh()
  (mode_tile "iswh" 1)
  (mode_tile "issbh" 0)
  (if (= drawisyhb 0)
    (mode_tile "isyhb" 1)
    (mode_tile "isyhb" 0)
    )
  (mode_tile "text2" 1)
  (mode_tile "edit2" 1)
  (mode_tile "text3" 1)
  (mode_tile "edit3" 1)
  (mode_tile "text4" 1)
  (mode_tile "edit4" 1)
  (set_tile "text1" "预留宽度:")
  (set_tile "edit1" "2")
  (setq issbh1 2)
  (setq isyhb1 2)
  (setq draw_hf 3)
  )
!!!!!!!!!!!!!!!!!!!!!!!!
(defun sub_sv()
  (mode_tile "iswh" 0)
  (mode_tile "issbh" 0)
  (if (= drawisyhb 0)
    (mode_tile "isyhb" 1)
    (mode_tile "isyhb" 0)
    )
  (mode_tile "text2" 0)
  (mode_tile "edit2" 0)
  (mode_tile "text3" 0)
  (mode_tile "edit3" 0)
  (mode_tile "text4" 1)
  (mode_tile "edit4" 1)
  (set_tile "text1" "间隙:")
  (set_tile "edit1" "2")
  (set_tile "text2" "钝边:")
  (set_tile "edit2" "2")
  (set_tile "text3" "坡口角度:")
  (set_tile "edit3" "60")
  (setq issbh1 2)
  (setq isyhb1 2)
  (setq draw_hf 4)
  )
!!!!!!!!!!!!!!!!!!!!!!!!!
(defun sub_dv()
  (mode_tile "iswh" 0)
  (mode_tile "issbh" 0)
  (if (= drawisyhb 0)
    (mode_tile "isyhb" 1)
    (mode_tile "isyhb" 0)
    )
  (mode_tile "text2" 0)
  (mode_tile "edit2" 0)
  (mode_tile "text3" 0)
  (mode_tile "edit3" 0)
  (mode_tile "text4" 1)
  (mode_tile "edit4" 1)
  (set_tile "text1" "间隙:")
  (set_tile "edit1" "2")
  (set_tile "text2" "钝边:")
  (set_tile "edit2" "2")
  (set_tile "text3" "坡口角度:")
  (set_tile "edit3" "45")
  (setq issbh1 2)
  (setq isyhb1 2)
  (setq draw_hf 5)
  )
!!!!!!!!!!!!!!!!!!!!!!!!!
(defun sub_issbh()
  (setq issbhn (+ 0.5 issbhn))
  (if (= issbh1 2)
    (if (= (member issbhn '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)) nil)
      (progn
        (mode_tile "isyhb" 0)
        (setq issbh "1")
        (setq drawisyhb 1)
        (if (= isyhbn1 1)
          (set_tile "edit1" "6")
          )
        )
      (progn
        (mode_tile "isyhb" 1)
        (setq issbh "0")
        (setq drawisyhb 0)
        (set_tile "edit1" "2")
        )
      );end if issbh1=2
    (if (= (member issbhn '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)) nil)
      (progn
        (mode_tile "text2" 1)
        (mode_tile "edit2" 1)
        (setq drawisyhb 1)
        (setq issbh "1")
        )
      (progn
        (mode_tile "text2" 0)
        (mode_tile "edit2" 0)
        (set_tile "text2" "焊缝高度b:")
        (setq drawisyhb 0)
        (setq issbh "0")
        )
      );end if issbh1=2
    )
  )
!!!!!!!!!!!!!!!!!!!!!!!!!
(defun sub_isyhb()
  (setq isyhbn (+ 0.5 isyhbn))
  (if (= isyhb1 2)
    (if (= (member isyhbn '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)) nil)
      (progn
        (set_tile "edit1" "2")
        (setq isyhbn1 0)
        )
      (progn
        (set_tile "edit1" "6")
        (setq isyhbn1 1)
        )
      )
  )
  )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  角焊缝
(defun jhf()
  (pt)
  (if (= isxch "1")
    (hfxch)
    )
  (hfdim)
  (if (<= x1 x2)
    (progn
      (setq pt3 (list (+ x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))));文字点
      (setq pt33 (list (+ x2 (* #tsc 4.5)) (- y2 (* #tsc 3.7))));文字点1
      (setq pt3a (list (+ x2 (* #tsc 7)) y2));角起点1
      (setq pt3b (list (+ x2 (* #tsc 7)) (+ y2 (* #tsc 2.5))));角上点2
      (setq pt3b1 (list (+ x2 (* #tsc 7)) (- y2 (* #tsc 2.5))));角下点2
      (setq pt3c (list (+ x2 (* #tsc 9.5)) y2));角落点3
      (setq pt3d (list (+ x2 (* #tsc 13)) y2));线落点
      )
    (progn
      (setq pt3 (list (- x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))));文字点
      (setq pt33 (list (- x2 (* #tsc 4.5)) (- y2 (* #tsc 3.7))));文字点1
      (setq pt3a (list (- x2 (* #tsc 7)) y2));角起点1
      (setq pt3b (list (- x2 (* #tsc 7)) (+ y2 (* #tsc 2.5))));角上点2
      (setq pt3b1 (list (- x2 (* #tsc 7)) (- y2 (* #tsc 2.5))));角下点2
      (setq pt3c (list (- x2 (* #tsc 9.5)) y2));角落点3
      (setq pt3d (list (- x2 (* #tsc 13)) y2));线落点
      )
    )
  (command "text" "j" "bc" "non" pt3 (* #tsc 3) 0 edit1)
  (command "change" "l" "" "p" "la" "TEXT" "")
  (if (= issbh "1")
    (progn
      (command "text" "j" "bc" "non" pt33 (* #tsc 3) 0 edit2)
      (command "change" "l" "" "p" "la" "TEXT" "")
      )
    )
  ;(command "pline" "non" pt2 "non" pt3d "")
; (command "change" "l" "" "p" "la" "weld" "")
  (command "pline" "non" pt2 "non" pt3d "non" pt3a "non" pt3b "non" pt3c "")
  (command "change" "l" "" "p" "la" "weld" "")
  (if (= issbh "1")
    (progn
      (command "pline" "non" pt3a "non" pt3b1 "non" pt3c "")
      (command "change" "l" "" "p" "la" "weld" "")
      );end progn
    );end sbh
  (if (= iswh "1")
    (progn
      (command "circle" "non" pt2 (* #tsc 1) "")
      (command "change" "l" "" "p" "la" "weld" "")
      )
    )
  (if (= isxth "1")
    (hfxth)
    )
  (prin1)
  );end jhf
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!塞焊缝
(defun shf()
  (pt)
  (if (= isxch "1")
    (hfxch)
    )
  (hfdim)
  (if (<= x1 x2)
    (progn
      (setq pt3 (list (+ x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))));文字点
      (setq pt3a (list (+ x2 (* #tsc 7.5)) y2));角起点1
      (setq pt3b (list (+ x2 (* #tsc 7)) (+ y2 (* #tsc 2))));角上点2
      (setq pt3b1 (list (+ x2 (* #tsc 10.5)) (+ y2 (* #tsc 2))));角下点3
      (setq pt3c (list (+ x2 (* #tsc 10)) y2));角落点4
      (setq pt3d (list (+ x2 (* #tsc 13)) y2));线落点
      )
    (progn
      (setq pt3 (list (- x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))));文字点
      (setq pt3a (list (- x2 (* #tsc 7.5)) y2));角起点1
      (setq pt3b (list (- x2 (* #tsc 7)) (+ y2 (* #tsc 2))));角上点2
      (setq pt3b1 (list (- x2 (* #tsc 10.5)) (+ y2 (* #tsc 2))));角下点2
      (setq pt3c (list (- x2 (* #tsc 10)) y2));角落点3
      (setq pt3d (list (- x2 (* #tsc 13)) y2));线落点
      )
    )
  (command "text" "j" "bc" "non" pt3 (* #tsc 3) 0 edit1);写文字
  (command "change" "l" "" "p" "la" "TEXT" "")
  ;(command "pline" "non" pt2 "non" pt3d "")
  ;(command "change" "l" "" "p" "la" "weld" "")
  (command "pline" "non" pt2 "non" pt3d "non" pt3a "non" pt3b "non" pt3b1 "non" pt3c "")
  (command "change" "l" "" "p" "la" "weld" "")
  (if (= isxth "1")
    (hfxth)
    )
  (prin1)
  );end shf
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!对接焊
(defun djh()
  (pt)
  (if (= isxch "1")
    (hfxch)
    )
  (hfdim)
  (if (<= x1 x2)
    (progn
      (setq pt3 (list (+ x2 (* #tsc 8)) (+ y2 (* #tsc 0.7))));文字点
      (setq pt3a (list (+ x2 (* #tsc 6.5)) y2));角起点1
      (setq pt3b (list (+ x2 (* #tsc 6.5)) (+ y2 (* #tsc 4))));角落点2
      (setq pt3ba (list (+ x2 (* #tsc 6.5)) (- y2 (* #tsc 4))));角落点2
      (setq pt3b1 (list (+ x2 (* #tsc 9.5)) (+ y2 (* #tsc 4))));角落点2a
      (setq pt3b1a (list (+ x2 (* #tsc 9.5)) (- y2 (* #tsc 4))));角落点2a
      (setq pt3c (list (+ x2 (* #tsc 9.5)) y2));角起点1a
      (setq pt3d (list (+ x2 (* #tsc 13)) y2));线落点
      )
    (progn
      (setq pt3 (list (- x2 (* #tsc 8)) (+ y2 (* #tsc 0.7))));文字点
      (setq pt3a (list (- x2 (* #tsc 6.5)) y2));角起点1
      (setq pt3b (list (- x2 (* #tsc 6.5)) (+ y2 (* #tsc 4))));角落点2
      (setq pt3ba (list (- x2 (* #tsc 6.5)) (- y2 (* #tsc 4))));角落点2
      (setq pt3b1 (list (- x2 (* #tsc 9.5)) (+ y2 (* #tsc 4))));角落点2a
      (setq pt3b1a (list (- x2 (* #tsc 9.5)) (- y2 (* #tsc 4))));角落点2a
      (setq pt3c (list (- x2 (* #tsc 9.5)) y2));角起点1a
      (setq pt3d (list (- x2 (* #tsc 13)) y2));线落点
      )
    )
  (command "text" "j" "bc" "non" pt3 (* #tsc 3) 0 edit1);写文字
  (command "change" "l" "" "p" "la" "TEXT" "")
  ;(command "pline" "non" pt2 "non" pt3d "")
  ;(command "change" "l" "" "p" "la" "weld" "")
  ;(command "pline" "non" pt3a "non" pt3b "")
  ;(command "change" "l" "" "p" "la" "weld" "")
  (command "pline" "non" pt2 "non" pt3d "non" pt3a "non" pt3b "non" pt3a "non" pt3c "non" pt3b1 "")
  (command "change" "l" "" "p" "la" "weld" "")
(if (= issbh "1")
   (progn
     (command "pline" "non" pt3a "non" pt3ba "")
     (command "change" "l" "" "p" "la" "weld" "")
     (command "pline" "non" pt3c "non" pt3b1a "")
     (command "change" "l" "" "p" "la" "weld" "")
    )
   );end issbh
(if (and (= isyhb "1") (= drawisyhb 1))
   (hfyhb)
   );end isyhb
  (if (= isxth "1")
    (hfxth)
    )
  (if (= iswqht "1")
    (hfwqht)
    )
  );end djh

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!双边V型焊
(defun sv(/  )
  (pt)
  (if (= isxch "1")
    (hfxch)
    )
  (hfdim)
  (if (< x1 x2)
    (progn
      (setq pt3 (list (+ x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))))
      (setq pt4 (list (+ x2 (* #tsc 8.5)) (+ y2 (* #tsc 3))))
      (setq pt5 (list (+ x2 (* #tsc 9)) (+ y2 (* #tsc 7))))
      (setq pt3a (list (+ x2 (* #tsc 8.5)) y2));起点1
      (setq pt3b (list (+ x2 (* #tsc 8.5)) (+ y2 (* #tsc 1))));落点1
      (setq pt3b1 (list (+ x2 (* #tsc 5.5)) (+ y2 (* #tsc 5.2))));起点2
      (setq pt3b2 (list (+ x2 (* #tsc 11.5)) (+ y2 (* #tsc 5.2))));落点2
      (setq pt3c (list (+ x2 (* #tsc 8.5)) (- y2 (* #tsc 1))));落点1a
      (setq pt3c1 (list (+ x2 (* #tsc 5.5)) (- y2 (* #tsc 5.2))));起点2a
      (setq pt3c2 (list (+ x2 (* #tsc 11.5)) (- y2 (* #tsc 5.2))))
      (setq pt3d (list (+ x2 (* #tsc 13)) y2));线落点
    )
    (progn
      (setq pt3 (list (- x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))))
      (setq pt4 (list (- x2 (* #tsc 8.5)) (+ y2 (* #tsc 3))))
      (setq pt5 (list (- x2 (* #tsc 9)) (+ y2 (* #tsc 7))))
      (setq pt3a (list (- x2 (* #tsc 8.5)) y2));起点1
      (setq pt3b (list (- x2 (* #tsc 8.5)) (+ y2 (* #tsc 1))));落点1
      (setq pt3b1 (list (- x2 (* #tsc 5.5)) (+ y2 (* #tsc 5.2))));起点2
      (setq pt3b2 (list (- x2 (* #tsc 11.5)) (+ y2 (* #tsc 5.2))));落点2
      (setq pt3c (list (- x2 (* #tsc 8.5)) (- y2 (* #tsc 1))));落点1a
      (setq pt3c1 (list (- x2 (* #tsc 5.5)) (- y2 (* #tsc 5.2))));起点2a
      (setq pt3c2 (list (- x2 (* #tsc 11.5)) (- y2 (* #tsc 5.2))))
      (setq pt3d (list (- x2 (* #tsc 13)) y2));线落点
      )
    );end if
  (command "text" "j" "bc" "non" pt3 (* #tsc 3) 0 edit2)
  (command "change" "l" "" "p" "la" "TEXT" "")
  (command "text" "j" "bc" "non" pt4 (* #tsc 3) 0 edit1)
  (command "change" "l" "" "p" "la" "TEXT" "")
  (command "text" "j" "bc" "non" pt5 (* #tsc 3) 0 (strcat edit3 "%%d"))
  (command "change" "l" "" "p" "la" "TEXT" "")
  (command "pline" "non" pt2 "non" pt3d "")
  (command "change" "l" "" "p" "la" "weld" "")
  (command "pline" "non" pt3a "non" pt3b "")
  (command "change" "l" "" "p" "la" "weld" "")
  (command "pline" "non" pt3b1 "non" pt3b "non" pt3b2 "")
  (command "change" "l" "" "p" "la" "weld" "")
  (if (= issbh "1")
    (progn
      (command "pline" "non" pt3a "non" pt3c "")
      (command "change" "l" "" "p" "la" "weld" "")
      (command "pline" "non" pt3c1 "non" pt3c "non" pt3c2 "")
      (command "change" "l" "" "p" "la" "weld" "")
      )
    );end issbh
  (if (and (= isyhb "1") (= drawisyhb 1))
    (hfyhb)
    );end isyhb
  (if (= iswh "1")
    (progn
      (command "circle" pt2 (* #tsc 1) "")
      (command "change" "l" "" "p" "la" "weld" "")
      )
   );end iswh
  (if (= isxth "1")
    (hfxth)
    );end isxth
  (if (= iswqht "1")
    (hfwqht)
    )
  )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!单边V型焊
(defun dv()
  (pt)
  (if (= isxch "1")
    (hfxch)
    )
  (hfdim)
  (if (< x1 x2)
    (progn
      (setq pt3 (list (+ x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))))
      (setq pt4 (list (+ x2 (* #tsc 9.5)) (+ y2 (* #tsc 3))))
      (setq pt5 (list (+ x2 (* #tsc 10)) (+ y2 (* #tsc 7))))
      (setq pt3a (list (+ x2 (* #tsc 8.5)) y2));起点1
      (setq pt3b (list (+ x2 (* #tsc 8.5)) (+ y2 (* #tsc 5))));落点1
      (setq pt3a1 (list (+ x2 (* #tsc 8.5)) (+ y2 (* #tsc 1))));起点2
      (setq pt3b1 (list (+ x2 (* #tsc 12.5)) (+ y2 (* #tsc 5))));落点2
      (setq pt3c (list (+ x2 (* #tsc 8.5)) (- y2 (* #tsc 5))));落点1a
      (setq pt3a2 (list (+ x2 (* #tsc 8.5)) (- y2 (* #tsc 1))));起点2a
      (setq pt3b2 (list (+ x2 (* #tsc 12.5)) (- y2 (* #tsc 5))))
      (setq pt3d (list (+ x2 (* #tsc 13)) y2));线落点
    )
    (progn
      (setq pt3 (list (- x2 (* #tsc 4.5)) (+ y2 (* #tsc 0.7))))
      (setq pt4 (list (- x2 (* #tsc 9.5)) (+ y2 (* #tsc 3))))
      (setq pt5 (list (- x2 (* #tsc 10)) (+ y2 (* #tsc 7))))
      (setq pt3a (list (- x2 (* #tsc 8.5)) y2));起点1
      (setq pt3b (list (- x2 (* #tsc 8.5)) (+ y2 (* #tsc 5))));落点1
      (setq pt3a1 (list (- x2 (* #tsc 8.5)) (+ y2 (* #tsc 1))));起点2
      (setq pt3b1 (list (- x2 (* #tsc 12.5)) (+ y2 (* #tsc 5))));落点2
      (setq pt3c (list (- x2 (* #tsc 8.5)) (- y2 (* #tsc 5))));落点1a
      (setq pt3a2 (list (- x2 (* #tsc 8.5)) (- y2 (* #tsc 1))));起点2a
      (setq pt3b2 (list (- x2 (* #tsc 12.5)) (- y2 (* #tsc 5))))
      (setq pt3d (list (- x2 (* #tsc 13)) y2));线落点
      )
    );end if
  (command "text" "j" "bc" "non" pt3 (* #tsc 3) 0 edit2)
  (command "change" "l" "" "p" "la" "TEXT" "")
  (command "text" "j" "bc" "non" pt4 (* #tsc 3) 0 edit1)
  (command "change" "l" "" "p" "la" "TEXT" "")
  (command "text" "j" "bc" "non" pt5 (* #tsc 3) 0 (strcat edit3 "%%d"))
  (command "change" "l" "" "p" "la" "TEXT" "")
  (command "pline" "non" pt2 "non" pt3d "")
  (command "change" "l" "" "p" "la" "weld" "")
  (command "pline" "non" pt3a "non" pt3b "")
  (command "change" "l" "" "p" "la" "weld" "")
  (command "pline" "non" pt3a1 "non" pt3b1 "")
  (command "change" "l" "" "p" "la" "weld" "")
  (if (= issbh "1")
    (progn
      (command "pline" "non" pt3a "non" pt3c "")
      (command "change" "l" "" "p" "la" "weld" "")
      (command "pline" "non" pt3a2 "non" pt3b2 "")
      (command "change" "l" "" "p" "la" "weld" "")
      )
    );end issbh
  (if (and (= isyhb "1") (= drawisyhb 1))
    (hfyhb)
    );end isyhb
  (if (= iswh "1")
    (progn
      (command "circle" pt2 (* #tsc 1) "")
      (command "change" "l" "" "p" "la" "weld" "")
      )
   );end iswh
  (if (= isxth "1")
    (hfxth)
    );end isxth
  (if (= iswqht "1")
    (hfwqht)
    )
  )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(defun hfdim()
  (setq old_dim (getvar "dimstyle"))
  (setq dimname (strcat "Weld" (rtos #tsc 2 0)))
  (setq ts (tblsearch "dimstyle" dimname))                             
  (if (null ts)                                                        
    (progn                                                            
         (prompt (strcat "\nCreating new dimension style: " dimname ))
         (command "_dimstyle" "s" dimname)                             
         (dims)                                                
         (command "_dimstyle" "s" dimname "y" )                        
    )                                                                 
  (command "_dim" "restore" dimname "e")                             
  );end if
  (command "_leader" "non" pt1 "non" pt2 "" "" "n")
  (setq ts (tblsearch "layer" "weld"))
  (if (null ts)                                            
    (progn                                                
         (prompt (strcat "\nCreating new layer: WELD" ))     
         (princ "\n")                                      
         (command "_layer" "new" "WELD" "c" "1" "WELD" "")  
    )                                                      
  );end if
  (command "_change" "l" "" "p" "la" "weld" "")
  (command "_dim" "restore" old_dim "e")
  (prin1)
  );end hfdim

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(defun pt()
  (setvar "osmode" 512)
  (setq pt1 (getpoint "\nPick the Start of the Section: "))
  (setq pt2 (getpoint pt1 "\nPick the end of the Section: "))
  (setvar "osmode" 4287)
  (setq x1 (car pt1))
  (setq y1 (cadr pt1))
  (setq x2 (car pt2))
  (setq y2 (cadr pt2))
  (setq ang (angle pt1 pt2))
  );end pt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(defun hfxch()
   (if (<= x1 x2)
     (progn
       (setq pt8 (list x2 (+ y2 (* #tsc 6.5))))
       (setq pt8a (list x2 (+ y2 (* #tsc 4.5))))
       (setq pt8b (list (+ x2 (* #tsc 3.5)) (+ y2 (* #tsc 4.5))))
       )
     (progn
       (setq pt8 (list x2 (+ y2 (* #tsc 6.5))))
       (setq pt8a (list x2 (+ y2 (* #tsc 4.5))))
       (setq pt8b (list (- x2 (* #tsc 3.5)) (+ y2 (* #tsc 4.5))))
       )
     )
    (command "pline" "non" pt2 "non" pt8 "")
    (command "change" "l" "" "p" "la" "weld" "")
    (command "pline" "non" pt8 "non" pt8a "non" pt8b "c" "")
    (command "change" "l" "" "p" "la" "weld" "")
    (command "hatch" "solid" "p" "")
    (command "change" "l" "" "p" "la" "weld" "")
  (prin1)
  );end hfxch


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(defun hfyhb()
  (if (<= x1 x2)
    (progn
      (setq pt6 (list x2 (- y2 (* #tsc 0.8))))
      (setq pt6a (list (+ x2 (* #tsc 13)) (- y2 (* #tsc 0.8))))
      (setq pt7 (list (+ x2 (* #tsc 5.3)) (- y2 (* #tsc 0.8))))
      (setq pt7a (list (+ x2 (* #tsc 5.3)) (- y2 (* #tsc 3.8))))
      (setq pt7b (list (+ x2 (* #tsc 11.7)) (- y2 (* #tsc 3.8))))
      (setq pt7c (list (+ x2 (* #tsc 11.7)) (- y2 (* #tsc 0.8))))
      )
    (progn
      (setq pt6 (list x2 (- y2 (* #tsc 0.8))));虚线起点
      (setq pt6a (list (- x2 (* #tsc 13)) (- y2 (* #tsc 0.8))));虚线落点
      (setq pt7 (list (- x2 (* #tsc 4.8)) (- y2 (* #tsc 0.8))))
      (setq pt7a (list (- x2 (* #tsc 4.8)) (- y2 (* #tsc 3.8))))
      (setq pt7b (list (- x2 (* #tsc 11.2)) (- y2 (* #tsc 3.8))))
      (setq pt7c (list (- x2 (* #tsc 11.2)) (- y2 (* #tsc 0.8))))
      )
    );end if
  (command "pline" "non" pt6 "non" pt6a "")
  (command "change" "l" "" "p" "la" "H" "s" (* 0.4 #tsc) "")
  (command "pline" "non" pt7 "non" pt7a "non" pt7b "non" pt7c "")
  (command "change" "l" "" "p" "la" "weld" "")
  );end yhb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(defun hfxth()
  (if (and (< x1 x2) (< y1 y2))
    (progn
      (setq ptxth (list (+ (* #tsc 1) x2) y2))
      (setq ang1 (* (/ (+ pi ang) pi) 180))
      (command "arc" "c" pt2 "non" ptxth "a" ang1)
      )
    )
  (if (and (> x1 x2) (< y1 y2))
    (progn
      (setq ang1 (- pi ang))
      (setq ptxth (list (+ (* (* #tsc 1) (cos ang1)) x2) (- y2 (* (* #tsc 1) (sin ang1)))))
      (command "arc" "c" pt2 "non" ptxth "a" (* ( / (- (* 2 pi) ang) pi) 180))
      )
    )
  (if (and (< x1 x2) (> y1 y2))
    (progn
      (setq ang1 (- (* 2 pi) ang))
      (setq ptxth (list (- x2 (* (* #tsc 1) (cos ang1))) (+ y2 (* (* #tsc 1) (sin ang1)))))
      (command "arc" "c" pt2 "non" ptxth "a" (* ( / (+ pi ang1) pi) 180))
      )
    )
  (if (and (> x1 x2) (> y1 y2))
    (progn
      (setq ptxth (list (- x2 (* #tsc 1)) y2))
      (setq ang1 (* (/ ang pi) 180))
      (command "arc" "c" pt2 "non" ptxth "a" ang1)
      )
    )
  (command "change" "l" "" "p" "la" "weld" "")
  );end hfxth
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
(defun hfwqht()
  (command "circle" pt2 (* #tsc 1) "")
  (command "change" "l" "" "p" "la" "weld" "")
  (command "hatch" "solid" "p" "")
  (command "change" "l" "" "p" "la" "weld" "")
  )


对话框文件

bzhf:dialog
{
        label="标注焊缝";
        key="dial";
        :boxed_row
        {
                :boxed_radio_column
                {
                        :radio_button
                        {
                                label="角焊缝";
                                key="jhf";
                        }
                        :radio_button
                        {
                                label="塞焊缝";
                                key="shf";
                        }
                        :radio_button
                        {
                                label="对接焊";
                                key="djh";
                        }
                        :radio_button
                        {
                                label="双边V形焊";
                                key="sbvxh";
                        }
                        :radio_button
                        {
                                label="单边V形焊";
                                key="dbvxh";
                        }
                        :radio_button
                        {
                                label="双边U形焊";
                                key="sbuxh";
                        }
                        :radio_button
                        {
                                label="单边U形焊";
                                key="dbuxh";
                        }
                }
                :boxed_column
                {
                        :toggle
                        {
                                label="现场焊";
                                key="isxch";
                                value="0";
                        }
                        :toggle
                        {
                                label="双边焊";
                                key="issbh";
                                value="0";
                        }
                        :toggle
                        {
                                label="引弧板";
                                key="isyhb";
                                value="0";
                        }
                        :toggle
                        {
                                label="围  焊";
                                key="iswh";
                                value="0";
                        }
                        :toggle
                        {
                                label="相同焊";
                                key="isxth";
                                value="0";
                        }
                }
                :boxed_column
                {
                        :toggle
                        {
                                label="完全焊透";
                                key="iswqht";
                                value="0";
                        }
                        :row
                        {
                                :text
                                {
                                        value="焊缝高度:";
                                        width=10;
                                        key="text1";
                                        fixed_width=true;
                                }
                                :edit_box
                                {
                                        key="edit1";
                                        fixed_width=true;
                                        allow_accept = true;
                                }
                        }
                        :row
                        {
                                :text
                                {
                                        value="焊缝高度:";
                                        width=10;
                                        key="text2";
                                        fixed_width=true;
                                }
                                :edit_box
                                {
                                        key="edit2";
                                        fixed_width=true;
                                        allow_accept = true;
                                }
                        }
                        :row
                        {
                                :text
                                {
                                        value="焊缝高度:";
                                        width=10;
                                        key="text3";
                                        fixed_width=true;
                                }
                                :edit_box
                                {
                                        key="edit3";
                                        fixed_width=true;
                                        allow_accept = true;
                                }
                        }
                        :row
                        {
                                :text
                                {
                                        value="焊缝高度:";
                                        width=10;
                                        key="text4";
                                        fixed_width=true;
                                }
                                :edit_box
                                {
                                        key="edit4";
                                        fixed_width=true;
                                        allow_accept = true;
                                }
                        }
                }
        }
        spacer_1;
        ok_cancel;
        errtile;
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2006-4-3 15:53:33 | 显示全部楼层
程序太长,建议分开调试
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2025-9-29 05:30 , Processed in 0.313788 second(s), 34 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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