遮罩(Wipeout)转面域(Region)
;;;--------------------------------------------------------------------;
;;; 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)
)
纯cad能用吧 楼主威武啊这都能搞出来 这都能整。佩服。 又学到新知识了,感谢分享。
页:
[1]