Jump to content
lutzow10

Update to "Convert Wipeout to Polyline Region"?

Recommended Posts

lutzow10

(Here is a link to the original post I am referencing)

 

Hi Guys,

 

I found this awesome lisp by Renderman/Black Box and I have run it a few times and it worked great those times. Then I tried to run it to convert maybe 20 wipeouts at once and a bunch of them disappeared. I would really like to be able to use this one time once I finish drawing all the wipeouts and not after everyone, but I also don't want to risk some failing to convert and having to redraw a bunch of them.

 

Does anyone see anything that would cause these errors?

 

;;;--------------------------------------------------------------------;
;;; c:WIPEOUT->REGION
;;; Courtesy of RenderMan, CADTutor.net
;;;--------------------------------------------------------------------;
;;; 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" "")
        (vla-delete v))
      (foreach o  visList
        (vla-put-visible o :vlax-true)))
     -1)
   (prompt "\n  <!>  No Wipeouts Detected in Currect Drawing  <!> "))
 (WIPEOUT->REGION:Quit))

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×