7 Replies Latest reply on Sep 17, 2015 9:22 AM by al_layson

    Variant Manager Automation Problem EEVX.1

    Wolfgang_Antrey

      Hello,

       

      I used in EE7.9.5 a script for generating the Variant Schematics PDFs and Partlists.

       

      I changed now as described in the EEVM Automation section to "MGCVARIANTGUI.MGCVariantGUICtrl.2"

       

      But the following code does not work - since following error comes up:

      Variable not defined => eVMOperNone.

       

      For each vmCompMod in VmDocObj.ComponentModifications(var.Name)

        if vmCompMod.Operation = eVMOperNone then

       

        end if

      next

       

       

       

      The same code works in EE7.9.5 - whats wrong?

       

      Wolfgang

        • 1. Re: Variant Manager Automation Problem EEVX.1
          peter_festesen

          Hi Wolfgang

           

          I haven't looked at your script yet - if you have added the "MGCVARIANTGUI.MGCVariantGUICtrl.2" library as in the example from the EEVX.1 xPCB Automation manual, I suggest that you log a Service Request for this issue - it may be a bug..

           

          BR Peter

          • 2. Re: Variant Manager Automation Problem EEVX.1
            Patrick.Cashman

            I have checked the code and don't believe it's an issue, because I cannot get the eVMOperNone case to exist.  If I set a component to CNI (we use this for "Component Not Installed"), it fires the eVMOperUnplace case.  If I replace the part number, it fires the eVMOperReplace case.  If I reset to no action, the eVMOperNone does not happen. 

             

            A small difference is that I use the integer value of the constants instead of the constant name. 

             

            Here is the code:

             

                    For Each vmcompmod In vmcompmods

             

                         if vmcompmod.Operation = 0 then

                             'do nothing

                             Debug.Print("component " & vmcompmod.Component.Name & " has cmcompmod.operation = 0")

                         End If

                        

                         if vmcompmod.Operation = 1 then 'selects out the unplaced components

                            unplaced.Add(vmcompmod.Component.Name) 'adds the unplaced components to the unplaced arraylist

                         End If

                        

                         if vmcompmod.Operation = 2 then 'selects out the replaced components

                             replaced.Add(vmcompmod.Component.Name, vmcompmod.NewPartNumber)

                         End If

             

                     Next

            The first one, = 0, never happens. And I get no errors when I compile or run.

             

            So I suggest you use the integers, and then verify if it actually ever happens or not.  If not, then remove that section of code.

             

            I'm curious to find out what you discover.

            • 3. Re: Variant Manager Automation Problem EEVX.1
              Wolfgang_Antrey

              Thank you Patrick for your hint.

              If I use the integer values (0 = eVMOperNone, 1=eVMOperUnplace, 2=eVMOperReplace) instead of the ENUM Types mentioned in the automation user book it works in both versions EE7.9.5 and EEVX.1.

               

              If I use any ENUM type like eVMOperUnplace or eVMOperReplace instead of the integer values I get the same error message for the first ENUM Type.

              eg. If I replace eVMOperNone with 0, then the first error appears with eVMOperUnplace as not defined variable.

              If I replace eVMOperNone with 0 and eVMOperUnplace with 1 then the error comes with eVMOperReplace

               

              If I change all values to integer constants - everything works perfect.

               

              So it looks like a bug from Mentor! Maybe the ENUM Types are not public anymore?!?

               

              Best regards.

               

              Wolfgang

              • 4. Re: Variant Manager Automation Problem EEVX.1
                Patrick.Cashman

                In every case where there is this kind of enumerated set of possible values, that have an integer counterpart, I always use the integer. Some have a hex value, so I use that.  Never the enumeration strings.  I can't remember when or why I started doing that, but I suspect it was because long ago I encountered one that did not work, found that the integer did work, and went with that from that point on.

                 

                Since I self-taught VB, and don't know all the 'rules', there is probably some fundamental principle I'm violating by doing this.  But oh, well.  It works. 

                • 5. Re: Variant Manager Automation Problem EEVX.1
                  al_layson

                  Wolfgang,

                  In VX releases, you must specify the correct progid in the objects, IE:

                   

                  From an opened application:

                       Dim sComVersion : sComVersion = Scripting.GetEnvVariable("EXP_PROG_ID_VER") : If sComVersion = "" Then sComVersion = "1"

                       Dim progID : progID = "MGCVARIANTGUI.MGCVariantGUICtrl." & sComVersion   

                       Set addinObj = launchAddin(progID, addinName, associatedScript,addinPlacement, shortcutKey)

                       Scripting.AddTypeLibrary("MGCVARIANTGUI.MGCVariantGUICtrl." + sComVersion)

                   

                  This will get you access to the enums.

                   

                  Regards,

                  Al

                  • 6. Re: Variant Manager Automation Problem EEVX.1
                    Wolfgang_Antrey

                    Hello Al,

                     

                    Thanks for your answer - I did that, but this did not help.

                     

                    Best regards

                     

                    Wolfgang

                    • 7. Re: Variant Manager Automation Problem EEVX.1
                      al_layson

                      Wolfgang,

                      Yes it works. The following changes were made to your script to test with the code I proposed. This modified script is attached. Use “run DX_Partlist_SAP_InOut.vbs” in xDX Designer key-in.