| • | Definitions of Creo Parametric TOOLKIT objects and their hierarchical relationships |
| • | Definitions of Creo Parametric TOOLKIT functions |
| • | Declarations of data types used by Creo Parametric TOOLKIT functions |
| • | The Creo Parametric TOOLKIT Users’ Guide, which users can browse by topic or by object |
| • | Code examples for Creo Parametric TOOLKIT functions (taken from applications provided as part of the Creo Parametric TOOLKIT installation) |
| • | The User’s Guide is also available in PDF format. This file is located at:<creo_toolkit_loadpoint>\tkuse.pdf |
| • | From Creo Parametric 4.0 F000, the applet based APIWizard is no longer supported. Use the non-applet based APIWizard instead. |
<creo_toolkit_loadpoint>\protkdoc\index.html| • | Search by API names |
| • | Search using wildcard character *, where * (asterisk) matches zero or more nonwhite space characters |
| • | ProFeature—A feature |
| • | ProSurface—A surface |
| • | ProSolid—An abstract object created to exploit the commonality between parts and assemblies |
| • | ProWcell—A workcell feature in a manufacturing assembly |
|
Action Verb
|
Type of Action
|
|---|---|
|
Get
|
Read information directly from the Creo Parametric database.
|
|
Eval
|
Provide the result of a simple calculation.
|
|
Compute
|
Provide the result of a computation that typically involves numerical analysis of the model geometry.
|
| • | ProEdgeLengthEval() |
| • | ProSurfaceAreaEval() |
| • | ProSolidRayIntersectionCompute() |
| • | PRO_TK_BAD_INPUTS—The Creo Parametric TOOLKIT program called the function incorrectly. |
| • | PRO_TK_OUT_OF_MEMORY or PRO_TK_COMM_ERROR—System failure. |
| • | PRO_TK_USER_ABORT—A function that supports user interaction was aborted by the Creo Parametric user. |
| • | PRO_TK_E_NOT_FOUND—A function attempted operation on an empty object list. |

