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

Creo 3.0 Toolkit Fatal Error encountered

SOLVED
jsu
Level 1

Creo 3.0 Toolkit Fatal Error encountered

Hi everyone, I've been having a big problem trying to display a model in creo with TOOLKIT on my computer.Following is my programm:


#include "stdafx.h"

#include "ProToolkit.h"

#include "ProCore.h"

#include "ProMdl.h"

#include "ProUtil.h"

#include "ProWindows.h"

#include <ProTKRunTime.h>

int main()

{

  char *a_char_ptr;

  a_char_ptr= "C:\\Program Files\\PTC\\Creo 3.0\\M010\\Parametric\\bin\\parametric.bat";

  ProError i= ProEngineerStart(a_char_ptr,"");

  ProError status;

  ProPath Mdlpath;

  ProType MdlType;

  ProMdl *Mdl;

  ProMdlName MdlName;

  int *w_id;

  ProStringToWstring(Mdlpath,"C:\\Users\\fsd_proe\\Documents\\bauteil1.prt");

  status =ProMdlFiletypeLoad(Mdlpath,PRO_MDLFILE_UNUSED,PRO_B_FALSE, Mdl);

  status=ProMdlTypeGet(Mdl,(ProMdlType*)&MdlType);

  status=ProMdlMdlnameGet(Mdl,MdlName);

  status= ProObjectwindowMdlnameCreate(MdlName,MdlType,w_id);

  status=ProMdlDisplay(Mdl);

  ProTKPrintf("Well done!");

  return 0;

}

The function "ProEngineerStart" works well, I can open creo without problem. However when I try to display a model, a window pops up that says:

traceback.PNG

According to this link Re: Creo 2.0 Parametric Fatal Error encountered, I have insert a config.pro file in the directory containing traceback.log, i.e. C:\Users\fsd_proe\Desktop\Toolkit\17Console1\17Console1. But it doesn't work. In the directory C:\Users\Public\Documents, it doesn't work either.  My computer is belonging to my university and Creo is installed under username as shown above and I work also in under this username.

My OS is win7 64bit and my image card is

Grafikkarte.PNG

Any help would be much appreciated! Thanks a lot!


Christian


1 ACCEPTED SOLUTION

Accepted Solutions

Re: Creo 3.0 Toolkit Fatal Error encountered

The error is with your toolkit code.

Try this:

int main() {

  char *a_char_ptr;

  a_char_ptr= "C:\\Program Files\\PTC\\Creo 3.0\\M010\\Parametric\\bin\\parametric.bat";

  ProError i= ProEngineerStart(a_char_ptr,"");

  ProError status;

  ProPath Mdlpath;

  ProType MdlType;

  ProMdl Mdl; // not a pointer

  ProMdlName MdlName;

  int w_id; // not a pointer

  ProStringToWstring(Mdlpath,"C:\\Users\\fsd_proe\\Documents\\bauteil1.prt");

  status =ProMdlFiletypeLoad(Mdlpath,PRO_MDLFILE_UNUSED,PRO_B_FALSE, &Mdl); // fills the address of the ProMdl

  status=ProMdlTypeGet(Mdl, (ProMdlType*)&MdlType);

  status=ProMdlMdlnameGet(Mdl, MdlName);

  status= ProObjectwindowMdlnameCreate(MdlName, MdlType, &w_id); // fill the address

  status=ProMdlDisplay(Mdl);

  ProTKPrintf("Well done!");

  return 0;

}

As a side note, if it generates a traceback.log file, and your code has a .PDB file, it should show you the line at which your code causes the failure.

President & Founder
CadActive Technologies - www.cadactive.com
3 REPLIES 3

Re: Creo 3.0 Toolkit Fatal Error encountered

It is good practice to always check the return value of the functions before continuing with the application (at least until you can be sure everything works under any condition)

e.g. what happens, if ProMdlFiletypeLoad() doesn't return a handle to the model for whatever reason?

Regards,

Gunter

Re: Creo 3.0 Toolkit Fatal Error encountered

The error is with your toolkit code.

Try this:

int main() {

  char *a_char_ptr;

  a_char_ptr= "C:\\Program Files\\PTC\\Creo 3.0\\M010\\Parametric\\bin\\parametric.bat";

  ProError i= ProEngineerStart(a_char_ptr,"");

  ProError status;

  ProPath Mdlpath;

  ProType MdlType;

  ProMdl Mdl; // not a pointer

  ProMdlName MdlName;

  int w_id; // not a pointer

  ProStringToWstring(Mdlpath,"C:\\Users\\fsd_proe\\Documents\\bauteil1.prt");

  status =ProMdlFiletypeLoad(Mdlpath,PRO_MDLFILE_UNUSED,PRO_B_FALSE, &Mdl); // fills the address of the ProMdl

  status=ProMdlTypeGet(Mdl, (ProMdlType*)&MdlType);

  status=ProMdlMdlnameGet(Mdl, MdlName);

  status= ProObjectwindowMdlnameCreate(MdlName, MdlType, &w_id); // fill the address

  status=ProMdlDisplay(Mdl);

  ProTKPrintf("Well done!");

  return 0;

}

As a side note, if it generates a traceback.log file, and your code has a .PDB file, it should show you the line at which your code causes the failure.

President & Founder
CadActive Technologies - www.cadactive.com

Re: Creo 3.0 Toolkit Fatal Error encountered

James is right about the wrong levels of indirection!

I am marking his answer as Correct on behalf of Christian (it's a while back he filed the question, so probably found the error anyway)