Allows you to access the Bill of Materials (BOM) layouts installed in a vault.
Tailor the IEdmBomMgr2 C# example to use this interface by replacing its GetBOM_Click function with:
public void GetBOM_Click(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault11 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault11)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}
if (aFile != null)
{
// Get named BOMs and their versions for the selected file
EdmBomInfo[] derivedBOMs = null;
aFile.GetDerivedBOMs(out derivedBOMs);
int arrSize = 0;
EdmBomVersion[] ppoVersions = null;
int i = 0;
int j = 0;
int id = 0;
string str = "";
string verstr = "";
int verArrSize = 0;
arrSize = derivedBOMs.Length;
int userID = 0;
bool canSeeLayout = false;
userID = vault2.GetLoggedInWindowsUserID(vault2.Name);
while (i < arrSize)
{
id = derivedBOMs[i].mlBomID;
bom = (IEdmBom)vault2.GetObject(EdmObjectType.EdmObject_BOM, id);
str = "Named BOM: " + derivedBOMs[i].mbsBomName + "\r\n" + "Type of BOM as defined in EdmBomType: " + derivedBOMs[i].meType + "\\n" + "Check-out user: " + bom.CheckOutUserID + "\r\n" + "Current state: " + bom.CurrentState.Name + "\r\n" + "Current version: " + bom.CurrentVersion + "\r\n" + "ID: " + bom.FileID + "\r\n" + "Is checked out: " + bom.IsCheckedOut;
MessageBox.Show(str);
bom.GetVersions(out ppoVersions);
verArrSize = ppoVersions.Length;
while (j < verArrSize)
{
verstr = "BOM version: " + "\r\n" + "Type as defined in EdmBomVersionType: " + ppoVersions[j].meType + "\r\n" + "Version number: " + ppoVersions[j].mlVersion + "\r\n" + "Date: " + ppoVersions[j].moDate + "\r\n" + "Label: " + ppoVersions[j].mbsTag + "\r\n" + "Comment: " + ppoVersions[j].mbsComment;
MessageBox.Show(verstr);
j = j + 1;
}
i = i + 1;
}
// Get a BOM view with the specified layout
bomMgr = (IEdmBomMgr2)vault2.CreateUtility(EdmUtility.EdmUtil_BomMgr);
EdmBomLayout2[] ppoRetLayouts = null;
EdmBomLayout2 ppoRetLayout = default(EdmBomLayout2);
bomMgr.GetBomLayouts2(out ppoRetLayouts);
i = 0;
arrSize = ppoRetLayouts.Length;
str = "";
while (i < arrSize)
{
ppoRetLayout = ppoRetLayouts[i];
canSeeLayout = bomMgr.CanSeeBomLayout(userID, ppoRetLayout.mlLayoutID);
bomMgr4 = (IEdmBomMgr4)bomMgr;
EdmBomDefaultSetting _bomDefSetting;
_bomDefSetting = bomMgr4.GetBomDefaultSetting(ppoRetLayout.mlLayoutID);
str = "";
switch (_bomDefSetting.mlBomDisplayType)
{
case 1: str = "BOM display type is indented";break;
case 2: str = "BOM display Type is parts only"; break;
case 3: str = "BOM display type is top level only"; break;
case 4: str = "BOM display type is Flattened"; break;
}
MessageBox.Show(str);
str = "BOM Layout " + i + ": " + ppoRetLayout.mbsLayoutName + "\r\n" + "ID: " + ppoRetLayout.mlLayoutID;
str = str + " Logged-in user can see this layout? " + canSeeLayout;
if (ppoRetLayout.mbsLayoutName == "BOM")
{
bomView = (IEdmBomView3)aFile.GetComputedBOM(ppoRetLayout.mbsLayoutName, 0, "@", (int)EdmBomFlag.EdmBf_AsBuilt + (int)EdmBomFlag.EdmBf_ShowSelected);
}
MessageBox.Show(str);
i = i + 1;
}
// Display BOM view row and column information
object[] ppoRows = null;
IEdmBomCell ppoRow = default(IEdmBomCell);
bomView.GetRows(out ppoRows);
i = 0;
arrSize = ppoRows.Length;
str = "";
while (i < arrSize)
{
ppoRow = (IEdmBomCell)ppoRows[i];
str = "BOM Row " + i + ": " + "\r\n" + "Item ID: " + ppoRow.GetItemID() + "\r\n" + "Path name: " + ppoRow.GetPathName() + "\r\n" + "Tree level: " + ppoRow.GetTreeLevel() + "\r\n" + " Is locked? " + ppoRow.IsLocked();
MessageBox.Show(str);
i = i + 1;
}
EdmBomColumn[] ppoColumns = null;
bomView.GetColumns(out ppoColumns);
i = 0;
arrSize = ppoColumns.Length;
str = "";
while (i < arrSize)
{
str = "BOM Column " + i + ": " + "\r\n" + "Header: " + ppoColumns[i].mbsCaption + "\r\n" + "Column type as defined in EdmBomColumnType: " + ppoColumns[i].meType + "\r\n" + "ID: " + ppoColumns[i].mlColumnID + "\r\n" + "Flags: " + ppoColumns[i].mlFlags + "\r\n" + "Variable ID: " + ppoColumns[i].mlVariableID + "\r\n" + "Variable type as defined in EdmVariableType: " + ppoColumns[i].mlVariableType + "\r\n" + "Column width: " + ppoColumns[i].mlWidth;
MessageBox.Show(str);
i = i + 1;
}
SaveBOM.Enabled = true;
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}