How RapCAD will do CAM.

The intention of RapCAD is to provide a programmers IDE that will allow the user to not only model their ideas, but also prototype and manufacture those ideas. Initially the focus is to support additive machines like Reprap and Makerbot. However maybe people will want to use it one day for controlling subtractive machines such as CNC routers, or Laser cutters. To support this I wanted to add as much flexibility as I could to the process of converting the description of the model into GCODE instructions that will create the model.

The idea is to use a special type of RapCAD script called an .rcam script that will perform the slicing dicing and generate paths that will be used by the GCODE generation code.

/* Manufacture module called by RapCAD.
* RapCAD will measure the bounds of the
* final model and pass the model to the
* manufacture module. The size of the
* model is made available via the $bounds
* vector. The manufacture module will be
* called for each layer, the output should
* be a 2D path.
*/
module manufacture(){
   echo("Printing object of size: ",$bounds);
   echo("Printing layer: ",$layer," of ",layers());
   infill(0.4) {
     inset(0.4) {
      slice(h=0.4,cut=$layer*0.4) {
       child(0);
      }
     }
   }
}

/* Layers function called by RapCAD.
* RapCAD will call this function to determine
* the number of layers in the model
*/
function layers() = $bounds.z/0.4;

Apart from the file name extention this script is only different from a standard RapCAD script by the definition of a module which must be called manufacture(), and a function which must be called layers(). The idea is that RapCAD will have all the modules needed for turning a primitive into a set of paths. The paths will then be sent to the GCODE generation routines. The most important module needed for turning a primitive into a path is the offset() module. In Fused Filament Fabrication, we have to shrink the shape by half the thickness of the filament, so that when the model is constructed it fills out to the correct size. A more obvious module is the slice() module, which is responsible for turning the three dimensional form into the two dimensional slices that are build up on top of each other during the printing process. In addition to others there will be an infill() module that given a two dimensional offset polygon will turn it into path roads ready for conversion to GCODE.

When RapCAD is asked to generate GCODE for the given design it first compiles and renders the description into a primitive and adds the result to a cache. The bounding box of the primitive is calculated and then the layers() function within the .rcam script is called to determine how many manufacturing cycles will need to be made. Then the manufacture module is called for each cycle, each time passing the full cached primitive and an incremented value accessible via the $layer variable.

RapCAD will come installed with a standard .rcam script designed for a reprap machine, but I hope that by giving people the flexibility to tweak the scripts, new and better ones will be written.

That’s the plan, now I just have to implement it!


As promised there is a new release of RapCAD available. This months release of RapCAD can be installed by following the instructions on the new download page

For those who want to know what has been added please see the release notes

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s