You are on page 1of 21

Introduction to Silkworm

Silkworm is a plugin that translates Grasshopper and Rhino geometry into GCode for 3d printing. Silkworm
allows for the complete and intuitive manipulation of the printer GCode, enabling novel printed material
properties to be specified by non-solid geometry and techniques of digital crafting.

Project Silkworm is an open project to develop the concept of digital craft via the resources of open source
3d printing technology, initiated by Adam Holloway, Arthur Mamou-Mani and Karl Kjelstrup-Johnson. The
revolution of 3D printing is seeing a rise in novel methodologies of material design communication, from
concept through to construction. Now additive processes can be manipulated through data driven logics
programmed directly by the designer and Silkworm offers the designer a vocabulary to choreograph these
additive processes. While conventional 3d printer software translates solid geometry into GCode for print-
ing by slicing it into planar layers, Silkworm aims to extend this process conceptually to include non-solid
geometry, i.e. surfaces, curves and points and further.

License

It is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


Download at http://projectsilkworm.com/download

2
3
1. TOOLS/ CONCEPTS

1.1. What is RepRap?


“RepRap is humanity’s first general-purpose self-replicating manufactur machine. RepRap takes the form of
a free desktop 3D printer capable of printing plastic objects. “ - Reprap.org 2012

4
Rep Rap’s low cost, open source and open hardware design makes it easily the most accessible form of
3d printing technology, and by basing Silkworm initially on this technology it is hoped that digital craft will
become also an accessible design process.

http://www.reprap.org/wiki/RepRap

1.2 What is GCode?

G-code is the common name for the most widely used computer numerical control (CNC)programming
language, which has many implementations. Used mainly in automation, it is part of computer-aided engi-

G1 F144000 Z0
G1 F360 E1.2
G92 E0
G1 F60 X137.02 Y62.98 Z0
E-72.89
G1 F60 X137.02 Y137.02 Z0
E-146.93
G1 F60 X62.98 Y137.02 Z0
E-220.97
Example G-Code: G1 F60 X62.98 Y64.13 Z0
E-293.87

G1 X5 Y3 Z0 G92 E0
G1 F360 E-1
G1 F144000 Z0.3
G92 E0
G1 F144000 X64.13Y62.32
G1 F144000 Z0

PtB (5,3,0) G1 F360 E1.2


G92 E0
G1 F60 X137.68 Y62.32 Z0

Toolhead E-73.55
G1 F60 X137.68 Y137.68 Z0
E-148.91
G1 F60 X62.32 Y137.68 Z0
E-224.27
G1 F60 X62.32 Y64.13 Z0
E-297.83
G92 E0

PtA (10,4,7) G1 F360 E-1


G1 F144000 Z0.6
G92 E0
G1 F144000 X64.13Y64.13
G1 F144000 Z0.3
G1 F360 E1.2
G92 E0
G1 F60 X135.87 Y64.13 Z0.3
E-71.74
G1 F60 X135.87 Y135.87 Z0.3
E-143.48
G1 F60 X64.13 Y135.87 Z0.3

neering. G-code is sometimes called G programming language.


In fundamental terms, G-code is a language in which people tell computerized machine tools what to make
and how to make it. The “what” and “how” are mostly defined by instructions on where to move to, how
fast to move, and through what path to move.
For a list of Rep Rap appropriate G-Code commands please see the Appendices at the back of the manual.

5
1.2.1 Digital information to physical object

Traditional methodologies of 3D printing rely on software that slices the trimeric form into layers based
upon deposition layer thicknesses and generated tool-paths based on solid form shells and infills.
Silkworm is not limited to horizontal planar slices, but can operate with 3d non-solid geometry.

1.3 Why we are creating a Grasshopper plugin for this?

The revolution of 3D printing will see rise to novel methodologies of design communication in material
from concept through to construction. Additive processes can be manipulated through data driven logics
programmed directly by the designer. Project Silkworm offers the designer a vocabulary to choreograph
additive processes. Grasshopper as a graphical language is an intuitive way of creating a vocabulary to cho-
reograph additive processes to feedback into a generative design process.

1.4 The concept of digital crafting


Digital Crafting is positioned between design space and production space through the manipulation of ma-
terial technologies in its literal determinate fabrication. It relates the design field’s current preoccupation
with digital production back to an earlier idea of craftsmanship in the material production of the object. By
manipulating G-Code to encode materiality in the printed object, the designer is able to experiment with
novel object material properties as well geometric properties. The idea of crafting is where the process of
design feeds back into the design itself.

6
7
2. THE WORKFLOW

2.2. The Components



2.2.1 Settings

This component allows for the loading of custom GCode generation setting from an external
file. This component is included to allow users to use settings that work with their printer
which they may already have developed with another GCode generation program (i.e. Slic3r).
This component is activated by double clicking.

