- 积分
- 6583
- 明经币
- 个
- 注册时间
- 2020-9-11
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 世井 于 2021-12-17 10:22 编辑
大师帮忙看看,多个排列的圆打断什么会出现这样
(Defun C:tt (/ oldecho oldmode lst1 lst2 dclname f x dcl_re dd qws qwd ss i en s pt1 pt2 x z1 z11 st qed ad dd de aj ej aeed xa j xb Z1 Z2)
(vl-load-com)
(command "undo" "be")
(setq lst1 (mapcar 'car lst)
lst2 (cdr (car lst))
dclname (vl-filename-mktemp "re-dcl-tmp.dcl")
f (open dclname "w"))
(foreach x
(list
"RENAME:dialog{"
" label=\"加桥位\";"
" :edit_box{label=\"桥位数量\";key=\"qws11\";width=5;}"
" :edit_box{label=\"桥位大小\";key=\"qwd11\";width=5;}"
" ok_cancel;"
"}"
)
(write-line x f)
)
(close f)
(if (> (setq dcl_re (load_dialog dclname)) 0) (progn
(if (new_dialog "RENAME" dcl_re "") (progn
(vl-file-delete dclname)
(if qws_QJ (set_tile "qws11" qws_QJ) (set_tile "qws11" "1"))
(if qwd_QJ (set_tile "qwd11" qwd_QJ) (set_tile "qwd11" "4"))
(action_tile "accept" "(abab) (done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq dd (start_dialog))
) (progn
(princ "Unable to display dialog box!\n无法显示对话框!")
(unload_dialog dcl_re)
))
))
(if (= dd 1) (aabbAA))
(princ)
)
;;;;;;;;;;;;;;;
(defun abab ()
(setq qws (atoi (get_tile "qws11")) qws_QJ (get_tile "qws11"))
(if (= qws 0)(setq qws 1))
(setq qwd (atof (get_tile "qwd11")) qwd_QJ (get_tile "qwd11"))
(if (zerop qwd)(setq qwd 4.0))
)
;子程序
(defun aabbAA()
(setq oldecho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq oldmode (getvar "osmode"))
(setvar"osmode" 0)
(defun *error* (msg)
(setvar "cmdecho" oldecho)
(setvar "osmode" oldmode)
(princ "error: ")
(princ msg)
(princ)
)
(PRINC "\n选择线,圆,圆弧加桥位:")
(setq ss (ssget '((0 . "CIRCLE,ARC,LINE"))))
(setq i 0)
(while (< i (sslength ss))
(setq en (ssname ss i))
(setq bb (cdr (assoc 0 (entget en))))
(setq s (vlax-curve-getDistAtParam en (vlax-curve-getEndParam en)));求出线长
(setq pt1 (vlax-curve-getstartpoint en));求出起点
(setq pt2 (vlax-curve-getendpoint en));求出端点
(setq x (/ (- s (* qwd qws)) (+ 1 qws)));除去桥位等分长度 线与圆弧的计算方式
(cond ((= bb "CIRCLE");;
(setq st (cdr (assoc 10 (entget en))))
(setq aeed (cdr (assoc 40 (entget en))))
(setq xa (/ (/ qwd aeed) 2.0) )
(setq j 1)
(setq xb 0)
(while (<= j qws)
(cond ((>= j 2)
(setq xb (/ (* pi 2.0) qws))
(cond ((>= j 3)
(setq xb (* xb (- j 1))) ) ) ) )
(setq z1 (polar st (- xb xa) aeed)
z2 (polar st (+ xb xa) aeed))
(setq j (+ j 1))
(command "break" z1 z2)
) ))
(setq i (1+ i)))
(setvar "CMDECHO" oldecho)
(setvar "osmode" oldmode)
(command "undo" "e")
(princ))
|
|