For a syntec machine with an ATC spindle and drill unit there is no good postprocessor in Vcarve. So if I save a file with the .pp that comes with the machine then for each tool change commands are written for both motors so that the dust covers and the motors start to rotate at the same time. So for the spindle M6 T1 to T12 it writes M3 S [speed] plus the macros M33 and M63. If the drill is called M6 T21 to T29 it also writes M3 S[] plus M33 and M63. These files are written as .nc. My idea was to automatically change those files and that can be done with a Python script.
I don't know anything about Python but fortunately Chatgpt does: so I wrote a question that helps me achieve my goal.
"If a text file contains M6T1, M6T2 up to and including M6T12, then M33 and M63 must be removed in the next 4 lines. Also if there are M6T21 up to and including M6T30, then M3 S must be removed in the next line. Please provide a Python script for this."
AI's answer worked immediately So I thought if there are a number of .nc files in a folder, then it would be easy to change them all at once. So another question for Chatgtp to change all files in a folder C:\Users\info\Desktop\ncfiles and write them to a new folder C:\Users\info\Desktop\ncfiles\ncfilesclean
The chat went as follows:
Let me know if you want to apply this to subfolders or multiple files.
You said:
I would like to apply this to all .nc files in a folder
ChatGPT said:
Great! Below is a modified script that applies the above to all .nc files in a specified folder. It creates a modified version of each file in a subfolder edited so that the original files are preserved.
I was then able to copy and paste the script into a text file and save it as cleanup.py and it works great!