8
2.2.2 Silkworm Slicer

This component translates solid geometry from Grasshopper into regions and paths that can
be further manipulated through the Silkworm workflow. Solids can be sliced by any plane or
series of planes, but if a plane isn’t horizontal further methods must defined to instruct the
printer how to build the slice.

Inputs
Settings - External configuration file for print settings
Solids - Input open or closed Breps to be sliced. (Support for meshes to be developed)
Plane(s) - Multiple or single plane to slice solid with. If you use planes that are not horizontal it is up to you
to define how the printer will build these.
Layer - For a single plane input. This sets the perpendicular offset to the plane, replicating the plane as far
as the bounding box of the object
Shell - In plane shell thickness

Outputs
Closed Regions - Lists of Planar Breps that represent the slices of the object. DIvided by branch depending
on whether they are 0 - a complete slice, 1 - a perimeter region, 2 - an infill region (bridge and overhang
detection to be developed)
Open Regions - Lists of Planar Curves that represent the slices of an open object

9
2.2.3 Silkworm Region Filler

This component creates paths from planar and non-planar surfaces.based on custom or pre-
defined fill patterns and methods.

Inputs
Settings - External configuration file for print settings
Regions - Input planar Breps to be infilled with a curve pattern.
Infill Type - Choose between 0 - Spiral infill, 1 - Hatch Infill (Futher patterning procedures to be developed)
Infill Density -
Infill Rotation -

Outputs
Infill - Outputs the infill pattern for each region as a list of polyline curves.

10
2.2.x Silkworm Segmenter

This component converts any curve into a list of line segments based on curvature, using
custom or default settings. This component basically exposes the Rhinocommon method for
Curve.ToPolyline().

Inputs
Curves - List of curves to segment based on custom settings.
Seg - If mainSegmentCount <= 0, then both subSegmentCount and mainSegmentCount are ignored. If
mainSegmentCount > 0, then subSegmentCount must be >= 1. In this case the nurb will be broken into main-
SegmentCount equally spaced chords. If needed, each of these chords can be split into as many subSeg-
mentCount sub-parts if the subdivision is necessary for the mesh to meet the other meshing constraints. In
particular, if subSegmentCount = 0, then the curve is broken into mainSegmentCount pieces and no further
testing is performed.
subSeg - An amount of subsegments.
maxAngle - ( 0 to pi ) Maximum angle (in radians) between unit tangents at adjacent vertices.
maxChord - Maximum permitted value of (distance chord midpoint to curve) / (length of chord).
maxAspect - If maxAspectRatio < 1.0, the parameter is ignored. If 1 <= maxAspectRatio < sqrt(2), it is
treated as if maxAspectRatio = sqrt(2). This parameter controls the maximum permitted value of (length of
longest chord) / (length of shortest chord).
tol - If tolerance = 0, the parameter is ignored. This parameter controls the maximum permitted value of the
distance from the curve to the polyline.
minEdge - The minimum permitted edge length.
maxEdge - If maxEdgeLength = 0, the parameter is ignored. This parameter controls the maximum permit-
ted edge length.
SPt? - If true the starting point of the curve is added to the polyline. If false the starting point of the curve is
not added to the polyline.

Outputs
Pline - A polyline for each curve inputted

11
2.2.x Silkworm Movement

This component defines an extruding Silkworm Movement composed of a list of Silkworm


Lines, with associated values for Extrusion Speed, Flow and Temperature. A Movement can
include a Delimiter at the end and/or beginning.

Movement Command
Feedrate (Speed)
Coordinates
Extrusion (Flow)

G1 F100 X15 Y12 E0.02 G1 F200 X32 Y20 E0.01 G1 F300 X40 Y19 E0.005

PtD (40,19,0)
PtC (32,20,0)
PtB (15,12,0)

PtA (5,3,0)

Inputs
Geometry - Geometry that can describe a tool path. These can be either a List of Line, a single Curve or
even a single Point. If a Point is defined, no values are accepted for speed and flow, they are determined by
the delimiter.
Speed - A corresponding list of speed values for each segment of the movement, or a speed override for the
whole movement
Flow - A corresponding list of flow values for each segment of the movement, or a flow override for the
whole movement
Delimiter - A delimiter for the start/ end or start and end of movement.

Outputs
Movements - A complete (or incomplete) Silkworm Movement. An incomplete Movement is one in which
not all of the attributes (Speed, Flow or Delimiter) have been supplied. The Movement will automatically be
completed by the Generator component using the specified default settings.

12
2.2.x.1 Silkworm Delimiter
Example: Creates stringing from end of Movement to next Movement

A Delimiter is a non-extruding movement that comes at the beginning or end of a extruding


Silkworm Movement. A Delimiter in Silkworm can be defined by a series of relative vectors
and associated values for feedrate and chamber pressure.

