AnsweredAssumed Answered

C# PDM addin : Not getting data card exact information for related file when changing state instead getting BOM info. :

Question asked by Dipak Shah on Dec 27, 2019
Latest reply on Jan 6, 2020 by Jesse Seger

Hello Everyone,

 

Actually i created one addin where whenever file state is change i want to fetch 'Data card' tab information. in following figure 1. (ex. its JPR-DKUS-A-01 ...02 etc..) -> But strange this is i am not getting it but actually what i get is BOM's last row's product information (SCR-0039) (see figure 2) ..when i do state change on other file i am getting proper data card information who don't have BOM. don't know why this is happening.

 

 

Figure :1

Data card information

 

 

 

Figure:2

BOM

 

 

 

C# Addin Code is like as below:

 

 

 

 

public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
IEdmVault5 edmVault = poCmd.mpoVault as IEdmVault5;
IEdmFile7 aFile;
IEdmBom bom;
IEdmBomMgr bomMgr;
IEdmBomView bomView;
string str_b = "";

try
{
switch (poCmd.meCmdType)
{
case EdmCmdType.EdmCmd_PostState:

   

IEdmFile5 file = vault.GetFileFromPath(fileName, out IEdmFolder5 folder);

int ver = 0;
ver = file.CurrentVersion;

IEdmEnumeratorVariable8 EnumVarObj = default(IEdmEnumeratorVariable8);
EnumVarObj = (IEdmEnumeratorVariable8)file.GetEnumeratorVariable();

// Get configurations
EdmStrLst5 cfgList = default(EdmStrLst5);
cfgList = file.GetConfigurations();

IEdmPos5 pos = default(IEdmPos5);
pos = cfgList.GetHeadPosition();
string cfgName = null;

Dictionary<string, Dictionary<string, string>> myDictDict = new Dictionary<string, Dictionary<string, string>>();

while (!pos.IsNull)
{

cfgName = cfgList.GetNext(pos);
object VarObj = null;

EnumVarObj.GetVar("PartNo", cfgName, out VarObj);
string VarVal = VarObj?.ToString();

EnumVarObj.GetVar("Description", cfgName, out VarObj);
string Description = VarObj?.ToString();

EnumVarObj.GetVar("Revision", cfgName, out VarObj);
string revision = VarObj?.ToString();

Dictionary<string, string> values = new Dictionary<string, string>();

values.Add("PartNo", VarVal);
values.Add("Revision", revision);
values.Add("Description", Description);


myDictDict.Add(cfgName, values);

}
}
}
}
}

 

Please Help.

 

c #  epdm addin query epdm solidworks bom

Amen Allah Jlili Pdm Admin Artem Taturevich

Outcomes