1 Reply Latest reply on Aug 11, 2017 7:51 AM by Patrick.Cashman

    get collection of specific component with VBscript

    ozaouiidrissi

      Hello Community,

       

      I want to know the best way to parse specific component (in my case every time i do it with nested loops on all the board, schematic, sheets, ...) in this way, script will take lot of time to be executed, i know that there is other way to get collection of specific component ( i think that in this way we can optimize time and script will be more fast ).

       

      so someone can help me in this topic by script examples ?

       

      Best Regards,

      Otmane,

        • 1. Re: get collection of specific component with VBscript
          Patrick.Cashman

          The fastest way to select a part in either the board or schematic is with the PCB open, then use the following:

           

          (assumes you already have a valid reference to pcbdoc, the PCB document object)

           

          dim refdes as string

          dim comp as mgcpcb.component

           

          refdes = "U1"

          comp = pcbdoc.findcomponent(refdes)

          comp.selected = true

           

           

          if the U1 component exists it will be selected in the board.  With cross-probing turned on, it will also be selected in the schematic.