Start of Extruding Movement End of Extruding Movement

Example: Creates clean non-extruding Movement at end

Inputs
Start Vec - This specifies what vector the delimiting movement should approach the extruding movement.
Start Spd - This specifies the feedrate of the starting delimiter
Start Prs - This specifices the pressure of the starting delimiter (the pressure parameter represents the same
GCode value as flow in the Movement component, here it is renamed pressure because, the actual pressure
of the extrusion chamber is based on the previous movement’s end delimiter pressure value, and this move-
ment’s start delimiter pressure value).
EndVec - This specifies what vector the delimiting movement leaves extruding movement at.
EndSpd - This specifices the feedrate of the end delimiter
EndPrs - This specificies the pressure of the end delimiter (see above)
Travel - This specificies the travel speed at which printer will move between extruding movements.

Outputs
Delimiters - A collection of delimiters for use with the Movement component.

13
2.2.x Silkworm Generator

This component takes as input any kind of Grasshopper geometry and/ or Silkworm Move-
ments. It slices, fills and organises the input based on the default Settings, and outputs GCode
and a Silkworm Model that can be visualised via the Silkworm Viewer.

Inputs
Settings - This input allows for the addition of a custom external settings file.
Geo - This input accepts any kind of Rhino Geometry and any Silkworm Movement, even if it is incomplete.
Sort - This tells the generator how the input should be sorted: 1 - the input is unsorted, please sort it com-
pletely 2 - the input is sorted in X and Y, please sort by Z level 3 - the input is completely sorted, do nothing.

Outputs
GCode - Output GCode as a list of string, for plugging into the Print component, or using through an exter-
nal graphical interface
SWModel - Outputs a Silkworm Model for use in the Viewer component.

14
2.2.x Silkworm Viewer

This component allows for the visualisation of a Silkworm Model. It allows the user to view
specific information about the Movements and Delimiters in the Model and the predicted
physical attributes of the material print. At the moment the viewer will show you the extrud-
ing movement as colours relating to their relative speed and thickness relating to their relative flow values,
and non-extruding movements as grey connecting lines with arrows describing the delimiters.

Inputs
SWModel - Accepts as input a Silkworm Model or a complete Silkworm Movement.
Start - Specify where the Model preview should start.
End - Specify where the Model preview should start.
Display Values - Turn on or off additional display helpers.

15
APPENDICES

16
An Index of common G and M codes for Rep Rap machines
G-Codes

G0: Rapid move

Example: G0 X12

In this case move rapidly to X = 12 mm. In fact, the RepRap firmware uses exactly the same code for rapid
as it uses for controlled moves (see G1 below), as - for the RepRap machine - this is just as efficient as not
doing so. (The distinction comes from some old machine tools that used to move faster if the axes were not
driven in a straight line. For them G0 allowed any movement in space to get to the destination as fast as
possible.)

G1: Controlled move

Example: G1 X90.6 Y13.8 E22.4

Go in a straight line from the current (X, Y) point to the point (90.6, 13.8), extruding material as the move
happens from the current extruded length to a length of 22.4 mm.
RepRap does subtle things with feedrates. Thus:
G1 F1500
G1 X90.6 Y13.8 E22.4
Will set a feedrate of 1500 mm/minute, then do the move described above at that feedrate. But
G1 F1500
G1 X90.6 Y13.8 E22.4 F3000
Will set a feedrate of 1500 mm/minute, then do the move described above accelerating to a feedrate of
3000 mm/minute as it does so. The extrusion will accelerate along with the X, Y movement so everything
stays synchronized.
RepRap thus treats feedrate as simply another variable (like X, Y, Z, and E) to be linearly interpolated. This
gives complete control over accelerations and decelerations in a way that ensures that everything moves
together and the right volume of material is extruded at all points.
Note: not every firmware implements this, e.g. the current Marlin will use the new feedrate from the be-
ginning of the move and not change it.
The first example shows how to get a constant-speed movement. The second how to accelerate or deceler-
ate. Thus
G1 F1500
G1 X90.6 Y13.8 E22.4 F3000
G1 X80 Y20 E36 F1500
Will do the first movement accelerating as before, and the second decelerating from 3000 mm/minute back
to 1500 mm/minute.
To reverse the extruder by a given amount (for example to reduce its internal pressure while it does an
in-air movement so that it doesn’t dribble) simply use G1 to send an E value that is less than the currently
extruded length.

G28: Move to Origin

Example: G28

This causes the RepRap machine to move back to its X, Y and Z zero endstops, a process known as “hom-
ing”. It does so accelerating, so as to get there fast. But when it arrives it backs off by 1 mm in each direc-
tion slowly, then moves back slowly to the stop. This ensures more accurate positioning.
If you add coordinates, then just the axes with coordinates specified will be zeroed. Thus
17
G28 X0 Y72.3
will zero the X and Y axes, but not Z. The actual coordinate values are ignored.

