Identify attributed blocks that contain duplicate values

Identify attributed blocks that contain duplicate values

Anonymous
Not applicable
369 Views
5 Replies
Message 1 of 6

Identify attributed blocks that contain duplicate values

Anonymous
Not applicable
Hello,

I'm after some help in trying to identify attributed blocks that contain duplicate values for a particular tag. I can get to the stage of iterating through each attribute value held within an array but was wondering if anyone could point me in the right direction to identify duplicate values? Or would it be easier to create a collection of the attribute values and undertake some form of algorithm on that?

Hope someone can help!

Many thanks

DOm
0 Likes
370 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Here's an idea.

Create an Access database with a single table to hold your values. Make the
field you are writing to unique [no duplicates]. Then within your code when
an error occurs [because you are attempting to save a duplicate value] write
it somewhere [debug window, text file, another table] along with any other
ancillary data you may need to perform your task.

Just a thought ...


wrote in message news:5201027@discussion.autodesk.com...
Hello,

I'm after some help in trying to identify attributed blocks that contain
duplicate values for a particular tag. I can get to the stage of iterating
through each attribute value held within an array but was wondering if
anyone could point me in the right direction to identify duplicate values?
Or would it be easier to create a collection of the attribute values and
undertake some form of algorithm on that?

Hope someone can help!

Many thanks

DOm
0 Likes
Message 3 of 6

Anonymous
Not applicable
Hi Joe,

cheers for the reply,

I'm attempting to undertake an initial data check purely within ACAD before I extract info out into Excel. This is primarily because I do not to envisage there to be many, if any, duplicate values and thus, if need be, immediately rectify any duplicates found.

thanks,

dom
0 Likes
Message 4 of 6

Aubelec
Explorer
Explorer
hello.
use a collection of string with key is the value of your attrib ex :

dim ValueOfAttribut as string. '--> you have to fill this variable before my exemple 🙂
dim Coll as new collection ' Collection of objet + Init

on error resume next '--> if error see line after
'-->Add objet with the key in the collection
Coll.add ValueOfAttribut ,ValueOfAttribut
if err.number 0 then '--> if 0 --> error so the key is duplicate
on error goto 0 '
'management your duplicate key
else
on error goto 0
'management your unique attribut value
end if

in the end of your prog :
dim element as variant
for each element in Coll
coll.remove 1 'remove first element in the collection
next
set Coll=nothing 'release objet of colelction

So for me is the best choice for your prob.
0 Likes
Message 5 of 6

fxcastil
Advocate
Advocate
Dom,

Once you have all your attributes in an array you can sort the array using a bubble sort algorithm and then check the first array value to the second array value , then check the second array value to the third array value and work your way thru all the elements in the array.

There are many sorting algrithims available on the internet


Fred Castillo
0 Likes
Message 6 of 6

Anonymous
Not applicable
Many thanks to you both for your replies,

When I get a moment i will have a go at applying your suggestions,


regards,

Dom
0 Likes