Saturday, December 31, 2011

Using QtDesigner!!!!

I'm starting to get the hang of using QtDesigner for making pyQt Dialogs with FreeCAD/HeeksCNC. I love it!!!!

A little progress report

I'm still learning the internals of FreeCAD. I helped the main project a little by creating a lowly 'Point' class, which Yorik integrated into the Draft workbench. Doing this helped me get familiar with the source. Having this object class will also be useful later on for CAM work (start and end points for profiles etc).
I have also made some scripts for extracting libarea 'curve' elements from objects in the FreeCAD document. Right now, I can click on edges of solids or lines and arcs in Sketches or Draft elements and then run a macro to produce some python code that can be pasted into a HeeksCNC python script for producing g-code.
The resulting code looks like this:

curve = area.Curve()
#open path
curve.append(area.Vertex(-1 , area.Point( 57.129109, -39.051727), area.Point(57.129109, -33.935955)))
curve.append(area.Point( -56.043546, -39.051727))
curve.append(area.Vertex(-1 , area.Point( -64.821892, -30.273381), area.Point(-56.043546, -30.273381)))

If you've ever used HeeksCNC, this code should look familiar.
I can take this code and paste it into a script such as this one:

import sys
import math
import area
import kurve_funcs
from import *
import nc.emc2b

program_begin(123, 'Test program')



#(4.7752 mm Carbide End Mill)
tool_defn( id=4, name='4.7752 mm Carbide End Mill', radius=2.3876, length=23.876, gradient=-0.1)
tool_diameter = float(4.7752)
cutting_edge_angle = float(0)

#path/geometry section
curve = area.Curve()
curve.append(area.Vertex(-1 , area.Point( 57.129109, -39.051727), area.Point(57.129109, -33.935955)))
curve.append(area.Point( -56.043546, -39.051727))
curve.append(area.Vertex(-1 , area.Point( -64.821892, -30.273381), area.Point(-56.043546, -30.273381)))
#end of path/geometry section

#program action:
comment('tool change to 4.7752 mm Carbide End Mill')
tool_change( id=4)
feedrate_hv(840, 100)
clearance = float(5)
rapid_safety_space = float(2)
start_depth = float(0)
step_down = float(2)
final_depth = float(-10)
roll_radius = float(5.0)
offset_extra = 0
roll_on = 'auto'
roll_off = 'auto'
extend_at_start= 0
extend_at_end= 0
lead_in_line_len= 5.0
lead_out_line_len= 5.0
kurve_funcs.profile(curve, 'left', tool_diameter/2, offset_extra, roll_radius, roll_on, roll_off, rapid_safety_space, clearance, start_depth, step_down, final_depth,extend_at_start,extend_at_end,lead_in_line_len,lead_out_line_len )



The resulting gcode might give something like this (backplotted in FreeCAD):

Saturday, November 5, 2011


Lately I've gotten interested in FreeCAD .
FreeCAD is "a a general purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler" written in C++, with python scripting built in. It runs on Windows, Linux, and supposedly Mac OS X. FreeCAD is built "with a modular software architecture which makes it easy to provide additional functionality without modifying the core system."
I am interested in adapting some of the HeeksCNC libraries to a plugin for FreeCAD. My motives are practical, I think:

1. FreeCAD's is maintained by a core group of developers already. They are very active.
2. It has python scripting built in by default. HeeksPython is great,but is broken frequently by changes to HeeksCAD itself.
3. The OS related build system is already taken care of for all desktop platforms. I don't want to deal with this at all.
4. There is an active FreeCAD forum.
5. I just want to work on CADCAM and import/export issues.

I have been working on improving the DXF import/export scripts that are already in FreeCAD and have started on a DXF to constraints/Sketcher importer. I have also started work on backplotting CNC g-code into FreeCAD:

The screenshot is from some g-code that I generated in HeeksCNC and backplotted using the HeeksCNC python scripting, adapted to FreeCAD.

Saturday, August 27, 2011

Waterline Machining

I have been machining a part that has a draft angle of 20 degrees on two walls and I think I found a good method.
Here is a screenshot of one version of the part, where I tried using 'zigzag' machining with Heekscnc:

When I actually did machine the part, it took about an hour and 20 minutes. I knew that I would have to set my boundaries closer to the tapered walls, if I wanted to save any time on the next part. Also notice the extra tool paths that are cutting air. I wanted to eliminate them.
Heekscnc uses 3D machining methods from Opencamlib . There are several strategies for 3D milling there and 'waterline' is one of them. Waterline machining makes the tool path run at a constant Z level around the part. This seemed like a perfect strategy for the part I was working on. I tried out the HeeksCNC implementation of ocl waterline using a flat bottomed end mill and got a tool path that looked like this:

I liked the approach, but I only wanted to machine the tapered walls of the part. There were some entries in the Heekscnc waterline operation for boundaries, but they weren't functioning. I looked at the source code and added some logic to '' to connect them and was then able to get the tool path to look like this:

Ahh! That's much better. When I actually milled the part, my cycle time was down to 20 minutes.


Sunday, July 10, 2011

Translating toolpaths with scriptop

