Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Rediscovering Pro/ENGINEER Pro/Toolkit

Shridharaswamy

New member
Hi:

I have used Pro/DEVELOP on Pro/ENGINEER Version 16.0 at Graduate school for my Ph.D. work. At my work now they are using Pro/ENGINEER Wildfire 3.0 on Unix. I find Pro/Toolkit to be totally different from Pro/DEVELOP.

At the present time I have only a PDF file tkuse.pdf from the installation directory. This Guide is not comprehensive. The examples are hard to understand. Where can I download a Beginners guide to Pro/TOOLKIT. Can any one share with me some sample project etc.

When I compile the example problems I get the executable dll file created. But Pro/E crashes. Please share with me easier and simpler examples to get me started on Pro/TOOLKIT.

Thanks
Shridhara
 
Hi Patrick:

Thanks for the reply. I know of the wizard. Can any one give some simple Pro/Toolkit source code to get me started.

Thanks

Regards
Shridhara
 
I don't think people have simple code laying around, it all is used in context. In the wizard, on the left side column select the down arrow and select User's guide. Then look in fundementals. It is full of simple code.


Here is some code from a training class I took years ago (Rel 18). It shows the basic formation of a program. I doubt that it would compile, and its probably the similiar tothe sample you get in the wizard. This uses side menus, which are rarely used any more.


/*========================================================== ==========*\


FILE : menutest.c


PURPOSE : Check Pro/TOOLKIT installation


*=========================================================== =========*/


/*---------------------------------------------------------- ----------*\


Pro/Toolkit includes


\*---------------------------------------------------------- ----------*/


#include<ProToolkit.h>


#include<ProMenu.h>


#include<ProMessage.h>


int UsrMyButton();


int EnterVals();


typedef struct UserData


{


int userint ;


double userdouble;


wchar_t userstr[80] ;


}UserData;





int user_initialize()


{


int action,menu_id;


ProMenuFileRegister("part","part.mnu",&menu_id);


ProMenuAuxfileRegister("part","part.aux",&menu_id);


ProMenubuttonActionSet("part","Menu Test",UsrMyButton,NULL,0);


return(0);


}


void user_terminate()


{


}


int UsrMyButton()


{


int action,menu_id;


UserData vals;


ProMenuFileRegister("usermsg","usermsg.mnu",&menu_id);


ProMenubuttonActionSet("usermsg","Integer",EnterVals,&va ls,1);


ProMenubuttonActionSet("usermsg","Double",EnterVals,&val s,2);


ProMenubuttonActionSet("usermsg","String",EnterVals,&val s,3);


ProMenubuttonActionSet("usermsg","Done/Return",ProMenuDelete ,NULL,4);


ProMenuCreate(PROMENUTYPE_MAIN,"usermsg",&menu_id);


ProMenuProcess("usermsg",&action);


return(0);


}








int EnterVals (char *MyVals, int options)


{


static ProName msgfile;


int i1;


double d1;


wchar_t s1[80];





UserData * LocalVals;


LocalVals = (UserData*)MyVals;


ProStringToWstring(msgfile,"msgfile.txt");


switch (options) {





case 1: ProMessageDisplay(msgfile,"Message_1") ;


ProMessageIntegerRead(NULL, &i1);


LocalVals->userint = i1;


ProMessageDisplay(msgfile,"Message_4", LocalVals->userint) ;


break;


case 2: ProMessageDisplay(msgfile,"Message_2") ;


ProMessageDoubleRead(NULL, &d1);


LocalVals->userdouble = d1;


break;


case 3: ProMessageDisplay(msgfile,"Message_3") ;


ProMessageStringRead(80, (LocalVals->userstr));


break;


case 4: ProMessageDisplay(msgfile,"Message_4", LocalVals->userint) ;


ProMessageDisplay(msgfile,"Message_5", LocalVals->userdouble) ;


ProMessageDisplay(msgfile,"Message_6", LocalVals->userstr) ;


break ;


}





return(0);


}
 
