cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Error by imputing values ​​for parameters.

sindl.ecoml.sa
1-Visitor

Error by imputing values ​​for parameters.

I'm trying to insert some values ​​in two parameters in CREO.

 

These two parameters are obtained through the values ​​of a JTextField.

 

This code is in a jbutton. Below is the code:

 

What is happening is that it is not transferring these values ​​and the application is locking the process, the solution is to end the process.

 

 

private void btnInsereParamActionPerformed(java.awt.event.ActionEvent evt) {

 

 

try {

Session session = pfcGlobal.GetProESession();

Model model = session.GetCurrentModel();

 

 

Parameter paramDescMat = model.GetParam("DESC_MAT");

Parameter paramCodMat = model.GetParam("COD_MAT");

 

 

paramDescMat.SetValue(pfcModelItem.CreateStringParamValue(txtDescMP.getText()));

paramCodMat.SetValue(pfcModelItem.CreateDoubleParamValue(Integer.parseInt(txtCodMP.getText())));

 

 

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e, "Erro", JOptionPane.WARNING_MESSAGE);

}

JOptionPane.showMessageDialog(null, "Parametros imputados com sucesso!", "Erro", JOptionPane.INFORMATION_MESSAGE);

}

2 REPLIES 2

First of all in this line you tried to put integer to double parameter. This is bad.

paramCodMat.SetValue(pfcModelItem.CreateDoubleParamValue(Integer.parseInt(txtCodMP.getText())));

Try to comment this line and do test your program again.

Thanks Yaroslav Sinitzin for the help!

The problem was that I was using a JPanel. I used a JDialog and it worked perfectly.

I also fixed the problem pointed out by you.

I found the solution here: http://communities.ptc.com/thread/56865

Announcements


Top Tags