Jump to content

Lisp to explode all the region in a drawing.


Recommended Posts

tiwari1211

Dear lisp experts, 

 

I am looking for a Lisp to convert all the region in a drawing to Ploy-line.  I found below lisp online but it doesn't work. Can any one please help me to provide such lisp. 

Thank you very much. 

 

(defun c:Region2Polyline nil
  (if (setq ss (ssget "_x" '((0 . "REGION"))))
    (:Region2Polyline ss)
  )
  (princ)
)
  • Confused 1
Link to post
Share on other sites
mhupp

What you posted only makes a selection set of Regions and then runs something else with that selection set. Might have been part of a bigger lisp. yep you need the lisp from the first post. looks like that does alot more stuff then what i posted and has error handling.

 

;;----------------------------------------------------------------------;;
; Region To Polyline
(defun C:R2P (/ SS LastEnt en)
  (if (setq ss (ssget "_x" '((0 . "REGION"))))
    (progn
      (setq LastEnt (entlast))
      (vl-cmdf "_.Explode" SS)
      (if (setq en (entnext LastEnt))
        (while en
          (ssadd en SS)
          (setq en (entnext en))
        )
      )
      (vl-cmdf "_.Join" SS "")
      ;(sssetfirst nil SS) ;uncomment if you want them selected after lisp ends
    )
    (princ "No Regions in the Drawing")
  )
  (princ)
)

 

--edit-- forgot the princ

Edited by mhupp
Link to post
Share on other sites

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
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...