I'm trying make a check for Electrical BundleSegment Names to be unique in a product(assembly) using the code below. This one will take a lot of time, since it goes thru' every part in the product as opposed to only for BundleSegments. Can some suggest anything better than this -...
p art; bn:BundleSegment
let BSList(list)
let BS1(BundleSegment)
let BS2(BundleSegment)
let i = 1
let j = 1
let BSListSz = 0
let Passed(List)
let Pass(Boolean)
Pass=true
BSList = p.Owner->Query("BundleSegment",""
BSListSz = BSList->Size()
for i while i<=BSListSz
{ BS1 = BSList-> GetItem(i)
for j while j<=BSListSz
{ BS2 = BSList-> GetItem(j)
if (i <> j)
{ if (BS1.Name == BS2.Name)
{ ThisCheck.AddTupleFailed(p.Owner,BS2)
Pass=false
}
}
}
}
if(Pass==true) ThisCheck.AddTupleSucceeded(Passed)
Thanks - |