4 Replies Latest reply on Jan 5, 2010 5:56 AM by Andre

    Or'ing Query parameters

    Andre

      Hi,

       

      actually I'm writing a script to remove the XREF attributes since Tools->CrossRef->Remove doesn't work at all on my hierarchical design.

      scout.ini is present of course.

       

      In order to do this I have to iterate over components (pins) and nets, check for "XREF*" attribute name and delete it.

       

      Therefore my query looks like this :

       

      For Each SchComp In vdapp.ActiveView.Query(VDM_COMP + VDM_NET, VD_ALL) .... giving me *no* results at all.

       

      Using two sequential queries with a single argument only (COMP or NET) works perfectly fine.

       

      I expected the required matching to be or'able since the values are looking like a bitmask

       

      Am I wrong ? How can I concatenate the query args ?

       

       

      Regards,

      André

        • 1. Re: Or'ing Query parameters
          john_dube

          Hi Andre,

           

          The syntax looks correct. 

           

          Make sure the type library is loaded, so that the VDM_COMP and VDM_NET enum values are defined, by running the script in-process (using the "run" keyin command or putting the code into a script form), or if the script must run in a separate process, use 'mgcscript' and call Scripting.AddTypeLibrary("ViewDraw.Application").

           

          John

          • 2. Re: Or'ing Query parameters
            Andre

            John,

             

            thanks for your quick reply.

             

            Currently Im using external VBSEdit with debugger and DxD Buttons calling a helper initialized by scripts.ini ...

             

             

                 RegisterOLECommand "runvbs", "User run method", false, Scriptengine

                 function runvbs(ArgList)
                     Set WshShell = CreateObject("WScript.Shell")
                     WshShell.Run "wscript.exe " & ArgList,,True
                 End function

                 Scripting.DontExit = True

             

             

            This leads to using WScript from everywhere giving me access to ODBC and networking ressources.

             

            Anyway, this is not the problem. I've defined this according to the ViewDraw object "VdObjectTypeMask"

             

            Const VDM_COMP = 128

            Const VDM_NET = 32

             

            Looks like it simply doesn't work.

             

            Can you confirm that it basically works fine inside the netlist flow ?

             

             

            Regards,

            André

            • 3. Re: Or'ing Query parameters
              john_dube

              Hi Andre,

               

              This simple script works for me, using a netlist project in EE2007.5 and EE2007.7, running in VBSEdit debugger:

               

              Const VDM_COMP = 128

              Const VDM_NET = 32

              Const VD_ALL = 0


              Set vdapp = GetObject(,"ViewDraw.Application")

              For Each obj In vdapp.ActiveView.Query(VDM_COMP + VDM_NET, VD_ALL)

              vdapp.AppendOutput "Query", obj.UID

              Next

               

              John

              • 4. Re: Or'ing Query parameters
                Andre

                John,

                 

                thanks - it also works for me, now.

                 

                Looks like I had a check missing in the "for each attr in query_result.attributes" statement after the query ... actually I thought VBS *never* enters the loop if the object is nothing.

                 

                But it does

                 

                After adding an "if not attr is nothing" check it works fine.

                 

                 

                Sorry for the noise.

                 

                 

                Regards,

                André