Skip to main content
1-Visitor
March 24, 2014
Question

jlink api to extract generic values from the family table.

  • March 24, 2014
  • 1 reply
  • 4816 views

Hi,

 

I am trying to extract the values of generics and instances in a family table using jlink api. I was successful in extracting the values of instances but not generics.

 

 

family_table.png

 

In the attached image , First row indicates the generic, Rest of the rows are instances.

Using the below code I am able to get the instance values but not generics.

 

 

 

Can any one let me know if there is any API to extract generic values.

 

Thanks.

 

ParamValue dimV = ((FamilyMember) proeModel).GetCell(colValue, row);

1 reply

8-Gravel
March 24, 2014

Try this!

It looks like you treat the Generic Dimensions as Model Parameters not FamilyMember Items.

******************************************************************************************************

try {


//Get current model(open the Generic model)
Model model =curSession.GetCurrentModel();

//Get a list of all Columns in the Row
FamilyTableColumns colList = ((FamilyMember)model).ListColumns();

//Loop thru each Column in the list
for(int j=0;j<colList.getarraysize();j++) {
FamilyTableColumn currentColumn = colList.get(j);

//Get column name
String cName = currentColumn.GetSymbol();

//Get generic dimension
//If all the Parameter Value Types are always the same,
//you can ditch the "getParamValueAsString" Method.
//But testing for the type makes it more universal.
String genDim = getParamValueAsString(model.GetParam(cName));

//Prints to a System window
//If you don't have a System Console you can send it somewhere else!!!
System.out.println("Generic Dimension @ " +cName +" = "+genDim);
}

}catch (jxthrowable e) {
e.printStackTrace();
}

}

******************************************************************************************************

/**

* Method to get a String Value of a Parameter

*

*/
public static String getParamValueAsString (Parameter param)
{
String paramVal = "UNDEFINED";
try {
int type = param.GetValue().Getdiscr().getValue();

switch (type)
{
case ParamValueType._PARAM_STRING:
paramVal = param.GetValue().GetStringValue();;
break;

case ParamValueType._PARAM_INTEGER:
int iVal = param.GetValue().GetIntValue();
paramVal ="" +iVal;
break;

case ParamValueType._PARAM_BOOLEAN:
boolean Bval = param.GetValue().GetBoolValue();
paramVal = "" +Bval;
break;

case ParamValueType._PARAM_DOUBLE:
double Dval = param.GetValue().GetDoubleValue();
paramVal = "" +Dval;
break;

case ParamValueType._PARAM_NOTE:
paramVal = param.GetValue().GetStringValue();
break;

default:
System.out.println("unknown Pro/E parameter type: " +paramVal);
paramVal = "UNDEFINED";
break;
}
} catch (jxthrowable e) {
e.printStackTrace();
}

return (paramVal);
}

******************************************************************************************************

GSam1-VisitorAuthor
1-Visitor
March 25, 2014

Thanks . This solved my problem.

But using this code I am able to retrieve only dimension values but not the feature values. For feature I am getting values as null .

8-Gravel
March 25, 2014

I see what you mean, for some reason a Y/N response to a Feature is not the same as a Boolean YES/NO response to a Parameter. I think I have an idea but I need to try it out.