G4: Dwell

Example: G4 P200
In this case sit still doing nothing for 200 milliseconds. During delays the state of the machine (for example
the temperatures of its extruders) will still be preserved and controlled.

G10: Head Offset

Example: G10 P3 X17.8 Y-19.3 Z0.0 R140 S205


This sets the offset for extrude head 3 (from the P3) to the X and Y values specified. You can put a non-zero
Z value in as well, but this is usually a bad idea unless the heads are loaded and unloaded by some sort of
head changer. When all the heads are in the machine at once they should all be set to the same Z height.
Remember that any parameter that you don’t specify will automatically be set to the last value for that
parameter. That usually means that you want explicitly to set Z0.0.
The R value is the standby temperature in oC that will be used for the tool, and the S value is its operating
temperature. If you don’t want the head to be at a different temperature when not in use, set both values
the same. See the T code (select tool) below.
The NIST G-code standard mentions an additional L parameter, which is ignored.
This command is subject to discussion.

G20: Set Units to Inches

Example: G20
Units from now on are in inches.

G21: Set Units to Millimeters

Example: G21
Units from now on are in millimeters. (This is the RepRap default.)

G90: Set to Absolute Positioning

Example: G90
All coordinates from now on are absolute relative to the origin of the machine. (This is the RepRap default.)

G91: Set to Relative Positioning

Example: G91
All coordinates from now on are relative to the last position.

G92: Set Position

Example: G92 X10 E90


Allows programming of absolute zero point, by reseting the current position to the values specified. This
would set the machine’s X coordinate to 10, and the extrude coordinate to 90. No physical motion will oc-
cur.
A G92 without coordinates will reset all axes to zero.

18
M-Codes

M0: Stop

Example: M0
The RepRap machine finishes any moves left in its buffer, then shuts down. All motors and heaters are
turned off. It can be started again by pressing the reset button on the master microcontroller. See also M1,
M112.

M1: Sleep

Example: M1
The RepRap machine finishes any moves left in its buffer, then shuts down. All motors and heaters are
turned off. It can still be sent G and M codes, the first of which will wake it up again. See also M0, M112.

M17: Enable/Power all stepper motors

M18: Disable all stepper motors

Example: M18
Disables stepper motors and allows axis to move ‘freely.’
- Is this not the same as M84? -- MrAlvin 05:53, 20 September 2012 (UTC)

M20: List SD card

Example: M20
All files in the root folder of the SD card are listed to the serial port. This results in a line like:
ok Files: {SQUARE.G,SQCOM.G,}
The trailing comma is optional. Note that file names are returned in upper case, but - when sent to the M23
command (below) they must be in lower case. This seems to be a function of the SD software. Go figure...

M21: Initialize SD card

Example: M21
The SD card is initialized. If an SD card is loaded when the machine is switched on, this will happen by de-
fault. SD card must be initialized for the other SD functions to work.

M22: Release SD card

Example: M22
SD card is released and can be physically removed.

M23: Select SD file

Example: M23 filename.gco


The file specified as filename.gco (8.3 naming convention is supported) is selected ready for printing.

M24: Start/resume SD print

Example: M24
The machine prints from the file selected with the M23 command.

M25: Pause SD print

19
Example: M25
The machine pause printing at the current position within the file selected with the M23 command.

M26: Set SD position

Example: M26
Set SD position in bytes (M26 S12345).

M27: Report SD print status

Example: M27
Report SD print status.

M28: Begin write to SD card

Example: M28 filename.gco


File specified by filename.gco is created (or overwritten if it exists) on the SD card and all subsequent com-
mands sent to the machine are written to that file.

M29: Stop writing to SD card

Example: M29 filename.gco


File opened by M28 command is closed, and all subsequent commands sent to the machine are executed
as normal.

M40: Eject

If your RepRap machine can eject the parts it has built off the bed, this command executes the eject cycle.
This usually involves cooling the bed and then performing a sequence of movements that remove the
printed parts from it. The X, Y and Z position of the machine at the end of this cycle are undefined (though
they can be found out using the M114 command, q.v.).
See also M240 and M241 below.

M41: Loop

Example: M41
If the RepRap machine was building a file from its own memory such as a local SD card (as opposed to a file
being transmitted to it from a host computer) this goes back to the beginning of the file and runs it again.
So, for example, if your RepRap is capable of ejecting parts from its build bed then you can set it printing in
a loop and it will run and run. Use with caution - the only things that will stop it are:
When you press the reset button,
When the build material runs out (if your RepRap is set up to detect this), and
When there’s an error (such as a heater failure).

20
Additional Links
http://reprap.org/wiki/G-code
http://replicat.org/primer
http://replicat.org/gcodes
http://replicat.org/mcodes

21

You might also like