Tap File Contents and Hand Editing

Discussion/questions about software used with your CNC Shark and programming issues

Moderators: al wolford, sbk, Bob, Kayvon

Post Reply
jeb2cav
Site Admin
Posts: 1524
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky
Contact:

Re: Tap File Contents and Hand Editing

Post by jeb2cav »

Part 2 - continuing from Part 1 –

If you look at the example tap file, you’ll see some important aspects of the contents and resulting behavior. These are important to recognize if you want to hand edit a tap file into chunks – or hand edit to ‘ignore’ certain pieces in a multi-part tap file.

By the time the job reaches the end of the header – the last 2 lines are:
• M3
• G0 Z(Home Position height value)
- the router is powered on and the tool has been moved to the safe height.
Note – if you wanted the router to power on after rising to the safe height, you could reverse these 2 lines in the Shark post processor file.

The next command moves the tool to the X,Y location of the first cut and the clearance height (in this example, 0.2”).

The next command does not change the X,Y location, and plunges the tool in Z to the depth of cut.

In this example, the next few commands are moving the router along the edges of the shape while carving the profile. There is no need for the tool to raise up to the clearance height and travel to a new start location before continuing the job while carving the individual shape’s profile in this case.

You’ll note that just before the header starts, when the tool has finished the cut the last command does not change the X,Y location, but raises the cutter in Z to the clearance height.

The footer line sets the tool to the safe height in Z, moves the tool back to X0, Y0, then ends the job (and shuts the router off).

Another way to think about this flow in execution and tap file construct for the movement section for this very simple shape is:
• Move to the first point in X, Y, and at a Z of the clearance height
• Plunge to the starting depth of cut in Z – no change in X, Y
• Continue the specified movements
• At the end of the last cutting movement, raise the cutter to the clearance height – no change in X, Y

Key Points To Remember When Hand Splitting
If you think of the file in these three sections – Header, Movement, Footer – and ensure that your resulting file has each of these, I’ve found that I have a file that I can use reliably.

For the header you can use the ‘original’ header of the tap file you started with. Use the ‘whole thing’ – so the last line of this section is:
• G0 Z(Home Position height)

You must ensure that the resulting ‘Movement’ section of the tap file contains the four steps listed above. Just to be clear, these are:

• Move to the first point in X, Y, and at a Z of the clearance height
• Plunge to the starting depth of cut in Z – no change in X, Y
• Continue the specified movements
• At the end of the last cutting movement, raise the cutter to the clearance height – no change in X, Y

For the footer, you can use the ‘original’ footer of the tap file you started with.

When I do this, I make a couple copies of the tap file I’m about to split/edit. I use plain English in the file name – so the original file has ‘original’ in the name, and I will not edit that one. I’ll make copies of the ‘original’ – 1 copy for each split. If I inadvertently use the ‘original’, I wills start over. Having the original is important to me for comparison and ‘knowing with authority’ that ‘this’ is what I ‘started with’.

I also keep track of the number of lines of text. Again, any error in this process can result in a range of damage from material to machine, shop and operator. I use a program designed for text editing called ‘TextPad’. It is shareware. WorkPad and Notepad will work just fine, but it will not enable you to count the lines of text – other than by hand. There are other text editing programs out there I’m sure. The other nice thing about TextPad is that it will load extremely large text files – notepad and even wordpad sometimes struggle when editing a 15 hour job.

Example 1
So a simple example to highlight what I’ve found important and that enables this to ‘work’. I’ve made a tap file using the new arcs inches post processor for the shape in the lower left hand corner of my project. I’m going to split it at line 34 as shown in the figure below.
Tap File Split Location
Tap File Split Location

The original tap file, and the resulting part 1 tap file are attached to this post. Part 2 of the tap file is attached to the next post.

