- (Defun C:v () (setvar "cmdecho" 0) (menucmd "P0=bpf.FM") (menucmd "P0=*") (setq famen (getstring (strcat "\阀门类型:"))) (cfm_zhs))(defun cfm_zhs() (setvar "cmdecho" 0) (setvar "OSMODE" 16383) (initget " ") (setq guan (entsel "\n右键退出/拾取管线<支持line或pline>:")) (cond ( (= guan "") nil) ( (and (= (type guan) 'LIST) (or (= (cdr (assoc 0 (entget (car guan)))) "LINE") (= (cdr (assoc 0 (entget (car guan)))) "LWPOLYLINE") ) ) (setq point (cadr guan)) (setq en (entget (car guan))) (setq en5 (cdr (assoc 0 en))) (if (= en5 "LINE") (progn (setq old (cdr (assoc 10 en))) (setq old1 (cdr (assoc 11 en))) ) (progn (setq snn (assoc 10 en)) (setq old (cdr snn)) (setq sn3 (member snn en))(setq sn4 (cdr sn3))(setq sn5 (assoc 10 sn4))(setq sn6 (member sn5 sn4))(setq sn7 (car sn6))(setq old1 (cdr sn7)) ) ) (setq jiao (angle old old1)) (if (< 1.57 jiao 4.71) (setq jiao (+ jiao 3.14159))) (setq jiao1 (angtos jiao 0 4)) (command "insert" famen point "1" "1" jiao1) (if (= famen "f_fm_jzfx") (progn (princ) ) (progn (setq en3 (polar point jiao 175)) (setq en4 (polar point (+ pi jiao) 175)) (command "break" guan "f" en3 en4) ) ) (cfm_zhs) ) (t (cfm_zhs)) ) (princ))
主程序如上,问题是:
1)想要的效果为附件1那样子,但是程序运行,很多时候会出现附件2和附件3的样子,
也就是说插入块的点(command "insert" famen point "1" "1" jiao1)和打断的起始点(command "break" guan "f" en3 en4)
en3和en4为polar函数经过变量point计算而得,但是从附件2和3中看出:两个point不是同一点,这就纠结了?
2)假如程序中没有(setvar "OSMODE" 16383),当关闭cad中的捕捉时候,运行程序会出现附件4那个样子,加上去了,就没事了
所以我猜想为题1)很有可能也是捕捉的问题,可能弄了好多天都没弄出来,希望论坛里的高手帮忙解决下!
|