框内一点式
- (defun c:tt(/ ELAST1 ENT LST MP1 MP2 MP3 MP4 P0 P1 P2 P3 P4 P5 X Y)
- (vl-load-com)
- (defun sk_dxf(ent code)(cdr(assoc code (entget ent))))
- (defun sk_m2p (p1 p2)(mapcar '(lambda(x y)(* 0.5 (+ x y))) p1 p2))
- (if(setq p0(getpoint "\n在框内指定一点:"))
- (progn
- (setq elast1(entlast))
- (command "-BOUNDARY" p0 "")
- (setq ent(entlast))
- (if(and (= (sk_dxf ent 0) "LWPOLYLINE")(/= (sk_dxf ent 5)(sk_dxf elast1 5)))
- (progn
- (setq lst(mapcar 'cdr (vl-remove-if-not '(lambda(x)(= 10 (car x)))(entget ent))))
- (setq p1(car lst)
- p2(cadr lst)
- p3(caddr lst)
- p4(cadddr lst)
- mp1(sk_m2p p1 p2)
- mp2(sk_m2p p2 p3)
- mp3(sk_m2p p3 p4)
- mp4(sk_m2p p4 p1)
- )
- (princ (list mp1 mp2 mp3 mp4))
- (entdel ent)
- (command "trim" "" "c" mp1 mp3 "" )
- (command "trim" "" "c" mp2 mp4 "" )
- )
- )
- )
- )
- (princ)
- )
|