;***************************************************************************
;***
;***     eptdwg.lsp
;***     Copyright (C) 2010 IJCAD Corporation. All rights reserved.
;***     
;***     Use of the information contained herein, in part or in whole,
;***     in/as source code and/or in/as object code, in any way by
;***     anyone other than authorized employees of IJCAD Corporation,
;***	 or by anyone to whom IJCAD Corporation has not granted
;***     use is illegal.
;***     Description:
;*******************************************************************************

(defun C:lockup( / ss time en oldcmd)
(alert "̋@\gpƁA}ʂύXłȂȂ܂B\nOtĂ̐}ʂۑ邩A܂͂̋@\gpÕt@CɕۑꂽƂmFĂB")
  (setq oldcmd (getvar "cmdecho"))
 (setq errold *error*)
	
	(defun *error* (msg / )
		(setq *error* errold)
		(setvar "cmdecho" oldcmd )
		(setq ss time en oldcmdnil)
	)
	
	(setvar "cmdecho" 0)
	(SETQ SS (SSGET '((-4 . "<NOT")(0 . "VIEWPORT")(-4 . "NOT>"))))
	(if ss
		(progn
			(setq time (rtos (getvar "CDATE") 2 10))


			(setq lockfalg 0)
			(if (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (getvar "clayer"))))))
				(progn 
					(command "_.LAYER" "_UNLOCK" (getvar "clayer") "")
					(setq lockflag 1)
				)
			)
			(command "block" time '(0 0 0) ss "")
			(command "minsert" time '(0 0 0)"" "" "" 2 1 0)
			(setq en (entlast))
			(vla-ConvertToAnonymousBlock (vlax-ename->vla-object en))
			(vla-delete (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) time))
			(if (= 1 lockflag)
				(command "._LAYER" "_LOCK" (getvar "clayer") "")
			)		
			(setq lockfalg nil)
		)
	)

	(setvar "cmdecho" oldcmd)
	(princ)
)

(vl-load-com) (princ)
