Jump to content

Find duplicates and Missing IDs


subodh_gis

Recommended Posts

I have parcel IDs (numbers as text objects) in a layer. I like to find out duplicate Parcel IDs and Missing Parcel Ids in sequence.

Link to comment
Share on other sites

I have parcel IDs (numbers as text objects) in a layer. I like to find out duplicate Parcel IDs and Missing Parcel Ids in sequence.

 

Sound easy enough, and do what with the results afterwards If there are indeed missing and duplicates?

Link to comment
Share on other sites

Thanks for kind reply.Can we make list box of the duplicates and missing. when we select the listbox item it just zoom to that id in case of duplicate and previous id in case of missing.

Link to comment
Share on other sites

Thanks for kind reply.Can we make list box of the duplicates and missing. when we select the listbox item it just zoom to that id in case of duplicate and previous id in case of missing.

 

Figures, I knew there's more to that than just capturing those items. I can only write a quick code for missing/duplicates. Will that help you at all?

 

BYW: are those whole "numbers" as text? can you post a sample of a parcel ID number?

Link to comment
Share on other sites

yes they are integer like 123 124 125 and so on. i have to manually correct the duplicates so it will be better if we can change the property of duplicate so that we can identify them. But how we will identify missing in the sequence, any table?

Link to comment
Share on other sites

I can only "Help" you so much subodh_gis, the only thing i'll do for you is to provide a simple code to target missing/duplicates. You need to remember , we are doing this on our spare time. You can however contact forum members to write a custom lisp for you for a fee. otherwise wait for somebody here to write a complete code to your liking.

 

Your call dude.

Link to comment
Share on other sites

ok code what u can. Every help is great for me.

thanks in advance.

 

That is all i want to hear :)

 

Q&D for duplicate/missing items

(defun c:demo ( / sst a b c duplicate e f g i n missing sequence data)
;;;		Demo by pBeMay2014		;;;
 (if (setq data nil
    c nil duplicate nil missing nil
    sst (ssget "_X"
		'((0 . "TEXT")
		(8 . "ThisLayer");<--- change this to your specific layer
		(1 . [color="blue"]"*#*"[/color]))))
   	(progn
;;;	Gather all "number" from valid selected objects		;;;
  (repeat (setq i (sslength sst))
    (setq data
	   (cons
	     (cdr (assoc 1 (entget (ssname sst (setq i (1- i)))))
	     )
	     data
	   )
    )
  )
;;;		Find duplicates via while loop		 	;;;
  (while (setq a (car data)
	       b (cdr data)
	 )
    (setq c (cons a c))
    (if	(> (length b) (length (setq b (vl-remove a b))))
      (Setq duplicate (cons a duplicate))
    )
    (setq data b)
  )
;;;	Sort remaining items from lowest to highest value	;;;
  (setq sequence (vl-sort (mapcar 'atoi c) '<))
;;;	Retrieve missing item on the sorted list 		;;; 
  (while (setq e (car sequence)
	       f (cdr sequence)
	 )
    (setq n 1)
    (while (and  (/= (setq g (+ n e)) (car f)))
      (setq missing (cons (itoa g) missing) n (1+ n)
      )
    )
    (setq sequence f)
  )
)
   (princ "\n<<<None objects Found>>>")
   )
(princ "\nDuplicates: ") (princ (vl-sort (mapcar 'atoi duplicate) '<))
(princ "\nMissing: ") (princ (reverse missing))
(princ)
 )

 

HTH

Edited by pBe
Link to comment
Share on other sites

Thanks its working perfect. but is some situation when any number by mistake is having space before and after it will not treat it as a number. can we find such number.

Link to comment
Share on other sites

subodh_gis,

 

Please tell us at least you are trying to learn how to code on your own, it appears that you're just helping yourself and the company you work for with free routines in the expense of our fellow forum members.

 

This is CADTutor after all.

 

Come to think of it, i do remember you from some other thread -->Find-Missing-text-number-in-a-layer

Link to comment
Share on other sites

Yes I am learning Autolisp. I respect CADTutor and all the fellow forum members.I can pay the fee for this routine if they will charge.

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...