I’ve reached the 3 attachment limit, on to part 3…
Attachments
Profile 4 - Lower Right Original.tap
Profile 4 - Original Tap File
(982 Bytes) Downloaded 505 times
Profile 4 - Lower Right Part 1.tap
Profile 4 - Tap File Part 1
(950 Bytes) Downloaded 476 times

jeb2cav
Site Admin
Posts: 1524
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky
Contact:

Re: Tap File Contents and Hand Editing

Post by jeb2cav »

Part 3 - continuing from Part 2 –

Looking at the ‘original’, there are:
• 40 total lines
• 26 lines in the header
• 3 lines in the footer
• There are 4 lines used to move the tool to the first cutting point, and plunge the tool into the material at the first cutting point (lines 27 – 30)
• There are 2 lines used to raise the tool out of the material to the clearance height after the last cutting point (lines 38-39)
• There are a total of 5 lines in the Movement section (lines 31-35) not associated with plunging at the initial point or raising at the end point of the movement

I expect to have a total of 5 lines in the Movement section between the resulting 2 tap files. You’ll see where this expectation is really 6 lines (+1), and even then might vary by +1 line in a bit.

Splitting this at line 34 (yes I know this leaves only one line of cutting code in part 2 (this is a ‘simple example’)), I first enter a blank line (carriage return) after the last movement line I want to leave in this part. I then enter a blank line at the end of the movement section.
Add Some Blank Lines at Start of Editing
Add Some Blank Lines at Start of Editing

Line 39 in the picture above is the line that raises the tool out of the material to the clearance height after the ‘last’ cutting point (which we are in the process of changing). Note that the X and Y coordinate are the coordinate of the last position of the tool ‘in’ the material. We will need to change that as we are putting that line in the Part 2 tap file.

I delete the line (in this case – usually tens of thousands of lines when I decide to do this (as stated, this is high adventure and I don’t use this method often)). I still have a blank line or 2 between the ‘new’ last line in the movement section and the raise the tool section and footer. I now edit the X and Y values in the raise the tool section to match the X and Y values of the last line in the movement section.
Edit Tool Raise Up Line
Edit Tool Raise Up Line

Remove the blank lines and save the file. The file has 41 lines at the end of this process. Reminder, this tap file is attached to part 2 of this thread.

I’m going to start Part 4 now to enable the creation of the part 2 tap file to be in a single post. However, to take advantage of having one more attachment to use on this post, I’ve attached the final Part 2 tap file here.
Attachments
Profile 4 - Lower Right Part 2.tap
Profile 4 - Tap File Part 2
(920 Bytes) Downloaded 474 times

jeb2cav
Site Admin
Posts: 1524
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky
Contact:

Re: Tap File Contents and Hand Editing

Post by jeb2cav »

Part 4 - continuing from Part 3 –

I open the part 2 tap file I created. When I first open it, it contains all of the content from the original. The first thing I do is to create blank lines (carriage return):
• Between the header and the first part of the movement section that moves the tool to the location where the cut starts and the tool is plunged into the material at the initial cut depth
• Between the initial position where the tool is plunged into the material at the initial cut depth and the rest of the movement section
• In the movement section, one line above where the part 2 part of the movement section actually begins. I need to start where Part 1 ‘left off’ or ended.

I don’t place a blank between the movement section end and the lines that raise the tool out of the material to the clearance height. As part 2 is the ‘second’ part of the original tap file, that section and the footer require not changes while creating part 2.
Add Blank Lines at Start of Editing Part 2
Add Blank Lines at Start of Editing Part 2
I’ll then delete the lines in the movement section that are in part 1, leaving a blank line or 2 to ensure I can readily see what changes I need to make in X and Y in the section that moves the tool to the first cutting point and plunges the tool into the material to the correct cut depth (Z). There are 2 lines to edit.
Edit Tool Move to First Point
Edit Tool Move to First Point
Looking at the figure above, I notice that there is no feed rate present after the tool is initially plunged into the material. I add a line, typing in F40.0 (the feed rate I’m using with this tool in this project). Removing any remaining blank lines, I save the file.
Part 2 Tap File with F(eed Rate) Command
Part 2 Tap File with F(eed Rate) Command

