CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 12828
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedregion2poly error

 Post Reply Post Reply
Author
w64bitcad View Drop Down
Newbie
Newbie


Joined: 18.May.2021
Location: United Kingdom
Using: AutoCAD 2021
Status: Offline
Points: 9
Direct Link To This Post Topic: region2poly error
    Posted: 15.Jul.2021 at 14:25
When I use region2poly 1.1 on AutoCAD 2021, I receive an error:
Invalid option keyword.
; error: Function cancelled
Is there anything I can do in order to fix this?

Back to Top
Vladimir Michl View Drop Down
Moderator Group
Moderator Group

Arkance Systems CZ

Joined: 26.Jul.2007
Location: Czech Republic
Using: Autodesk software
Status: Offline
Points: 2015
Direct Link To This Post Posted: 15.Jul.2021 at 14:39
It probably doesn't like one of the options. Please try the following LISP code:

; Convert Region to Polyline (by Arkance Systems)
;
;1.1 - multiple
;
(defun c:region2poly (/ cmde ss reg reg1 lay etyp i)
 (setq cmde (getvar "CMDECHO"))
  (setvar "cmdecho" 0)
  ;(setq reg (entsel "\nSelect a region: "))
  ;(if reg
  (setq ss (ssget '((0 . "REGION"))))
  (if ss
   (progn
   (setq i 0)
   (while (< i (sslength ss))
   ;(setq reg1 (entget (car reg)))
   (setq reg1 (entget (ssname ss i)))
   (setq lay (cdr (assoc 8 reg1)))
   (setq etyp (cdr (assoc 0 reg1)))
;is layer locked?
(if (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" lay)))))
 (command "_LAYER" "_U" lay "")
)

;region?
;     (if (eq etyp "REGION")
;          (progn
(command "._explode" (cdr (assoc -1 reg1)))
(setq reg1 (entget (entlast)))
(setq etyp (cdr (assoc 0 reg1)))

(if (eq etyp "LWPOLYLINE")(command "._PEDIT" "_L" "_J" "_P" "" ""))

(if (and (/= etyp "CIRCLE")(/= etyp "LWPOLYLINE"))
 (command "._PEDIT" "_L" "_Y" "_J" "_P" "" "")
)
(princ "\nConverted to polyline.")
;)
;(princ " Not a region!")
;) ; if
(setq i (1+ i))
) ; while
))
(setvar "cmdecho" cmde)
(princ)
);

Vladimir Michl (moderator)
Arkance Systems - arkance-systems.cz - Autodesk reseller
Back to Top
w64bitcad View Drop Down
Newbie
Newbie


Joined: 18.May.2021
Location: United Kingdom
Using: AutoCAD 2021
Status: Offline
Points: 9
Direct Link To This Post Posted: 15.Jul.2021 at 14:45
I did some digging.
The problem is with PEDITACCEPT.

Instead of:
(if (eq etyp "LWPOLYLINE")(command "._PEDIT" "_L" "_J" "_P" "" ""))
(if (and (/= etyp "CIRCLE")(/= etyp "LWPOLYLINE"))(command "._PEDIT" "_L" "_Y" "_J" "_P" "" "")
this seems to work:
(if (= (getvar "PEDITACCEPT") 1)(command "PEDIT" "_L" "_J" "_P" "" "")(command "PEDIT" "_L" "_Y" "_J" "_P" "" ""))



Edited by w64bitcad - 16.Jul.2021 at 12:16
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,344 seconds.