ZWSOFT User Community > ZWSOFT Forums - Find. Share. Connect. > Essential Posts for ZWCAD/ZW3D > How to Convert Ellipse to Arcs?
How to Convert Ellipse to Arcs?
12-07-2012 11:34 . am | View his/her posts only
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
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




