Skip to content

Commit

Permalink
Merge branch 'release/v1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Mar 18, 2022
2 parents f1a71d0 + 7053dcc commit 2b26c11
Show file tree
Hide file tree
Showing 58 changed files with 626 additions and 132 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<p align="center">
<img src="doc/logo.png"/>
</p>

# DXF Plotter

> Fast and easy to use DXF to GCode converter for laser and router CNC
Expand All @@ -13,13 +17,20 @@ This application helps users converting DXF files to GCode with minimal settings
It targets only laser and router CNC following every lines and arcs from DXF file with optional desired depth.


## Features
## Features

* DXF support of line, arc, circle, polyline, spline
* Customizable GCode command format
* Saving current work to file
* Multi selected path setting edition
* Path offseting (Tool Compensation)
* Pocket generation with islands capabilities
* Multi passes with depth
* Scale and translate paths

<p align="center">
<img src="doc/pocket.gif" width="80%"/>
</p>

## Installation

Expand All @@ -34,22 +45,20 @@ chmod +x dxfplotter-*.AppImage
./dxfplotter-*.AppImage
```

### Manual installation from source
### 🏗 Manual installation from source

This project depends on Qt5, yaml-cpp and fmt, for debian like distribution following command install all dependencies:
This project depends on Qt5, for debian like distribution following command install all dependencies:

```sh
sudo apt-get install qtbase5-dev libyaml-cpp-dev libfmt-dev
sudo apt-get install qtbase5-dev
```

```sh
git submodule init
git submodule update

