Skip to main content
16-Pearl
November 10, 2023
Solved

What am I doing wrong?

  • November 10, 2023
  • 3 replies
  • 3199 views

I have wrote a ptgram that has no functionality only one class. And i can't register it in creo 

text directories are added protk.dat added but there is still an error.

ilyachaban_0-1699623615099.png

 

 

 

 

Best answer by YaroslavSin

VB application can't operate as auxiliary application registered using protk.dat. VB application can only connecting to Creo.

So, if you want integrate auxiliary application in to Creo, then you must developing using Java (J-Link, Java OTK) or C/C++ (ProToolkit/C++ OTK).

 

To get responses from Creo (buttons and listeners) to VB app need to create "Full Asynchronous Mode"

From documentation: "Full asynchronous mode is identical to the simple asynchronous mode except in
the way the VB API application handles requests from Creo Parametric. In simple
asynchronous mode, it is not possible to process these requests. In full
asynchronous mode, the application implements a control loop that ‘‘listens’’ for
messages from Creo Parametric. As a result, Creo Parametric can call functions in
the application, including callback functions for menu buttons and notifications."

 

3 replies

RPN
18-Opal
November 10, 2023

Is this an asyn, or synchrounes test?

 

user_initialize and user_terminate are called on load/exit by creo/ptc. If asyn, you must connect upfront, if sync(connect makes no sense in my point of view, becasue you are already connected 🙂 ).

 

16-Pearl
November 14, 2023

So, if i understood correctly, I need to create app with sub main where i connect to the app using asynconn.connect(...). and outside of sub main i need to add listenters for buttons to retrieve commands from ptc creo?

RPN
18-Opal
November 11, 2023

And note, you have arguments in user_initialize, it is NOT void!

 

int user_initialize(int argc, char *argv[], …
17-Peridot
November 13, 2023

Asynchronous mode is a multiprocess mode in which the VB API application and
Creo Parametric can perform concurrent operations. The VB API application
(containing its own main() method) is started independently of Creo Parametric
and subsequently either starts or connects to a Creo Parametric process.

 

So, you cant use user_initialize and user_terminate functions and protk.dat file.

Instead, start VB application and then connect to Creo.

16-Pearl
November 14, 2023

Are there any examples or code templates with code that does nothing? I've found it in protoolkit manual but it doesn't fit here for vb api.

17-Peridot
November 14, 2023

...\PTC\Creo xxx\Common Files\vbapi\vbapi_examples

 

Start to learn code from macros in Async_Mode_Example.xls