;;;;本程序主要是用于CAD软件中,冲压模具零件的快速拆分,程序是按照图层为基础,快速的拆分出模具零件,程序的命令是CMB。欢迎大家使用。 (defun c:cmb (/ ss p1 p2 p3) (princ \ \
(setq p2 (getpoint \ left quarter: \ (setq p3 (getpoint \ Right quarter: \ (setq p1 (getpoint \ Insert point:\ (command \ (command \ (setq ss (ssget \
(list (car p2) (cadr p2)) (list (car p3) (cadr p3)) ) )
(while ss (setq n 0)
(while (>= (sslength ss) 1) (setq ee (ssname ss 0))
(setq la (cdr (assoc 8 (entget ee)))) (setq s (ssget \
(list (car p2) (cadr p2)) (list (car p3) (cadr p3)) ) )
(while s
(setq s1 (ssadd)) (setq c 0)
(while (<= c (- (sslength s) 1)) (setq e (ssname s c))
(if (= la (cdr (assoc 8 (entget e)))) (progn
(ssadd e s1)
(ssdel (handent (cdr (assoc 5 (entget e)))) ss) ) )
(setq c (+ 1 c)) )
(setq s nil) )
(setq sc (- (cadr p3) (cadr p2))) (if (>= n 7)
(setq pt1 (list (+ (car p1) (- (car p3) (car p2))) (+ (cadr p1) (* (+ sc 100) (- n 6))) ) )
(if (< n 7)
(setq pt1 (list (car p1)
(+ (cadr p1) (* (+ sc 100) n)) ) ) ) )
(command \ (command \ (PRINC P2) (setq n (+ n 1)) )
(setq ss nil) )
(princ \ (princ) )
is over!)\