Skip to main content
1-Visitor
May 8, 2017
Question

How to get the session and cuurent model name in protoolkit

  • May 8, 2017
  • 1 reply
  • 1166 views

Anybody explain with example. thanks

1 reply

14-Alexandrite
May 10, 2017

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