优化穿线孔到孔边的距离,节省线割路径
(defun c:qqq (/ ss n me en pt k)
(setq ss (ssget '((0 . "CIRCLE"))))
(repeat (setq n (sslength ss))
(setq me (ssname ss (setq n (1- n))))
(setq en (entget me))
(setq pt (cdr (assoc 10 en)))
(setq k (cdr (assoc 40 en)))
(command "_CIRCLE" "none" (polar pt (* pi 0.25) (- k 3)) 1)
)
(princ)
)
(defun c:qq (/ s1 s2 en1 en2 p1 p2 ang k)
(while (and (setq s1 (entsel "\n选择第一个圆: "))
(setq s2 (entsel "\n选择第二个圆: ")))
(setq en1 (entget (car s1)))
(setq en2 (entget (car s2)))
(setq p1 (cdr (assoc 10 en1)))
(setq p2 (cdr (assoc 10 en2)))
(setq ang (angle p2 p1))
(setq k (- (cdr (assoc 40 en2)) (cdr (assoc 40 en1)) 1))
(setq en1 (subst (cons 10 (polar p2 ang k)) (cons 10 p1) en1))
(entmod en1)
)
(princ)
) 直接出个画穿丝孔的不省事,这种圆的还是比较简单
整套模具图纸3D转出来的穿线孔位置比较乱,分使用环境吧 ma344578245 发表于 2024-11-19 14:06
整套模具图纸3D转出来的穿线孔位置比较乱,分使用环境吧
异型孔呢 建议可以优化成框选模式,两个圆大小不一样,程序内部直接分析,谁是大圆谁是小圆,效率又提高了
页:
[1]