+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member
    Computer Details
    jammie's Computer Details
    Operating System:
    Ubuntu / XP / W8
    Discipline
    Civil
    jammie's Discipline Details
    Occupation
    Design Technician
    Discipline
    Civil
    Using
    AutoCAD 2012
    Join Date
    May 2006
    Location
    Ireland
    Posts
    299

    Default Convert Ellipse to Arcs

    Registered forum members do not see this ad.

    Hi all,

    I am currently working on a drawing that has been done using ellipses instead of arcs. I need to create a polyline so I can take off an area

    The major and minor radii of the ellipses are equal.

    I was hoping to be able to extact the relvant properties from an ellipse and produce an arc at its location. Here is a routine I have been working on but it does not work correctly.

    It inserts an arc with the correct radius but there seems to be a problem with the start and end angles


    Code:
    (defun ellipse->arc ();/ SS LI_ENAME ACADOBJ acaddoc acadms PASS FAIL radius OBJ StartAngle EndAngle Center)
    
    
      (if
        (and
          (setq ss (ssget '((0 . "ellipse"))))
          (setq li_enames (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
          )
    
        (progn
      ;Load ActiveX Support
    
    
      (vl-load-com)
      (setq acadobj  (vlax-get-acad-object)
    	acaddoc	 (vla-get-activeDocument acadobj )
    	acadms 	 (vla-get-modelspace acaddoc)
    	pass  0
    	fail  0
    	)
    
      (FOREACH N li_enames
        (setq obj (vlax-ename->vla-object n))
    
           
        (if
          (equal
    	(vla-get-RadiusRatio obj) 1 0.0001)
    
          (progn
    
    	(setq  radius     (vla-get-MajorRadius obj )
    	       StartAngle (vla-get-StartAngle OBJ)
    	       EndAngle   (vla-get-EndAngle obj)
    	       Center     (vla-get-Center obj)
    	       )
    
    	(vla-addarc acadms Center radius StartAngle EndAngle  )
    	(entdel n)
    	(setq pass (1+ pass))
    	)
    
          (setq fail (1+ fail))
          )
        )
    
      (alert (strcat "\n<" (rtos pass 2 0) "> Ellipse objects converted to Arcs" )
    	 (strcat "\n<" (rtos fail 2 0) "> Ellipse objects failed to be converted" ))
      )
        (alert "\No Ellipses selected")
        )
       )
    Any help would be greatly appreciated

    Thanks

    Jammie

  2. #2
    Senior Member
    Computer Details
    JohnM's Computer Details
    Operating System:
    xp pro
    Using
    AutoCAD 2006
    Join Date
    Feb 2009
    Location
    houston, texas
    Posts
    380

    Default

    Could you be a little more detailed in what you want to accomplish.
    If drawing an ellipse set the AutoCAD system variable pellipse to 1 so when you draw an ellipse it is made with a polyline.
    If an ellipse is in the drawing you can save it down to the lowest DXF like R12 then open it back up and the ellipse will be converted to a polyline.
    There are many methods that can be used to make an ellipse. I believe the math AutoCAD uses will use about 8 – 10 different arcs to make an ellipse.

  3. #3
    Senior Member
    Computer Details
    jammie's Computer Details
    Operating System:
    Ubuntu / XP / W8
    Discipline
    Civil
    jammie's Discipline Details
    Occupation
    Design Technician
    Discipline
    Civil
    Using
    AutoCAD 2012
    Join Date
    May 2006
    Location
    Ireland
    Posts
    299

    Default

    Thanks John,

    I didn't create the drawing myself. I just need to do an area check. The particular boundary that I needed was drawn using lines and ellipses


    If an ellipse is in the drawing you can save it down to the lowest DXF like R12 then open it back up and the ellipse will be converted to a polyline.
    That worked fine for finding the area I required,

    Thanks

    -Jammie

  4. #4
    Senior Member
    Computer Details
    JohnM's Computer Details
    Operating System:
    xp pro
    Using
    AutoCAD 2006
    Join Date
    Feb 2009
    Location
    houston, texas
    Posts
    380

    Default

    I don’t know exactly what you are doing but you might want to check out the boundary command. If an area is closed you can create a boundary the list the area and perimeter
    Type –boundary (hyphen boundary) then pick a point inside the closed area and it will create a polyline outline of the area then you can use list last to get info or have lisp do it for you.
    Note: if the area contains a ellipse you will be asked to create a region and then you can get info

  5. #5
    Senior Member
    Computer Details
    jammie's Computer Details
    Operating System:
    Ubuntu / XP / W8
    Discipline
    Civil
    jammie's Discipline Details
    Occupation
    Design Technician
    Discipline
    Civil
    Using
    AutoCAD 2012
    Join Date
    May 2006
    Location
    Ireland
    Posts
    299

    Default

    I don’t know exactly what you are doing
    Hah I spend most of the day wondering that myself...

    Note: if the area contains a ellipse you will be asked to create a region and then you can get info
    Creating a region works very well.

    Interestingly AutoCAD seems to convert the ellipses to arcs when creating the region. (I am positive they are ellipses though)

    When I explode the region, it creates a series of ARCs and lines

    -Jammie

  6. #6
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,540

    Default

    Jammie
    Click this link, maybe you can find something usefull on that page:
    http://www.cadtutor.net/forum/showthread.php?t=1639&
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  7. #7
    Senior Member
    Computer Details
    jammie's Computer Details
    Operating System:
    Ubuntu / XP / W8
    Discipline
    Civil
    jammie's Discipline Details
    Occupation
    Design Technician
    Discipline
    Civil
    Using
    AutoCAD 2012
    Join Date
    May 2006
    Location
    Ireland
    Posts
    299

    Default

    Jammie
    Click this link, maybe you can find something usefull on that page:
    http://www.cadtutor.net/forum/showthread.php?t=1639&
    fuccaro,

    That is an interesting thread and very nice work on the routine to convert an ellipse to a pline.

    That also explains why offsetting an ellipse creates a spline

    Thanks for your help

    Jammie

  8. #8
    Senior Member Adesu's Avatar
    Using
    AutoCAD 2005
    Join Date
    Feb 2004
    Location
    Indonesia-Tangerang
    Posts
    158

    Default

    I think you look for like this code
    Code:
    (defun c:e2a (/ acaddoc acadms acadobj center endangle obj radius ss ssn startangle)
      (vl-load-com)
      (if 
        (setq ss (ssget '((0 . "ellipse"))))
        (progn      
          (setq acadobj (vlax-get-acad-object))
          (setq acaddoc (vla-get-activeDocument acadobj))
          (setq acadms (vla-get-modelspace acaddoc))
          (setq ssn (ssname ss 0))
          (setq obj (vlax-ename->vla-object ssn))
          (if
    	obj ;(equal (vla-get-RadiusRatio obj) 1 0.0001)
    	(progn
    	  (setq radius (vla-get-MajorRadius obj))
    	  (setq StartAngle (vla-get-StartAngle OBJ))
    	  (setq EndAngle (vla-get-EndAngle obj))
    	  (setq Center (vlax-get obj 'center))
    	  (entdel ssn)
    	  (vla-addarc acadms (vlax-3d-point Center) radius StartAngle EndAngle)
    	  ) ; progn
    	(alert "> Ellipse objects failed to be converted")
    	)   ; if
          )     ; progn
        )       ; if
      (princ)
      )       ; defun
    Quote Originally Posted by jammie View Post
    Hi all,

    I am currently working on a drawing that has been done using ellipses instead of arcs. I need to create a polyline so I can take off an area

    The major and minor radii of the ellipses are equal.

    I was hoping to be able to extact the relvant properties from an ellipse and produce an arc at its location. Here is a routine I have been working on but it does not work correctly.

    It inserts an arc with the correct radius but there seems to be a problem with the start and end angles


    Code:
    (defun ellipse->arc ();/ SS LI_ENAME ACADOBJ acaddoc acadms PASS FAIL radius OBJ StartAngle EndAngle Center)
    
    
      (if
        (and
          (setq ss (ssget '((0 . "ellipse"))))
          (setq li_enames (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
          )
    
        (progn
      ;Load ActiveX Support
    
    
      (vl-load-com)
      (setq acadobj  (vlax-get-acad-object)
    	acaddoc	 (vla-get-activeDocument acadobj )
    	acadms 	 (vla-get-modelspace acaddoc)
    	pass  0
    	fail  0
    	)
    
      (FOREACH N li_enames
        (setq obj (vlax-ename->vla-object n))
    
           
        (if
          (equal
    	(vla-get-RadiusRatio obj) 1 0.0001)
    
          (progn
    
    	(setq  radius     (vla-get-MajorRadius obj )
    	       StartAngle (vla-get-StartAngle OBJ)
    	       EndAngle   (vla-get-EndAngle obj)
    	       Center     (vla-get-Center obj)
    	       )
    
    	(vla-addarc acadms Center radius StartAngle EndAngle  )
    	(entdel n)
    	(setq pass (1+ pass))
    	)
    
          (setq fail (1+ fail))
          )
        )
    
      (alert (strcat "\n<" (rtos pass 2 0) "> Ellipse objects converted to Arcs" )
    	 (strcat "\n<" (rtos fail 2 0) "> Ellipse objects failed to be converted" ))
      )
        (alert "\No Ellipses selected")
        )
       )
    Any help would be greatly appreciated

    Thanks

    Jammie

  9. #9
    Senior Member
    Computer Details
    jammie's Computer Details
    Operating System:
    Ubuntu / XP / W8
    Discipline
    Civil
    jammie's Discipline Details
    Occupation
    Design Technician
    Discipline
    Civil
    Using
    AutoCAD 2012
    Join Date
    May 2006
    Location
    Ireland
    Posts
    299

    Default

    I think you look for like this code
    Code:

    (defun c:e2a (/ acaddoc acadms acadobj center endangle obj radius ss ssn startangle)
    (vl-load-com)
    (if
    (setq ss (ssget '((0 . "ellipse"))))
    (progn
    (setq acadobj (vlax-get-acad-object))
    (setq acaddoc (vla-get-activeDocument acadobj))
    (setq acadms (vla-get-modelspace acaddoc))
    (setq ssn (ssname ss 0))
    (setq obj (vlax-ename->vla-object ssn))
    (if
    obj ;(equal (vla-get-RadiusRatio obj) 1 0.0001)
    (progn
    (setq radius (vla-get-MajorRadius obj))
    (setq StartAngle (vla-get-StartAngle OBJ))
    (setq EndAngle (vla-get-EndAngle obj))
    (setq Center (vlax-get obj 'center))
    (entdel ssn)
    (vla-addarc acadms (vlax-3d-point Center) radius StartAngle EndAngle)
    ) ; progn
    (alert "> Ellipse objects failed to be converted")
    ) ; if
    ) ; progn
    ) ; if
    (princ)
    ) ; defun
    Adesu,

    I have just tested your code and it works very well. It converts the ellipses to arcs which is exactly what I was hoping for.

    Thank you for you help

    Regards,

    Jammie

  10. #10
    Senior Member Adesu's Avatar
    Using
    AutoCAD 2005
    Join Date
    Feb 2004
    Location
    Indonesia-Tangerang
    Posts
    158

    Default

    Registered forum members do not see this ad.

    Ahh....I very glad can help one.

    Quote Originally Posted by jammie View Post
    Adesu,

    I have just tested your code and it works very well. It converts the ellipses to arcs which is exactly what I was hoping for.

    Thank you for you help

    Regards,

    Jammie

Similar Threads

  1. Joinning lines/ellipse arcs and circle arc???!
    By Nass in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 17th Aug 2012, 06:20 pm
  2. convert arcs & splines to polylines
    By coffeetime in forum AutoCAD General
    Replies: 1
    Last Post: 25th Nov 2008, 11:35 pm
  3. v2004: Convert arcs for tab profile?
    By ajs in forum AutoCAD 3D Modelling & Rendering
    Replies: 6
    Last Post: 28th Nov 2007, 06:47 pm
  4. Convert text to lines and arcs
    By Tim in forum AutoCAD General
    Replies: 14
    Last Post: 27th Sep 2005, 10:18 pm
  5. break up ellipse into tangent arcs in ac-2000
    By keninsite in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 7th Dec 2004, 07:41 am

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