You are on page 1of 8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

AnIntrotoGcodeandHowto
GenerateItUsingInkscape

Categories

Miscellaneous(28)

Projects(70)

3Dprinting(7)

Audio(2)

BeerBrewing(2)

formachines.Asanaturalcontinuationfromlastweek,werenowgoingtotalkabout

Clocks(2)

suchtoolpaths,calledGcode,andhowtogeneratethoseinInkscape.

CNC(7)

DrawingMachines
(12)

FScontroller(1)

GameShow
System(2)

Games(2)

Hydroponic
Gardening(5)

Installations(11)

Instruments(4)

Inverted

August12,2015

MadsAasvik

CNC,Misctutorials

Inlastweekspostwediscussedhowtocreatevectorgraphicsfrombitmapsin
Inkscape.Thethirdsuggestiononwhytodosuchathinginvolvedcreatingtoolpaths

WhatisGcode?
Gcodeisthemostwidelyusedprogramminglanguageforcontrollingindustrial
machinessuchasmills,lathesandcuttersaswellas3Dprinters.Gcodehasmany
dialectsorvariants,butmost(orall)adheretocertaincommonrules.

Pendulum(1)

ACNCmillinterpretingGcodeinrealtime

StructureandCommands
Eachnewline(calledblock)intheGcodecanberoughlyregardedasanewcommand.
Everywhereyoulookinthecodeyouwillmostlyseeletterswithnumbersbehindthem.
Theseletterscorrespondstodifferenttypesofcommands.Themostimportantonesare
arguablyG(usedinmostmovementcommands),M(miscellaneouscommands),X,Y
http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

LaserEngraver
(4)

Lasers(3)

Leds(9)

Longboard(3)

TeaDipping
Machine(1)

Tutorials(32)

3Dprinting
tutorials(3)

Arduinotutorials
1/8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

(8)

andZ(thelastthreeareusedtodefinepositionsintheX,Y,Zspace,absoluteor
incremental).Acompletelistofalloftheletterswithexplanationscanbefoundhere.A

listofthedifferentGandMcodescanbefoundhereandhere.

Electronics
tutorials(9)

Misctutorials(15)

Example
Atrivialexampleofacoupleofblockscanbe
G90G21
G00X1.1Y1.1Z1.1
G01Z1.0F100
G01X2.2Y3.3Z1.0F500

Newsletter
Getnewsdirectlyintoyour
inboxabouthowtobridgethe
gapbetweenIdeaandCreation!

Thefirstblockdoestwothingsandiskindofaverysimplesetupblock.G90isthe

Youcanalsofollowour
Instagramand/orfacebook
formoreawesomeness!

commandthatdefinesallcoordinatesasabsolutewithanoriginasareference.G21

FirstName:

definesallnumericalvaluesasmillimeters.
Thesecondblockmakesthemachinerunrapidlytoposition(1.1,1.1,1.1)intheXYZ
spacefromitscurrentposition.Howfastthismovementisdoneisdefinedinhardware.

Yourfirstname
Emailaddress:
Youremailaddress

ThethirdblockmovesthemachineintheZaxisto1witharateof100mm/min.
Thelastblockmovesthemachineinastraightlinetoposition(2.2,3.3)intheXYplane

SIGNUP

witharateof500mm/min.

AsnippetfromanactualGcodefile

GeneratingGcodeinInkscape
WritingGcodemanuallyformorethanasimplesquarewouldbepracticallysuicide,so
http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

2/8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

luckilywehaveprogramswhichdothisforus.

ImportantConsiderations!
WhengeneratingGcodethiswayitsimportanttoknowwhatkindofmachineyoure
generatingGcodeforandhowitinterpretsthecode.UsingInkscapetogenerateGcode
isNOTrecommendedwhenoperatingCNCmills,lathes,cuttersoranythingofthat
sort.Forthatitstoodangerous!Forthosekindofmachinesyoushouldusemore
professionalsoftware,suchasanythingfromVectric.However,ifyouvemadea
machineonyourownwhichneedsomekindofmotion,suchasadrawingmachineora
laserengraver,generatingGcodeinInkscapeisbothquickandeasy.

Gcodetools
Youllneedanextension(thatswhattheycallpluginsinInkscape)tobeablegenerate
GcodeinInkscape,andtheonlyonethatwereawareofwhichiscapableofdoingso
isGcodetools(yes,thisforumthreadistheclosestyoullgetanofficialpage).Itisfar
fromperfectandpoorlydocumented,butitdoesthejob.

Gcodetoolsmainfeaturesaccordingtothedeveloper

StepbystepTutorial(byexample)
Inthisexamplewewillgenerateatoolpathforourlaserengravertoengraveadrawing
ofadinosaur.ThewaythelaserengraverinterpretstheGcodeisthatitturnsonthe
laserwhenthevirtualZaxishasanegativevalueandoffwhenitszeroorpositive.

Preparations

http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

3/8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

