Line Intersection

Discussion in 'AutoCAD' started by OPTIMIZE CAD Technologies, Jun 4, 2004.

  1. Hi



    I 'am looking for a lisp routine which can indicate the intersection of a
    line and arc.


    ( simular of AutoCAD command: inders. )



    Tanks in Advance

    Arnold
     
    OPTIMIZE CAD Technologies, Jun 4, 2004
    #1
  2. OPTIMIZE CAD Technologies

    Jeff Guest

    Something like this?

    (defun intersection (ent1 ent2 / start leglen)
    (and
    ent1
    ent2
    (or (= (type ent1) 'ENAME)
    (= (type ent1) 'VLA-OBJECT)
    )
    (or (= (type ent2) 'ENAME)
    (= (type ent2) 'VLA-OBJECT)
    )

    )
    (if (= (type ent1) 'ENAME)
    (setq ent1 (vlax-ename->vla-object ent1))
    )
    (if (= (type ent2) 'ENAME)
    (setq ent2 (vlax-ename->vla-object ent2))
    )
    (setq start (vlax-invoke ent1 "intersectwith" ent2 acextendnone)
    leglen (* 0.03 (getvar "viewsize"))
    )
    (grdraw (polar start (angtof "135" 1) leglen)
    (polar start (angtof "315" 1) leglen)
    7)
    (grdraw (polar start (angtof "45" 1) leglen)
    (polar start (angtof "225" 1) leglen)
    7)
    start
    )

    Use like this:
    (setq test (intersection (car (entsel)) (car (entsel))))

    Jeff
     
    Jeff, Jun 8, 2004
    #2
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.