VERICUT Users' Forum

Due to relentless spammers, we are no longer automatically accepting new forum registrations. If you wish to register for this forum, please send an e-mail to: info@cgtech.com

You are not logged in.

#1 2008-09-15 16:16:53

vhubbard
Beta User
From: Dallas, TX
Registered: 2004-11-11
Posts: 222
Website

Tip for simplifying control message creation

One of the things that we often do is add messages to commands.   Errors, warnings or informative.  The display of these messages is based on other settings in the control.  We set variables as flags to display the messages.

The traditional way to do this is to add another logical condition in the command with the message.   A simple example with  G65 and G5P10000/P0 is shown.  We set the variable $HFMODE to flag if G5P10000 is active or inactive.  0 inactive, 1 active. G65 should not be called on this control with G5P10000, so we generate an error.   The problem with this is we have to code the 4012 and CallNCMacro twice.    If we have 3 message macros in a command, it would take  6 conditions in the G65 logic to handle the message combinations.   

    WORD_VALUE "G" "5" {
        COND_AND "P" "0" {
            VARIABLE "$HFMODE" {
                OVERRIDE_VALUE 0
            }
        }
        VARIABLE "$HFMODE" {
            OVERRIDE_VALUE 1
        }
    }


    WORD_VALUE "G" "65"{
            COND_VAR_AND "$HFMODE" "1" {
        MACRO "MessageMacro" {
            OVERRIDE_VALUE 1 " TEXT_OVERRIDE_VALUE "G5P10000 active, Macro Call Invalid"
                        }       
                        VARIABLE "4012"
        MACRO "CallNCMacro" {
            PASS1 Yes
        }
         }   
                 VARIABLE "4012"
         MACRO "CallNCMacro" {
         PASS1 Yes
         }
    }

and in the events processing we set the default value at startup.

        VARIABLE "$HFMODE" {
            OVERRIDE_VALUE 0
        }

An alternate method.
The message macro can take a value of 1-7.   1 error, 2 warning, 3 info and 4-7 to certain report files.  7 is the Control Settings Messages, which we do not use and have set to go "to Nowhere" in Vericut by default.

So if we set $HFMODE to 1 for error or 7 for  disabled and recode the message macro to use OVERRIDE_EXP , the message macro now has an "IF" mode.  If 1-6 display/print out.  If 7 ignore for all intents and purposes. 

As far as the user is concerned, it acts the same way.  As far as coding the control it is simpler.   I am able to easily add error or warning messages without building more conditional logic.   We have many error/warnings in our controls and this has simplified our control logic.  If I have 3 messages, it is still 1 conditional.

    WORD_VALUE "G" "5" {
        COND_AND "P" "0" {
            VARIABLE "$HFMODE" {
                OVERRIDE_VALUE 1
            }
        }
        VARIABLE "$HFMODE" {
            OVERRIDE_VALUE 1
        }
    }


           WORD_VALUE "G" "65" {
        MACRO "MessageMacro" {
            OVERRIDE_EXP "#$HFMODE" TEXT_OVERRIDE_VALUE "G5P10000 active, Macro Call Invalid"
        }
        VARIABLE "4012"
        MACRO "CallNCMacro" {
            PASS1 Yes
        }
    }

Now in events processing we have

        VARIABLE "$HFMODE" {
            OVERRIDE_VALUE 7
        }

FWIW

Offline

Board footer