cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

What am I doing wrong?

ilyachaban
14-Alexandrite

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

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

9 REPLIES 9
RPN
17-Peridot
17-Peridot
(To:ilyachaban)

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

 

ilyachaban
14-Alexandrite
(To:RPN)

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
17-Peridot
17-Peridot
(To:ilyachaban)

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

 

int user_initialize(int argc,  char *argv[],  …

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.

ilyachaban
14-Alexandrite
(To:YaroslavSin)

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.

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

 

Start to learn code from macros in Async_Mode_Example.xls

ilyachaban
14-Alexandrite
(To:YaroslavSin)

I've already went through this examples. Now i need to understand program structure to oprerate in creo using auxilary application. xls doesn't work in this case because of multiple reasons. some functions simply doesn't work in VBA and second of all it can't be started as auxilary application and be operated from creo prametric using buttons.(or depending on how small knowledge I have in this area I don't know about it)

When i was writing application in VBA i've had button to connect to creo to disconnect from creo and listeners in each function to catch errors and disconnect in case of any application errors. So it doesnt' stay connected and broken at the same time. 

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

 

ilyachaban
14-Alexandrite
(To:YaroslavSin)

Thank you so much for your response. That is exactly what I needed.

So whole workflow will be changed since now)))

Announcements


Top Tags