HI FishNut:

The code compiled fine, but when proe starts I get a Message stating debug_error Some Serious error. I am using Pro/E Wildfire 3.0. on Linux .The Menu Style is different from Version 18.0. Here is some code from the Menu chapter of tkuse.pdf


/*---------------------------------------------------------- ----------*\
Application includes
\*---------------------------------------------------------- ----------*/
#include "TestError.h"
#include <time.h>
#include <ProToolkit.h>
#include <ProMessage.h>
#include <ProUIMessage.h>
#include <ProArray.h>


/*========================================================== ======*\
FUNCTION: TestAccessDefault()
PURPOSE: Define the accessibility of menu buttons.
\*========================================================== ======*/
static uiCmdAccessState TestAccessDefault (uiCmdAccessMode access_mode)
{
return (ACCESS_AVAILABLE);
}
/*========================================================== ======*\
FUNCTION: MiscAction()
PURPOSE:Generic action function
\*========================================================== ======*/
int MiscAction()
{
ProMessageDisplay (UserMsg, "USER %0s", "Action function called.");
return (0);
}




/*========================================================== =================*\
Function : main
Purpose : Test the ProToolkitMain() function. main is optional function.
\*========================================================== =================*/
main(argc, argv)
int argc;
char **argv;
{
fprintf(stderr, "\n\tWelcome to Pro/TOOLKIT - The \"pt_install_test\" program\n");

ProToolkitMain(argc, argv);

return(0);
}


/*========================================================== ======*\
FUNCTION: user_initialize()
PURPOSE: Pro/TOOLKIT standard initialize
\*========================================================== ======*/
int user_initialize(
int argc,& nbsp;

char *argv[],
char *version,
char *build,
wchar_t errbuf[80])
{

char cbuff1[PRO_PATH_SIZE], cbuff2[PRO_PATH_SIZE];
char astr1[PRO_LINE_SIZE];
int i, menu_id;
ProPath wbuff1, wbuff2;
ProError status;
uiCmdCmdId&n bsp;cmd_id;




/*---------------------------------------------------------- ------*\
Message file.
\*---------------------------------------------------------- ------*/
ProStringToWstring (UserMsg, "msg_ugfund.txt");
ProMessageDisplay (UserMsg, "USER %0s", "Demo of ProMenuBar.h functions.");
/*---------------------------------------------------------- ------*\
Add a new menu to the menu bar (to the right of Utilities).
\*---------------------------------------------------------- ------*/

status = ProMenubarMenuAdd (?UserMenu?, "USER -UserMenu",
"Utilities", PRO_B_TRUE, UserMsg);
/*---------------------------------------------------------- ------*\
Add to the new menu.
\*---------------------------------------------------------- ------*/
status = ProCmdActionAdd ("UserDispMsg", (uiCmdCmdActFn)MiscAction,
uiCmdPrioDefault, TestAccessDefault, PRO_B_TRUE, PRO_B_TRUE,
&cmd_id);
status = ProMenubarmenuPushbuttonAdd ("UserMenu", "MainBtn1",
"USER -MainBtn1", "USER New Button help.", NULL, PRO_B_TRUE,
cmd_id, UserMsg);
status = ProMenubarmenuMenuAdd ("UserMenu", "Sub1", "USER -Sub1",
"MainBtn1", PRO_B_TRUE, UserMsg);
/*---------------------------------------------------------- ------*\
Fill in the buttons of Sub1.
\*---------------------------------------------------------- ------*/
status = ProMenubarmenuPushbuttonAdd ("Sub1", "Sub1Btn1",
"USER -Sub1Btn1", "USER New Button help.", NULL, PRO_B_TRUE,
cmd_id, UserMsg);
status = ProMenubarmenuPushbuttonAdd ("Sub1", "Sub1Btn2",
"USER -Sub1Btn2", "USER New Button help.", NULL, PRO_B_TRUE,
cmd_id, UserMsg);
.
.
.
return (0);
}