The final part 2 tap file is an attachment in Part 3 of this series of posts.

Check the Files Via Line Count
One way to get a sense that you’ve correctly performed this manual operation is to perform a line count. If you’ll recall:
• 26 lines in the header
• 4 lines to perform the initial move to the start point and plunge to the starting depth
• 2 lines to raise the tool out of the material to the clearance height after all movements are completed
• 3 lines in the footer
• 35 total lines that should be in both part 1 and part 2 tap files.
There were 5 lines remaining in the Movement section of the original tap file.

We also know that Part 2 included the last movement line from Part 1 (we need to being part 2 where part 1 left off).

Lastly, we know that we had to create an F (feed rate) command in the Part 2 tap file.

So we expect to see a total of 7 lines present between parts 1 and 2, after we subtract the lines that are present in both tap files (70 total lines (35x2)).

There are a total of 39 lines in Part 1, and 38 lines in Part 2 – 77 total. 77-70 = 7. This is what I’d expect to find. I may in fact repeat this drill on a second copy of the original, with that file and the additional 2 files representing part 1 and part 2 in a new folder and confirm the outcome. You can also use a text editor like TextPad to compare files. So I use that to compare the ‘first’ part 1 tap file with the ‘second’ part 1 tap file. If it all lines up, I’m then willing to use these on the machine.

You can come up with your own method. Just remember that this is high adventure. Any mistakes in this hand editing process can result in damage to your project, machine, shop and operator…

I’m on a roll, even though the UK game is now ending (listened to UoL earlier)(yes, neither were much of a game given who they played), so on to Part 5…

jeb2cav
Site Admin
Posts: 1524
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky
Contact:

Re: Tap File Contents and Hand Editing

Post by jeb2cav »

Part 5 – continuing from Part 4...

Hand Splitting a Multi-Toolpath Tap File
As all 4 parts use the same tool (1/4” end mill), I created a single tap file of all 4 toolpaths. I’ve attached this tap file to this post.

You’ll notice that at the end of cutting part 1, the tool is raised to the clearance height. Then the next section of the tap file starts by moving the tool to the X,Y position of the starting point of the first cut for the second part (Profile 2 in this case), and plunges the tool to the initial depth of cut.

This is repeated for the 3rd (Profile 3) and 4th (Profile 4) parts. At the completion of the cut for the 4th part, the tool is raised to the clearance height, and then the footer raises it to the Home Position height and back to X0, Y0.

Following the steps outlined in thread post parts 3 and 4, I split the original into 2 pieces between Profile 2 and Profile 3. The steps above are the way to approach this. The one difference though is that the split is made between movements for each part (Profile). There is no need to include ‘where you left off’ when you make the edits to create the tap file Part 2.

I’ve attached these to this post. No pictures this time, but provided for your reference and review.

I’ve reached the maximum of 3 attachments, so on to Part 6…
Attachments
Profiles 1-4 In One File Original.tap
4 Toolpaths in One Tap File
(5.03 KiB) Downloaded 474 times
Profiles 1-4 In One File - Part 1.tap
4 Toolpaths Split Part 1
(4.28 KiB) Downloaded 449 times
Profiles 1-4 In One File - Part 2.tap
4 Toolpaths Split Part 2
(1.42 KiB) Downloaded 473 times

jeb2cav
Site Admin
Posts: 1524
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky
Contact:

Re: Tap File Contents and Hand Editing

Post by jeb2cav »

Part 6 (of 6) – continuing from Part 5…

Commenting Out a Section
One of the recent discussion questions was how do I edit a tap file that consists of 2 or more individual toolpaths, and comment out the toolpath I don’t want to use for a given job.

To comment out a line of code in the tap file, begin and end with parenthesis – ( and ).

