Skip to main content
16-Pearl
Nov 10, 2023 1:41 PM UTC
Solved

What am I doing wrong?

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

 

 

 

 

17-Peridot
Nov 14, 2023 8:16 AM UTC

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."

 

9 replies

RPN
18-Opal
Nov 10, 2023 3:23 PM UTC

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 🙂 ).

 

Translate
16-Pearl
Nov 14, 2023 7:07 AM UTC

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?

Translate
RPN
18-Opal
Nov 11, 2023 7:13 PM UTC

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

 

int user_initialize(int argc, char *argv[], …
Translate
17-Peridot
Nov 13, 2023 12:44 PM UTC

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.

Translate
16-Pearl
Nov 14, 2023 7:11 AM UTC

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.

Translate
17-Peridot
Nov 14, 2023 7:27 AM UTC

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

 

Start to learn code from macros in Async_Mode_Example.xls

Translate