Tap File Contents and Hand Editing

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

Moderators: sbk, al wolford

Tap File Contents and Hand Editing

Postby jeb2cav » Sat Sep 08, 2012 11:14 pm

Part 1 of 6

A few recent (and less than recent) posts have asked about editing the tap file by hand. As you’ll see, I have a lengthy response and apologize for not taking the time to jot all this down and share it earlier.

This 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).

I’ve done a fair amount of self-education on this over the last couple of years – often sharing notes with other members. I’ve often thought about taking the time to jot down some notes on this and share with the group, and finally finished that today. Please keep in mind that all of this is based on use knowledge and investigation/reading. No formal machining training here.

Again, I’m obliged to say that manually editing the tap file is high adventure. Mistakes and subsequent use of these mistakes can result in damage to your project, machine, and worst case shop and operator.

A couple of references on G-Code:

http://linuxcnc.org/docs/html/gcode.html
http://www.cncci.com/resources/tips/g61.htm

Not claiming these are authoritative or the best ones out there. They are ones that have been provided here on the forum or I’ve found useful over the years.

Vectric Post Processor Guide

Can be found on disk in the installation folder of VCarve or Aspire in the /Help/Docs folder (example: C:\Program Files\VCarve Pro 6.0\Help\Docs)

A summary of G-Code commands typically seen in a Shark tap file:

G90 – Absolute Distance Mode
G20 – Inches (G21 – Millimeters)
F – Set Feed Rate (F40.0 – 40 ipm)
G64 P.01 – Continuous mode with optional path tolerance (in this case 0.01 inches)
S – Set Spindle Speed (not applicable with Shark system)
M3 – Turn spindle clockwise (not applicable with Shark system)
G0 – Rapid linear motion. Expected that no cutting will take place when G0 command is executing.
G00 – See G0
G1 – Linear Feed (straight line) – typically seen with the first plunge into the material
G01 – Linear Feed (straight line)
G02 – Clockwise arc feed. I – arc center in X axis (relative to last X, Y). J – arc center in Y axis (relative to last X, Y).
M02 – End Program

I’ve not taken the time to reverse engineer a ‘total’ list of g-code commands that the Shark supports. I think if you went through the Shark post processor file, and using the Vectric Post Processor Guide manual as a reference, you could come up with an authoritative list. NWA has not published an authoritative list of supported commands.

G64 directly influences accuracy (or fidelity) of how the machine follows the output path and points given to it. A reasonable discussion of this can be found in the CNC Shark Post Processors – 3 Jan 11.pdf (actually created and released in 2012) – on the NWA downloads page (http://www.nextwaveautomation.com/DownLoads.aspx).

In my opinion, to truly gauge the accuracy of your Shark, you’d need to edit the new arcs post processor file and remove the G64 P.01 entry. Warning: While this may be great if you’re wanting to create a square or circle (assuming the circle or oval consists of arcs and not a bazillion points/line segments), you will have a higher occurrence of ‘rough’ or ‘scoring’ along a given toolpath where every vertex along the vector exists. A good example of this would be to have a square, with a vertex in each corner, but also at the half way point of each edge. As the machine is moving ‘exactly there’, the opportunity for a minor mark to be left along that edge increases. This is easiest to see using a profile toolpath to cut a piece out, even easier with a profile and a circle with a bazillion points (and no G64 in play). In the end, the use of a small value of 0.01 inches is used in the new arcs post processor.

For those who use the millimeters post processor (like are friends who live in Oz/Paradise), you’ll find that in this case, the correct equivalent in millimeters is used for the G64 P value.

Overview of Case Used to Support the Discussion:

I created a simple project using 4 simple shapes. Each shape started out as a 2” x 2” square. I then used the node editing tool to create the final shapes. The origin of the project is the top of the material in the lower left corner. The Home Position height is 2” and the clearance height is 0.2”
• Lower Left Corner – converted the top edge to an arc, and then set the ‘top’ of the arc to be 1/2" above the original square.
• Center – converted the top edge to an arc, and left it at 1” above the original square. Then I converted that arc edge to a Bezier edge.
• Upper Right Corner – converted the right and bottom edges to arcs, each 1” away from the original edges of the square.
• Lower Right Corner – a square

1_Tap File Discussion Project.jpg
Editor View of VCarve Project



I used a Profile toolpath on each individual shape, set to a depth of cut of 0.1”. I’ve uploaded the VCarve project as well.

General Structure of the Tap File
A Shark tap file has 3 sections:
• Header – With the most recent (Jan 12) Shark Post Processors, this includes information about the project, as well as any project Notes you may have entered in the VCarve or Aspire project file (see CNC Shark Post Processors document referenced above for a full description). The header also sets the G64 command, sets the units of measurement, starts the router (if plugged into the Control Box), and moves the tool to the Home Position height (set in the VCarve or Aspire project).
o Keep in mind that the behavior of the Shark is to move the tool to 0,0,0 at the start of the job (Run). This is not controlled by the tap file.
• Movements – This section contains all the commands for movement, feed rate and plunge rate speeds.
• Footer – This section positions the tool at the Home Position height, moves it to X0, Y0, and ends the job (this also shuts off the router).

Using the tap file for the shape in the lower right hand corner of the project, the Header, Movements and Footer section are shown in the attached picture.

2_Tap File Structure.jpg
Tap File Structure


I’ve reached the 3 attachment limit, on to part 2….
Attachments
4 Squares.crv
Example Project to Support Discussion
(60 KiB) Downloaded 282 times
jeb2cav
Site Admin
 
Posts: 1527
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky

Re: Tap File Contents and Hand Editing

Postby jeb2cav » Sat Sep 08, 2012 11:17 pm

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.

3_Original Tap File and Split Location.jpg
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 258 times
Profile 4 - Lower Right Part 1.tap
Profile 4 - Tap File Part 1
(950 Bytes) Downloaded 257 times
jeb2cav
Site Admin
 
Posts: 1527
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky

Re: Tap File Contents and Hand Editing

Postby jeb2cav » Sat Sep 08, 2012 11:21 pm

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.

4_Add Blank Lines in Part 1 Tap File.jpg
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.

5_Edit Tool Raise Up Line in Part 1.jpg
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 246 times
jeb2cav
Site Admin
 
Posts: 1527
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky

Re: Tap File Contents and Hand Editing

Postby jeb2cav » Sat Sep 08, 2012 11:24 pm

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.

6_Add Blank Lines in Part 2 Tap File.jpg
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.

7_Edit Tool Move to and Plunge Line in Part 2.jpg
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.

8_Part 2 Tap File Finished - with F Command Added.jpg
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: 1527
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky

Re: Tap File Contents and Hand Editing

Postby jeb2cav » Sat Sep 08, 2012 11:26 pm

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 264 times
Profiles 1-4 In One File - Part 1.tap
4 Toolpaths Split Part 1
(4.28 KiB) Downloaded 240 times
Profiles 1-4 In One File - Part 2.tap
4 Toolpaths Split Part 2
(1.42 KiB) Downloaded 250 times
jeb2cav
Site Admin
 
Posts: 1527
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky

Re: Tap File Contents and Hand Editing

Postby jeb2cav » Sat Sep 08, 2012 11:28 pm

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 282 times
jeb2cav
Site Admin
 
Posts: 1527
Joined: Thu Sep 30, 2010 7:04 pm
Location: Kentucky

Re: Tap File Contents and Hand Editing

Postby Buc » Sun Sep 09, 2012 8:53 am

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
User avatar
Buc
 
Posts: 549
Joined: Mon Aug 16, 2010 9:34 pm
Location: Waterford, PA


Return to Software. Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron