Laser cutter-specific tools?

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
peepsalot
Posts: 50
Joined: Sun Nov 13, 2011 9:44 pm

Laser cutter-specific tools?

Post by peepsalot »

Would tools for slicing models into laser-cuttable pieces be considered part of the CAM module or is it intended strictly for milling?

Here is a short demo of Autodesk 123D Make: http://www.youtube.com/watch?feature=pl ... o5TxtKLmjM

It shows a couple different laser cutter friendly ways of breaking down a model:
1) A simple set of stacked layers where each layer is attached to the next.
2) 2 sets of orthogonal layers with spacing in between and slotting to hold them together.

As far as I know there are not currently any tools in FreeCAD for doing either such thing? If this were developed would this sort of tool be considered part of CAM module?

I am playing around with Python scripts and Part.slice methods right now to see what kind of results I can get, slicing objects at arbitrary angles.

Code: Select all

import Part
import sys
from FreeCAD import Base

shape=Part.makeTorus(10,5,Base.Vector(0,0,0),Base.Vector(0,0,1))

def frange(start, end, step):
    i = 0
    x = start
    while x < end:
        yield x
        i += 1
        x = start + i * step

class SlicedShape:
    def __init__(self, shape, spacing=0.2, normal=Base.Vector(0,0,1)):
        self.shape = shape
        self.spacing = spacing
        self.normal = Base.Vector(normal)
        self.normal.normalize()
        self.slices = None

    def render(self):
        bb = self.shape.BoundBox
        points = [
            Base.Vector(bb.XMin,bb.YMin,bb.ZMin), 
            Base.Vector(bb.XMin,bb.YMin,bb.ZMax),
            Base.Vector(bb.XMin,bb.YMax,bb.ZMin),
            Base.Vector(bb.XMin,bb.YMax,bb.ZMax),
            Base.Vector(bb.XMax,bb.YMin,bb.ZMin),
            Base.Vector(bb.XMax,bb.YMin,bb.ZMax),
            Base.Vector(bb.XMax,bb.YMax,bb.ZMin),
            Base.Vector(bb.XMax,bb.YMax,bb.ZMax)
        ]
        dmax = sys.float_info.min
        dmin = sys.float_info.max
        origin = Base.Vector(0,0,0)
        for point in points:
            d = point.distanceToPlane(origin, self.normal)
            if d > dmax:
                dmaxPoint = point
                dmax = d
            if d < dmin:
                dminPoint = point
                dmin = d
        
        print "Bounds x1:%f y1:%f z1:%f x2:%f y2:%f z2:%f" % (bb.XMin, bb.YMin, bb.ZMin, bb.XMax, bb.YMax, bb.ZMax)
        print "Min: %f, Max: %f" % (dmin, dmax)

        # display the max and min point being used
        Part.show(Part.makeSphere(0.1, dmaxPoint))
        Part.show(Part.makeSphere(0.1, dminPoint))

        # display the line over which the slicing plane will iterate
        n = self.normal
        maxPoint = (n.x * dmax, n.y * dmax, n.z * dmax)
        minPoint = (n.x * dmin, n.y * dmin, n.z * dmin)
        Part.show(Part.makeLine(minPoint, maxPoint))
        
        if self.slices is not None:
            #TODO remove old slices if some already displayed
            pass

        # redundant slicing to print which offsets are returning wires or not
        for offset in frange(dmin, dmax, self.spacing):
            slice = self.shape.slice(self.normal, offset)
            print offset, slice
        
        # slice for display
        slices = self.shape.slices(self.normal, [x for x in frange(dmin, dmax, self.spacing)])
        Part.show(slices)
        self.slices = slices


s = SlicedShape(shape, normal=Base.Vector(0, 1, 1))
Part.show(shape)
s.render()

The resulting slices are missing some bits:
Image

Seems like there are some bugs in the Part.slice method?
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Laser cutter-specific tools?

Post by sliptonic »

I'm interested in this too. I don't completely understand how the eventual CAM workbench will work but here's a couple random thoughts:

From the video, it's like there's two things going on. One is just an arbitrary slicing, similar to your script. I'd imagine that this would be a special kind of Tool Path Generator (TPG). In my mind, a TPG should reference a model and store elements selected from the model for use generating the tool path. In milling for example, I'd pick a model to be milled, then select an edge/wire which will be the outer profile. The TPG should store the identification of both the model and the selection.

In your example, I'd pick the model to slice and set the slicing parameters. The TPG would store the parameters, slice the model and spit out a cut path for each one. But what if I only want to generate a tool path for one of the slices? I think the TPG needs to store the selection as well before the user hits the 'go' button to generate gcode.

From the video, the other example is more complex and I'm less sure belongs in the CAM workbench. The model is sliced in multiple directions, then laser cut, and assembled. the interaction between the slices to allow assembly (ie slots, bolt holes, tabs, etc) requires special design consideration and potentially alters the original model. That, to me, is a design challenge and probably belongs elsewhere though I'd love to see it in FreeCAD.
mrlukeparry
Posts: 655
Joined: Fri Jul 22, 2011 8:37 pm
Contact:

Re: Laser cutter-specific tools?

Post by mrlukeparry »

Even though it's proprietary software in that video, arguably it is pretty impressive result.

I think such program behaviour would honestly be best suited to a separate module, that extends upon the cam module as an optional dependency. For example, some users may want to cut out the parts using cardboard and an old fashioned pair of scissors. I took a while to find the actual name of this process - 'slice-forms'
david-nicholls
Posts: 12
Joined: Thu Jun 06, 2013 12:16 am

Re: Laser cutter-specific tools?

Post by david-nicholls »

This has similarities to a water-line type of machining. It's not quite the same but it's close. I wonder if a water-line tool-path generating module could accept 'settings' that allowed GCode to be generated for a single layer.
Post Reply