/Voxel2GCode

🕸 Transform geometric objects and voxel-based models into 3D-printable G-code instructions.

Primary LanguageC#MIT LicenseMIT

Voxel2GCode

A set of workflows to transform geometric objects and voxel-based models into 3D-printable G-code instructions.

Material Gradients with Monolith

Voxel2GCode is a project which aims for a flexible, customizable workflow for 3D printing, which started as part of the Material Gradients with Monolith project by Nono Martínez Alonso while working with the Autodesk Generative Design Group, during the summer of 2016. The project facilitates the generation of custom printing and slicing workflows, in an effort to simplify the delivery of instructions to 3D printers and the fabrication of artifacts from geometric objects and voxel-based models with low cost multi-material 3D printers.

Tweet this.

In a nutshell, Voxel2GCode provides five tools:

  • Voxel2GCodeCore as a standalone .NET library.
  • Voxel2GCodeRhinoCommon for scripting with C# using RhinoCommon.
  • Voxel2GCodeGH as a Grasshopper for Rhino plugin.
  • Voxel2GCodeDesignScript for scripting with C# using DesignScript.
  • Voxel2GCodeDynamo as a Dynamo package.

Download

  • Voxel2GCode.zip
  • The voxel utilities of V2G require you to install Monolith, everything else should work fine without it.

Material Gradients with Monolith

Table of Contents

Installation

Voxel2GCode for Grasshopper and RhinoCommon

  • Copy and paste all files inside the Voxel2GCode for Grasshopper into your Grasshopper components folder -- accessible via Grasshopper > File > Special Folders > Components Folder.
  • (In case you want to use the voxel components you'd have to install Monolith.)

Voxel2GCode for Dynamo and DesignScript

  • Open a new Dynamo document.
  • Under the nodes tab, click on Import, and select the Voxel2GCode for Dynamo.dll library.
  • (In case you want to use the voxel components you'd have to install Monolith.)

Voxel2GCodeCore.dll

  • You can use the Voxel2GCodeCore.dll library, for instance, as a reference in your C# project, or to script inside Grasshopper components.
  • (In case you want to use the voxel components you'd have to install Monolith.)

Reference

Voxel2GCodeCore

A .NET library to write G-code instructions from geometric objects.

  • V2GModel
  • V2GPath
  • V2GSettings
  • V2GSlice
  • V2GState

Primitives

  • V2GPoint
  • V2GLine
  • V2GCurve
  • V2GVoxelPoint

Printables

Geometric objects augmented with printing metadata.

  • V2GPrintable
  • V2GPrintPosition
  • V2GPrintPolyline

Instructions

  • V2GInstruction
  • V2GMovement
  • V2GPrintSegment

Utilities

  • V2GGeometry
  • V2GMath
  • V2GPrint
  • V2GVoxel

Voxel2GCodeRhinoCommon

A .NET library for RhinoCommon-specific functions of Voxel2GCode. It subclasses and expands classes of the Core library to use specific RhinoCommon functions.

  • V2GRhinoCurve
  • V2GRhinoGeometry

Voxel2GCodeGH

A Grasshopper for Rhino plugin.

G-code

  • Construct PrintPoint
  • Construct PrintPolyline
  • Construct Printer
  • Construct Printing Settings
  • Construct Printer
  • PrintingBoundaries (TODO)
  • Export G-code (TODO)
  • Extract PrintPolylineData

Slicer

  • Sort Curves
  • Get Bounding Frames
  • Get Slice Planes

Voxel

  • Construct VoxelPoint
  • Get VoxelCurvePoints

Implementation of Voxel2GCodeLib for Grasshopper.

Voxel2GCodeDesignScript

A .NET library for DesignScript-specific functions of Voxel2GCode.

  • V2GDesignScriptCurve
  • V2GDesignScriptGeometry

Voxel2GCodeDynamo

A ZeroTouch Dynamo package.

  • PrintPoint
  • PrintPolyline
  • PrintPolylineData
  • Printer
  • PrintSettings
  • Export
     
  • CurveSort
  • CurveSinusoidalPoints

Basic Usage

Here are a few examples on how to use the library for scripting, with Grasshopper for Rhino, and with Dynamo. More in detail examples are being developed.

Voxel2GCodeCore

Printing A Polyline

// Create a printer
V2GState printer = new V2GState();

// Create a printable model
V2GModel model = new V2GModel();

// Create a list of points to hold positions
List<V2GPoint> positions = new List<V2GPoint>();

// Add positions
positions.Add(new V2GPoint(25.0, 40.0, 0.0));
positions.Add(new V2GPoint(30.0, 45.0, 0.0));
positions.Add(new V2GPoint(35.0, 40.0, 0.0));

// Create a printable polyline
V2GPrintPolyline printPolyline = new V2GPrintPolyline();
foreach(V2GPoint position in positions) {
  Print(position.ToString() + " " + position.X);
  printPolyline.AddPrintPosition(position);
}

// Append the printable polylines as paths to the model
model.AppendAsPath(printPolyline);

// Create a StringBuilder to store G-code
System.Text.StringBuilder sb = new System.Text.StringBuilder();
model.GenerateGCode(sb, printer);

// Create a string with G-code
string GCode = sb.ToString();

Create a Printer with Custom Settings

// Create a printer
V2GState printer = new V2GState();

// Create printing settings
V2GSettings settings = new V2GSettings();

// Override some parameters
settings.T0Temperature = 220.0;
settings.BedTemperature = 80.0;
settings.ZOffset = 0.5;
settings.Retraction_Length = 0.3;

// Attach the settings to the printer
printer.SetSettings(settings);

Voxel2GCodeGH

Printing A Polyline With Custom Settings

Voxel2GCodeGH Polyline Workflow.

Extract Gradient and Contour Curves From A Monolith Vol File

Voxel2GCodeGH Voxel Workflow.

Lemon — Contour and Gradient Curves with Voxel2GCode

Voxel2GCodeDynamo

Printing A PolyCurve

Voxel2GCodeDynamo PolyCurve Workflow.

Sample Files

Grasshopper and Dynamo sample files will be posted soon.

Acknowledgements

The development of Voxel2GCode was sponsored by Autodesk Inc, as part of a summer research residency project in Boston, 2016. Please take a look at the detailed list of acknowledgments.

Voxel2GCode was created and is maintained by Nono Martínez Alonso.

License

Voxel2GCode is licensed under the MIT license.

Me

I'm Nono Martínez Alonso (nono.ma), a computational designer and architect with a penchant for simplicity.
I tweet at @nonoesp and write at Getting Simple. If you use Voxel2GCode, I would love to hear about it. Thanks!

Contributing

In its early stages, Voxel2GCode sets a base structure for growth and flexibility. Any kind of contribution or collaboration is welcome. If you are interested in playing around with this library shoot me a tweet.