Concept - Using OpenSCAD for Laser cutting/engrawing
Using OpenSCAD for Laser cutting/engrawing
I used:
Software:
- OpenSCAD - for modeling parts.
- Notepad++ - editing text files such as SVG. You can use your favorite editor.
- https://convertio.co/ - converting SVG to JPG. You can use your favorite converter.
- Google Drive - for exchanging files between desktop and mobile.
- LaserGRBL - preparing G_Code. You can use our favorite software.
- AlgoLaser App - for sending data to the machine.
Laser machine
AlgoLaser DIY KIT 5W Diode Laser Module with DIY blower.
Materials:
- 6 mm plywood for walls
- 4 mm plywood for lid/bottom
- PVA wood glue
Features of the software used
LaserGRBL
- Raster images (.png,.jpg...) - can be used for cutting and engraving
- Vector images (.svg) - contour cutting
AlgoLaser App
- Raster images (.png,.jpg...) - can be used for cutting and engraving
- Vector images (.svg) are not supported
- G_Code file - sent "as is"
Step-by-step guide
As an example, we will make a box for a hand router cutters.
The lid is sliding.
The lid will have a picture - a description of the contents and a divot to facilitate opening.
Side walls of the box
Modeling the side wall parts in OpenSCAD.
See the example - myBox.scad. Place the parts in an order convenient for cutting.
Important! OpenSCAD combines parts that touch. Therefore, place the parts with a small gap, for example 0.5 mm.
Render and export to SVG. I use the following file name format: xx-<cut/engrave> - for example 80x82x38-c.svg
Cuts and grooves on the walls.
It is necessary to make a quarter cuts at the bottom for the bottom lid and a groove for the sliding top lid. In order not to do this with a hand router, we will do it with laser engraving.
Model grooves and recesses in OpenSCAD.
See the example - myBox.scad. Place the parts strictly in the same order as for cutting.
I make one model for cutting and engraving with the parameter Output=0;//[0:Engraw, 1:Conturs for cut]
In addition, I output to the console all the main sizes of the resulting model:
ECHO: "======================================"ECHO: "Inner size", w = 80, l = 82, h = 38ECHO: "-------------------------------------"ECHO: "Outher size", W = 91.4, L = 93.4, H = 48.5ECHO: "-------------------------------------"ECHO: "Image size", W = 93.4, L = 189ECHO: "===================================="
Important! Design the grooves so that they are only inside and do not extend outward onto the walls.
Render and export to SVG 80x82x38-e.svg
Preparing the drawing for engraving
Unfortunately, LaserGRBL can only cut the SVG file along the contour. Therefore, it is necessary to convert the SVG file to JPG. But the JPG drawing of the engraving file must be the same size and proportions as for cutting. Open the files 80x82x38-c.svg and 80x82x38-e.svg in a text editor.
- Copy lines 3 through the penultimate from the cutting file 80x82x38-c.svg

- Replace lines 3,4 in the engraving file 80x82x38-e.svg.

You can also add an empty line for convenience. - Highlighted in green - set the line width to 0. Highlighted in crimson - set the color to black for the engraved elements.

- Save 80x82x38-e.svg and open it in the browser. Check that the cutting and engraving contours match.

- Highlighted in red - set the color to white for the cutting elements.

- Convert the resulting file to JPG. For example, using the online converter https://convertio.co/

Preparing G-Code for engraving and cutting side walls in LaserGRBL.
Open files in LaserGRBL:
- Open the file 80x82x38-e.jpg. Set the engraving parameters and image size.

- Append file 80x82x38-c.svg. Set the cutting parameters.

- The received engraving/cutting code

