Custom file-open prompt

Same as most software packages, simCNC uses the operating system standard file-open prompt. When using a touch screen I found the standard window hard to use – and in addition wanted to get some more information on the files presented.

simCNC gives plenty of options to customize the frontend… here is my result.

Default file prompt

My file-prompt

Details

  • Display of CAM generated comment
  • Count of lines the file has (still working on a way to get estimated processing time from CAM)
  • Used work coordinate systems (WCS) from parsing the GCode
  • Stock size from CAM
  • Used tools the GCode

In a next step I will have the funtion check tools for a) existence in tool table and b) if tool is currently in the magazine. This will reduce setup time and risk.

As I am using the actual GCode to get most of the information, this tool will work wish any CAM software or post processor.

Currently I have the script set to pull the information for all .tap files in the folder straight away – delay is bearly noticable. Okay, admittably this was just 40 files with a total of 2MB in size. A folder full of heavy 5-axis 3D operations will probably take much longer… Probably I will soon adjust my Post Processor to output all relevant information in the header of the GCode file, so they are easier to fetch.

Code

I am currently working on the first version of the file explorer / open-file prompt. As soon as I have a tested stable, I will release it on Git & here. But you can already have a glimpse at the current alpha version on my Git repository.

# Code available on GIT
https://github.com/AndreUeberbach/simcnc/tree/main/File%20Manager

Some restrictions, the code currently has:

  • In order to read wcs, tool, stock and comment information, some changes to your post processor are requried to post this information in the expected way. I have my settings in a separate article (Fusion360 PP, based on the Fanuc standard)
  • Currently only one folder can be selected and it’s hard-coded

Installation

  • Copy script and folder „icon“ to profile/<yourprofile>/
  • Create a new tool button in your GUI and trigger the fileManager.py script
  • Done

Technical details

  • On start, this script generates an interface with the Python Tkinter package, containing a treeView object.
  • The list is populated with all .tap files found in my NC program folder, which I host on Dropbox.
  • Each attribute is a single line in the treeView, below the „file“ element. This way the information can be collapsed and is not shown in a full tabular structure.
  • On expansion of the file name treeView node, the following steps are carried out
    • Fetch of the date/time of last modification from operating system
    • Reading the first line of the GCode to extract the comment the Post Processor has set. Here we can put helpful information about the program
    • Parse the file (i.e. run through the lines) and extract information on:
      • Used work coordinate systems (WCS), i.e. G53, G54, etc.
      • Used tools – script will search for M6 Tx commands
      • Count number of lines to show size
  • Items in the treeView can be selected by clicking on them. A double-click will trigger d.openGCodeFile( string filePath ) to load the selected file into simCNC.

Discussion

Discussion in the official simCNC support forum can be found here.


Schreibe einen Kommentar 0

Your email address will not be published. Required fields are marked *