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

Unpredictable macro crash

mcielok
13-Aquamarine

Unpredictable macro crash

Hello everyone,

I'm facing a complex and apparently insoluble problem with macro execution.

The code is launched by a Visual Basic Sendkeys instruction from another application and does the following actions:

- Reads data from a text file and stores them into an LTAB;

- Deletes the text file;

- Sets a part name; check if already exists, deletes it, creates a new part with that name;

- Draws a table starting from 0,0 and fills it with stored data;

- Adds all data as Info to the part;

- Prints a pdf file of the table;

- Deletes the table heading text;

- Goes to Top, executes a Modify Move action taking the table and leaving it hanging to the mouse pointer.

Everything worked fine on seven Workstations for about ten years; a couple of months ago it began giving problems on one single PC (which is the same as mine): the code hangs or ends in a random looking way.

From time to time it fails before deleting the existing table, deletes it and ends, begins filling the table and ends after a variable number of records, hangs at the attribution of Info, finishes before printing pdf.

In normal executions, it never reaches the Modify instruction; instead, setting up a Breakpoint, the step-by-step running succeeds without issues.

Since we needed to replace another Workstation, we decided to buy the new one for this user and set it up without cloning the disk to solve the problem; well, the new WS has the same problem.

I tried inserting multiple Wait instructions to give the interpreter some time to reflect with no success.

Has anyone experienced such problems?

Thank you

Marco

4 REPLIES 4

Do all of the stations receive updates?  My thought, is that  this is a Microsoft related issue with an update to visual basic.

 

Perhaps going to an older version of visual basic would fix this issue?

 

Tom

 

Creo Element\Direct Modeling 20.6.0.0.0
mcielok
13-Aquamarine
(To:ThomasKirkman)

Thank you for the attention Tom.

First, I was not clear enough: there is an .exe program, likely not suffering from any Microsoft update, inputting MYMACRONAME plus parameters in the Drafting command line and entering the input.

All the actions described in my original post are executed by MYMACRONAME, written in MI language.

We have seven workstations, both Win10 and Win7, regularly updated, all equipped with Direct Drafting 19.0 and all but one are running MYMACRONAME correctly. Same behavior with the macro running under Drafting 18.1.

Failing other solutions, my next action will be to write down the code starting from zero and see if changes resulting from experience can fix the problem.

Thanks once again

Marco

Unless you have already solved the problem (did you?), try the following:

´- Call/start Drafting (ME10F) from a BAT-File (not via Visual Basic).
- Look (especially) at LTAB Operations (Syntax, DELETE_LTAB,CREATE_LTAB etc.)

In my long time as *the* WorkManager/Model Manager expert of CoCreate/PTC I have worked
on some similar nasty crashes/hangups and the two hints above are the most common root
causes (WorkManager and ME10 have similar MACRO language and a common Interpreter)


@mcielok wrote:

Thank you for the attention Tom.

First, I was not clear enough: there is an .exe program, likely not suffering from any Microsoft update, inputting MYMACRONAME plus parameters in the Drafting command line and entering the input.

All the actions described in my original post are executed by MYMACRONAME, written in MI language.

We have seven workstations, both Win10 and Win7, regularly updated, all equipped with Direct Drafting 19.0 and all but one are running MYMACRONAME correctly. Same behavior with the macro running under Drafting 18.1.

Failing other solutions, my next action will be to write down the code starting from zero and see if changes resulting from experience can fix the problem.

Thanks once again

Marco


 

Regards,

    Max

mcielok
13-Aquamarine
(To:MaxR.Kublin)

Thank you Max,

the problem was temporarily moved aside by giving the code execution a simple break ("Press OK to continue"), but your hint is much interesting.

Drafting is always started by a dedicated bat file, while indeed a couple of LTABs are managed by the macro: the syntax seems correct, since the code always worked fine before, but I'm going to check for possible logical bugs in dimensions, securing, creating and deleting... if you remember exactly where the problem may hide I'll be even more thankful!

I'll anyway let you know.

Much appreciated!

Marco

Top Tags