Skip to main content
1-Visitor
February 1, 2018
Question

J-link set parameter value : Xtoolkitnotvalid exception

  • February 1, 2018
  • 1 reply
  • 1748 views
Hi,

I'm working on a J-Link based plugin for Creo Parametric 4.0, and I have issues setting a value to a part's parameter.

I am able to correctly read the parameter value using this code :
Parameter valuesParam_PTC_MATERIAL_NAME = myModel.GetParam("PTC_MATERIAL_NAME");
String strPTCMaterialName = valuesParam_PTC_MATERIAL_NAME.GetScaledValue().GetStringValue();

But when I try to set a new value with this code :

ParamValue value = pfcModelItem.CreateStringParamValue("MyNewMaterialName");
myModel.GetParam("PTC_MATERIAL_NAME").SetScaledValue(value,null);

I'm getting the following exception :

com.ptc.wfc.Implementation.pfcExceptions$XToolkitNotValid
at com.ptc.wfc.Implementation.WFCRemoteCommImpl.makeObject(WFCRemoteCommImpl.java:5440)
at com.ptc.cipjava.NativeTransport.recvObject(NativeTransport.java:122)
at com.ptc.cipjava.CIPRemoteComm.processMessages(CIPRemoteComm.java:153)
at com.ptc.wfc.Implementation.pfcModelItem$Parameter.SetScaledValue(pfcModelItem.java:732)
at com.thales.param_rename.UtilParamRename.addParamRename(UtilParamRename.java:131)
at com.thales.param_rename.UtilParamRename.OnCommand(UtilParamRename.java:40)
at com.ptc.wfc.Implementation.WFCRemoteCommImpl.dispatch(WFCRemoteCommImpl.java:406)
at com.ptc.cipjava.CIPRemoteComm.processMessages(CIPRemoteComm.java:116)
at com.ptc.wfc.Implementation.WfcStarter.serverLoop(WfcStarter.java:61)
at com.ptc.wfc.Implementation.WfcStarter.main(WfcStarter.java:39)

I checked the parameter of the part directly inside Creo Parametric UI, and there is no access restriction on it...

Would anyone have an idea about the possible cause for this issue ?

Thank you very much for your help and time.
Regards

1 reply

mxlecanu1-VisitorAuthor
1-Visitor
February 1, 2018

I finally found a way to solve my problem.

It appears that PTC_MATERIAL_NAME can't be modified directly, so I had to create a new empty material with the desired name, and to assign it to the part.

Then all works perfectly !