Using the Profiles 1-4 In One File Original (attached to post Part 5), I’ve commented out the Profile 3 toolpath. In this case, all you need to do is enclose each line of the part you don’t want to carve in parenthesis. Of course, I made these changes on a copy of the original tap file. Again, no pictures, but provide for your reference and review.

One Last Comment on Splitting
As Buc pointed out in this thread - http://cncsharktalk.com/viewtopic.php?f=2&t=1846 - there is a 'Split' function available and supported by Vectric that can be added to the Shark post processor. As Tim Merrill points out in that same thread -

"Realize that Tape Splitting was added to support CNC machines that were memory limited or restricted to running a set number of lines of code at a time. I have tested it and used it in actual projects and while it works, it was not intended for this purpose. One issue you may very well see are lines where one cut file has stopped and the next starts. This can be caused by wood movement overnight and/or a difference in the bit's Z-zero setting if your machine doesn't hold position while shutdown or paused. Not saying it will happen, but you should realize the possibility exists. And believe me, if it happens in a detailed area of the carving you aren't going to easily sand it out."

I agree with Tim's points and this is why I very rarely use this method myself. In the rare instances where I have used this, I have been fortunate - and while I was able to discern where the 'first' part ended and the 'second' tap file began, I've been able to remedy the minor difference in a short time with a sand mop. A lot of factors play into that - including Grace. In all of my own use of this method, I did not power down the machine, control box or computer between tap files.


While We’re ‘Here’
If you’ve made it this far, you might as well take a closer look at the Profiles 1-4 In One File Original tap file. Way back in post Part 1, I described the example project. The shape used with the Profile 2 toolpath (center of the project) used a Bezier curve. The shapes used with the Profile 1 (bottom left corner) and Profile 3 (upper right corner) toolpaths used arcs.

When the toolpaths were ran through the post processor, different outcomes are found. The vectors that are ‘arcs’ end up using the G02 command. This results in an extremely smooth/fluid tool movement along that vector. The vectors that are ‘bezier’ end up as a series of short linear segments using the G01 command to control tool movement. If you are using Bezier vectors for example to define an oval that you are going to use to define a profile toolpath used to ‘cut out’ the project from the original material, I think you will find that the edge is not as ‘smooth’ as it would be if that oval was defined by vectors that are ‘arcs’.

You can use the Fit Curves to Selected Vectors and set the Fitting Type to ‘Circular Arcs’. However, doing this in one step on even a simple shape like that shown in the example project will also transform the straight lines to arcs. This will be more of a mess than the one Bezier span. I often go into Node edit mode and using the shortcut key ‘A’, change the Bezier curves to arcs. I certainly am in the habit of ensuring that any oval or circle I’m using to cut out something or ‘frame’ a 3D component are ‘arc’ spans vice Bezier spans.

Remember, hand editing and splitting tap files is high adventure from my perspective – in that the opportunity to induce an error into the tap file is very high. Any error induced can result in damage not only to your project, but also your machine. In a worst case, any errors induced could result in significant damage to the machine, shop, and operator(s).

Hope this answered some questions on the topic of hand editing, splitting, and commenting out sections of a tap file for use with the Shark.
Attachments
Profiles 1-4 In One File Original - Profile 3 Toolpath Commented Out.tap
One Toolpath Commented Out in Tap File
(5.07 KiB) Downloaded 495 times

User avatar
Buc
Posts: 548
Joined: Mon Aug 16, 2010 9:34 pm
Location: Waterford, PA

Re: Tap File Contents and Hand Editing

Post by Buc »

Joe,

Well written and though out post. Remember just one little oops can and will ruin your day. Be careful and proof read your edits. May even want to dry run the program to see how it runs. Thanks for taking the time on this project and posting your results. NorthWestern Highschool? (Go Wild Cats)

Be careful and be safe,
Buc
I have not failed. I've just found 10,000 ways that won't work.

Thomas A. Edison

The Only Easy Day Was Yesterday

Post Reply