![]() |
Tips for Editing Control Texts (CAM) |
www.CAD6.com |
Handling ParenthesesPlease note that variables in CAD6 generally contain character strings. Such a character string can represent a numerical value, e.g. -0.25 or 10000. However, these character strings can also contain complete terms. For example this is true for the variable ~XIncr~ (refer to chapter "Variables for Control Texts"). This variable contains the character string (~X1~-~PrevX~). The enclosing parentheses are essential!
The following example depicts how during export variables inside a control text are being replaced step by step and how finally the resulting term is being evaluated. Variable ~X1~ contains the value 180.2543 (which is actually a character string representing a numerical value) and ~PrevX~ contains 100.0.
X {,-~XIncr~*2} X {,-(~X1~-~PrevX~)*2} X {,-(180.2543-100.0)*2} X -160,51
The first line shows the original text as it was entered in the corresponding input field of the control text in the "Edit Postprocessor". In the two following lines variables are replaced by their respective content (character string). In the final step the numerical term statement (refer to Statements in Texts) is evaluated. This evaluation also determines that a comma is exported as decimal separator and that the result is rounded according to the number of decimal places (two in this case) specified in the postprocessor.
If the variable ~XIncr~ contains the character string ~X1~-~PrevX~ (without enclosing parentheses), then this is the result:
X {,-~XIncr~*2} X {,-~X1~-~PrevX~*2} X {,-180.2543-100.0*2} X -380,25
So if you assign a term to a variable (for example a T-parameter) then it is mandatory to enclose it in parentheses. Thus you avoid that later during term evaluation in the control text unexpected results occur.
Working in Input FieldsThe dialog window "Control Text Editing" is sizeable. It will make editing of control texts a lot easier if you enlarge this dialog window so that all lines are visible without horizontal scrolling. Finally, some search commands are available that allow finding texts within the current control text as well as all other input fields. You can start these search commands by means of key shortcuts: CTRL + F Opens a dialog in which the text to be found can be entered. If at the time of opening this dialog a part of the text in the field is marked, this partial text will be copied into the dialog. F3 Searches for the next occurrence of the text in forward direction, starting with the current cursor position or text marking. SHIFT + F3 Searches for the next occurrence of the text in backward direction, starting with the current cursor position or text marking. CTRL + F3 Searches in forward direction for the currently selected text, starting behind the text marking. SHIFT + CTRL + F3 Searches in backward direction for the currently selected text, starting before the text marking. The last search text is globally saved, so that it remains available in the next dialogs. For example by using these search commands and pasting from the clipboard you can easily replace the text {+ with {&. F4 Starting with the current cursor position the nearest brace { or } is searched and marked. If a brace is already marked then the matching brace is marked. F5 Starting with the current cursor position or text marking the directly enclosing pair of braces { } is searched and the corresponding text is marked. The search commands for braces are helpful when entering and verifying nested text statements, such as {?!~ContourSubprogramActive~ {$ {!CycleCommands{$}{$G00 {?~EndOfCycleSequence~{$Z{&~ZClearance~} M05{?~ToolControl1~{$ M09}}}{$Z{&~ZWorking~}}}}} } }
If a text statement is not nested correctly of if any other error occurs the text (***SYNTAX ERROR***) is copied to the corresponding position in the NC file.
|
CAD6industrie CAM Release 2025.0 - Copyright 2025 Malz++Kassner® GmbH