Tool Table

Tool Table data plugin.

Exposes all the info available in the tool table. Watches the tool table file for changes and re-loads as needed.

Tool Table YAML configuration:

data_plugins:
  tooltable:
    kwargs:
      # specify the columns that should be read and writen to the
      # tooltable file. To use all columns set to: TPXYZABCUVWDIJQR
      columns: PTDZR
      # specify text to be added before the tool table data
      file_header_template: |
        LinuxCNC Tool Table
        -------------------

        QtPyVCP will preserve comments before the opening semicolon.
qtpyvcp.plugins.tool_table.merge(a, b)[source]

Shallow merge two dictionaries

class qtpyvcp.plugins.tool_table.ToolTable(columns='TPXYZABCUVWDIJQR', file_header_template=None, remember_tool_in_spindle=True)[source]
current_tool

Current Tool Info

Available items:

  • T – tool number
  • P – pocket number
  • X – x offset
  • Y – y offset
  • Z – z offset
  • A – a offset
  • B – b offset
  • C – c offset
  • U – u offset
  • V – v offset
  • W – w offset
  • I – front angle
  • J – back angle
  • Q – orientation
  • R – remark

Rules channel syntax:

tooltable:current_tool
tooltable:current_tool?X
tooltable:current_tool?x_offset
Parameters:item – the name of the tool data item to get
Returns:dict, int, float, str
initialise()[source]

Initialize the plugin.

This method is called after the main event loop has started. Any timers or threads used by the plugin should be started here.

This method should set self._initialized to true if successfully.

terminate()[source]

Terminate the plugin.

This is called right before the main event loop exits. Any cleanup of the plugin should be done here, such as saving persistent data.

static validateColumns(columns)[source]

Validate display column specification.

The user can specify columns in multiple ways, method is used to make sure that that data is validated and converted to a consistent format.

Parameters:columns (str | list) – A string or list of the column IDs that should be shown in the tooltable.
Returns:None if not valid, else a list of uppercase column IDs.
newTool(tnum=None)[source]

Get a dict of default tool values for a new tool.

saveToolTable(tool_table, columns=None, tool_file=None)[source]

Write tooltable data to file.

Parameters:
  • tool_table (dict) – Dictionary of dictionaries containing the tool data to write to the file.
  • columns (str | list) – A list of data columns to write. If None will use the value of self.columns.
  • tool_file (str) – Path to write the tooltable too. Defaults to self.tool_table_file.