Polerase LSP

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

;;;____________________________________________________________________________

;;;
;;; BORRA OBJETOS POR POL�GONO-VENTANA/CAPTURA INTERIOR/EXTERIOR,
;;; O BORRA Y RECORTA POR POLIGONO EXTERIOR/INTERIOR
;;;____________________________________________________________________________
;;;
;;; scaner - Julio 2004 - Visita: www.hispacad.com
;;;____________________________________________________________________________
(defun c:polerase (/ pol pol_tip pol_lst pol_pnt_lst
key1 key2 pnt_nom pnt_cor cnj_x cnj_pv
cnj_pc n lst_lyr
)
(setq old_cmdecho (getvar "cmdecho")
old_highlight (getvar "highlight")
old_ucsfollow (getvar "ucsfollow")
)
(setvar "cmdecho" 0)
(setvar "ucsfollow" 0)
(command "_undo" "_begin")
(command "_ucs" "_world")
(while (/= pol_tip "LWPOLYLINE")
(while
(not (setq pol (car (entsel "\n Seleccione polil�nea de l�mite: "))))
)
(setq pol_lst (entget pol)
pol_tip (cdr (assoc 0 pol_lst))
)
)
(while (assoc 10 pol_lst)
(setq pol_pnt_lst (cons (cdr (assoc 10 pol_lst)) pol_pnt_lst)
pol_lst (cdr (member (assoc 10 pol_lst) pol_lst))
)
)
(initget "V C R")
(if (not (setq key1
(getkword
"\n Borrar por pol�gonoV / pol�gonoC, borrar y Recortar <borrar y
Recortar>: "
)
)
)
(setq key1 "R")
)
(lyr_act_reu)
(initget 1)
(command "_point" (getpoint "\n Designe punto interior/exterior: "))
(setq pnt_nom (cdr (assoc 5 (entget (entlast))))
pnt_cor (cdr (assoc 10 (entget (entlast))))
cnj_x (ssdel pol (ssget "_x" lst_lyr))
cnj_pv (ssget "_wp" pol_pnt_lst)
cnj_pc (ssdel pol (ssget "_cp" pol_pnt_lst))
n 0
)
(repeat (sslength cnj_pv)
(setq obj (ssname cnj_pv n))
(if (= pnt_nom (cdr (assoc 5 (entget obj))))
(setq key2 T) ;interior
)
(setq n (1+ n))
)
(cond ((and (or (= key1 "V") (= key1 "R")) key2) (command "_erase" cnj_pv ""))
((and (or (= key1 "V") (= key1 "R")) (not key2))
(command "_erase" cnj_x "_remove" cnj_pc "")
)
((and (= key1 "C") key2) (command "_erase" cnj_pc ""))
((and (= key1 "C") (not key2))
(command "_erase" cnj_x "_remove" cnj_pv "")
)
)
(if (= key1 "R")
(progn (if (not c:etrim)
(load "extrim")
)
(etrim pol pnt_cor)
)
)
(command "_ucs" "_prev")
(command "_undo" "_end")
(setvar "ucsfollow" old_ucsfollow)
(setvar "highlight" old_highlight)
(setvar "cmdecho" old_cmdecho)
(princ)
)
(prompt "\n Nuevo comando Polerase definido en AutoCAD")
;;;____________________________________________________________________________
;;;
;;; OBTIENE EL LISTADO DE LAS CAPAS UTILIZADAS Y ACTIVADAS
;;;____________________________________________________________________________

(defun lyr_act_reu (/ lyr lyr_nom lyr_stat lyr_clr)


(setq lyr (tblnext "layer" T)
lst_lyr (list)
)
(while lyr
(setq lyr_nom (cdr (assoc 2 lyr))
lyr_stat (cdr (assoc 70 lyr))
lyr_clr (cdr (assoc 62 lyr))
lyr (tblnext "layer")
)
(if (not (or (= (logand lyr_stat 1) 1) (minusp lyr_clr)))
(setq lst_lyr (append (list (cons 8 lyr_nom)) lst_lyr))
)
)
(setq lst_lyr (append (list '(-4 . "<or")) lst_lyr (list '(-4 . "or>"))))
)
(princ)

You might also like