.
return (0);
}


/*========================================================== ==========*\
FUNCTION : user_terminate()
PURPOSE : To handle any termination actions
\*========================================================== ==========*/
void user_terminate()
{
/*---------------------------------------------------------- -----------*\
Loging file close.
\*---------------------------------------------------------- -----------*/
ProTestErrlogClose();

printf("user_terminate\n");
}


I get these errors when I compile this code

gcc -c -fpic -DPRO_MACHINE=34 -DPRO_OS=3 -I. -I/usr/local/ptc/proeWildfire3.0/protoolkit//protk_appls/inc ludes -I/usr/local/ptc/proeWildfire3.0/protoolkit//includes /home/infinite/Pro-Engineer/UserInit.c
/home/infinite/Pro-Engineer/UserInit.c: In function 'MiscAction':
/home/infinite/Pro-Engineer/UserInit.c:211: error: 'UserMsg' undeclared (first use in this function)
/home/infinite/Pro-Engineer/UserInit.c:211: error: (Each undeclared identifier is reported only once
/home/infinite/Pro-Engineer/UserInit.c:211: error: for each function it appears in.)
/home/infinite/Pro-Engineer/UserInit.c: In function 'user_initialize':
/home/infinite/Pro-Engineer/UserInit.c:259: error: 'UserMsg' undeclared (first use in this function)
/home/infinite/Pro-Engineer/UserInit.c:265: error: expected expression before '?' token
/home/infinite/Pro-Engineer/UserInit.c:265: error: 'UserMenu' undeclared (first use in this function)
/home/infinite/Pro-Engineer/UserInit.c:266: error: too few arguments to function 'ProMenubarMenuAdd'
/home/infinite/Pro-Engineer/UserInit.c:287: error: expected expression before '.' token
/home/infinite/Pro-Engineer/UserInit.c: At top level:
/home/infinite/Pro-Engineer/UserInit.c:293: error: expected identifier or '(' before '.' token
/home/infinite/Pro-Engineer/UserInit.c:295: error: expected identifier or '(' before '}' token
make: *** [UserInit.o] Error 1


Can anyone help me with this code

Thanks


Regards,
Shridhara
 
Hi Toolking:

Do you have a sample code for Menus etc for Wildfire 3.0 on Linux. The sample code you posted had errors when I compiled, I think it is written for Visual C++.

Thanks,

Regards,
Shridhara
 
HiL

I got the Menu example to compile properly, but I dont get anything when Pro/E starts. Here is the code. Please let me know if anything is wrong.

Thanks,
Regards,
Shridhara

/*---------------------------------------------------------- ----------*\
Application includes
\*---------------------------------------------------------- ----------*/
#include "TestError.h"
#include <time.h>
#include <ProToolkit.h>
#include <ProMessage.h>
#include <ProUIMessage.h>
#include <ProArray.h>


/*========================================================== ======*\
FUNCTION: TestAccessDefault()
PURPOSE: Define the accessibility of menu buttons.
\*========================================================== ======*/
static uiCmdAccessState TestAccessDefault (uiCmdAccessMode access_mode)
{
return (ACCESS_AVAILABLE);
}
/*========================================================== ======*\
FUNCTION: MiscAction()
PURPOSE:Generic action function
\*========================================================== ======*/
int MiscAction()
{
ProMessageDisplay (UserMsg, "USER %0s", "Action function called.");
return (0);
}




/*========================================================== =================*\
Function : main
Purpose : Test the ProToolkitMain() function. main is optional function.
\*========================================================== =================*/
main(argc, argv)
int argc;
char **argv;
{
fprintf(stderr, "\n\tWelcome to Pro/TOOLKIT - The \"pt_install_test\" program\n");

ProToolkitMain(argc, argv);

return(0);
}


