Util_Layers.lsp

;;; Início Util_Layers.lsp
;;; Ver 2.2

;;; J.A.
;;; www.cadtom.com

;;; Ver 1.0 - 1996-02-03
;;; Ver 1.1 - 1998-12-04
;;; Ver 1.2 - 1999-05-06
;;; Ver 1.3 - 1999-10-29
;;; Ver 1.4 - 2001-03-27
;;; Ver 2.0 - 2006-05-17
;;; Ver 2.1 - 2006-05-19
;;; Ver 2.2 - 2007-01-29


;;; Função Err

(defun *error* (msg)

 (setq *error* AERR)
 (setvar "cmdecho" ADECH)
 (command "_.undo" "end")
 (princ (strcat " Aplicação interrompida com erro: " msg))
)

;;;

(defun SETVRS ()

 (setq ACMDCH (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 (command "_.undo" "begin")
 (setq AERR *error*)
)

;;;

(defun RESETVRS ()

 (setq *error* AERR)
 (command "_.undo" "end")
 (setvar "cmdecho" ACMDCH)
)

;;; ==========================================================

;;; Função LAFA
;;; Congelar todos os layers

(defun C:LAFA ()

 (SETVRS)
 (prompt "\n»» Congelar todos os layers")
 (command "_.-Layer" "Freeze" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LATA
;;; Descongelar todos os layers

(defun C:LATA ()

 (SETVRS)
 (prompt "\n»» Descongelar todos os layers")
 (command "_.-Layer" "Thaw" "*" "")
 (terpri)
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAONA
;;; Ligar (On) todos os layers

(defun C:LAONA ()

 (SETVRS)
 (prompt "\n»» Ligar (On) todos os layers")
 (command "_.-Layer" "On" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAOFA
;;; Desligar (Off) todos os layers

(defun C:LAOFA ()

 (SETVRS)
 (prompt "\n»» Desligar (Off) todos os layers")
 (command "_.-Layer" "Off" "*" "Y" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LALOA
;;; Trancar (Lock) todos os layers

(defun C:LALOA ()

 (SETVRS)
 (prompt "\n»» Trancar (Lock) todos os layers")
 (command "_.-Layer" "Lo" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAULA
;;; Destrancar (Unlock) todos os layers

(defun C:LAULA ()

 (SETVRS)
 (prompt "\n»» Destrancar (Unlock) todos os layers")
 (command "_.-Layer" "Un" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAS
;;; Activar um layer seleccionando uma entidade

(defun C:LAS (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt "\n»» Activar um layer seleccionando uma entidade")
 (setq VENT (car (entsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Activar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "S" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAF1
;;; Congelar o layer da entidade seleccionada

(defun C:LAF1 (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt "\n»» Congelar um layer seleccionando uma entidade")
 (setq VENT (car (nentsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Congelar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "S" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAFS
;;; Congelar todos os layers excepto o da entidade seleccionada

(defun C:LAFS (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt
 "\n»» Congelar todos os layers excepto o da entidade seleccionada"
 )
 (setq VENT (car (entsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Congelar os restantes layers ")
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (progn
 (command "_.-Layer" "S" VLAY "")
 (command "_.-Layer" "Freeze" "*" "")
 )
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAFES
;;; Congelar todos os layers, excepto o corrente e das entidades seleccionadas

(defun C:LAFES (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Congelar todos os layers, excepto o corrente e das entidades seleccionadas"
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt
 "\n»» Seleccione entidades dos layers a não congelar:"
 )
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "F" "*" "T" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAF
;;; Congelar os layers das entidades seleccionadas

(defun C:LAF (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Congelar os layers das entidades seleccionadas"
 )
 (setq VLAYS " ")
 (setq VVIRG ",")
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "F" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAF1
;;; Congelar o layer da entidade seleccionada

(defun C:LAF1 (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt "\n»» Congelar um layer seleccionando uma entidade")
 (setq VENT (car (nentsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Congelar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "F" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAO
;;; Desligar (Off) os layers das entidades seleccionadas

(defun C:LAO (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Desligar (Off) os layers das entidades seleccionadas "
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "Off" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAO1
;;; Desligar (Off) o layer da entidade seleccionada

(defun C:LAO1 (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt
 "\n»» Desligar (Off) um layer seleccionando uma entidade"
 )
 (setq VENT (car (nentsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Desligar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "Off" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; Início Util_Layers.lsp
;;; Ver 2.2

;;; J.A.
;;; www.jorgeanjos.com

;;; Ver 1.0 - 1996-02-03
;;; Ver 1.1 - 1998-12-04
;;; Ver 1.2 - 1999-05-06
;;; Ver 1.3 - 1999-10-29
;;; Ver 1.4 - 2001-03-27
;;; Ver 2.0 - 2006-05-17
;;; Ver 2.1 - 2006-05-19
;;; Ver 2.2 - 2007-01-29


;;; Função Err

(defun *error* (msg)

 (setq *error* AERR)
 (setvar "cmdecho" ADECH)
 (command "_.undo" "end")
 (princ (strcat " Aplicação interrompida com erro: " msg))
)

;;;

(defun SETVRS ()

 (setq ACMDCH (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 (command "_.undo" "begin")
 (setq AERR *error*)
)

;;;

(defun RESETVRS ()

 (setq *error* AERR)
 (command "_.undo" "end")
 (setvar "cmdecho" ACMDCH)
)

;;; ==========================================================

;;; Função LAFA
;;; Congelar todos os layers

(defun C:LAFA ()

 (SETVRS)
 (prompt "\n»» Congelar todos os layers")
 (command "_.-Layer" "Freeze" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LATA
;;; Descongelar todos os layers

(defun C:LATA ()

 (SETVRS)
 (prompt "\n»» Descongelar todos os layers")
 (command "_.-Layer" "Thaw" "*" "")
 (terpri)
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAONA
;;; Ligar (On) todos os layers

(defun C:LAONA ()

 (SETVRS)
 (prompt "\n»» Ligar (On) todos os layers")
 (command "_.-Layer" "On" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAOFA
;;; Desligar (Off) todos os layers

(defun C:LAOFA ()

 (SETVRS)
 (prompt "\n»» Desligar (Off) todos os layers")
 (command "_.-Layer" "Off" "*" "Y" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LALOA
;;; Trancar (Lock) todos os layers

(defun C:LALOA ()

 (SETVRS)
 (prompt "\n»» Trancar (Lock) todos os layers")
 (command "_.-Layer" "Lo" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAULA
;;; Destrancar (Unlock) todos os layers

(defun C:LAULA ()

 (SETVRS)
 (prompt "\n»» Destrancar (Unlock) todos os layers")
 (command "_.-Layer" "Un" "*" "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAS
;;; Activar um layer seleccionando uma entidade

(defun C:LAS (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt "\n»» Activar um layer seleccionando uma entidade")
 (setq VENT (car (entsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Activar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "S" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAF1
;;; Congelar o layer da entidade seleccionada

(defun C:LAF1 (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt "\n»» Congelar um layer seleccionando uma entidade")
 (setq VENT (car (nentsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Congelar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "S" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAFS
;;; Congelar todos os layers excepto o da entidade seleccionada

(defun C:LAFS (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt
 "\n»» Congelar todos os layers excepto o da entidade seleccionada"
 )
 (setq VENT (car (entsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Congelar os restantes layers ")
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (progn
 (command "_.-Layer" "S" VLAY "")
 (command "_.-Layer" "Freeze" "*" "")
 )
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAFES
;;; Congelar todos os layers, excepto o corrente e das entidades seleccionadas

(defun C:LAFES (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Congelar todos os layers, excepto o corrente e das entidades seleccionadas"
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt
 "\n»» Seleccione entidades dos layers a não congelar:"
 )
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "F" "*" "T" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAF
;;; Congelar os layers das entidades seleccionadas

(defun C:LAF (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Congelar os layers das entidades seleccionadas"
 )
 (setq VLAYS " ")
 (setq VVIRG ",")
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "F" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAF1
;;; Congelar o layer da entidade seleccionada

(defun C:LAF1 (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt "\n»» Congelar um layer seleccionando uma entidade")
 (setq VENT (car (nentsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Congelar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "F" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAO
;;; Desligar (Off) os layers das entidades seleccionadas

(defun C:LAO (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Desligar (Off) os layers das entidades seleccionadas "
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "Off" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAO1
;;; Desligar (Off) o layer da entidade seleccionada

(defun C:LAO1 (/ VENT VLAY VGETKW)

 (SETVRS)
 (prompt
 "\n»» Desligar (Off) um layer seleccionando uma entidade"
 )
 (setq VENT (car (nentsel "\n»» Seleccione uma entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt "\n»» Desligar o layer ")
 (princ VLAY)
 (initget "Sim Não")
 (setq VGETKW (getkword "? [S/N] <S> "))
 (if (= VGETKW "Sim")
 (command "")
 )
 (if (/= VGETKW "Não")
 (command "_.-Layer" "Off" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAL
;;; Trancar (Lock) os layers das entidades seleccionadas

(defun C:LAL (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Trancar (Lock) os layers das entidades seleccionadas"
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "Lo" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAUL
;;; Destrancar (UnLock) os layers das entidades seleccionadas

(defun C:LAUL (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)

 (prompt
 "\n»» Destrancar (UnLock) os layers das entidades seleccionadas "
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "Un" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAMS
;;; Alterar layers de entidades para o layer de outra entidade

(defun C:LAALE (/ VENT VLAY VSENT)

 (SETVRS)
 (prompt
 "\n»» Alterar layers de entidades para o layer de outra entidade"
 )
 (setq VENT (car (entsel "\n»» Seleccione entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt
 "\n»» Seleccione as entidades que quer mover para o layer "
 )
 (prin1 VLAY)
 (setq VSENT (ssget))
 (if (/= VSENT nil)
 (command "_.Change" VSENT "" "Prop" "Layer" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAMC
;;; Alterar layers de entidades para o layer corrente

(defun C:LAALC (/ VLAY VSENT)

 (SETVRS)
 (setvar "cmdecho" 0)
 (prompt
 "\n»» Alterar layers de entidades para o layer corrente"
 )
 (setq VLAY (getvar "clayer"))
 (prompt "\n»» Layer corrente é ")
 (princ VLAY)
 (prompt
 "\n»» Seleccione as entidades que pretende mover para o layer "
 )
 (prin1 VLAY)
 (setq VSENT (ssget))
 (command "_.Change" VSENT "" "Prop" "Layer" VLAY "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LACP
;;; Copiar propriedades (Layer, Color e Linetype) de uma entidade")

(defun C:LACP (/ VENT VCOLOR VSENT)

 (SETVRS)

 (prompt
 "\n»» Copiar propriedades (Layer, Color e Linetype) de uma entidade"
 )
 (setq VENT (car (entsel "\n»» Seleccione entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 VCOLOR (cdr (assoc 62 VENT))
 VLTP (cdr (assoc 6 VENT))
 )
 (if (= VCOLOR nil)
 (setq VCOLOR "BYLAYER")
 )
 (if (= VLTP nil)
 (setq VLTP "BYLAYER")
 )
 (prompt
 "\n»» Seleccione as entidades que pretende alterar as propriedades "
 )
 (setq VSENT (ssget))
 (if (/= VSENT nil)
 (progn
 (command "_.Change" VSENT "" "Prop" "Layer" VLAY "")
 (command "_.Change" VSENT "" "Prop" "Color" VCOLOR "")
 (command "_.Change" VSENT "" "Prop" "Ltype" VLTP "")
 )
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAL
;;; Trancar (Lock) os layers das entidades seleccionadas

(defun C:LAL (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)
 (prompt
 "\n»» Trancar (Lock) os layers das entidades seleccionadas"
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "Lo" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAUL
;;; Destrancar (UnLock) os layers das entidades seleccionadas

(defun C:LAUL (/ VVIRG VENT VSSLEN VTEMP VVAL VLAYS VLAYSTMP)

 (SETVRS)

 (prompt
 "\n»» Destrancar (UnLock) os layers das entidades seleccionadas "
 )
 (setq VLAYS " "
 VVIRG ","
 )
 (prompt "\n»» Seleccione entidades:")
 (setq VENT (ssget))
 (if VENT
 (progn
 (setq VSSLEN (sslength VENT))
 (while (> VSSLEN 0)
 (setq VTEMP (ssname VENT (setq VSSLEN (1- VSSLEN)))
 VVAL (cdr (assoc 8 (entget VTEMP)))
 VLAYSTMP (strcat VVAL VVIRG)
 VLAYS (strcat VLAYSTMP VLAYS)
 )
 )
 (command "_.-Layer" "Un" VLAYS "")
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAMS
;;; Alterar layers de entidades para o layer de outra entidade

(defun C:LAALE (/ VENT VLAY VSENT)

 (SETVRS)
 (prompt
 "\n»» Alterar layers de entidades para o layer de outra entidade"
 )
 (setq VENT (car (entsel "\n»» Seleccione entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 )
 (prompt "\n»» Seleccionado o layer ")
 (princ VLAY)
 (prompt
 "\n»» Seleccione as entidades que quer mover para o layer "
 )
 (prin1 VLAY)
 (setq VSENT (ssget))
 (if (/= VSENT nil)
 (command "_.Change" VSENT "" "Prop" "Layer" VLAY "")
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!\n")
 )
 (RESETVRS)
)

;;; ==========================================================

;;; Função LAMC
;;; Alterar layers de entidades para o layer corrente

(defun C:LAALC (/ VLAY VSENT)

 (SETVRS)
 (setvar "cmdecho" 0)
 (prompt
 "\n»» Alterar layers de entidades para o layer corrente"
 )
 (setq VLAY (getvar "clayer"))
 (prompt "\n»» Layer corrente é ")
 (princ VLAY)
 (prompt
 "\n»» Seleccione as entidades que pretende mover para o layer "
 )
 (prin1 VLAY)
 (setq VSENT (ssget))
 (command "_.Change" VSENT "" "Prop" "Layer" VLAY "")
 (RESETVRS)
)

;;; ==========================================================

;;; Função LACP
;;; Copiar propriedades (Layer, Color e Linetype) de uma entidade")

(defun C:LACP (/ VENT VCOLOR VSENT)

 (SETVRS)

 (prompt
 "\n»» Copiar propriedades (Layer, Color e Linetype) de uma entidade"
 )
 (setq VENT (car (entsel "\n»» Seleccione entidade tipo:")))
 (if VENT
 (progn
 (setq VENT (entget VENT)
 VLAY (cdr (assoc 8 VENT))
 VCOLOR (cdr (assoc 62 VENT))
 VLTP (cdr (assoc 6 VENT))
 )
 (if (= VCOLOR nil)
 (setq VCOLOR "BYLAYER")
 )
 (if (= VLTP nil)
 (setq VLTP "BYLAYER")
 )
 (prompt
 "\n»» Seleccione as entidades que pretende alterar as propriedades "
 )
 (setq VSENT (ssget))
 (if (/= VSENT nil)
 (progn
 (command "_.Change" VSENT "" "Prop" "Layer" VLAY "")
 (command "_.Change" VSENT "" "Prop" "Color" VCOLOR "")
 (command "_.Change" VSENT "" "Prop" "Ltype" VLTP "")
 )
 )
 )
 (prompt "\n»» Nenhuma entidade seleccionada!")
 )
 (RESETVRS)
)

 

Top