Hi,
I had the same thoughts and it seems that I found a way to change the shown values on the combo box.
Add the following lines to your postprocessor file and adapt it according to your needs.
It shows the following in the combo box: <tool name> [<tool diameter>, <tool type>, <tool description>].
If tool type cannot be determined or if tool description is empty, these values are left out.
Below I attached a screenshot how it looks like for me (in german language).
Code: Select all
<Name of your Postprocessor>.prototype.initToolComboItem = function(toolCombo, toolName, toolBlock) {
var toolDiameter = toolBlock.getCustomProperty("QCAD", "CamDiameter", undefined);
var toolDescription = toolBlock.getCustomProperty("QCAD", "CamDescription", undefined);
var toolType = toolBlock.getCustomProperty("QCAD", "CamToolType");
var itemText = toolName + " [\u00F8" + toolDiameter;
if (!isNull(toolType) && !isNaN(toolType))
{
switch (parseInt(toolType))
{
case Cam.ToolType.Mill:
toolType = "mill";
break;
case Cam.ToolType.Drill:
toolType = "drill";
break;
}
itemText += ", " + toolType;
}
if (!isNull(toolDescription))
itemText += ", " + toolDescription;
itemText += "]";
toolCombo.addItem(itemText, toolName);
//if (!isNull(toolDescription))
// toolCombo.setItemData(toolCombo.count-1, toolDescription, Qt.ToolTipRole);
};
The two lines commented out at the bottom are for the tool tip. For me, this is no longer necessary since all information is shown in the combo box itself.
Further, I changed the default behaviour of the description text field in the "CAM Edit Tool" dialog. Normally, this field is automatically generated each time you change the tool name or the diameter and contains "<toolname> <diameter of tool>". I want to use my own (useful) descriptions.
This can be achieved by overwrite the following function in your postprocessor file:
Code: Select all
<Name of your Postprocessor>.prototype.getToolTypeTitleTemplate = function(toolType) {
return null;
}
Perhaps this helps.
Regards,
Deejay