View: 12445|Reply: 10

gcode (grbl) sender with editor and plugins. modular and expandable

[Copy link]

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
Published in 2016-11-13 07:40:44 | Show all floors |Read mode

GCode sender/editor (for home CNC. grbl-based current) with plugin system. modular, easily expandable and extendable.
with error handling, changing wrong code on the fly and continuing of sending from place of error.

it is highly portable as most of it was written in lua scripting language. utilising aggressive modular strategy, without any heavyweight and system-depended plugins (but currently it tested and used only under linuxes. both ARM and x86)

compile
-------
```
$ ./bld.sh  #run this from the root folder
```

run
---
```
$ cd bld
$ ./prg
```

browse/change scripts part
-----------------------------
```
cd bld/conf  #and look there
```

browse/change binary part
-------------------------
look starting from root folder. it contain full set of sources (links to their urls are in the README.md)

is it GRBL-only?
----------------
all controller depended parts are separated to it own module (conf/controllers). but was written and tested only grbl module till for now (conf/controllers/grbl)

DESCRIPTION
===========

Frontend (main) part:
=====================
- can load & edit & send g-code files.

Visualiser (display)
--------------------
- visualise g-code in 2 projections: XY and XYZ,
- visualise process of sending,
- visualiser can zoom drawing with buttons on top or with mouse wheel,
- move viewport with mouse,
- highlight a line of drawing by clicking on it (and selects it in the editor list),

Editor
------
- editor shows full list of gcodes,
- can edit gcodes line to line,
- can add lines,
- can remove lines,
- all changes shows on the display,
- currently selected line highlights on the display,
- the line was selected on the display selects itself in the editor list,
- the line where appears an error in the CNC controller selects itself in the editor automatically,
- have ability to send a single gcode line from edited list,
- have ability to set from and to gcode lines to send only part of gcode list,
- can find or replace gcodes line by line using regexps (lua kind),

Terminal
--------
- shows the process of gcode sending,
- can compose and send a single custom gcode string,
- can reedit and resend already sent gcode (just click on it in the terminal list),
- after an error, wrong command appears in the terminal edit. it may be edited and sent again.
- after an error, sending may be continued from next command by clicking on the pause button,
- in the time of send terminal shows number of sent command,

Controller of CNC
-----------------
- can move the CNC spindle by XYZ axes with buttons,
- can change step of moving,

Showroom
--------
- just big visualiser/display. sometimes i need it,

Plugins part:
=============
common description
------------------
- each plugin executed in the its own thread, in the its own global space and in the protected mode,
- all communications with main program occurs using hidden channels,
- plugin it is a folder by the conf/plugins path,
- plugin contains at least 2 files: init.lua and params.lua,
- init.lua it is the main part it should return the special but simple structure,
- params.lua should return a structure with params for editing before execute of plugin,
- current plugins may be 2 types: CAM and Filter,
- CAM - should make and return gcode using module "conf.gen.gcode". it can use any possibility of lua. modules - lua or binary,
- Filter - runtime handler/filter of gcodes. in the time of sending it receives every next gcode line and should return the processed one to send.

..more complete description and formats of will be later.

ready to use plugins/examples
-----------------------------
go to folder conf/pluging

