+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 18 of 18
  1. #11
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Bill_Myron View Post
    The ellipse are circular with a radius ratio of 1.

    Attached is a drawing that will not allow me to select the ellipses with the lisp.
    Thank you for attaching the sample drawing.

    The issue is that, although very close to being circular, the ellipse axis ratio is in fact not quite equal to 1.0.

    You can verify this by using the following program to retrieve the axis ratio for a selected ellipse:
    Code:
    (defun c:eratio ( / e )
        (while
            (and (setq e (car (entsel "\nSelect ellipse: ")))
                 (= "ELLIPSE" (cdr (assoc 0 (entget e))))
            )
            (princ (strcat "\nEllipse ratio: " (rtos (cdr (assoc 40 (entget e))) 2 15)))
        )
        (princ)
    )
    Testing the program with a few ellipses from your drawing yields the following results:
    Code:
    Select ellipse:
    Ellipse ratio: 0.999999532781626
    Select ellipse:
    Ellipse ratio: 0.999999532795758
    Select ellipse:
    Ellipse ratio: 0.999999532786339
    Select ellipse:
    Ellipse ratio: 0.999999532749180
    Select ellipse:
    Ellipse ratio: 0.999999532857222
    The following code is a modification of the Ellipse to Arc program published on my site here, to incorporate some tolerance into the ellipse ratio filter:
    Code:
    ;;-------------------=={ Ellipse to Arc }==-------------------;;
    ;;                                                            ;;
    ;;  Converts circular Ellipses & Elliptical Arcs (i.e. for    ;;
    ;;  which the Ellipse Axis Ratio = 1.0) to Circles & Arcs,    ;;
    ;;  whilst retaining all original properties. Works with      ;;
    ;;  Ellipses & Elliptical Arcs constructed in any UCS.        ;;
    ;;------------------------------------------------------------;;
    ;;  Author: Lee Mac, Copyright © 2013 - www.lee-mac.com       ;;
    ;;------------------------------------------------------------;;
    
    (defun c:e2a ( / a b c e i m p q r s u v z )    
        (if (setq s (ssget "_:L" '((0 . "ELLIPSE") (-4 . ">=") (40 . 0.9999) (-4 . "<=") (40 . 1.0001))))
            (repeat (setq i (sslength s))
                (setq e (entget (ssname s (setq i (1- i))))
                      z (cdr (assoc 210 e))
                      c (trans (cdr (assoc 10 e)) 0 z)
                      p (trans (cdr (assoc 11 e)) 0 z)
                      a (distance '(0.0 0.0) p)
                      b (* a (cdr (assoc 40 e)))
                      r (angle '(0.0 0.0) p)
                      u (cdr (assoc 41 e))
                      v (cdr (assoc 42 e))
                      m (list (list (cos r) (- (sin r))) (list (sin r) (cos r)))
                      p (mapcar '+ c (mxv m (list (* a (cos u)) (* b (sin u)))))
                      q (mapcar '+ c (mxv m (list (* a (cos v)) (* b (sin v)))))
                )
                (if
                    (if (equal p q 1e-8)
                        (entmake
                            (cons '(0 . "CIRCLE")
                                (append (LM:defaultprops e)
                                    (list
                                        (cons  010 c)
                                        (cons  040 a)
                                        (assoc 210 e)
                                    )
                                )
                            )
                        )
                        (entmake
                            (cons '(0 . "ARC")
                                (append (LM:defaultprops e)
                                    (list
                                        (cons  010 c)
                                        (cons  040 a)
                                        (cons  050 (angle c p))
                                        (cons  051 (angle c q))
                                        (assoc 210 e)
                                    )
                                )
                            )
                        )
                    )
                    (entdel (cdr (assoc -1 e)))
                )
            )
        )
        (princ)
    )
    
    ;; Default Properties  -  Lee Mac
    ;; Returns a list of DXF properties for the supplied DXF data,
    ;; substituting default values for absent DXF groups
    
    (defun LM:defaultprops ( elist )
        (mapcar
            (function
                (lambda ( pair )
                    (cond ((assoc (car pair) elist)) ( pair ))
                )
            )
           '(
                (008 . "0")
                (006 . "BYLAYER")
                (039 . 0.0)
                (062 . 256)
                (048 . 1.0)
                (370 . -1)
            )
        )
    )
    
    ;; Matrix x Vector  -  Vladimir Nesterovsky
    ;; Args: m - nxn matrix, v - vector in R^n
    
    (defun mxv ( m v )
        (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
    )
    
    (princ)
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  2. #12
    Senior Member
    Using
    Civil 3D 2011
    Join Date
    Aug 2011
    Posts
    151

    Default

    Never thought of checking the ratio units that far.

    Perfect. Thanks Lee Mac.

  3. #13
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    You're welcome Bill
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  4. #14
    Full Member
    Discipline
    Architectural
    Hsanon's Discipline Details
    Occupation
    Architect
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Nov 2014
    Posts
    93

    Default

    I agree with Bill.... the program is not recognizing the ellipse.... so it is not getting selected.

    i understand this is an old thread..... maybe the forum has shifted to another thread... it will be useful to convert ellipses to mathematically accurate circles / arcs

  5. #15
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    Quote Originally Posted by Hsanon View Post
    I agree with Bill.... the program is not recognizing the ellipse.... so it is not getting selected.
    What is the axis ratio of your ellipses? (use the above program to check this)
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  6. #16
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    I have now updated the Ellipse to Arc program published on my site to incorporate the tolerance on the ellipse axis ratio.

    Lee
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  7. #17
    Forum Newbie
    Using
    AutoCAD 2013
    Join Date
    Mar 2015
    Posts
    1

    Default Ellispse to arc convert

    hi everyone,

    Please help me to convert ellipse to arc ,i attach my cad file.in my cad file ellipse major and minor radius is not equal .
    Attached Files

  8. #18
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    Registered forum members do not see this ad.

    Refer to the solution offered here.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Convert Ellipse to Arcs
    By jammie in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 27th Feb 2015, 10:05 pm
  2. How to convert LINE, ARC, SPLINE,ELLIPSE to POLYLINE
    By cadamrao in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 16th Jun 2010, 03:57 pm
  3. Ellipse Not Right
    By gsksun4 in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 25th Mar 2010, 04:34 pm
  4. ellipse won't convert to polyline
    By zera in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 7
    Last Post: 17th Dec 2009, 09:19 pm
  5. Ellipse
    By johnengineer in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 30th Mar 2007, 12:55 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts