LibrePCB Developers Documentation
excellongenerator.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_CORE_EXCELLONGENERATOR_H
21#define LIBREPCB_CORE_EXCELLONGENERATOR_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../fileio/filepath.h"
27#include "../geometry/path.h"
28#include "../types/length.h"
29#include "gerberattribute.h"
30
31#include <QtCore>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Point;
39
40/*******************************************************************************
41 * Class ExcellonGenerator
42 ******************************************************************************/
43
47class ExcellonGenerator final {
48 Q_DECLARE_TR_FUNCTIONS(ExcellonGenerator)
49
50public:
51 // Types
52 enum class Plating { Yes, No, Mixed };
54
55 // Constructors / Destructor
57 ExcellonGenerator(const ExcellonGenerator& other) = delete;
58 ExcellonGenerator(const QDateTime& creationDate, const QString& projName,
59 const Uuid& projUuid, const QString& projRevision,
60 Plating plating, int fromLayer, int toLayer) noexcept;
61 ~ExcellonGenerator() noexcept;
62
63 // Setters
64 void setUseG85Slots(bool use) noexcept { mUseG85Slots = use; }
65
66 // Getters
67 const QString& toStr() const noexcept { return mOutput; }
68
69 // General Methods
70 void drill(const Point& pos, const PositiveLength& dia, bool plated,
71 Function function) noexcept;
72 void drill(const NonEmptyPath& path, const PositiveLength& dia, bool plated,
73 Function function) noexcept;
74 void generate();
75 void saveToFile(const FilePath& filepath) const;
76
77 // Operator Overloadings
79
80private:
81 void printHeader() noexcept;
82 void printToolList() noexcept;
83 void printDrills();
84 void printPath(const NonEmptyPath& path);
85 void printDrill(const Point& pos) noexcept;
86 void printSlot(const NonEmptyPath& path);
87 void printRout(const NonEmptyPath& path) noexcept;
88 void printMoveTo(const Point& pos) noexcept;
89 void printLinearInterpolation(const Point& pos) noexcept;
90 void printCircularInterpolation(const Point& from, const Point& to,
91 const Angle& angle) noexcept;
92 void printFooter() noexcept;
93
94 // Types
95 typedef std::tuple<Length, bool, Function> Tool;
96
97 // Metadata
100
101 // Configuration
103
104 // Excellon Data
105 QString mOutput;
107};
108
109/*******************************************************************************
110 * End of File
111 ******************************************************************************/
112
113} // namespace librepcb
114
115#endif
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:78
The ExcellonGenerator class.
Definition: excellongenerator.h:47
void printMoveTo(const Point &pos) noexcept
Definition: excellongenerator.cpp:228
void printDrills()
Definition: excellongenerator.cpp:151
void saveToFile(const FilePath &filepath) const
Definition: excellongenerator.cpp:109
void printCircularInterpolation(const Point &from, const Point &to, const Angle &angle) noexcept
Definition: excellongenerator.cpp:238
void printRout(const NonEmptyPath &path) noexcept
Definition: excellongenerator.cpp:196
bool mUseG85Slots
Definition: excellongenerator.h:102
const QString & toStr() const noexcept
Definition: excellongenerator.h:67
void printDrill(const Point &pos) noexcept
Definition: excellongenerator.cpp:173
void printSlot(const NonEmptyPath &path)
Definition: excellongenerator.cpp:178
void drill(const Point &pos, const PositiveLength &dia, bool plated, Function function) noexcept
Definition: excellongenerator.cpp:88
ExcellonGenerator(const ExcellonGenerator &other)=delete
void generate()
Definition: excellongenerator.cpp:102
void printToolList() noexcept
Definition: excellongenerator.cpp:136
void setUseG85Slots(bool use) noexcept
Definition: excellongenerator.h:64
~ExcellonGenerator() noexcept
Definition: excellongenerator.cpp:81
void printFooter() noexcept
Definition: excellongenerator.cpp:252
ExcellonGenerator & operator=(const ExcellonGenerator &rhs)=delete
GerberAttribute::ApertureFunction Function
Definition: excellongenerator.h:53
void printHeader() noexcept
Definition: excellongenerator.cpp:117
void printLinearInterpolation(const Point &pos) noexcept
Definition: excellongenerator.cpp:233
std::tuple< Length, bool, Function > Tool
Definition: excellongenerator.h:95
void printPath(const NonEmptyPath &path)
Definition: excellongenerator.cpp:161
Plating mPlating
Definition: excellongenerator.h:98
QString mOutput
Definition: excellongenerator.h:105
QMultiMap< Tool, NonEmptyPath > mDrillList
Definition: excellongenerator.h:106
QVector< GerberAttribute > mFileAttributes
Definition: excellongenerator.h:99
Plating
Definition: excellongenerator.h:52
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
A Gerber X2 attribute.
Definition: gerberattribute.h:43
ApertureFunction
Definition: gerberattribute.h:53
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:83
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition: point.h:79
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
type_safe::constrained_type< Path, NonEmptyPathConstraint, NonEmptyPathVerifier > NonEmptyPath
Definition: path.h:221