find intersections

Discussion in 'AutoCAD' started by hulioman, Mar 28, 2005.

  1. hulioman

    hulioman Guest

    I am building a routine to take a closed polyline an find any occurance of intersections along it. Does anyone have a good method to do this?
     
    hulioman, Mar 28, 2005
    #1
  2. hulioman

    ECCAD Guest

    I use something like this:

    (setq endpt (vlax-curve-getendpoint obj))
    (setq begpt (vlax-curve-getstartpoint obj))
    (setq slen (/ len nseg)); segment length
    (setq di slen pb begpt)
    (repeat nseg
    (setq pa (vlax-curve-getpointatdist obj di))
    (setq cc 0)
    (if hs
    (progn
    (setq nh (sslength hs)); # house lines
    (repeat nh
    (setq ename (ssname hs cc))
    (setq lent (entget ename))
    (setq p1 (cdr (assoc 10 lent))); end point1
    (setq p2 (cdr (assoc 11 lent))); end point2
    (setq cp (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.0)))
    (setq pnt nil)
    (setq pnt (inters p1 p2 pa pb T))
    (if pnt
    (progn
    ...... do whatever

    Bob
     
    ECCAD, Mar 28, 2005
    #2
  3. hulioman

    hulioman Guest

    I think i need to clarify what I am looking for.
    I have a closed polyline...
    I need to find any other entities in the drawing that intersect it and then store the intersection location.
     
    hulioman, Mar 28, 2005
    #3
  4. hulioman

    ECCAD Guest

    This line does the checking for intersecting objects:
    (setq pnt (inters p1 p2 pa pb T))
    where, pa and pb are 'endpoints' of some line that
    (may) intersect. If the line (does) intersect, the intersection
    point is returned in variable pnt.

    The portion of the routine posted goes through a closed
    polyline, and examines all 'line' objects on the drawing, and
    if they intersect, returns that point...

    Bob
     
    ECCAD, Mar 28, 2005
    #4
  5. hulioman

    Jürg Menzi Guest

    Hi 'hulioman'

    Visit my homepage -> Free Stuff and search for 'VxGetInters' and
    'VxGetBlockInters'.

    Cheers
     
    Jürg Menzi, Mar 29, 2005
    #5
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.