AnsweredAssumed Answered

Is there a fast way to get Name2 and ComponentReference for all components?

Question asked by Dan Markoff on Sep 22, 2018
Latest reply on Sep 22, 2018 by Fifi Riri

I have a need to get the Name and ComponentReference of all parts in a rather large assembly. 

 

        Dim partsList As Object() = swModel.GetComponents(False)

        For Each activeComp In partsList

            activePart = New CustomPartClass

            activePart.PN = activeComp.Name2

            activePart.refdes = activeComp.ComponentReference

            partsLists.Add(activePart.PN, activePart)

        Next

This works, but is REALLY slow.  For some of my assemblies, this takes 30 seconds or more. I inserted some telemetry and the GetComponents call alone is about half the time and then the Name2 and ComponentReference calls take up the other half.

 

Is there a faster way to do this?


Thanks!

Outcomes