is sent directly to the laser machine, or we save the G-Code and save the NC file on Google Drive for subsequent work via AlgoLaser App
Result:
Bottom and lid
The engraving depth depends significantly on the material. Moreover, for plywood it can be different depending on the side from which the engraving is made.
Therefore, we measure the dimensions of the bottom and lid on site. We assemble the product without glue
Preparing the drawing of the bottom and lid cutout.
We measure the width and length of the bottom/lid. The measurement must be made as close to the corners as possible to eliminate possible bending of the walls from compression with clamps. In my case, the dimensions were:
- Width of the bottom/lid 82.6 mm
- Length of the bottom 84.6 mm
- Length of the lid 89.4 mm
We create 2 rectangles according to the measured dimensions. This can be done in OpenSCAD with subsequent export to SVG.
However, it is much easier to create a SVG file rect.svg in a text editor with the following content:
<?xml version="1.0" standalone="no"?><svgxmlns="http://www.w3.org/2000/svg">` `
Preparing G-Code for engraving and cutting the bottom and lid in LaserGRBL.
- Open the rect.svg file and set the parameters for engraving the contour of the bottom and lid. This is necessary to control the position of the image - a description of the contents and a divot for easy opening. Engrave the contours of the bottom and lid.
- Engrave the image on the lid, setting the size, position and parameters.
- Engrave the drawing of the divot for easy opening divot.jpg, setting the size, position and parameters. The engraving parameters are similar to the engraving for the bottom and grooves for the sliding lid.
- Reopen the rect.svg file and set the parameters for cutting along the contour.
Result:
Final assembly
Glue the walls and bottom with PVA glue
After the glue dries, install the lid. If necessary, adjust the size of the lid - sand the ends of the lid with sandpaper.
To give the product a beautiful look, sand the surfaces with sandpaper.
You can also coat the product with wood impregnation. Vaseline oil can be used for this.
Useful links:
- https://www.w3schools.com/graphics/svg_intro.asp Description of the SVG file format with examples.
- https://en.wikibooks.org/wiki/OpenSCAD_User_Manual OpenSCAD documentation
I invite all interested parties to the discussion. Write your questions, comments, and suggestions in the comments.
====================
Использование OpenSCAD для лазерной резки/гравировки
Я использовал:
Программное обеспечение:
- OpenSCAD - для моделирования деталей.
- Notepad++ - редактирование текстовых файлов, таких как SVG. Вы можете использовать свой любимый редатор.
- https://convertio.co/ - конвертация SVG в JPG. Вы можете использовать свой любимый конвертор.
- Google Drive - для обмена файлами между настольным компьютером и мобильным устройством.
- LaserGRBL - подготовка G_Code. Вы можете использовать наше любимое ПО.
- Приложение AlgoLaser App - для отправки данных на станок.
Лазерный станок
AlgoLaser DIY KIT 5W Diode Laser Module с самодельным обдувом.
Материалы:
- фанера 6 мм для стенок
- фанера 4 мм для крышки/дна
- столярный клей ПВА
Особенности используемого ПО
LaserGRBL
- Растровые изображения (.png,.jpg...) - можно использовать для вырезки и гравировки
- Векторные изображения(.svg) - резка по контуру
AlgoLaser App
- Растровые изображения (.png,.jpg...) - можно использовать для вырезки и гравировки
- Векторные изображения(.svg) не поддерживаются
- Файл G_Code - отправляется "как есть"
Пошаговое руководство
В качестве примера изготовим коробочку для фрез к ручному фрезеру.
Крышка сдвижная.
На крышке будет рисунок - описание содержимого и выемка чтобы облегчить открытие.
Боковые стенки коробочки
Моделируем в OpenSCAD детали боковых стенок.
См. пример - myBox.scad. Размещаете детали в удобном для резки порядке.
Важно! OpenSCAD объединяет касающиеся детали. Поэтому размещаем детали с небольшим зазором, например 0.5 мм.
Рендерим и экспортируем в SVG. Я использую такой формат имен файлов: xx-<cut/engrave> - например 80x82x38-c.svg
Выборки и пазы на стенках.
Необходимо выполнить выборку четверти внизу для донышка и паз для сдвижной крышки. Чтобы не делать это с помощью ручного фрезера выполним это гравировкой лазером.
Моделируем в OpenSCAD пазы и выемки.
См. пример - myBox.scad. Размещаем детали строго в том же порядке, что и для резки.
Я делаю одну модель для резки и гравировки с параметром Output=0;//[0:Engraw, 1:Conturs for cut]
Кроме этого я вывожу на консоль все основные размеры полученной модели:
ECHO: "======================================"ECHO: "Inner size", w = 80, l = 82, h = 38ECHO: "-------------------------------------"ECHO: "Outher size", W = 91.4, L = 93.4, H = 48.5ECHO: "-------------------------------------"ECHO: "Image size", W = 93.4, L = 189ECHO: "===================================="
Важно! Пазы проектируйте так, чтобы они были только внутри и не выходили наружу на стенки.
Рендерим и экспортируем в SVG 80x82x38-e.svg
Подготовка рисунка для гравировки
К сожалению, LaserGRBL умеет только вырезать по контуру файл SVG. Поэтому необходимо преобразовать SVG файл в JPG. Но рисунок JPG файла гравировки должен быть такого же размера и пропорций, как и для резки. Открываем файлы 80x82x38-c.svg и 80x82x38-e.svg в текстовом редакторе.
- Копируем строки с 3 по предпоследнюю из файла резки 80x82x38-c.svg

