Author Topic: REGION to PLINE CONVERSION  (Read 13292 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
REGION to PLINE CONVERSION
« on: December 01, 2006, 10:08:48 AM »
Hi all...

I'm not familar with region...
I know we can convert a closed polyline to region...
but can we do region to polyline with AutoCAD ?

 :|
Keep smile...

Gliderider

  • Guest
Re: REGION to PLINE CONVERSION
« Reply #1 on: December 01, 2006, 01:54:33 PM »
I don't know about converting a region to a polyline but you can use the bpoly command to create a polyline from a region.

Bryco

  • Water Moccasin
  • Posts: 1882
Re: REGION to PLINE CONVERSION
« Reply #2 on: December 01, 2006, 02:01:51 PM »
You can explode it, to its primitives then if applicable polyline join those, if not there are probably splines and or ellipses involved.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: REGION to PLINE CONVERSION
« Reply #3 on: December 01, 2006, 03:47:07 PM »
For the moment...i've wrote this..

Region to Polyline...

Code: [Select]
;;RETOPO
(defun c:retopo (/ w1)
  (setvar "cmdecho" 1)
  (setq w1 (entget (car (entsel "\nSélectionnez votre région: "))))
  (if w1
    (progn
;;is layer lock ?
(if (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (cdr (assoc 8 w1)))))))
(command "_layer" "_U" (cdr (assoc 8 w1)) "")
)

;;si c'est une REGION
     (if (eq (cdr (assoc 0 w1)) "REGION")
          (progn    
(command "._explode" (cdr (assoc -1 w1)))
(setq w1 (entget (entlast)))
(if (eq (cdr (assoc 0 w1)) "LWPOLYLINE")(command "._pedit" "_l" "_J" "_P" "" ""))

(if (and (/= (cdr (assoc 0 w1)) "CIRCLE")(/= (cdr (assoc 0 w1)) "LWPOLYLINE"))
(command "._pedit" "_l" "_Y" "_J" "_P" "" "")
)
(princ "\nConversion en polyligne réussi.")
(setq w1 (entget (entlast)))
(command "_area" "_O" (cdr (assoc -1 w1)))
(getretopoinfo)
)
(progn
(command "_area" "_O" (cdr (assoc -1 w1)))
(getretopoinfo)
))))
(princ)
(c:retopo)
)


;;;;;;;;;;;;;;;;;;;;;;;
(defun getretopoinfo ()
(alert (strcat "Superficie:  " (rtos (getvar "AREA") 2 8)
"\nPerimètre : " (rtos (getvar "PERIMETER") 2 8)))
)
Keep smile...