I have committed a change to my git repo that lets me snap new coordinates anywhere on the drawing and then have my toolpaths generated relative to it. This becomes useful if I import a dxf file and the geometry isn't anywhere near where it needs to be for sensible fixture offsets. Here's an example:

Notice how the origin/datum is to the far left of the rectangular sketch. To make things a little easier, create a new coordinate system with 'Set Origin' (I like to use the 'Pick 1 Point' option).

Snap the new coordinate datum to the upper left corner of the sketch:

Create a 'ScriptOp' operation and copy/paste the new coordinate object into it. Then you can position the ScriptOp operation just before a regular machining operation,such as Profiling. When you post process, the gcode will be shifted by the distance that the new coordinate object is away from the original origin:

This is useful if you want to place your fixture offset in a familiar place. In the case of this sketch, the fixture offset (G54-G59) is placed in the upper left corner. I like to place a fixture offset on that corner because I touch off to the fixed back jaw of my vise and the left side of the part. There are always other ways of doing things, but that is a common one.

Note for my fellow git brothers: I changed,, and ScriptOp.cpp to make this happen :)

Saturday, July 9, 2011

Manual Tool Changer Carousel

My Bridgeport CNC mill uses 'Quick Switch 30' tooling. I like it for prototype work- it's easy to change out a tool by hand. All that's required is a spanner wrench at the spindle nose to loosen and tighten the knurled ring. It only takes a quarter turn to secure the tool in the taper. When I bought the mill, it came with a small aluminum plate that had 5 holes in it for holding tools, that could be clamped down to the table. This made it convenient to have 5 tools within reach while running programs. This is not enough for the programs that I am running nowadays. Right now, I have 29 Quick Switch 30 toolholders and I like to use the hell out of them during a program. Sometimes I have 8 different tools in a program.
I have been thinking about using an old Heathkit turntable platter that I have had in my stock pile (junk pile) for many years- to make a tool carousel. It's a substantial aluminum casting that's .20" thick in it's cross section and about 11" diameter. It looked like I could put 10 holes in it that would comfortably hold 10 QC 30 tools.
I ended up writing a program in HeeksCNC, using scriptop to bore holes with an end mill. It ended up being pretty slick- it descends in a helical motion and then spirals out with an even chip load on the tool. It was kind of fun to write and use.

Here's a link to my 'array_of_holes.heeks' file that was used for this project:

Friday, July 1, 2011

Creating a rectangle with radiused corners (fillets)

I am just copy pasting this in from a reply to a question on the heekscad user's list on google groups. This might be helpful to some.

Q: How do I create a rectangular cut-out, but with rounded

A: Doing a rectangle with fillets in heekscad is pretty easy- use the sketch toolbar and look for the icon that is square- the tooltip for this is 'Start drawing rectangles'. After you select this, a box with appear in the left hand column of HeeksCAD that is titled 'input'. There is an entry for 'radius'. It might not work for you on the first try, so fill it in with a radius value and attempt to draw your rectangle on the screen. If your rectangle doesn't have fillets, right click with the mouse 'stop drawing' and then try making the rectangle all over again- then your fillet/radius values should stick this time.

Sunday, May 22, 2011

Cutter Radius Compensation

I do a lot of milling in my home shop with my CNC Bridgeport mill. This machine has a Centroid M40 control on it that works pretty well. It has a feature called 'cutter radius compensation' in it that is standard on most modern controls. This allows for variations in cutter size or cutting conditions such that the machine operator (me) can make the toolpath run closer or further from the part profile. Cutter radius compensation is a subject that is covered pretty well in cnc programming textbooks, so I won't get into it much here, except to mention a few things about programming to 'part profile' or programming to 'cutter centerline'. Over 20 years ago, I was taught to program a part to 'part profile' like this, when using cutter radius comp:

Using this method, it's easy to look at a blueprint and just write the program by hand. You can just enter the end points and center points of lines and radius' and add a G41 (or G42) to your code. Once the program is done,it's pretty intuitive to change the diameter value in the control to the actual diameter of the cutter and get a reasonable part milled. If your end mill is .499 inches in diameter, just enter that as the D value in your control. If you want to make the part a bit bigger all around, enter the value as .501 and 'trick' the control into moving the path away from the part profile. With just a little simple math, done in your head, it's easy to manipulate the size of the part.

After moving across the country, to the west coast, I was taught a different way of using cutter radius compensation. A part programmer can use a CAM system to make the cutter path the radius value of the cutter away from the part profile and then use very small values in the D value of the control to manipulate the size of the part.

The cutter value can be .000" to be 'on the line' and you can change it by .001" or -.001" to manipulate the part profile.
I guess you could call this the 'West Coast' method. Nowadays, I am using this method with my home shop mill. I've just gotten used to it. I'm using my Centroid post processor with HeeksCNC and things work well for this. In the post, there is a bit of code that adds a lead in line to the roll on radius. This is needed to give the control a bit of distance to move the cutter before it reaches an arc, while doing the cutter compensation. If I don't have a straight line on the first line of a crc move, the control gives an error. It works the same way on the lead out line just after the roll off radius. I don't think EMC2 works this way- I think you can start with a roll on radius with a crc command, without getting an error. This seems to be an exception in the cnc control world though. Most commercial controls expect a straight line.