hexagon logo

Lesson in Mixing Automation and View Path Lines

So I spent the better part of a day diagnosing a software lock-up condition.

Every time I turned on View Path Lines, PC-DMIS would freeze up and I would have to use task manager to shut it down. No other symptoms, and View Path Lines works fine in other programs.

Finally I figured it out: that function does a little quasi-offline run-through of the whole program, and when doing so gets caught in an endless loop of my own devising.

In the beginning of my program I call a little script for the operator to check the box of which style part is being run, and have that input passed into PC-DMIS as a variable value. That's not the problem.

The problem is that the next step is a simple If to make sure that variable is not empty ( = ""), because my script is not elegant enough to make sure the operator can't click OK without making a valid choice. If the variable is empty, a GOTO jumps PC-DMIS back to re-run the script... yes the script that never gets actually RUN during the quasi-offline View Path Lines.

So for View Path Lines the variable is always empty, and the IF is always true, and the program jumps back and doesn't run the script, so the variable is empty, so the IF is true, so the program jumps back...

This is an easy fix - I'm just going to put in the IF test that if the variable is empty, set it to a default part style AND put a comment in the report stating so. The style difference is not enough to cause a crash, if that were the case I'd put in a program stop.

So I'm posting this to share what is really a very basic computer programming lesson: don't set yourself up to get caught in endless loops.

- Josh