pline intersecting itself

Discussion in 'AutoCAD' started by elefebvre, Jun 8, 2004.

  1. elefebvre

    elefebvre Guest

    hi,

    how can I check if a polyline is intersecting itself? I tried the intersectwith option on itself but it gives a type mismatch.

    thanks in advance for any help,

    Emmanuel
     
    elefebvre, Jun 8, 2004
    #1
  2. elefebvre

    wivory Guest

    Can we see your code please?

    Regards

    Wayne Ivory
    IT Analyst Programmer
    Wespine Industries Pty Ltd
     
    wivory, Jun 9, 2004
    #2
  3. elefebvre

    elefebvre Guest

    dim Pi as variant
    dim pl as acadLWpolyline

    Pi=pl.intersectWith(pl,acExtendNone)
     
    elefebvre, Jun 9, 2004
    #3
  4. elefebvre

    wivory Guest

    Well, I ran your code (assigning a particular polyline to pl with HandleToObject) and didn't get any errors so I'm not sure why you're having a problem.

    Mind you, the results are probably not what you were hoping for anyway. Pi returned the coordinates for all the vertices. (This particular polyline doesn't overlap itself so possibly if it did you would get extra values returned which you could compare to the vertices.)

    Regards

    Wayne
     
    wivory, Jun 9, 2004
    #4
  5. elefebvre

    Jürg Menzi Guest

    Hi Emmanuel

    Make a temporary copy by copy method, explode both, get intersections between
    each segment:
    - no intersection -> nothing
    - 2 intersections and equal endpopints -> nothing
    - 1 intersection equal Endpoint -> collect
    - n intersections not equal Endpoint -> collect
    Disadvantage:
    If you've intersections they are exactly on both endpoints the method will fail.

    Cheers
     
    Jürg Menzi, Jun 9, 2004
    #5
  6. elefebvre

    Jürg Menzi Guest

    Correction:
    Explode the pline twice, no copy necessary...

    Cheers
     
    Jürg Menzi, Jun 9, 2004
    #6
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.