Mapcar fails to compare 2 lwpolylines

Discussion in 'AutoCAD' started by Jeff-FRCH, Jun 29, 2004.

  1. Jeff-FRCH

    Jeff-FRCH Guest

    If I use the boundary command twice in the same space using 2 different points to create 2 lwpolylines, is there a way to compare the 2 entities to see if they are the same? I have tried using (entget) on each entity and stripping away the first 4 elements of each data list to eliminate the name and handle. Even though they appear identical if I do a (mapcar 'equal data1 data2) I get a result similar to (T T T T T T T T T T nil T T T T T T T T T T T T T T T T T T T T). Each time it is different but the nil(s) always occurs at a DXF code 10 - a vertex point. How can I compare 2 lwpolylines to see if they are identical except for their name and handle?
     
    Jeff-FRCH, Jun 29, 2004
    #1
  2. Jeff-FRCH

    David Bethel Guest

    You probably need some fuzz factor added;

    (defun eqfuzz (a b)
    (equal a b 1e-11))

    (defun c:tef ()
    (setq ed1 (entget e1))
    (repeat 4
    (setq ed1 (cdr ed1)))
    (setq ed2 (entget e2))
    (repeat 4
    (setq ed2 (cdr ed2)))
    (setq r1 (mapcar 'eqfuzz ed1 ed2))
    (prin1 r1))

    -David
     
    David Bethel, Jun 29, 2004
    #2
  3. Jeff-FRCH

    Jeff-FRCH Guest

    Figured it out. I need to give a fuzz factor - (equal data1 data2 0.0001). I guess the precision of the boundary command causes variance out at 16 decimal places or whatever precision AutoCAD uses.
     
    Jeff-FRCH, Jun 29, 2004
    #3
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.