Generating G Code for the D3D Universal Plotter with Open Source Software

From Open Source Ecology
Jump to: navigation, search

The purpose of this page is to document several specific workflows of generating GCode for the D3D Universal Plotter.

Warning: This wiki is a work in progress and some of the instructions haven't been tested.

Note

  • The typical D3D Max build Volume is 6x6x6 inches (150x150x150 mm)
  • Some plugins may require installation, but OSE Linux 2 comes with gcodetools and gcodeplot

Working with images in Inkscape

Create a template

Plottertemplateforinkscape1.png

Follow these instructions to create a file you can use to start a plotter project.

  1. Open Inkscape.
  2. Go to File > Document Properties. It opens on the Page tab.
  3. For Custom size section, enter "150" into width and height fields, then press enter. Make sure the units are mm.
  4. Go to the metadata tab. Fill out information that can help you work with your file in the future.
  5. Go to the license tab. For OSE work, use CC Attribution Share Alike.
  6. Exit the screen.
  7. Save the file, name it "General_Plotter_Template.svg".
  8. Use the terminal to move it into the Templates folder.
    1. Open the terminal in the folder with your file use
      sudo mv General_Plotter_Template.svg /usr/share/inkscape/templates

Now you can use File > New from template to start a new project.

Use Inkscape to turn PNG to SVG, and from SVG generate GCode

See also Using Inkscape to Generate Gcode, Jessica Log According to a thread in the inkscape forum, issue of plotter repeating every curve twice is solved by using Pass by Pass option in the GCode panel.

Passbypass.png

PNG/JPEG to SVG

Simple line art

  1. Select PNG or JPEG
  2. Go to Path > Trace Bitmap
  3. Turn on Live Preview using the checkbox
  4. Adjust Brightness cutoff Threshold: until the image looks good to you
  5. Click OK
  6. Click and drag the image away- you'll see the JPEG. Delete the JPEG and bring back your trace

SVG to GCode

  1. Select all and go to Path > Object to Path
  2. Select all and go to Object > Ungroup. You may need to select all and ungroup multiple times.
  3. Save as 3-axis gcode plotter (*.gcode)
    1. See Gcodeplot Settings
  4. After saving your .gcode, open it in nc-viewer
  5. Add the following start code to the top of the file
G00 S1; endstops
G00 E0; no extrusion
G01 S1; endstops
G01 E0; no extrusion
G21; millimeters
G91 G0 F2100.0 Z4.000; pen park !!Zsafe
G90; absolute
G28 X; home
G28 Y; home
G28 Z; home
G29; autolevel - needs to be over +20 x
G90; absolute

SVG into DXF

  1. Select everything and go to Object > Ungroup
  2. With everything still selected, go to Path > Break Apart You should see boxy artifacts
  3. Save as DXF
  4. Uncheck boxes at the Desktop Cutting Plotter prompt and click OK

How to fill closed outlines with hatching

There are a couple of plugins that help with hatching.

See KM-Laser plugin- https://github.com/KnoxMakers/KM-Laser

  1. Open plotter template
  2. Import bitmap image
  3. Use Trace Bitmap
  4. Select all clear fill, add stroke
  5. Go to Extensions > KM LASER > GENERATE: HATCH FILL
  6. Save as gcode.

Axidraw plugin- https://github.com/evil-mad/AxiDraw/ WARNING: If you install Axidraw plugins DO NOT replace hershey.py and the hershey svg files. Axidraw's hershey text isn't working, and it will break the Render > Hershey Text extension pre-installed in Inkscape.

  1. Open plotter template
  2. Import bitmap image
  3. Use Trace Bitmap
  4. Select all clearfill, add stroke
  5. Go to Extensions > AxiDraw Utilities > Hatchfill
  6. Go to Extensions > AxiDraw Utilities > Plot Optimization
  7. Save as gcode

How to render a bitmap image using tiled SVG Clones.

Render Bitmap Images using Tiled SVG Clones

  1. Open your general plotter template.
  2. Import a bitmap file.
  3. Add a layer above the one with your bitmap
  4. Use the circle tool to make a small circle, close to your drawing in its upper-right.
    1. Set the stroke and fill of the circle to undefined.
  5. Select the circle and go to Edit > Clone > Create Tiled Clones
  6. Go to the Trace tab and select Trace the drawing . . .
  7. Check all the boxes for the 3rd field
  8. Set the width and height fields to the dimensions of your drawing.
  9. Click Create.
  10. Save your file as SVG. This helps in case you mess up the next steps and need to start over
  11. You have your circles. Use the instructions for SVG to GCode to complete.

Old method

  1. Open your general plotter template.
  2. Use guides to bound the area where you want to add the address. Hint: You may need to temporarily change your units to inches in Document Properties, and zoom into 100%
  3. You can save this file as an envelope template, if you want.
  4. Use the Text tool to enter the address in the bounds.
  5. Follow instructions here: https://www.lifewire.com/inkscape-to-make-templates-cutting-machines-1701892
  6. Save your file as SVG. This helps in case you mess up the next steps and need to start over
  7. Use the instructions for SVG to GCode to complete.

How to create contour lines

  1. threshold image
  2. erode image
  3. line trace
  4. erode again
  5. repeat

Working with text in Inkscape

