Arc from ellipse

Discussion in 'AutoCAD' started by Bob Hable, Jun 22, 2004.

  1. Bob Hable

    Bob Hable Guest

    Help. Why does this code not draw an arc? I am replacing ellipse's with
    arcs in a drawing. The values for start point, end point and mid point are
    all valid. The line
    (command "arc" stPt midPt entPt)
    will not draw an arc from the routine. But if I type and enter the same
    exact line at the command line it will then draw the arc. I do not
    understand.
    Thanks

    (elEnt is an ellipse from selection set)

    (defun ellipseToArc (elEnt)
    (vl-load-com)
    (setq obj (vlax-ename->vla-object elEnt))
    (setq stPt (vlax-curve-getStartPoint obj))
    (setq endPt (vlax-curve-getEndPoint obj))

    (setq pt (polar stPt (angle stPt endPt) (/ (distance stPt endPt) 2.0)))
    (setq midPt (vlax-curve-getClosestPointTo obj pt))

    (setq dist (/ (+ (distance stPt midPt) (distance midPt endPt)) 2.0))

    (setq midPt (vlax-curve-getPointAtDist obj dist))

    (command "arc" stPt midPt entPt) ;will not create an arc

    (princ)
    )
     
    Bob Hable, Jun 22, 2004
    #1
  2. Bob Hable

    randy benson Guest

    Because stpt & entpt are at the same location? (an ellipse is closed)
     
    randy benson, Jun 22, 2004
    #2
  3. Bob Hable

    Joe Burke Guest

    Bob,

    Assuming you want to replace an elliptical arc with an arc, I think the problem is a
    typo.

    (command "arc" stPt midPt entPt) ; endPt

    Joe Burke
     
    Joe Burke, Jun 22, 2004
    #3
  4. Bob Hable

    Bob Hable Guest

    You are right. A typo. Dumb mistake.
    Thanks


     
    Bob Hable, Jun 22, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.