Jump to content

Region 2 pline - helkp


teknomatika

Recommended Posts

Dearest

 

In this routine, I intend it to be converted the region into a pline

but intend at the same time be preserved region.

Thanks.

 

;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/region-to-polyline/td-p/2432294;;
;;somebudy;;
(defun c:r2p ( / ename old_cmdecho)

(if (setq ename (car (entsel)))
(if (= (cdr (assoc 0
(entget ename))) "REGION")

(progn
(setq old_cmdecho (getvar
'cmdecho))
(setvar 'cmdecho
0)
(command "_.undo"
"_begin")
(command "_.explode"
ename)
(command "_.pedit" "_m"
(ssget "_p") "" "_y" "_j" 0.0 "")

(command "_.undo" "_end")
(setvar
'cmdecho old_cmdecho)

)
(prompt "\nThe selected object is not a
region.")
)
(prompt
"\nNothing selected.")
)
(princ)
)

Link to comment
Share on other sites

And change

(command "_.explode" ename)

 

To

(command "_.explode" (entlast))

 

So that picked entity remains intact and operations that follow are performed on copy of picked REGION entity...

Link to comment
Share on other sites

You may also want to look into PEDITACCEPT. If PEDITACCEPT is set to one this function will fail.

 

Maybe you should get the old value of PEDITACCEPT then set it to zero and at the end set it back to the old PEDITACCEPT. The same way you do it with CMDECHO.

Link to comment
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
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...