- "gear" - CAM plugin to designing a simple gear (algo was adapted from the bcnc one),
- "roots" - CAM plugin to designing a lobe-roots pump profile (my own algo. haven't found in the internet),
- "picture" - CAM plugin to tracing a picture (*.ppm only now) to gcode using colors as height map (my own algo),
- "svg" - CAM plugin to loading a svg file as gcode (not fully tested. b-condition),
- "dxf" - CAM plugin to loading a dxf file (old library. i think up to autocad2000) as gcode (not fully tested. b-condition),

- cnc2laser - Filter plugin. it allows to send CNC gcode to laser by changing in the runtime Z+ and Z- commands to M5/M3.


Link to git repo:
=================
https://github.com/bhgv/lua.gcode.sender

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-11-13 23:22:54 | Show all floors
i have uploaded v1.0 release. linux-x86 and linux-arm.

before the first run - execute from top folder
```
$ ./inst.sh
```

to run - execute
```
$ ./prg
```
on some systems it should be (for access to ports)
```
$ sudo prg
```

https://github.com/bhgv/lua.gcode.sender/releases/tag/v1.0

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-11-15 19:22:10 | Show all floors
added a couple of instruments to the Edit tab for visual editing. now it is possible to:
- Move gcodes,
- Rotate gcodes around its zero point,
- Scale gcodes -
by dragging with mouse drawing on display as it do in regular graphical editors.
sender aplies changes to gcode just before send it to CNC.

(and now significally faster start of sending process)

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-11-21 10:23:22 | Show all floors
- plugin for loading/slicing 3D models was added. it supports only *.OBJ files and can make slices only to contour as for 3D printer for now. it contains both lua and binary parts and to use it needs to rebuild.

- minor works with editor (move/rotate/scale) and with colors in display

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-11-27 07:00:24 | Show all floors
- 3D models loader/slicer (.obj and .stl formats). it can prepare slices to: set of paths for external milling, set of paths for internal milling, set of countours as for 3D printing.

i think this is an easyest way to make a 3D figure

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-11-30 02:18:13 | Show all floors
added custom gcode filter. to filter gcodes stream just before send them to CNC. it is just a lua function. it receives current gcode line in the "gcode" variable and should return filtered line or nil.
example:
```
return gcode:gsub(
    "[Ff]%s*%d*%.?%d*",
    "f100"
)
```
-- changes any frequency options to 100 (i needed this today)

0

threads

3

posts

32

credits

Novice

Rank: 1

credits
32
Published in 2016-12-1 12:18:26 from mobile | Show all floors
Edited by yusufilker at 2016-12-2 01:42

Hello i am new this cnc gcode thing. I try to understand whether I can use your code for desktop size CNC machine. I would like to  elim
nate PC parallel port and use orangepi to drive TB6560 stepper drives directly. beaglebone black seems to work with machinekit.

Is your software capable of driving 4 axis cnc? is there any graphical user interface ?

thanks,

0

threads

3

posts

32

credits

Novice

Rank: 1

credits
32
Published in 2016-12-1 12:21:13 from mobile | Show all floors
Edited by yusufilker at 2016-12-2 01:43

Does it support opi zero? How to you set input output pins? Do we need gcode interpreter MCU unit at the cnc machine/3d printer side?  Or just stepper motor controllers are enough... sorry for the basic questions..

0

threads

3

posts

32

credits

Novice

Rank: 1

credits
32
Published in 2016-12-1 22:49:19 from mobile | Show all floors
Edited by yusufilker at 2016-12-2 01:44

How many axis supported? 3 or 4?


I wrote initial 3 comments from mobile phone, sorry for multiple entries.

11

threads

75

posts

376

credits

Intermediate member

Rank: 3Rank: 3

credits
376
 Author| Published in 2016-12-2 08:43:21 | Show all floors
@yusufilker
hello. thanks for your interest/responces.

it is a sender of gcodes to CNC controller. i tried to do something like bCNC (https://github.com/vlachoudis/bCNC). but without things that i don't like in it.
for example: its error handling is not very good. its system of sending is not flexible. it's difficult to change or expand as it was written as pair of very large files. and it tightly bound to a single CNC controller (grbl).
you can use more simple senders. it has a lot of them in the internet. but i think, soon you will understand why it needs an editor and error handler/checker and inplace resender.

yes, it has a graphical interface, display for gcode drawing, terminal, it shows the current position of carriage (spindle/laser/3d head) and many others.

about the CNC controller. currently it uses grbl (https://github.com/grbl/grbl). it cheapest and easiest. it is the best decision for beginer (but not the best in general).

all that you need:
- arduino uno/arduino nano/mini pro or any other atmega328 based; Arduino IDE (https://github.com/grbl/grbl/wiki/Compiling-Grbl)
- how to connect your arduino to motor controllers - https://github.com/grbl/grbl/wiki/Connecting-Grbl . arduino uno not the best for me. arduino nano or mini pro are better i think because they smaller, but for begining arduino uno is good.
- as stepper controllers i suggest to use a4988 or maybe drv8825. they are cheap, small, easy to use and you can easily buy for pair of $$ or make a board by yourselth to use your arduino with them (ex: https://github.com/garychan/Grbl--w-pololu-A4988-and-arduino-nano)
- as driver to spindle/laser i use just a mosfet (irfz44 or irf3205). laser must use their own controllers. if you didn't have an experience with lasers try from weakest and cheapest. lasers break easily

- grbl supports only 3 axis (because of number of arduino pins). the sender haven't dependencies to number of axis.

- yes the sender supports opi zero (but if you plan to use big gcode files remember about the memory). it depends only for linux, X (uses only Xlib calls to communicate with X. no gtk/qt/GL) and 1 usb port

- to connect/communicate with GRBL controller you can use any USB or COM port accessible by Arduino board (sometimes it needs to sudo)

- if you plan to use other CNC controller - all the controller depended code is in the 'conf/controllers' folder. grbl is in the 'conf/controllers/grbl'. just add the folder for your one and rewrite functions. but after finishing of works i maybe will write a kind of how-to.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list