Jump to content

Nneed a list to convert circles to polylines


MikeP

Recommended Posts

As previously suggested by profcad:

 

Use the BOUNDARY command and pick a point inside the circle. AutoCAD will create a polyline on top of the circle. This polyline can now be assigned a width.

Link to comment
Share on other sites

As previously suggested by profcad:

 

Use the BOUNDARY command and pick a point inside the circle. AutoCAD will create a polyline on top of the circle. This polyline can now be assigned a width.

 

simple like that ... :thumbsup:

Link to comment
Share on other sites

Here is mine hope you like it ............

 

(defun c:C2PL (/ o e)
 ; Tharwat Tue 26.10.2010
 (if (and (setq o
	  (car
	     (entsel "\n Select Circle :")))
          (eq (cdr (assoc 0
		   (setq e (entget o))))
                                          "CIRCLE")
   )
   (progn
     (vl-cmdf "_.donut"
       (* (cdr (assoc 40 e)) 2)
             (* (cdr (assoc 40 e)) 2)
                    (cdr (assoc 10 e)) "")
           (vl-cmdf "_.erase" o "")
         )
     (princ)
   )
 (princ)
 )

 

Tharwat

Link to comment
Share on other sites

(defun c:C2P (/ ss)
 ;; Circles to LWPolylines
 ;; Alan J. Thompson, 10.26.10
 (if (setq ss (ssget "_:L" '((0 . "CIRCLE"))))
   ((lambda (i / e d l)
      (while (setq e (ssname ss (setq i (1+ i))))
        (setq l nil)
        (foreach x (setq d (entget e)) (and (member (car x) '(6 8 39 48 62)) (setq l (cons x l))))
        (entmakex
          (append
            (list (cons 0 "LWPOLYLINE")
                  (cons 100 "AcDbEntity")
                  (cons 100 "AcDbPolyline")
                  (cons 90 2)
                  (cons 70 1)
            )
            l
            (list (cons 10 (polar (cdr (assoc 10 d)) 0. (cdr (assoc 40 d))))
                  '(42 . 1)
                  (cons 10 (polar (cdr (assoc 10 d)) pi (cdr (assoc 40 d))))
                  '(42 . 1)
            )
          )
        )
        (entdel e)
      )
    )
     -1
   )
 )
 (princ)
)

Link to comment
Share on other sites

Since you cant explode a circle. I need to be able to convert a circle to a poly line.

 

MikeP

 

Try this lisp, It draws the circle as a closed polyline made by two arcs.

 

 

(defun C:CIR (/ CDIA CPNT PT01 PT02)
 (or CIR:CDIA (setq CIR:CDIA 1.0))
 (initget (+ 2 4))
 (setq CIR:CDIA
   (cond
     ((getreal (strcat "\nSpecify circle diameter. <"(rtos CIR:CDIA 2 4)">: ")))
     (T CIR:CDIA)))
 (setq CDIA CIR:CDIA)
 (while
   (if (/= (setq CPNT (getpoint "\nSpecify center point: ")) nil)
     (progn
       (setq PT01 (polar CPNT (CIR_DTR   0.0)(/ CDIA 2.0)))
       (setq PT02 (polar PT01 (CIR_DTR  180.0)  CDIA))
       (CIR_DLWP (list PT01 PT02 PT01)(list -1.0 -1.0 -1.0) 0))))
 (princ))
(defun CIR_DLWP (VRT BF FLG)
 (entmakex
   (append
     (list
       (cons 0 "LWPOLYLINE")
       (cons 100 "AcDbEntity")
       (cons 100 "AcDbPolyline")
       (cons 90 (length VRT))
       (cons 70 FLG))
     (apply
       (function append)
       (mapcar
         (function
           (lambda
             (PNT BF)
             (list
               (cons 10 PNT)
               (cons 42 BF)))) 
         VRT BF))))
 (princ))
(defun CIR_DTR (a)(* pi (/ a 180.0)))

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