Nuts and Bolts

In this and few subsequent blogs, I would like to introduce Pro/Toolkit. It will be a helpful guide for the new users, experienced user may skip this section. Throughout this series of blog I will be using a Windows XP machine and my compiler will be Visual Studio. To keep it simple in the beginning, I will compile my Pro/Toolkit applications using the command line arguments of the VC compiler. For UNIX users, I would like to help them by emails if they have any specific requirement. You will be required to keep the index.html (APIWizard) started from the (ProENGINEER_LOADPOINT)\protoolkit\protkdoc folder.
To begin with, new Pro/Toolkit users must know some key stuff as listed below:
Pro/Develop - This was the customization tool used in Pro/ENGINEER till Pro/Toolkit replaced it in the Release 17 of Pro/ENGINEER. Though, we have a better product in Pro/Toolkit, we may still use Pro/Develop to build our application. In fact, there are few areas where there is no equivalent Pro/Toolkit function and we are required to use Pro/Develop functions. Both Pro/Toolkit and Pro/Develop uses the same mechanism to connect to Pro/ENGINEER, so in a single application we may have a mix of both these products.
protk.dat file - This is the file which registers a pro/Toolkit application in Pro/ENGINEER. It is a text file with .dat extension for Pro/ENGINEER to recognize and register the application. I will be taking a closer look at this file later on.
Environment variables: There are few environment variables required to be set for asynchronous application but for synchronous application no additional environment variables are required to be set. The environment variable "PRO_COMM_MSG_EXE" should point to "(ProENGINEER_LOADPOINT)/obj/pro_comm_msg.exe" file. The other environment variables like Pro/ENGINEER path, etc are already set when installing Pro/ENGINEER. Some special environment variables are required for J-link, which we will cover when we touch that topic.
Synchronous Application: This is the mode of Pro/Toolkit when the application is registered in Pro/ENGINEER and is controlled by the Pro/ENGINEER session. This application has no main () function but two mandatory function called user_initialize () and user_terminate (). The function user_initialize () is the first function to be visited when the application is being called from Pro/ENGINEER. Standalone synchronous application is not feasible as it has no main () function and it dependent on Pro/ENGINEER session to make calls to it. There are two ways of creating a synchronous application; Spawn mode and DLL mode.
  • Spawn mode: In this mode the executable file interacts with the Pro/ENGINEER process (xtop.exe) using Inter Process Communication (IPC). This mode is slower as compared with the DLL mode but while developing an application, this mode is recommended as it is easier to debug a smaller application.
  • DLL mode: In this mode the executable (DLL file) gets embedded inside the Pro/ENGINEER process (xtop.exe), while it launches. This mode is much faster than the spawn mode. This mode should be used when the application has to be released for the end users.
Asynchronous Application: In this mode, the executable file has its own main () function. Which means it can exist independently. In this mode the application makes a call either to connect to an existing Pro/ENGINEER session or to start a new Pro/ENGINEER session. In this mode the Pro/ENGINEER process (xtop.exe) and application perform operations concurrently. There are two forms of Asynchronous application; Simple Asynchronous Mode and Full Asynchronous Mode.
  • Simple Asynchronous Mode: In this mode there is no implementation in the application to handle the request from Pro/ENGINEER. So, any event (user click, feature failure etc) will not be passed on to the application to react to it. This application can start/connect to Pro/ENGINEER session and ask Pro/ENGINEER to perform some tasks and then disconnect/end Pro/ENGINEER session. None of the functions of the applications can be invoked by Pro/ENGINEER.
  • Full Asynchronous Mode: In this mode, there is a mechanism to handle the requests from Pro/ENGINEER. In this mode, the application has to implement a control loop that waits for messages from Pro/ENGINEER. In this mode, Pro/ENGINEER can call functions in the application also the application can react to events in Pro/ENGINEER.
MSVC Vs Command prompt: There are two different ways by which we can compile and create an executable file in Pro/Toolkit. The first way is to create a project in Visual Studio and then compile the code. Though this mode is very user friendly, it could become a daunting task for the new users to learn Pro/Toolkit as well as the operations of the Visual studio. For setting up the Visual studio project, please read the chapter 2 of Getting started guide of Pro/Toolkit in the Wildfire 4.0 installation directory (Protoolkit_GSG.pdf). If you have prior experience in Visual studio I would highly recommend it. Otherwise for a new user it would be better if we follow the command prompt way of compiling to start with and then moving on to Visual Studio. In the command prompt mode we normally set the environment variables of the VC compiler in the command window and then compile our code with the "nmake" option. I will cover how we can set up the environment variables of the VC compiler and compile a Pro/Toolkit application. I would encourage all to use the make files supplied by PTC. Throughout this blog I will use the PTC's makefiles to compile my applications.
Makefile: I will be covering the Makefile in more details later on. For the time being you may consider a make file as an instruction file for the compiler about the various compiler flags to be set while compiling and linking the application to the Pro/ENGINEER libraries.
________________________________________________________
These are the few concepts/terms which should help new users to accelerate their learning. Again, do let me know if you find this blog interesting, do leave me a comment; I will be happy to interact with you. I am signing off for now.
_________________________________________________________
TRADEMARKS: Pro/ENGINEER, Wildfire, Pro/Toolkit, Pro/Develop, J-Link, Pro/Web.Link and VB API are the registered trademarks of PTC (http://www.ptc.com/). All other products or services mentioned in this blog are the trademarks or service marks of their respective companies or organizations.

2 comments:

  1. Thanks for your valuable articles, i am going to start learning ProTool/Kit. Your articles were very helpful to me.

    ReplyDelete