/*========================================================== ======*\
FUNCTION: user_initialize()
PURPOSE: Pro/TOOLKIT standard initialize
\*========================================================== ======*/
int user_initialize(
int argc,& nbsp;

char *argv[],
char *version,
char *build,
wchar_t errbuf[80])
{

char cbuff1[PRO_PATH_SIZE], cbuff2[PRO_PATH_SIZE];
char astr1[PRO_LINE_SIZE];
int i, menu_id;
ProPath wbuff1, wbuff2;
ProError status;
uiCmdCmdId&n bsp;cmd_id;




/*---------------------------------------------------------- ------*\
Message file.
\*---------------------------------------------------------- ------*/
ProStringToWstring (UserMsg, "msg_ugfund.txt");
ProMessageDisplay (UserMsg, "USER %0s", "Demo of ProMenuBar.h functions.");
/*---------------------------------------------------------- ------*\
Add a new menu to the menu bar (to the right of Utilities).
\*---------------------------------------------------------- ------*/

status = ProMenubarMenuAdd (?UserMenu?, "USER -UserMenu",
"Utilities", PRO_B_TRUE, UserMsg);
/*---------------------------------------------------------- ------*\
Add to the new menu.
\*---------------------------------------------------------- ------*/
status = ProCmdActionAdd ("UserDispMsg", (uiCmdCmdActFn)MiscAction,
uiCmdPrioDefault, TestAccessDefault, PRO_B_TRUE, PRO_B_TRUE,
&cmd_id);
status = ProMenubarmenuPushbuttonAdd ("UserMenu", "MainBtn1",
"USER -MainBtn1", "USER New Button help.", NULL, PRO_B_TRUE,
cmd_id, UserMsg);
status = ProMenubarmenuMenuAdd ("UserMenu", "Sub1", "USER -Sub1",
"MainBtn1", PRO_B_TRUE, UserMsg);
/*---------------------------------------------------------- ------*\
Fill in the buttons of Sub1.
\*---------------------------------------------------------- ------*/
status = ProMenubarmenuPushbuttonAdd ("Sub1", "Sub1Btn1",
"USER -Sub1Btn1", "USER New Button help.", NULL, PRO_B_TRUE,
cmd_id, UserMsg);
status = ProMenubarmenuPushbuttonAdd ("Sub1", "Sub1Btn2",
"USER -Sub1Btn2", "USER New Button help.", NULL, PRO_B_TRUE,
cmd_id, UserMsg);
.
.
.
return (0);
}

.
return (0);
}


/*========================================================== ==========*\
FUNCTION : user_terminate()
PURPOSE : To handle any termination actions
\*========================================================== ==========*/
void user_terminate()
{
/*---------------------------------------------------------- -----------*\
Loging file close.
\*---------------------------------------------------------- -----------*/
ProTestErrlogClose();

printf("user_terminate\n");
}
 
Hi FishNut:

Your code compiles right, but I get these errors

dbg_err_crash() - continuing from serious error (ORDER_DEBUG)

I get this error after Registering (which says that it is already registered)

Invalid extension

I am using Pro/E Wildfire 3.0 on Linux, Your menu structure is as in Version 18.0 The code I pasted above which compiles right but does nothing when I start Proe is the latest for Pro/E menu structure. There is significant change ini the Menus from Version 18.0 and Wildfire 3.0. I want some examples for Wildfire 3.0/4.0

Thanks for your help,

Regards,
Shridhara
 
Example problems from tkuser.pdf compile fine. But upon starting Pro/E. I get an error message stating

Foriegn Program pt_install_proe failed to iniitialize Error code 1


IS there a fix to this

Thanks

Shridhara
 
Hello Shridhara,





Do you unclock the dll or exe of the application?Let try to unlock and load the application again. From the commnand prompt give the command protk_unlock.


With regards,


Kishore V
 
Hi:

I continue to get a Message stating Appplication pt_install_proe failed to load Message

Does any one know why?

Thanks
Regards
Shridhara
 

Sponsor

Articles From 3DCAD World

Back
Top