Jump to content

Deleting Duplicate Points


fallen

Recommended Posts

thanx for the code, but have u tried mine?, it takes lesser time about 10 secs for 34000 pts, if u can fix the error of mine i'll be so pleased.

thank u

How are you testing it? It doesn't work for me.

Link to comment
Share on other sites

I doubt that you could optimise the procedure much above Alan's example imo.

Exactly what I was thinking.

Step through SS once, if dxf 10 is member of list delete it, if not add dxf 10 to list.

If you setq i to -1 instead of using lambda, it would improve your rate by some infinitesimal amount, but that's about it.

Link to comment
Share on other sites

i see, alan's code is clearer and much understandble than mine. but i don't understand why my routine doesn't work on alan's system, there is an error on exiting, but it completed the task.

Link to comment
Share on other sites

it is working i 've tested it many many times for different point sets including restarting autocad :). what kind of error did it produce on your system could u explain it?

thank u

Link to comment
Share on other sites

Select objects:
Backtrace:
[0.48] (VL-BT)
[1.44] (*ERROR* "bad argument type: 2D/3D point: (nil nil)")
[2.39] (_call-err-hook #<SUBR @2e5fdcd0 *ERROR*> "bad argument type: 2D/3D 
point: (nil nil)")
[3.33] (sys-error "bad argument type: 2D/3D point: (nil nil)")
:ERROR-BREAK.28 "bad argument type: 2D/3D point: (nil nil)"
[4.25] (DISTANCE (nil nil) (nil nil))
[5.19] (DUPSIL)
[6.15] (#<SUBR @2b21a1e0 -rts_top->)
[7.12] (#<SUBR @16ab435c veval-str-body> "(dupsil)" T #<FILE internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)

Error: bad argument type: 2D/3D point: (nil nil)

Link to comment
Share on other sites

I must admit, looking at your code, I don't see how it could be faster than mine. Mine steps through the selection set once and the most strenuous effort it has is to see if the dxf 10 code is a member of a list that can only be as big as the smallest possible number of points.

Link to comment
Share on other sites

how can i proove that my code is working and faster than yours. i am thinking now very deeply :):)

By the way i like ur algorithm

Mine depends on similar divide & conquer algorithm i think :)

Link to comment
Share on other sites

allan, sorry for bothering u again but, i have just ran ur code again, it completed the task then i select the remaining points that not duplicated for another test "triangulation" but "triangulation" found still duplicate points.

may be discuss it tomorrow

i am very happy to you response my post and interested in

may be i can proove it tomorrow :):)

Link to comment
Share on other sites

Difficult since your routine crashes even on your machine.

 

Get the time before the routine starts to work (after valid selection with ssget) and subtract the time when completed from it.

 

;;; Egg Timer for calculating run time in milliseconds
;;; Alan J. Thompson, 03.22.09
;;; Argument: #StartStop - 1 for begin, 0 for end
(defun AT:EggTimer (#StartStop)
 (cond
   ((eq 1 #StartStop) (setq *EggTimer* (getvar "millisecs")))
   ((eq 0 #StartStop)
    (if *EggTimer*
      (setq *EggTimer*
             (alert
               (strcat "Process Time: "
                       (rtos (- (getvar "millisecs") *EggTimer*))
                       " Milliseconds"
               ) ;_ strcat
             ) ;_ alert
      ) ;_ setq
    ) ;_ if
   )
 ) ;_ cond
) ;_ defun


(defun c:DDP-check (/ ss lst)
 ;; Delete Duplicate Points
 ;; Alan J. Thompson, 07.06.10
 (if (setq ss (ssget "_:L" '((0 . "POINT"))))
   (progn (AT:EggTimer 1)
          ((lambda (i / p)
             (while (setq e (ssname ss (setq i (1+ i))))
               (if (vl-position (setq p (cdr (assoc 10 (entget e)))) lst)
                 (entdel e)
                 (setq lst (cons p lst))
               )
             )
           )
            -1
          )
          (AT:EggTimer 0)
   )
 )
 (princ)
)

 

 

 

Man I hate how ugly my code used to look.

Link to comment
Share on other sites

allan, sorry for bothering u again but, i have just ran ur code again, it completed the task then i select the remaining points that not duplicated for another test "triangulation" but "triangulation" found still duplicate points.

may be discuss it tomorrow

i am very happy to you response my post and interested in

may be i can proove it tomorrow :):)

Why don't you post an example drawing. We can only guess about your 'duplicate points'.

 

Discuss away. :wink:

Link to comment
Share on other sites

sure, i ll be very happy but how about tomorrow. Time is 10.50 PM here and i must go

see u tomorrow ok!!

thanks again.

Link to comment
Share on other sites

Here is the second routine for delete dup points in xyz

to run the routine type deldups same as previous routine

 

i have tested it for 500.000 points, no error or etc. had produced.

 

thank you

 

any comments will welcome.

deldupden_3.LSP

Link to comment
Share on other sites

the second routine may

2 doesn't delete everything and 3 doesn't do anything.

 

What is the purpose of everything your routines are doing?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...