mkdir build
cd build
cmake ..
make
cmake -B build
cmake --build build -j $(nproc)
```

## Usage example
Expand All @@ -76,16 +85,15 @@ Once opened, select path from left panel or from viewport and modify settings of

Export with `File->Export` or `Ctrl+E`


## Configuration
## ✏ Configuration

![](doc/configuration.png)

Configuration settings are exposed in `Configuration->Settings`, the configuration is splitted in two:
* general settings aiming dxf importing or default values
* tools with settings such as radius and gcode formatting

## GCode format
## 📝 GCode format

Simple set of GCode command is used per tool:

Expand Down
Binary file modified doc/configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pocket.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions resource/icons/pocket-shape.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions resource/icons/zoom-in.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions resource/resource.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
<file>icons/list-remove.svg</file>
<file>icons/path-inset.svg</file>
<file>icons/path-outset.svg</file>
<file>icons/pocket-shape.svg</file>
<file>icons/resizecol.svg</file>
<file>icons/show-path-outline.svg</file>
<file>icons/transform-rotate.svg</file>
<file>icons/zoom-in.svg</file>
</qresource>
</RCC>
3 changes: 2 additions & 1 deletion src/common/aggregable.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <set>
#include <memory>

namespace Common
namespace common
{

template <class Item>
Expand All @@ -16,6 +16,7 @@ class Aggregable

using List = std::vector<Item>;
using ListPtr = std::vector<Item *>;
using ListCPtr = std::vector<const Item *>;
using ListUPtr = std::vector<UPtr>;

template <size_t Size>
Expand Down
4 changes: 2 additions & 2 deletions src/common/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <sstream>
#include <string>

namespace Common
namespace common
{

class FileCouldNotOpenException : public std::exception
Expand All @@ -14,7 +14,7 @@ class GCodeFormatException : public std::runtime_error
{
private:
template <class ... Args>
std::string errorMessage(const std::string &format, const char *error, Args&& ... args)
static std::string errorMessage(const std::string &format, const char *error, Args&& ... args)
{
std::ostringstream stream;
stream << "Formatting error, format \"" << format << "\" with arguments";
Expand Down
2 changes: 1 addition & 1 deletion src/common/function.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

namespace Common
namespace common
{

template <typename Func>
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Config::Config(const std::string &filePath)
try {
m_yamlRoot = YAML::LoadFile(filePath);
}
catch (const YAML::BadFile &e) {
catch (const YAML::BadFile&) {
qInfo() << "Initializing configuration from defaults";
}

Expand Down Expand Up @@ -43,7 +43,7 @@ const Root &Config::root() const
return m_root;
}

void Config::save()
void Config::save() const
{
std::ofstream outStream(m_filePath);
outStream << m_yamlRoot;
Expand Down
2 changes: 1 addition & 1 deletion src/config/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public:
Root& root();
const Root& root() const;

void save();
void save() const;
};

}
9 changes: 4 additions & 5 deletions src/config/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class List : public Node
YAML::Node m_yamlNode;

public:
explicit List(const std::string& name, const std::string &description, YAML::Node yamlNode)
explicit List(const std::string& name, const std::string &description, const YAML::Node &yamlNode)
:Node(name, description),
m_yamlNode(yamlNode)
{
Expand All @@ -29,7 +29,7 @@ class List : public Node
}
else {
// Create items from yaml node
for (std::pair<YAML::Node, YAML::Node> pair : m_yamlNode) {
for (const auto &pair : m_yamlNode) {
const std::string &name = pair.first.as<std::string>();
m_children.emplace(name, Child(name, pair.second));
}
Expand All @@ -45,8 +45,7 @@ class List : public Node

const Child *get(const std::string &name) const
{
const auto it = m_children.find(name);
if (it != m_children.end()) {
if (const auto it = m_children.find(name); it != m_children.end()) {
return &it->second;
}

Expand Down Expand Up @@ -84,7 +83,7 @@ class List : public Node
template <class Visitor>
void visitChildren(Visitor &&visitor) const
{
for (auto &pair : m_children) {
for (const auto &pair : m_children) {
visitor(pair.second);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace config

class Node
{
protected:
private:
std::string m_name;
std::string m_description;

Expand Down
21 changes: 9 additions & 12 deletions src/exporter/gcode/exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void Exporter::convertToGCode(const model::Path &path, std::ostream &output) con
class PassesIterator
{
private:
bool m_odd;
bool m_odd = true;
const bool m_closed;
const bool m_cuttingBackward;
const geometry::Polyline& m_polyline;
Expand All @@ -54,18 +54,17 @@ class PassesIterator

const geometry::Polyline &polylineForward() const
{
return (m_cuttingBackward) ? m_polylineInverse : m_polyline;
return m_cuttingBackward ? m_polylineInverse : m_polyline;
}

const geometry::Polyline &polylineBackward() const
{
return (m_cuttingBackward) ? m_polyline : m_polylineInverse;
return m_cuttingBackward ? m_polyline : m_polylineInverse;
}

public:
explicit PassesIterator(const geometry::Polyline &polyline, geometry::CuttingDirection direction)
:m_odd(true),
m_closed(polyline.isClosed()),
:m_closed(polyline.isClosed()),
m_cuttingBackward(direction == geometry::CuttingDirection::BACKWARD),
m_polyline(polyline),
m_polylineInverse(needPolylineInverse() ? m_polyline.inverse() : geometry::Polyline())
Expand Down Expand Up @@ -126,15 +125,11 @@ void Exporter::convertToGCode(PathPostProcessor &processor, const geometry::Bulg
const QVector2D relativeCenter = circle.center() - bulge.start();
switch (circle.orientation()) {
case geometry::Orientation::CW:
{
processor.cwArcMove(relativeCenter, bulge.end());
break;
}
case geometry::Orientation::CCW:
{
processor.ccwArcMove(relativeCenter, bulge.end());
break;
}
default:
break;
}
Expand All @@ -151,6 +146,8 @@ struct CommentLineStream
m_output << "; " << prefix;
}

CommentLineStream(CommentLineStream &) = delete;

~CommentLineStream()
{
m_output << "\n";
Expand All @@ -175,13 +172,13 @@ struct ConfigToCommentVisitor
}

template <class ValueType>
void operator()(const config::Property<ValueType> &property)
void operator()(const config::Property<ValueType> &property) const
{
commentLineStream() << property.name() << " = " << config::toSerializable((ValueType)property);
}

template <class Node>
void operator()(const Node &node)
void operator()(const Node &node) const
{
commentLineStream() << node.name();
node.visitChildren(ConfigToCommentVisitor{m_output, m_prefix + " "});
Expand All @@ -191,7 +188,7 @@ struct ConfigToCommentVisitor
template <class Group>
void convertConfigNodeToComments(const Group &group, std::ostream &output)
{
ConfigToCommentVisitor visitor{output, ""};
const ConfigToCommentVisitor visitor{output, ""};
visitor(group);
}

Expand Down
2 changes: 1 addition & 1 deletion src/exporter/gcode/postprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PostProcessor
m_stream << fmt::format(format, std::forward<Args>(args)...) << "\n";
}
catch (const fmt::format_error &exception) {
throw Common::GCodeFormatException(format, exception.what(), fmt::to_string(args.name)...);
throw common::GCodeFormatException(format, exception.what(), fmt::to_string(args.name)...);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(SRC
cleaner.cpp
circle.cpp
cubicspline.cpp
pocketer.cpp
polyline.cpp
quadraticspline.cpp
spline.cpp
Expand Down
Loading

0 comments on commit 2b26c11

Please sign in to comment.