CAD/CAM discussion forum > CAD Tutorial & Tips > [CAD Source Codes] How to Convert Ellipse to Arc by lisp in ZWCAD? ellipse arc

# [CAD Source Codes] How to Convert Ellipse to Arc by lisp in ZWCAD? ellipse arc

davies65

Newbie

posts: 6

Registered: 2012-7-11

Message 1 of 1

[CAD Source Codes] How to Convert Ellipse to Arc by lisp in ZWCAD? ellipse arc
12-07-2012 11:34 . am   |   View his/her posts only
How to Convert Ellipse to Arc? Conversation of ellipse arc.

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

(if
(and
(setq ss (ssget '((0 . "ellipse"))))
(setq li_enames (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
)

(progn

pass 0
fail 0
)

(FOREACH N li_enames
(setq obj (vlax-ename->vla-object n))

(if
(equal

(progn

StartAngle (vla-get-StartAngle OBJ)
EndAngle (vla-get-EndAngle obj)
Center (vla-get-Center obj)
)

(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" ))
)