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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Error by imputing values ​​for parameters.

sindl.ecoml.sa
1-Newbie

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

Top Tags