5 Replies Latest reply on Aug 25, 2014 5:23 PM by Satoru

    Quickly find a component in DxDesigner

    peter.kurlak

      Is there a way to find and obtain a reference to a component without iterating through all the components? For example, if I want to find the component with reference designator 'J1', I currently do (in Python):

       

      dxdApp = com.GetActiveObject('ViewDraw.Application')
      schName = dxdApp.GetProjectData().GetiCDBDesignRootBlock(dxdApp.GetActiveDesign())
      
      for comp in dxdApp.DesignComponents("", schName, -1, "STD", True):
         if comp.Refdes == "J1":
             # Do stuff with comp
             print "Found my comp!"
      

       

      Obviously, this O(N) operation is not ideal for large designs.  I can (and currently do) create a dictionary cache (e.g. { "J1": comp, "J2": comp, ... }), but initializing that still takes 20s+ on some designs. Plus, if the design changes while my automation is open, the changes will not be reflected until I recreate/modify the cache.

       

      If the API does not have a O(1) search solution, can we get one? Thanks.