AnsweredAssumed Answered

Problem in setting Variant Manager settings - ConfigFile - if the existing ConfigFile is invalid

Question asked by beltz on Oct 27, 2016
Latest reply on Jun 17, 2020 by andreas.neumann

I'm following an example in the Variant Manager Automation manual; under VMSettings Object, Example 2-1 Settings Example.


Among other things I'm try to set ConfigFile to a certain filename.  But I've found that if the existing ConfigFile value is invalid (blank or invalid filename) then it doesn't set the ConfigFile value to what I'm specifying in the code.  When I run the program which opens Variant Manager (and the existing ConfigFile value is invalid) and attempts to set this value, I get an error message in red in the Variant Manager window that says:

Library source data configuration file not defined. Use Settings to define.


I get this message when it executes

Set toolSettingsObj = settingsObj.LibQuery

and when it executes

toolSettingsObj.ConfigFile = "/home/dms_lib/WDIR795/DXDBLex.dbc"


NOTE: I'm running on RedHat Enterprise Linux.  I get this same behavior when running the program in DxDesigner and ExpeditionPCB.


NOTE: If the existing ConfigFile value is valid, then it will change the ConfigFile value to what is specified in my program.


Also I'm noticing that the Variant Manager Enumerated Types don't appear to be available in my program, even though I am loading them with (for VX.1)

Scripting.AddTypeLibrary "MGCVARIANTGUI.MGCVariantGUICtrl.2"


So instead I have to use the constant numerical values.


Option Explicit


    Dim vmaddin   ' The Variant Manager Addin object

    Set vmaddin = Application.Addins("Variant Manager")

    ' if vmaddin Is Nothing then Addin not already loaded, so load it now

    If vmaddin Is Nothing Then

      Set vmaddin = Application.Addins.Add("MGCVARIANTGUI.MGCVariantGUICtrl.2", "Variant Manager", "")

      vmaddin.Visible = True


      vmaddin.Visible = True

    End If

        ' Load TypeLibrary so that Variant Manager Enumerated Types are available

    Scripting.AddTypeLibrary "MGCVARIANTGUI.MGCVariantGUICtrl.2"


    Dim settingsObj, toolSettingsObj

        Set settingsObj = vmaddin.Control.VariantGuiApplication.Settings

        ' General Setting

        Set toolSettingsObj = settingsObj.General

        toolSettingsObj.ReportTxtDelimiter = ""

    ' the following didn't work

        'toolSettingsObj.ReportViewExcel = eVMOptionOff

    toolSettingsObj.ReportViewExcel = 0


    'toolSettingsObj.ReportViewHTML = eVMOptionOff

        toolSettingsObj.ReportViewHTML = 0

        toolSettingsObj.UnplacedKeyword = "NO-POP"

        ' PCB Setting

        Set toolSettingsObj = settingsObj.PCB

    'toolSettingsObj.FablinkActionPrompt = eVMOptionOn

        toolSettingsObj.FablinkActionPrompt = 1


        'toolSettingsObj.FablinkDataGenerationMode = eVMFXEOnRequest

    toolSettingsObj.FablinkDataGenerationMode = 3

        toolSettingsObj.UnplaceAssKeepOutline = 0

        toolSettingsObj.UnplaceAssKeepPartnum = 0

        toolSettingsObj.UnplaceAssKeepRefdes = 0

        toolSettingsObj.UnplaceSilkKeepOutline = 0

        toolSettingsObj.UnplaceSilkKeepPartnum = 0

        toolSettingsObj.UnplaceSilkKeepRefdes = 0

        toolSettingsObj.UnplaceSolderMask = 0

        toolSettingsObj.UnplaceSolderPaste = 0

        ' CAE Setting

        Set toolSettingsObj = settingsObj.CAE

        Call toolSettingsObj.SetMarkupColor (0, 0, 0) 'black

        Call toolSettingsObj.SetUnplaceColor (0, 0, 0) 'black

    'toolSettingsObj.PackageUnplaceOption = eVMCAEPackUnplaceMarkup

    toolSettingsObj.PackageUnplaceOption = 2

        ' Library Setting

    MsgBox("Before LibQuery")

        Set toolSettingsObj = settingsObj.LibQuery


        toolSettingsObj.ConfigFile = "/home/dms_lib/WDIR795/DXDBLex.dbc"

        toolSettingsObj.MaxResultsPerLib = 10

        toolSettingsObj.MaxResultsTotal = 22

        toolSettingsObj.PartNumberAttribute = "Part Number"

        toolSettingsObj.RowFormatter = "$(Part Number)"

        toolSettingsObj.SummaryInfoFormatter = "$(Part Number)"