- Заменяем строки 3,4 в файле гравировки 80x82x38-e.svg.

Можно также добавить пустую строку для удобства. - Выделено зеленым - устанавливаем ширину линии 0. Выделено малиновым - для гравируемых элементов устанавливаем цвет черный.

- Сохраняем 80x82x38-e.svg и открываем его в браузере. Проверяем совпадение контуров вырезки и гравировки.

- Выделено красным - для элементов резки устанавливаем цвет белый.

- Полученный файл конвертируем в JPG. Например при помощи онлайн конвертера https://convertio.co/

Подготовка G-Code гравировки и вырезки боковых стенок в LaserGRBL.
Открываем файлы в LaserGRBL:
- Открываем файл 80x82x38-e.jpg. Устанавливаем параметры гравировки и размер изображения.

- 80x82x38-c.svg. Устанавливаем параметры резки.

- Полученный код гравировки/вырезания

посылаем непосредственно на лазерный станок, либо сохраняем G-Code и сохраняем NC файл на Google Drive для последующей работы через AlgoLaser App
Результат:
Дно и крышка
Глубина гравировки существено зависит от материала. Более того, для фанеры она может быть разной в зависимости от стороны с которой производится гравировка.
Поэтому размеры дна и крышки измеряем по месту. Собираем изделие без клея
Подготовка рисунка вырезки дна и крышки.
Измеряем ширину и длину дна/крышки. Измерение необходимо производить как можно ближе к углам, чтобы устранить возможные изгибы стенок от сжатия струбцинами. В моем случае получились размеры:
- ширина дна/крышки 82.6 мм
- Длина дна 84.6 мм
- Длина крышки 89.4 мм
Создаем 2 прямоугольника по измеренным размерам. Можно это сделать в OpenSCAD с последующим экспортом в SVG.
Однако значительно проще создать в текстовом редакторе SVG файл rect.svg следующего содержания:
<?xml version="1.0" standalone="no"?><svgxmlns="http://www.w3.org/2000/svg">` `
Подготовка G-Code гравировки и вырезки дна и крышки в LaserGRBL.
- Открываем файл rect.svg и задаем параметры для гравировки контура дна и крышки. Это необходимо для контроля положения рисунока - описание содержимого и выемки для облегчения открытия. Гравируем контуры дна и крышки.
- Гравируем рисунок на крышке, задав размер, положение и параметры.
- Гравируем рисунок выемки для облегчения открытия divot.jpg, задав размер, положение и параметры. Параметры гравировки аналогично гравировке для донышка и пазов для сдвижной крышки.
- Повторно открываем файл rect.svg и задаем параметры для резки по контуру.
Результат:
Окончательная сборка
Склеиваем стенки и дно клеем ПВА
После высыхания клея устанавливаем крышку. При необходимости подгоните размеры крышки - прошлифуйте торцы крышки наждачной бумагой.
Для придания изделию красивого вида прошлифуйте поверхности наждачной бумагой.
Также можно покрыть изделие пропиткой для дерева. Для этого можно использовать вазелиновое масло.
Полезные ссылки:
- https://www.w3schools.com/graphics/svg_intro.asp Описание формата SVG файла с примерами.
- https://en.wikibooks.org/wiki/OpenSCAD_User_Manual Документация OpenSCAD