PTC provides the mark_otkmethod.pl tool to help you migrate applications from Creo Parametric TOOLKIT to Creo Object
TOOLKIT C++. This perl script is located at <creo_loadpoint>\<datecode>\Common Files\protoolkit\scripts. The script parses directories and looks for files with extensions such as, .c, .cxx, and .cpp, which are the default extensions
included in the script.
The script searches for Creo Parametric TOOLKIT functions in these files. When it finds Creo Parametric TOOLKIT functions, the script inserts comments with recommendations of possible replacing Creo Object
TOOLKIT C++ methods. By default, the script uses the mapping table protk2otkmap.txt provided at <creo_loadpoint>\<datecode>\Common Files\protoolkit\scripts.
The script options are listed when you run
mark_otkmethod.pl with no arguments, or with options
–h,
-? or
–help.
Note
The options may vary in future releases.
When you run the script, it saves a copy of the original files. However, PTC recommends that you back up all the files, before
running the script.
The script generates two types of outputs depending on the -m option. The mark_otkmethod.pl generates output similar to the mark_deprecated.pl script.
For example, consider a file
Xsection.c. It contains the following code:
ProMessageDisplay(msgfil, "USER Pick the start plane");
status = ProSelect("face", 1, NULL, NULL, NULL, NULL, &sel, &n_sel);
if(status != PRO_TK_NO_ERROR || n_sel < 1)
return(0);
ProSelectionModelitemGet(sel[0], &surface_modelitem);
ProSurfaceInit(part, surface_modelitem.id, &surface);
ProSurfaceTypeGet(surface, &stype);
if(stype != PRO_SRF_PLANE)
return(0);
If you specify the
-m option, the original file is retained, and the output file with the name
filename_markup.c is created. The recommended
Creo Object
TOOLKIT C++ methods are inserted as comments on separate lines in the output file. In this example, the output file
Xsection_markup.c is generated as shown below:
ProMessageDisplay(msgfil, "USER Pick the start plane");
/* Replace ProMessageDisplay with pfcSession::UIDisplayMessage /
pfcSession::UIDisplayLocalizedMessage */
status = ProSelect("face", 1, NULL, NULL, NULL, NULL, &sel, &n_sel);
/* Replace ProSelect with pfcBaseSession::Select */
if(status != PRO_TK_NO_ERROR || n_sel < 1)
return(0);
ProSelectionModelitemGet(sel[0], &surface_modelitem);
/* Replace ProSelectionModelitemGet with pfcSelection::GetSelModel /
pfcSelection::GetSelItem */
ProSurfaceInit(part, surface_modelitem.id, &surface);
ProSurfaceTypeGet(surface, &stype);
if(stype != PRO_SRF_PLANE)
return(0);
If you do not specify the
-m option, a copy of the file is saved as
filename.c.orig. The comments with recommendations are inserted in the file. In the example of the Xsection.c file, a copy of the file is
saved as
Xsection.c.orig. The output will be generated in the file
Xsection.c as shown below:
/* Replace ProMessageDisplay -> pfcSession::UIDisplayMessage /
pfcSession::UIDisplayLocalizedMessage */
ProMessageDisplay(msgfil, "USER Pick the start plane");
status =/* Replace ProSelect -> pfcBaseSession::Select */
ProSelect("face", 1, NULL, NULL, NULL, NULL, &sel, &n_sel);
if(status != PRO_TK_NO_ERROR || n_sel < 1)
return(0);
/* Replace ProSelectionModelitemGet -> pfcSelection::GetSelModel /
pfcSelection::GetSelItem */
ProSelectionModelitemGet(sel[0], &surface_modelitem);
ProSurfaceInit(part, surface_modelitem.id, &surface);
ProSurfaceTypeGet(surface, &stype);
if(stype != PRO_SRF_PLANE)
return(0);