Pro/TOOLKIT

From GICLWiki
(Difference between revisions)
Jump to: navigation, search
(Hello Button)
Line 72: Line 72:
  
 
The added functionality of some of the above code hints at what is to come here: a short talk on adding menus to Pro/E.  This section is based on code from the user guide, which has had its buggy portions removed.  
 
The added functionality of some of the above code hints at what is to come here: a short talk on adding menus to Pro/E.  This section is based on code from the user guide, which has had its buggy portions removed.  
 +
 +
Inside user_initialize...
 
<PRE>
 
<PRE>
wchar_t UserMsg[80];
+
wchar_t UserMsg[80];
  
 
/*================================================================*\
 
/*================================================================*\

Revision as of 19:32, 13 March 2007

I'm using Pro/ENIGNEER Wildfire 3.

Contents

Installation

Pro/TOOLKIT is sold as a component of Pro/ENGINEER. If your license allows, you can install Pro/TOOLKIT along with Pro/ENGINEER. There should be an option during the Define Installation Components section of the install with something like:

API Toolkits—Select this component to optionally install the files necessary to run the Application Program Interface toolkits like Pro/J.Link, Pro/Web.Link, and Pro/TOOLKIT.

Setting Up A Project

I found a tutorial on setting up a visual studio project at [1]. I used Visual Studio .Net 2003 and had no problems.

Hello World

The simplest method for a "HelloWorld" program is likely the following:

   ProStringToWstring (UserMsg, "C:\\cygwin\\home\\Admin\\tkTest\\TKTEMPLATE\\msg_user.txt");
   ProMessageDisplay (UserMsg, "USER %0s", 
       "Hello World.");

where msg_user.txt has the following:

USER %0s  
%0s  
#
#
USER -HelloWorld	
HelloWorld
#
#
USER -MainBtn1
-MainBtn1
#
#
USER New Button help.
New Button help.
#
#
USER -Sub1
-Sub1
#
#
USER -Sub1Btn1
-Sub1Btn1
#
#
USER -Sub1Btn2
-Sub1Btn2
#
#

The path will obviously have to be changed to wherever you keep the file. These message files keep the text that is displayed in Pro/ENGINEER. A typical use will be something like the following:

   status = ProMenubarMenuAdd ("HelloWorld", "USER -HelloWorld", 
       "Utilities", PRO_B_TRUE, UserMsg);

Here, a button will recieve the text defined in the file under "USER -HelloWorld." In the above, this is HelloWorld. However, if the the text file instead had the entry

USER -HelloWorld	
Export

the button would be named "Export." A quirky feature of these message files is that changes in them will only be recognized once Pro/ENGINEER is closed down and restarted. Merely restarting the auxiliary application or re-registering it is insufficient.

Hello Button

The added functionality of some of the above code hints at what is to come here: a short talk on adding menus to Pro/E. This section is based on code from the user guide, which has had its buggy portions removed.

Inside user_initialize...

wchar_t UserMsg[80];

/*================================================================*\
	Say hello and add menu buttons.
\*================================================================*/

/*----------------------------------------------------------------*\
    Message file.
\*----------------------------------------------------------------*/
    ProStringToWstring (UserMsg, "C:\\cygwin\\home\\Admin\\tkTest\\TKTEMPLATE\\msg_user.txt");
    ProMessageDisplay (UserMsg, "USER %0s",         "Apples2Apples export tool started.");

/*----------------------------------------------------------------*\
    Add a new menu to the menu bar (to the right of Utilities).
\*----------------------------------------------------------------*/
    status = ProMenubarMenuAdd ("Exporter", "USER -Exporter", 
        "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 = ProMenubarmenuMenuAdd ("Exporter", "Sub1", "USER -Sub1", 
        NULL, 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);

Links

1: http://www.caddigest.com/subjects/pro_engineer/select/tutorials/jovanovic_toolkit_environment.htm

Personal tools