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

jsu
1-Newbie
1-Newbie

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



This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions
sully7
13-Aquamarine
(To:jsu)

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

View solution in original post

3 REPLIES 3
gkoch
1-Newbie
(To:jsu)

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

sully7
13-Aquamarine
(To:jsu)

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
gkoch
1-Newbie
(To:sully7)

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)

Announcements