How to know a point is on an arc?

Discussion in 'AutoCAD' started by hamid2, Jan 18, 2005.

  1. hamid2

    hamid2 Guest

    I’ve got many points and an arc. I need to know which points are sitting on the arc. Any suggestion?
     
    hamid2, Jan 18, 2005
    #1
  2. hamid2

    mark Guest

    u can use the vlax-curve functions, and it will work for lines arcs
    polylines circles etc

    on the arc. Any suggestion?
     
    mark, Jan 18, 2005
    #2
  3. hamid2

    Jeff Mishler Guest

    Here's one, along with a sample on it's use, that will work for any arc,
    line, pline, spline, ellipse....

    (defun pt-on-arc? (pt arc)
    (if (= (type arc) 'ENAME)
    (setq arc (vlax-ename->vla-object arc))
    )
    (if (vlax-curve-getparamatpoint arc pt)
    t
    nil
    )
    )

    (defun c:test (/ arc pt)
    (setq arc (car (entsel "\nSelect arc: "))
    pt (getpoint "\nSelect point: ")
    )
    (if (pt-on-arc? pt arc)
    (princ " Yup...")
    (princ " Nope...")
    )
    (princ)
    )
     
    Jeff Mishler, Jan 18, 2005
    #3
  4. Didn't know that Luis, thanks.

    Which could reduce Jeff's function to

    (vlax-curve-getparamatpoint object point)

    which seems hardly worth a wrapper to get a
    T or NIL return value. I'd just use the return
    value(s) from vlax-curve-xxxx, or perhaps
    numberp if T or NIL is really needed.


    PS: Where in the help files does it say that?
     
    Jason Piercey, Jan 18, 2005
    #4
  5. hamid2

    Jeff Mishler Guest

    Heh, learn something new everyday.
    This also is the case in 2002.
    I don't recall seeing that mentioned before, thanks Luis!
     
    Jeff Mishler, Jan 18, 2005
    #5
  6. FWIW, my help file doesn't mention it (or at least
    not that I can find at the moment)
     
    Jason Piercey, Jan 18, 2005
    #6
  7. hamid2

    Fatty Guest

    There is another way with ActiveX method:

    (vl-load-com)

    (defun C:pOINTSONCURVE? ( / )
    (setvar "CMDECHO" 0)

    (setq vobj
    (vlax-ename->vla-object
    (car (entsel "\nSelect a curve (an arc) :"))))
    (setq lst nil)
    (while (setq pt (getpoint "\nPick point : "))
    (setq lst (cons pt lst)))
    (setq arc_lst (vl-remove-if (function not)
    (mapcar (function (lambda (x)
    (if (vlax-curve-getparamatpoint vobj x) x))) lst)))
    (if arc_lst
    (princ (strcat "There are is "
    (itoa (length arc_lst))
    " points on curve"))
    (princ "There aren't points on curve")))

    (C:pOINTSONCURVE?)
     
    Fatty, Jan 18, 2005
    #7
  8. Well, thanks for mentioning it.
     
    Jason Piercey, Jan 18, 2005
    #8
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.