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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How to get the session and cuurent model name in protoolkit

kguru
1-Newbie

How to get the session and cuurent model name in protoolkit

Anybody explain with example. thanks

1 REPLY 1
sully7
13-Aquamarine
(To:kguru)

Hi Keerthana,

Unlike the C++ API for "Object Toolkit" (OTK), which uses a session object - the C API for "Pro/Toolkit" doesn't actually have a "session" object that needs to get passed.

Here's some pseudo-code to get you started. NOTE: If you are using older versions of Creo/Wildfire, this code may change slightly.

void get_current_model_name() {

  ProError err = PRO_TK_NO_ERROR;

  ProMdl model;

  err = ProMdlCurrentGet(&model);

  if (err != PRO_TK_NO_ERROR) { return; }

  ProMdlName model_name;

  err = ProMdlMdlnameGet(model, model_name);

}

Be aware, you'll also have to add "#include <ProMdl.h>" to the top of your c file.

Please feel free to reach out if you have any questions.

Thanks,

James Sullivan

CadActive Technologies

President & Founder
CadActive Technologies - www.cadactive.com
Top Tags