Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hello Community,
I am using ProParameterWithUnitsCreate, on Creo 9.0.2.0,to add a parameter to a model. However, everything I have tried to make it work has failed.
The code I am using is below:
{
...
ProParamvalueSet(&testVal, p_value, new_value_type);
err= ProParameterWithUnitsCreate(&target_item, test, &testVal, NULL, &testInit);
...
}
target_item is a valid ProModelItem, test is a valid wchar_t*, testval is a valid ProParamValue, and testInit is an unitialized ProParameter. I have followed TestParams.c file to check if I did anything wrong, but it appears I have not.
I have also looked at this article, Article - CS383949 - Creo Parametric Toolkit API ProParameterWithUnitsCreate() fails with error PRO_TK_BAD_INPUTS on specific machine (ptc.com), but it is unclear to me what registry file I am supposed to change the unicode_encoding to True on.
Does anyone have any idea as to why, with valid inputs, I am receiving the PRO_TK_BAD_INPUTS error?
Thanks,
Mark Hardebeck
Solved! Go to Solution.
Check your protk.dat/creotk.dat
ProParameterWithUnitsCreate() fails with error PRO_TK_BAD_INPUTS on specific machine.
Caused by unicode_encoding set to False in the registry file
Resolution: Remove the registry key unicode_encoding (or) set its value to True
The model item must have a name, if this is true, you may need to provide more code 😉
This is a simple example from PTC.
ProDrawing drawing;
ProModelitem model_item;
ProParamvalue param_value;
ProParameter parameter;
status = ProMdlCurrentGet(&drawing);
status = ProMdlToModelitem(drawing, &model_item);
param_value.type = PRO_PARAM_DOUBLE;
param_value.value.d_val = 10.0;
status = ProParameterWithUnitsCreate(&model_item, L"test", ¶m_value,NULL, ¶meter);
For a string value use s_val, and copy using ProStringToWstring and PRO_PARAM_STRING for the type. For the Param name, same procedure.
Instead of „drawing“ use your ProModel (or Mdl :-)) „model“, same code, makes no different.
If this works, check the functions of ProParamvalue* and use them.
There are a lot of examples if you have toolkit installed.
I tried using your sample code, but I still received the same PRO_TK_BAD_INPUTS error.
Check your protk.dat/creotk.dat
ProParameterWithUnitsCreate() fails with error PRO_TK_BAD_INPUTS on specific machine.
Caused by unicode_encoding set to False in the registry file
Resolution: Remove the registry key unicode_encoding (or) set its value to True
Ah, thank you, I misunderstood what registry file meant on the solution that PTC provided. That worked for me