马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ;;;--------------------------------------------------------------------;
- ;;; Description:
- ;;; Convert all wipeouts within a given drawing to regions.
- ;;;--------------------------------------------------------------------;
- ;;; Exit function:
- (defun WIPEOUT->REGION:Exit (msg)
- (cond ((not msg)) ; Normal exit
- ((member msg '("Function cancelled" "quit / exit abort")))
- ; <esc> or (quit)
- ((princ (strcat "\n <!> Error: " msg " <!> ")))
- ) ; Fatal error, display it
- (WIPEOUT->REGION:Quit)
- )
- ;;;--------------------------------------------------------------------;
- ;;; Quit function:
- (defun WIPEOUT->REGION:Quit ()
- (setvar 'cmdecho *oldCmdecho*)
- (setq *oldCmdecho* nil)
- (setq *error* *oldError*
- *oldError* nil
- )
- (vla-endundomark *activeDoc*)
- (princ)
- )
- ;;;--------------------------------------------------------------------;
- ;;; Main function:
- (defun c:WIPEOUT->REGION (/ ss)
- (vl-load-com)
- (vla-startundomark
- (cond (*activeDoc*)
- ((setq *activeDoc*
- (vla-get-activedocument (vlax-get-acad-object))
- )
- )
- )
- )
- ;; Error checking
- (setq *oldError* *error*
- *error* WIPEOUT->REGION:Exit
- )
- (setq *oldCmdecho* (getvar 'cmdecho))
- (setvar 'cmdecho 0)
- ;; Main code
- (if (and (setq ss (ssget "_x" '((0 . "WIPEOUT"))))
- (setq ss (ssget "_x"))
- )
- ((lambda (i / e v visList wipList mn mx c)
- (while (setq e (ssname ss (setq i (1+ i))))
- (if (/= "WIPEOUT" (strcase (cdr (assoc 0 (entget e)))))
- (progn (vla-put-visible
- (setq v (vlax-ename->vla-object e))
- :vlax-false
- )
- (setq visList (cons v visList))
- )
- (setq wipList (cons e wipList))
- )
- )
- (foreach w wipList
- (vla-getboundingbox
- (setq v (vlax-ename->vla-object w))
- 'mn
- 'mx
- )
- (setq c (mapcar '*
- (mapcar '+
- (setq mn (vlax-safearray->list mn))
- (setq mx (vlax-safearray->list mx))
- )
- '(0.5 0.5 0.5)
- )
- )
- (vl-cmdf "._boundary" c "")
- (vl-cmdf "._matchprop" w (entlast) "")
- (vl-cmdf "._region" (entlast) "")
- (vla-delete v)
- )
- (foreach o visList (vla-put-visible o :vlax-true))
- )
- -1
- )
- (prompt
- "\n <!> No Wipeouts Detected in Currect Drawing <!> "
- )
- )
- (WIPEOUT->REGION:Quit)
- )
|