Jump to content

Recommended Posts

Posted

(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))

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...