petehouwen
01-30-2002, 10:49 AM
I am trying to set up an array of all of the decals in a library. It works,
but....
In a library with many parts (this one has 600+), this code runs
SSSSSLLLLOOOOWWW. It's OK if I only have a few decals. In the For...Next
loop, it sees objects at the rate of about 1 every 2 seconds. By then it has read the library, it's just the loop that is slow.
The code:
Function FillDecals (CurLib, DecFlt)
i=0
For Each libs In Libraries
If Libs.Name = CurLib Then
c = Libs.GetLibraryItems(ppcbLibraryItemTypeDecal,).Count
ReDim DecalArray(c)
Set items = Libs.GetLibraryItems(ppcbLibraryItemTypeDecal,DecFlt)
For Each item In items
DecalArray(i)= item.Name
i = i+1
Next item
End If
Next libs
End Function
Any ideas?
but....
In a library with many parts (this one has 600+), this code runs
SSSSSLLLLOOOOWWW. It's OK if I only have a few decals. In the For...Next
loop, it sees objects at the rate of about 1 every 2 seconds. By then it has read the library, it's just the loop that is slow.
The code:
Function FillDecals (CurLib, DecFlt)
i=0
For Each libs In Libraries
If Libs.Name = CurLib Then
c = Libs.GetLibraryItems(ppcbLibraryItemTypeDecal,).Count
ReDim DecalArray(c)
Set items = Libs.GetLibraryItems(ppcbLibraryItemTypeDecal,DecFlt)
For Each item In items
DecalArray(i)= item.Name
i = i+1
Next item
End If
Next libs
End Function
Any ideas?