Install Fonts

See OSE_Fonts#How_to_Install_in_OSE_Linux

Install OSE Fonts, or for more fonts see Creative Commons and Open licenced fonts - [1] , [2] , [3] , [4]

How to create custom fonts

See [5]

How to generate stroke text

Stroke text is text that mimics handwriting. This is good for small text such as addressing a letter, or the inside of a greeting card.

  1. Go to Render > Hershey Text
  2. Insert your text into the field. You'll enter it one line at a time.

Real example pen plotted: Hersheytext.jpg

How to generate outline text

Outline text is text that is graphical in nature. This is good for big decorative text, or fancy fonts. This requires having an extension that provides hatchfill. AxiDraw and KM Laser are two extension sets which include hatchfill.

  1. Click and open the text tool.
  2. Type your desired text and make it the desired size and other features. You may want to save your file at this point, in case you want to make small edits to the text.
  3. Select the text and go to Path > Object to Path.
  4. Go to Object > Fill and stroke.
  5. Remove the fill. Add stroke.
  6. Select hatchfill from either AxiDraw Utilities or KM Laser.
  7. Edit the settings according to your preference.

Inkscape Applied Examples

How to address regular mailing envelopes

  • Most envelopes will probably be longer than the plotter bed, but since you only need to print a portion of the area, it's ok.
  • Before you get started, either look up common dimensions for an address window on an envelope or determine for your self the area on the envelope you want to print. In US, refer to USPS guidelines: https://pe.usps.com/text/dmm300/202.htm A Common #10 envelope is 4 1/8 inches high by 9 1/2 inches long.
  • Assume that when you print, you'll align the bottom left of the envelope with the bottom left of the plotter bed.
  1. Open your general plotter template.
  2. Use guides to bound the area where you want to add the address. Hint: You may need to temporarily change your units to inches in Document Properties, and zoom into 100%
  3. You can save this file as an envelope template, if you want.
  4. Go to Extensions > Render > Hershey text...
  5. Enter the first line of the address and click Apply.
  6. Place your text image where you want it
  7. Repeat until complete.
  8. Save as gcode.

See also Working with Text, Stroke Text instructions above.

How to create a greeting card

Instructions for making an OSE themed greeting card and envelope. Check out OSE Graphic Guidelines to use the latest. You'll learn how to work and layout text and images that can be plotted.

Common greeting card sizes (W x H):

  • 3.5 x 5 (postcard-like - doesn't fold)
  • 13cmx9.5cm (opens up to 19cm)(fold down)
  • 3.75cm x 5cm (opens up to 7.5cm) (folds open)

Make the card

  1. Open your general plotter template.
  2. Use the rectangle tool (F4) to create a rectangle that is the same size as your desired card, approximately where you want to print on the bed.
  3. Make sure your square is selected, then press shift + G, or go to Objects > Object to Guides. You can save this file as a template to use for future greeting cards
  4. Go to File > Import to fetch an image to use.
  5. Move your image where you want and add your text (See Outline Text or Stroke Text Instructions).
  6. Save your file as .SVG Just in case you mess up the next steps and need to start over
  7. Use the instructions in SVG to GCode to complete.

Thanksgivingcard.png Seasonsgreetings3.png

Use Processing to create SVGs

Create a spirograph

  1. Download zip from https://github.com/rspt/processing-spirograph
  2. Extract, click the .pde file
  3. Edit the size to about 400 x 500 px, edit the stroke to about 3px.
  4. Run
  5. Move the mouse around to get different spirographs
  6. Click "s" to export to pdf (with svg)
  7. Import into Inkscape, Ungroup all (several times), convert object to path, make sure document properties have the right size, save as gcode

Create with SquiggleDraw

  1. Install Processing.
  2. Add controlP5 to your Sketchbook library.
  3. Download the SquiggleDraw zip from the repo and extract it where you want.
  4. Add images to SquiggleDraw-master/SquiggleDraw/data The images need easy, simple names you can remember. Don't use images that are too big- resize them first.
  5. Go to SquiggleDraw-master/SquiggleDraw and click SquiggleDraw.pde.
  6. Find the bit of code that says
     String imageName ='Rachel-Carson.jpg'
    and change it to the file name of the image you want to squiggledraw.
  7. Click the run button.
  8. Adjust settings as desired.

Sample actual print on D3D Universal 2:

Melaniesquiggles.jpg

Create a stippled file using StippleGen

OSE Linux 2 already includes Processing. See StippleGen for instructions on how to download and use Stipple Gen.

Example Stipplegen plotted

If there are details that you especially want captured by the stippling process, I recommend using the Burn and Dodge tools in the GIMP to create a sort of radical contour. That's how I made this grandfather's glasses appear when they otherwise woudn't have, I used the burn tool to darken the glasses. I also used the burn tool to emphasize the smile on the girl. You can also experiment using the levels tool, contrast/saturation and other photo editing techniques.

Other methods

DXF into GCode (with python)

See DXF_to_G-code_Conversion_Tutorial

Use Gimp to create stippling

https://wiki.evilmadscientist.com/Producing_a_stippled_image_with_Gimp

Create a signature

You can use this tool, which works in your browser: https://willowsystems.github.io/jSignature/#/demo/

See Also

D3D_Plotter_Log