Postprocessor settings window
What are settings?
Each postprocessor has some set of parameters which we can divide into three main groups.
- Descriptional properties like Machine and CNC system name, comments and list of authors.
- Common properties which defines the way how to handle some frequently encountered cases. For example, should it break circular arc movements to lines, halves or quarters.
- User defined parameters - they are a list of additional properties designed by the developer of exact postprocessor, which are shown to the user of postprocessor and which he must fill before starting the generation of G code. For example, the path to an output file, program name or number, employee name, etc.
The postprocessor stores its settings in a separate settings.xml file which is placed in the folder of source files next to the main postprocessor.cs file. When compiling, this file is embedded inside the main binary dll file of the postprocessor.
Example of Settings.xml file content
Below is an example of content of settings.xml file for a real Fanuc robot postprocessor.
Settings.xml - click to expand.
<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="PostSchema.xsd"?>
<Settings Version="1.0">
<Description>
<Comments />
<CNCSystem />
<MachineName />
<Authors />
</Description>
<Common>
<BreakArcs>No</BreakArcs>
<!-- No, Cuts, Halfs, Quaters -->
<BreakHelix>false</BreakHelix>
<!-- false, true -->
<ArcTolerance>0.01</ArcTolerance>
<MaxCircleRadius>0</MaxCircleRadius>
<DecimalSeparator>.</DecimalSeparator>
</Common>
<UserDefinedParameters>
<Group ID="OutFiles" Caption="$(OutputFiles)">
<Parameter ID="OutputFolder" Caption="$(NCFilesDir)" Type="FolderName" />
<Parameter ID="LSFileName" Caption="*.ls files short name" Type="String">moves</Parameter>
<Parameter ID="MaxMoveCount" Caption="Max movement count per file" Type="Integer">2000</Parameter>
</Group>
<Group ID="Smoothing" Caption="Smoothing">
<Parameter ID="DefaultACC" Caption="Default ACC value" Type="Integer">65</Parameter>
<Parameter ID="ShortLength" Caption="Short length" Type="Double">0.2</Parameter>
<Parameter ID="StartVelocity" Caption="Start velocity (mm/sec)" Type="Double">10</Parameter>
<Parameter ID="CntValueRapid" Caption="CNT for Rapid or Joint move (%)" Type="Integer">30</Parameter>
<Parameter ID="CntValueMin" Caption="Min CNT value (%)" Type="Integer">20</Parameter>
<Parameter ID="CntValueMax" Caption="Max CNT value (%)" Type="Integer">80</Parameter>
<Parameter ID="AngMin" Caption="Angle of min CNT (deg)" Type="Integer">90</Parameter>
<Parameter ID="AngMax" Caption="Angle of max CNT (deg)" Type="Integer">140</Parameter>
</Group>
<Group ID="Format" Caption="Format">
<Parameter ID="ExtAxesGroup" Caption="External axes group" Type="Integer">
<Value Caption="Group 1" Default="true">1</Value>
<Value Caption="Group 2">2</Value>
</Parameter>
<Parameter ID="RobotHolds" Caption="Robot holds" Type="Integer">
<Value Caption="Tool" Default="true">0</Value>
<Value Caption="Part">1</Value>
</Parameter>
<Parameter ID="UFrameFormat" Caption="UFRAME format" Type="Integer">
<Value Caption="UFRAME_NUM=1" Default="true">0</Value>
<Value Caption="UFRAME[1]=XYZABC">1</Value>
</Parameter>
<Parameter ID="UToolFormat" Caption="UTOOL format" Type="Integer">
<Value Caption="UTOOL_NUM=1" Default="true">0</Value>
<Value Caption="UTOOL[1]=XYZABC">1</Value>
</Parameter>
</Group>
</UserDefinedParameters>
</Settings>
Of course, you can edit this file manually inside Visual Studio Code. The PostSchema.xsd file even contain the syntax rules which will give you errors highlight and predefined words autocompletion for this purpose. But inside CLData Viewer we have a window which is specially designed to edit the settings.
Postprocessor settings window
Postprocessor settings window allows you to work with xml settings of postprocessor the most convenient way. In order to open the window, you need to select a postprocessor in CLDViewer, right-click on it. After that click on Edit postprocessor XML settings in the context menu.
Postprocessor settings window displays parameters in the form of visual tree of nodes and the properties inspector.
Postprocessor settings window:
Control elements
The tree element control panel is in the upper left part of the window. There are 3 controls on the panel:
- Add group - add user group to selected folder of User defined parameters section and in its root;
- Add parameter or enum value - add user parameter to selected folder of User defined parameters section and in its root. There are 7 variant to add parameter:
- String parameter;
- Integer parameter;
- Double parameter;
- Boolean parameter;
- FileName parameter;
- FolderName parameter;
- Enum value - this value is added only to selected parameter of User defined parameters
- Delete item - delete user selected item in elements tree.
Elements of tree
On the left part of the window there is a tree with a default parameters and user parameters.
Tree display:
- Section/folder - ;
- Default parameter - ;
- User parameter - ;
- Enum value - ;
Default parameters
Description section and Common section are default and parameters within them cannot be edited, added or deleted. Only allowed to enter parameter value. Description section stores string parameters to describe the postprocessor. It has 4 parameters:
- Machine;
- CNC System;
- Comments;
- Authors.
Common section stores parameters to set default setting for postprocessor. It has 5 parameters:
- Break arcs - allows you to set breaking arcs mode. It has following values:
- No - without breaking;
- Cuts - with breaking;
- Halves - breaking an arch in half;
- Quarters - breaking an arch in quarters;
- Break helix - allows you to enable or disable breaking helix mode;
- Arc tolerance - setting arc tolerance in double value;
- Max circle radius - setting maximum circle radius in double value;
- Decimal separator - available values: "." and ",".
User parameters
User can create own parameters and store them in own folders in User defined parameters section. Folders can store in other folders. You can use drag-n-drop to move parameters and folders but Enum value can be moved only in current parameter.
Attributes of elements panel
Attributes of elements panel is on the right side of the window.
In the case of default parameters, you can only enter their values in this panel. In the case of user parameters, you can you can do full customization.
Each user element has Caption attribute. You can set own caption but there are several reserved variables to specify caption:
- $(OutputFiles);
- $(NCFileExt);
- $(NCFileName);
- $(NCFilesDir);
- $(NCProgNumber). These variables allow you to make a translatable name (localization). Also it allows generating some default values depending on the meaning of the parameter, for example, NC files are stored by default in the folder specified in the CAM system settings.
User folder element has ID attribute: unique identifier of element.
User parameter element has following attributes:
- ID - unique identifier of element;
- Type - type of parameter. There are several values:
- String - parameter with string value;
- Integer - parameter with integer value;
- Double - parameter with double value;
- Boolean - parameter with boolean value, check box;
- FileName - parameter with dialog box for searching and specifying the path of files in parameter value;
- FolderName - parameter with dialog box for searching and specifying the path of folder in parameter value.
- FilesFilter - file extension to search and open in dialog box. Only for Type=FileName;
- Editable (with editable dropdown list) - allows you to edit existing enum value and you can add new value;
- Persistent - save value for new projects;
- Value - parameter value according to its type;
- DefaultValue - default value for parameter that has enumerated values, dropdown list.
Enum value element has Value attribute. Type of value is the same as the parent parameter.
Saving changes
After each change and move of the parameter, a warning will appear in the lower left part of the window: "You need to recompile the postprocessor to display changes in the main window".
In order for the changes to be saved in the xml file, you need to click the Ok button.
The main window of CLData Viewer shows the settings which are embedded into dll file of the postprocessor but not the source xml file. So you should rebuild the postprocessor in the Visual Studio Code to see the result of editing in the main windows.
It is also sometimes useful to reset the settings to the default state because CLData Viewer also stores the values you specify in the main window for debug purpose in a separate temporary file. To do this just use Reset postprocessor settings to default popup menu item of the postprocessor or properties inspector.
Accessing settings from C# code
Below is an example of how to get access to the settings from the C# code of postprocessor using the Settings and Settings.Params properties of the Postprocessor class:
void StartNewFile() {
ls = new LSFile();
ls.Name = Settings.Params.Str["OutFiles.LSFileName"];
ls.OutputFileName = Settings.Params.Str["OutFiles.OutputFolder"] + @"\" + ls.Name + ".ls";
unitsAreInches = prj.Int["Units"]>0;
MaxMoveCount = Settings.Params.Int["OutFiles.MaxMoveCount"];
smooth.accDefaultValue = Settings.Params.Int["Smoothing.DefaultACC"];
smooth.ShortLength = Settings.Params.Flt["Smoothing.ShortLength"];
smooth.StartVelocity = 60*Settings.Params.Flt["Smoothing.StartVelocity"];
smooth.cntValueRapid = Settings.Params.Int["Smoothing.CntValueRapid"];
smooth.cntValueMin = Settings.Params.Int["Smoothing.CntValueMin"];
smooth.cntValueMax = Settings.Params.Int["Smoothing.CntValueMax"];
smooth.angMin = Settings.Params.Int["Smoothing.AngMin"];
smooth.angMax = Settings.Params.Int["Smoothing.AngMax"];
}