FirstwefollowtheguidelinesonGcodetoolspagetoinstalltheextension.
Sincethedrawingofthedinosaurisaregularbitmapimageweneedtotracethe
bitmap.Readthisposttolearnhowtodothis.
Theobjectneedstobeinanownlayer(clickthelinktoseehowtouselayers).Justcut
pasteitintoanewonetobesure.
Wewanttohavecontrolofhowlargetheresultwillbeinreallife.Thereforewescale
theobjectsuchthatitisaslargeaswewantitinmillimeters(clickthepadlockiconor
holdctrldownanddragacornertolockproportions).Inthisexamplewewantittobe
maximum100mmineitheraxis.Also,wepositiontheobjectwherewewantit.We
wantittobeatleast10mmawayfromtheXandYaxes.

Scalingandpositioningourdinosaur

Ifweselecttheobject,wecanseeatthebottomoftheInkscapewindowhowmany
nodesthatexistalongthepath.Wehavearuleofthumbthatitshouldstaybelow3000
(or10000withonlystraightlines)sothattheGcodegenerationwontfreezeuponus
ortaketoolong.Ifyouhavetoomanynodes,simplifytheobjectbypressingctrl+Las
manytimesasnecessaryuntilthenodecountislowenough.Ourdinoisat528nodes,
sowedonthavetosimplify.

TheToolsLibraryandtheGreenThing
Weneedtochooseatoolforthejob,whetheritsouractualtoolorjustavirtualone.If
weclicktheExtensionsmenu,andunderGcodetoolsweclickToolslibrary,wegetto
thewindowwiththesamename.InallourappliancesforthistypeofGcodegeneration
(laserengraverandplotter)wehaveusedthecylinderoption.

http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

4/8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

Whenpressingapply,anobnoxiousgreenthingpopsupinourdrawing.Weclosethe
previouswindowandmovethegreenthingawayfromobstructingourdino.Thisgreen
squareispartoftheimageandatthesametimeusedtosetuptheGcodegeneration
(weird,right!?).
Tochangetheparameters,weselectthetexttoolandclickonthenumbers.Letssetthe
tooldiameterto1(doesnthavetoomuchtosay,butitsbesttonothaveittoobig),the
feedrateto200mm/min(inourcase,thisdecideshowstrongtheengravingwillget)
andthepenetrationfeedto10000(justanarbitraryhighnumbertoquicklyturnonand
offthelaser).Wellleavetherestasitis.

Dinoisnothappyaboutthegreenthinginvadinghisspace.

Orientationpoints
Theseareabitcryptic,butwedoneedthem.SelectOrientationpointsfromthe
Gcodetoolsmenu.
Inthewindowthatpopsupweselectthetopoption,settheZsurfaceto0,theZdepth
to0.1(wejustwantittobarelygobelowzerototurnonthelaserquickly)andthe
Unitsasmm.Thenweclickapplyandclosethewindow.Itisbesttoleavethosearrows
withthenumbersinparenthesisthatpopupwheretheyareanddontmessaroundwith
them.

http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

5/8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

Themysteriousorientationpoints

PathtoGcode
Nowwearereadyforthemagic.IntheGcodetoolsmenuweselectPathto
Gcode.Therearefourtabsinthewindowthatpopsup.
WestartinthePreferencestab.Wenamethefiledino.ngcandplacesitinaconvenient
directory(e.g.C:\Users\Mads\Desktop).Wesetalowsafeheightsuchas0.1sincewere
notactuallymovingalongtheZaxisatall.Units:mmandPostprocessor:None.The
restisblank.
UnderOptionsweleaveeverythingastheyarebydefault.
InthePathtoGcodetabwemakesureSubpathbysubpathisselectedandthatSort
pathstoreduse(yeah,weknow)rapiddistanceischecked.Therestisasitisbydefault.
MakesurethatonlytheobjectyouwanttogenerateGcodeofisselected(inourcase:
thedinosaur)andmakealsosurethatyouhavethePathtoGcodetabselectedbefore
pressingapply(youwill,believeitornot,getanerrormessageifyouhaveadifferent
tabselected).
Ifwedontencounteranyerrors,ourdinowilllooklikethisafterthegeneration
processisdone:

http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

6/8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

TheGcodegenerationisdone!Noticethearrowsalongthedinosaur.

VisualizetheGcode
ToconfirmthatthenewlygeneratedGcodewillresultinsomethingthatlooksremotely
likeourdino,weneedsomethingtovisualizetheGcode.Thereareprobablymany
programsouttherewhichcandothis,butweliketouseOpenSCAM.Herewecansee
howlongittakestoperformthewholejobaswellasseehowthemachinewilltravel
alongthepathinrealoracceleratedtime.

ScreenshotfromtheOpenSCAMsimulation

IfyouwanttohavealookattheGcodefile,itsavailablehere.

RelatedPosts
http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

7/8

6/14/2016

AnIntrotoGcodeandHowtoGenerateItUsingInkscapeNorwegianCreations

MakingaPlotterforTrondheimMakerFairePart4:Softwareandfirmware
November7,2014

MakingaPlotterforTrondheimMakerFairePart1:AnOverview October2,2014
HowtoTraceBitmapsinInkscape August5,2015

Disqusseemstobetakinglongerthanusual.Reload?

http://www.norwegiancreations.com/2015/08/anintrotogcodeandhowtogenerateitusinginkscape/

8/8