| • | The installation of Creo Parametric TOOLKIT is present, complete, and visible from your machine. |
| • | The version of Creo Parametric you plan to use during development has the Creo Parametric TOOLKIT license option added to it. |
| • | The machine you will use for development has access to all the necessary C program development tools, in versions supported by Creo Parametric TOOLKIT (especially, of course, the C compiler and linker). |
| • | Provides an effective way to build and test sample applications provided by PTC. |
| • | Provides a preconfigured Visual Studio development environment for use with Creo Parametric TOOLKIT. |
| • | Supports Intellisense for Creo Parametric TOOLKIT functions. Note
|
| 1. | Unzip protk_install_example.zip. The following files and directories are available:
|
| 2. | Open Microsoft Visual Studio. |
| 3. | Click . The Open Project dialog opens. |
| 4. | Browse the protk_install_example directory and select make_install.sln. |
| 5. | Click Open to access the solution file. |
| 1. | Click . The application should build without errors. This creates the Creo Parametric TOOLKIT DLL file called pt_inst_test.dll. If the application fails, check that the environment variable PROTOOL_SRC is set correctly. |
| 2. | Modify the exec_file and text_dir fields in the creotk.dat file located in the make_install directory to specify the full path to pt_inst_test.dll and \text, respectively. For example, exec_file <full_path>\pt_inst_test.dll
text_dir <full_path>\text
|
| 3. | Unlock the application, using the following command:<creo_loadpoint>\<datecode>\Parametric\bin\protk_unlock.bat |
| 4. | Start Creo Parametric. |
| 5. | On the Tools tab, in the Utilities group, click Auxiliary Applications. The Auxiliary Applications dialog box opens. |
| 6. | Click Register to register the updated creotk.dat file. The Register auxiliary application dialog box opens. |
| 7. | Browse to the <full_path> and select creotk.dat. |
| 8. | Click Open. The Creo Parametric TOOLKIT application adds the command Install Test under the menu in the TOOLKIT group in the Home tab on the Creo Parametric ribbon user interface. Note
Refer to the Creo Parametric Help for more information on customizing the Ribbon.
|
| 9. | Click Tools and then click . The Creo Parametric TOOLKIT Install Test Results message window opens, indicating that the installation test has succeeded.![]() |
| 10. | Click OK. |
| 1. | Copy the required makefile from <creo_toolkit_loadpoint>\$<machine_type>\obj to the make_install directory of the ready-to-use Visual Studio solution. If you are working on a 64-bit Windows platform, copy the file from <creo_toolkit_loadpoint>\x86e_win64\obj.
|
| 2. | Copy the text directory associated with the sample application from <creo_toolkit_loadpoint>\protk_appls\<app_name>\text to the make_install directory. |
| 3. | Open Visual Studio and set the values of the following variables in the makefile:PROTOOL_SRC = ../../../../../protoolkit
PROTOOL_SYS = $(PROTOOL_SRC)/$(PRO_MACHINE_TYPE)
|
| 4. | Click to update the NMake properties of the project. |
| 5. | Click . The application builds and creates a new .dll file. |
| 6. | Update the creotk.dat file located in the make_install directory with the name of the sample application and the DLL file. |
| 7. | Modify the exec_file and text_dir fields in the creotk.dat file to specify the full path to the .dll file and \text directory, respectively. |
| 8. | Start Creo Parametric. |
| 9. | On the Home tab, in the Utilities group, click Auxiliary Applications or click . The Auxiliary Applications dialog box opens. |
| 10. | Click Register to register the updated creotk.dat file. The Register auxiliary application dialog box opens. |
| 11. | Browse to the full path and select creotk.dat. |
| 12. | Click Open. The Creo Parametric TOOLKIT application runs. |
PROTOOL_SRC = ../.. PROTOOL_SRC = <creo_toolkit_loadpoint> nmake -f make_install name install_test
exec_file pt_inst_test.exe
text_dir <creo_toolkit_loadpoint>/protk_appls/pt_install_test
end
| • | You made a mistake when creating the creotk.dat file. If the syntax or contents are wrong, you should see a self-explanatory message in the window from which you started Creo Parametric. |
| • | The Creo Parametric you ran is not licensed for Creo Parametric TOOLKIT. This also causes an explanatory message to be displayed in the startup window. |
| • | The Creo Parametric TOOLKIT executable you created in Step 1 is wrong in some way: it is for the wrong platform, for example, or might not have execute
access. You can check this by trying to execute the file directly by typing its name. If the file is correct, the program
prints the following messages and then terminates: pt_inst_test: insufficient arguments; need 2 arguments:
(1) own RPC program #
(2) root directory path for Pro/TOOLKIT text files. |
nmake -f make_install dll startup dll| • | How Creo Parametric TOOLKIT Works |
| • | Compiling and Linking a Creo Parametric TOOLKIT Application |
| • | Registering a Creo Parametric TOOLKIT Application |
| • | Version Compatibility: Creo Parametric and Creo Parametric TOOLKIT |
| • | Stopping and Restarting a Creo Parametric TOOLKIT Application |
| • | Structure of a Creo Parametric TOOLKIT Application |
| • | User-Supplied Main |
| • | Creo Parametric TOOLKIT Techniques |
| • | All Creo Parametric TOOLKIT calls running in either synchronous (DLL or multiprocess) mode or asynchronous mode always clear the Undo/Redo stack in the Creo Parametric session. The Creo Parametric user interface reflects this by making the Undo and Redo menu options unavailable. |
| • | When you invoke the Creo Parametric TOOLKIT application, ensure that no dialogs are open in Creo Parametric session. If Creo Parametric dialog is open, the results may be unpredictable. |
| • | Change the macro MAKEFILENAME to refer to the makefile by its new name. |
| • | Change the macros EXE and EXE_DLL to define output file names more suitable for your own application. |
| • | Change the macro PROTOOL_SRC to refer to the loadpoint of Creo Parametric TOOLKIT. |
| • | Change the macro OBJS to refer to the object files that will result from compiling your Creo Parametric TOOLKIT source files. |
| • | Add targets for those object files. These contain instructions for |
| • | compiling your C source files. The form of these target definitions can be copied from the ones in the original makefile.
They generally take the following form: myfile.o: myfile.c
$(CC) $(CFLAGS) myfile.cNote
The second line must start with a tab character.
|
| • | In the absolute path specified in the creotkdat, protkdat, prodevdat, and toolkit_registry_file statements in the Creo Parametric configuration file. |
| • | For the files named creotk.dat, protk.dat, or prodev.dat in the following locations:
|
| • | <creo_loadpoint>—The Creo Parametric loadpoint (not the Creo Parametric TOOLKIT loadpoint). |
| • | <machine_type>—The machine-specific subdirectory, such as, i486_nt or x86e_win64. Set the environment variable PRO_MACHINE_TYPE to define the type of machine on which Creo Parametric is installed. |
| • | Option 1 is normally used during development, because the Creo Parametric TOOLKIT application is seen only if you start Creo Parametric from the specific directory that contains the registry file. |
| • | Option 3 is recommended when making an end-user installation, because it makes sure that the registry file is found no matter what directory is used to start Creo Parametric. |
name YourApplicationName
startup dll
exec_file $LOADDIR/$MACHINE_TYPE/obj/filename.dll
text_dir $LOADDIR
end| • | name—Assigns a unique name to this Creo Parametric TOOLKIT application. |
| • | startup—Specifies the method Creo Parametric should use to communicate with the Creo Parametric TOOLKIT application. The example above specifies the DLL mode. |
| • | exec_file—Specifies the full path and name of the file produced by compiling and linking the Creo Parametric TOOLKIT application. The example above shows a typical use of environment variables to make the reference to the executable file more flexible. |
| • | text_dir—Specifies the full path name to text directory that contains the language-specific directories. The language-specific directories
contain the message files, menu files, resource files and UI bitmaps in the language supported by the Creo Parametric TOOLKIT application. Note
The fields exec_file and text_dir have a character limit of PRO_PATH_SIZE-1 wide characters (wchar_t).
|
| • | end—Indicates the end of the description of this Creo Parametric TOOLKIT application. |
| • | Change the startup statement to: startup spawn |
| • | Make the exec_file statement refer to the Creo Parametric TOOLKIT program executable. Note
For all Creo Parametric TOOLKIT plugins, the registry file protk.dat is located inside the %ProgramData%\PTC\<Creo Parametric Toolkit version>\Plugins subdirectories. All registry files located in this location must use the absolute path in all their entries.
For more information about the registry file, refer to the section Creo Parametric TOOLKIT Registry File.
|
| • | Pro/ENGINEER release older than Pro/TOOLKIT release: Not supported
|
| • | Creo Parametric release newer than a Creo Parametric TOOLKIT release: This works in many, but not all, cases. The communication method used to link Creo Parametric TOOLKIT to Creo Parametric provides full compatibility between releases. However, there are occasional cases where changes internal to Creo Parametric may require changes to the source code of a Creo Parametric TOOLKIT application in order that it continue to work correctly. Whether you need to convert Creo Parametric TOOLKIT applications depends on what functionality it uses and what functionality changed in Creo Parametric and Creo Parametric TOOLKIT. PTC makes every effort to keep these effects to a minimum. The Release Notes for Creo Parametric TOOLKIT detail any conversion work that could be necessary for that release.
|
| • | Creo Parametric build newer than Creo Parametric TOOLKIT build This is always supported.
|
| • | Creo Parametric TOOLKIT application compiled on the same architecture and operating system as Creo Parametric. This is always supported. |
| • | Creo Parametric TOOLKIT application compiled on a machine with a smaller pointer size (native data size) than the machine on which the application is run For example, a Creo Parametric TOOLKIT application built on Windows 32-bit running on an Windows-64 bit installation of Creo Parametric. This is supported for spawn and asynchronous mode only. |
| • | Creo Parametric TOOLKIT application compiled on a machine with a larger pointer size (native data size) than the machine on which the application is run. For example, a Creo Parametric TOOLKIT application built on Windows-64 bit machine running on an Windows-32 bit installation of Creo Parametric. This is not supported. |
Multiprocess mode:
startup spawn
DLL mode:
startup DLL allow_stop TRUE delay_start TRUE| • | Register—Enables you to register a Creo Parametric TOOLKIT application whose registry file was not present when Creo Parametric was started. |
| • | Info—Reports the following information about each currently registered Creo Parametric TOOLKIT application:
|
<creo_loadpoint>/<datecode>/Parametric/bin/protk_unlock [-c]
<path to executables or DLLs to unlock>
|
Message
|
Cause
|
|---|---|
|
<application name>:Successfully unlocked application.
|
The application is unlocked successfully.
|
|
Usage: protk_unlock <one or more Creo Parametric TOOLKIT executables or DLLs>
|
No arguments supplied.
|
|
<application name>:ERROR: No READ access
<application name>:ERROR: No WRITE access
|
You do not have READ/WRITE access for the executable.
|
|
<application name>:Executable is not a Creo Parametric TOOLKIT application.
|
The executable is not linked with the Creo Parametric TOOLKIT libraries, or does not use any functions from those libraries.
|
|
<application name>:Executable is already unlocked.
|
The executable is already unlocked.
|
|
Error: Licenses do not contain Creo Parametric TOOLKIT License Code.
|
A requirement for unlocking a Creo Parametric TOOLKIT application.
|
|
ERROR: No Creo Parametric licenses are available for the startup command specified
|
Could not contact the license server.
|
|
<application name>:Unlocking this application requires option TOOLKIT-for-3D_Drawings.
|
The application uses functions requiring an advanced option; and this option is not available.
The license option 222, that is, the TOOLKIT-for-3D_Drawings license is not available.
|
|
<application name>:Unlocking this application requires option TOOLKIT-for-Mechanica.
|
The application uses functions requiring an advanced option; and this option is not available.
The license option 223, that is, the TOOLKIT-for-Mechanica license is not available.
|
| • | stdio.h |
| • | string.h |
| • | stddef.h |
| • | stdlib.h |
| • | user_initialize() must contain at least one Creo Parametric TOOLKIT API call. Failure to do so causes the Creo Parametric TOOLKIT application to fail and return PRO_TK_GENERAL_ERROR. |
| • | When coding a Creo Parametric TOOLKIT application in C++ you must declare the function user_initialize() as extern "C". |
| • | PROTK_DELAYINIT_NO_DELAY—Initiates Creo Platform Agent. However, Creo Parametric TOOLKIT applications are initiated, without waiting for Platform Agent to load. |
| • | PROTK_DELAYINIT_ALWAYS_INIT—Waits for Creo Platform Agent to load. However, it initiates the Creo Parametric TOOLKIT application even if Creo Platform Agent fails to load or times out. |
#include "ProToolkit.h"
int user_initialize()
{
return (0);
}
void user_terminate()
{
}|
int arg_num
|
Number of command-line arguments.
|
|---|---|
|
char *argc[]
|
Command-line arguments passed by Creo Parametric. (See further explanation below.)
|
|
char* version
|
Release name of the Creo Parametric being used.
Note: From Pro/ENGINEER Wildfire 4.0 onwards applications built with libraries older than Pro/ENGINEER 2001 will not run. You must recompile these applications with later versions of the Pro/TOOLKIT libraries.
|
|
char* build
|
The build number of the Creo Parametric being used.
|
|
wchar_t err_buff[80]
|
The text of an error message passed to Creo Parametric if the Creo Parametric TOOLKIT fails to initialize. Creo Parametric displays this text when it reports the Creo Parametric TOOLKIT failure (if user_initialize() returns non-zero).
|
+batch=mybatchfile.txt
-Level=expert pro +batch=<filename>/*================================================================*\
FUNCTION: UserAddHoles
PURPOSE: Find the circular datum curves and replace them with
holes.
\*================================================================*/
UserAddHoles (ProMdl p_part)
{
/* .
.
.
*/
}
/*================================================================*\
Load the part specified by the command line argument, and
replace its datum curves with holes.
\*================================================================*/
int user_initialize (int argc, char *argv[])
{
ProMdl p_part;
ProName name_wchar;
ProError err;
char *part_name;
/*----------------------------------------------------------------*\
Set up the part name from the argument list. Note that the
Creo Parametric arguments for Creo Parametric TOOLKIT have a leading
"+" or "-."
\*----------------------------------------------------------------*/
part_name = argv[1];
part_name++;
ProStringToWstring (name_wchar, part_name);
/*----------------------------------------------------------------*\
Retrieve the part.
\*----------------------------------------------------------------*/
err = ProMdlRetrieve (name_wchar, PRO_PART, &p_part);
if (err != PRO_TK_NO_ERROR)
{
printf ("*** Failed to retrieve part %s\n", part_name);
ProEngineerEnd();
}
/*----------------------------------------------------------------*\
Add the holes to the part.
\*----------------------------------------------------------------*/
UserAddHoles (p_part);
/*----------------------------------------------------------------*\
Save the part.
\*----------------------------------------------------------------*/
ProMdlSave (p_part);
/*----------------------------------------------------------------*\
Terminate the Creo Parametric session.
\*----------------------------------------------------------------*/
ProEngineerEnd();
return (0);
}
/*================================================================*\
FUNCTION: user_terminate()
PURPOSE: Report successful termination of the program.
\*================================================================*/
void user_terminate()
{
printf ("Creo Parametric TOOLKIT application terminated successfully\n");
}| • | Your main() must call the function ProToolkitMain() as its last statement. This function contains all the necessary setup code that needs to be run when the Creo Parametric TOOLKIT application starts up in multiprocess mode. |
| • | You must pass on the argc and argv arguments input to main() as the input arguments to ProToolkitMain() without modifying them in any way. |
| • | You cannot make calls to any other Creo Parametric TOOLKIT functions before the call to ProToolkitMain(), because the communications with Creo Parametric have not yet been set up. You may, however, make other non-Creo Parametric TOOLKIT function calls before calling ProToolkitMain(). |
#include "ProToolkit.h"
main(
int argc,
char *argv[])
{
.
.
.
ProToolkitMain (argc, argv);
/* The program exits from within ProToolkitMain().
Any code here is not executed. */
} typedef struct geom* ProSurface; typedef void* ProMdl;
typedef struct curve_header* ProEdge;
typedef struct sld_part* ProSolid;
typedef struct entity* ProPoint;
typedef struct entity* ProAxis;
typedef struct entity* ProCsys;
typedef struct entity* ProCurve; typedef struct pro_model_item
{
ProType type;
int id;
ProMdl owner;
} ProModelitem, ProGeomitem;| |
| |
| |
| |
| |
| |
| |
| • | The initial number of members in the array |
| • | The size, in bytes, of each array member |
| • | Number of objects added to ProArray at each memory reallocation. A higher number means more memory is preallocated and fewer reallocations of the ProArray are required. |
| • | The function creates a filled, expandable array as its output. |
| • | The function needs a filled, expandable array as its input. |
| • | The function needs an existing expandable array to which to write its output. |
ProError ProSolidFeatVisit (
ProSolid solid,
ProFeatureVisitAction visit_action,
ProFeatureFilterAction filter_action,
ProAppData app_data); typedef ProError (*ProFeatureVisitAction)(
ProFeature *feature,
ProError status,
ProAppData app_data);| • | The handle to the feature being visited |
| • | The status returned by the preceding call to the filter function |
| • | The application data passed as input to the visit function itself |
typedef ProError (*ProFeatureFilterAction)(
ProFeature *feature,
ProAppData app_data);| • | PRO_TK_CONTINUE—Do not call the visit action for this object, but continue to visit the subsequent objects. |
| • | Any other value—Call the visit action function for this object and pass the return value as the status input argument. |
| • | PRO_TK_NO_ERROR—Continue visiting the other objects in the list. |
| • | PRO_TK_E_NOT_FOUND—For visit functions, this value indicates that no items of the desired type were found and no functions could be visited. |
| • | Any other value (including PRO_TK_CONTINUE)—Terminate the visits. Typically this status is returned from the visit function upon termination, so that the calling function knows the reason that visiting terminated abnormally. |
| • | All characters from Unicode number 0800 onward. |
| • | The following characters from Unicode numbers 0000 to 0070F are supported. All the other Unicode characters between 0000 to
0070F are not supported.
|
int proe_wchar_size;
int protk_wchar_size = sizeof (wchar_t);
if (ProWcharSizeVerify (protk_wchar_size, &proe_wchar_size) !=
PRO_TK_NO_ERROR)
{
ProMessageDisplay (msgfil, "USER wchar_t size is %0d,
should be %1d", &protk_wchar_size, &proe_wchar_size);
return (1);
}ProEngineerStart("proe_path","text_path");| |
| |
| |
| |
| |
| |
| • | module—This is a mandatory argument. Specifies the name of the Creo module that triggers the event. |
| • | module_info—This is an optional argument. Specifies additional information about the Creo module that triggers the event. This additional information is used by the event-handling function of LearningConnector. |