Jim Sculley

Problem with Document Manager API property ISwDMTable2::ReferencedConfigurationNames

Discussion created by Jim Sculley on Jun 19, 2018
Latest reply on Oct 24, 2018 by Jim Sculley

I've been working with the SW API support staff to address a problem I'm having that they have not been able to duplicate.  Before I head down the path of a painful remote session or web meeting, I would like some confirmation that the problem truly exists.


The environment is SW2017 SP5.


I am calling the ISwDMTable2::ReferencedConfigurationNames property and I am seeing it (in certain circumstances) return all the configuration names of the model instead of just those configurations in the BOM table.  I have attached a sample file (a one part assembly with three configurations) .  Here is the code from the main method API support is saying works fine on their end:


String sLicenseKey = "<YOUR KEY HERE>";
String docFileName = @"<PATH TO SAMPLE DRAWING>\SR_1_18026881361.slddrw";
SwDMApplication swDocMgr = null;
SwDMClassFactory swClassFact;
SwDmDocumentType nDocType = SwDmDocumentType.swDmDocumentPart;
SwDmDocumentOpenError nRetVal = 0;
swClassFact = new SwDMClassFactory();
swDocMgr = swClassFact.GetApplication(sLicenseKey) as SwDMApplication;
SwDMDocument10 swDMDoc10 = null;
swDMDoc10 = (SwDMDocument10)swDocMgr.GetDocument(docFileName, nDocType, true, out nRetVal);
if (swDMDoc10 != null)
    ISwDMTable2 swTable = null;
    swTable = (ISwDMTable2)swDMDoc10.GetTable("Bill of Materials1");
    SwDmTableError obj;
    string[] vcfgNameArr = null;
    vcfgNameArr = swTable.ReferencedConfigurationNames(out obj) as string[];
    string message = "";
    message += "vcfgNameArr array length is: " + vcfgNameArr.Length;
    message += "\nNames:\n";
    foreach (string s in vcfgNameArr)
        message += s;
        message += "\n";



  The only changes I made to their code were to enter my document manager license key and file name (where noted) and I added the call to display a message box showing the length of the array and the names returned for the ReferencedConfigurationNames property.  When I use their code I see the problem behavior if I do the following:


  1. Open the drawing
  2. In Tools....Options select the Document Properties tab and check the 'Restrict top-level BOMs to one configuration' in the Tables....Bill of Materials category.
  3. Select the Bill of Material in its upper left corner to display the Property Manager
  4. Under 'Configurations', uncheck two of the three configurations and click the green OK check mark.
  5. Run the macro.

Since the BOM is restricted to one configuration and I also deselected two of the three configurations in the property manager, I expect the call to ReferencedConfigurationNames to return one name, but the array returned includes all three names, like this:


Rebuilding and saving before running the macro does not make a difference.


The whole interaction between the document setting and the property manager is wonky as well.  When you check the 'Restrict top-level BOMs to one configuration' option but the current BOM is showing more than one config the BOM does not change until you uncheck all but one of the configs in the Property Manager for the table.  Once you have it down to one config and click OK, the list of check boxes in the property manager changes to a drop down the next time you show the Property Manager for the table.


Could someone try this out and let me know if you are seeing the same bad behavior?  Preferably with SW2017.