Skip to content

Commit

Permalink
0.8.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Дамир Бакиев committed Jan 12, 2022
1 parent 0599a6b commit 4ccf3d2
Show file tree
Hide file tree
Showing 36 changed files with 2,967 additions and 2,867 deletions.
11 changes: 9 additions & 2 deletions GGEasy/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@
+ Предложение перезагрузки файла в проект, если он изменился.
+ Выбор тем оформления настройках)


.............

0.8.0.4
* Добавлена сортировка путей по расстоянию для Профиль Поверху.
* Добавлена сортировка путей по расстоянию для Профиль Поверху.

0.8.1.0
* Исправлено падение при открытии некоторых файлов сверловок и герберов.
* Перемещено место хранения файлов настроек и базы инструментов в системную директорию пользователя.
+ В окно настроек добавлена кнопка для открытия расположения папки настроек.
* Изменён алгоритм загрузки герберов, уменьшено занимаемое место и возможное появление «зазубрин» в УП карман.
* Изменён алгоритм загрузки герберов, уменьшено занимаемое место и возможное появление «зазубрин» в УП карман.
* Изменил раскладку виджетов в окне параметров УП (уменьшение занимаемой ширины).
4 changes: 2 additions & 2 deletions GGEasy/aboutform.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>701</width>
<height>198</height>
<height>229</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -39,7 +39,7 @@
<item>
<widget class="QLabel" name="lblAbout">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Build: %1&lt;br/&gt;Visit: &lt;a href=&quot;https://github.com/XRay3D/GERBER_X3/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/XRay3D/GERBER_X3/&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;https://github.com/Denvi/Candle/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/a&gt;© 2017-2020 Damir Bakiev&lt;br/&gt;License: GNU GENERAL PUBLIC LICENSE&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Build: %1&lt;br/&gt;Visit: &lt;a href=&quot;https://github.com/XRay3D/GERBER_X3/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/XRay3D/GERBER_X3/&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;https://github.com/Denvi/Candle/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/a&gt;© 2017-2022 Damir Bakiev&lt;br/&gt;License: GNU GENERAL PUBLIC LICENSE&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand Down
2 changes: 1 addition & 1 deletion GGEasy/gcode/gccreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ bool Creator::createability(bool side)
// Paths wpe;
const double d = m_gcp.tools.back().getDiameter(m_gcp.getDepth()) * uScale;
const double r = d * 0.5;
const double testArea = d * d - M_PI * r * r;
const double testArea = d * d - pi * r * r;

Paths srcPaths;
for (size_t pIdx = 0; pIdx < m_groupedPss.size(); ++pIdx) {
Expand Down
2 changes: 1 addition & 1 deletion GGEasy/gcode/gcpocketoffset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void PocketCreator::createMultiTool(mvector<Tool>& tools, double depth)

auto removeSmall = [](Paths& paths, double dOffset) {
//return;
const auto ta = dOffset * dOffset * M_PI;
const auto ta = dOffset * dOffset * pi;
const auto tp = dOffset * 4;
for (size_t i = 0; i < paths.size(); ++i) {
const auto a = abs(Area(paths[i]));
Expand Down
Binary file modified GGEasy/translations/GGEasy_en.qm
Binary file not shown.
1,136 changes: 578 additions & 558 deletions GGEasy/translations/GGEasy_en.ts

Large diffs are not rendered by default.

1,136 changes: 578 additions & 558 deletions GGEasy/translations/GGEasy_es.ts

Large diffs are not rendered by default.

1,136 changes: 578 additions & 558 deletions GGEasy/translations/GGEasy_fr.ts

Large diffs are not rendered by default.

1,136 changes: 578 additions & 558 deletions GGEasy/translations/GGEasy_pt.ts

Large diffs are not rendered by default.

Binary file modified GGEasy/translations/GGEasy_ru.qm
Binary file not shown.
1,132 changes: 582 additions & 550 deletions GGEasy/translations/GGEasy_ru.ts

Large diffs are not rendered by default.

Binary file removed GGEasy/translations/qtbase_ru.qm
Binary file not shown.
4 changes: 2 additions & 2 deletions GGEasy/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*******************************************************************************/
#pragma once

#define VER_FILEVERSION 0, 8, 0, 4
#define VER_FILEVERSION_STR "0.8.0.4\0"
#define VER_FILEVERSION 0, 8, 1, 0
#define VER_FILEVERSION_STR "0.8.1.0\0"

#define VER_PRODUCTVERSION VER_FILEVERSION
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
Expand Down
2 changes: 1 addition & 1 deletion GTE_Win/clipper/clipper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ typedef QVector<PolyNode*> PolyNodes;
class PolyNode {
public:
PolyNode();
/*virtual*/ ~PolyNode() {}
/*virtual*/ ~PolyNode() { }
Path Contour;
PolyNodes Childs;
PolyNode* Parent;
Expand Down
4 changes: 2 additions & 2 deletions GTE_Win/clipper/myclipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ Path CirclePath(double diametr, const IntPoint& center)
Path poligon(intSteps);
for (int i = 0; i < intSteps; ++i) {
poligon[i] = IntPoint(
static_cast<cInt>(cos(i * 2 * M_PI / intSteps) * radius) + center.X,
static_cast<cInt>(sin(i * 2 * M_PI / intSteps) * radius) + center.Y);
static_cast<cInt>(cos(i * 2 * pi / intSteps) * radius) + center.X,
static_cast<cInt>(sin(i * 2 * pi / intSteps) * radius) + center.Y);
}
return poligon;
}
Expand Down
8 changes: 0 additions & 8 deletions GTE_Win/clipper/myclipper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
#include <QDebug>
#include <QPolygonF>

#ifndef two_pi
#define two_pi (6.28318530717958647692528676655900576)
#endif

#ifndef M_PI
#define M_PI (3.1415926535897932384626433832795)
#endif

//QDebug operator<<(QDebug debug, const IntPoint& p)
//{
// //QDebugStateSaver saver(debug);
Expand Down
2 changes: 1 addition & 1 deletion GTE_Win/gerber/gbraperture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ QString ApPolygon::name() const { return QString("P(Ø%1, N%2)").arg(m_diam).arg

ApertureType ApPolygon::type() const { return Polygon; }

bool ApPolygon::fit(double toolDiam) const { return m_diam * cos(M_PI / m_verticesCount) > toolDiam; }
bool ApPolygon::fit(double toolDiam) const { return m_diam * cos(pi / m_verticesCount) > toolDiam; }

void ApPolygon::draw()
{
Expand Down
16 changes: 6 additions & 10 deletions GTE_Win/gerber/gbrparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

namespace Gerber {

#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif

Parser::Parser(QObject* parent)
: QObject(parent)
{
Expand Down Expand Up @@ -282,9 +278,9 @@ QList<QString> Parser::format(QString data)
double Parser::arcAngle(double start, double stop)
{
if (m_state.interpolation() == CounterclockwiseCircular && stop <= start)
stop += 2.0 * M_PI;
stop += 2.0 * pi;
if (m_state.interpolation() == ClockwiseCircular && stop >= start)
stop -= 2.0 * M_PI;
stop -= 2.0 * pi;
return qAbs(stop - start);
}

Expand Down Expand Up @@ -458,12 +454,12 @@ Path Parser::arc(const IntPoint& center, double radius, double start, double sto
const int intSteps = 18; //MinStepsPerCircle;

if (m_state.interpolation() == ClockwiseCircular && stop >= start)
stop -= 2.0 * M_PI;
stop -= 2.0 * pi;
else if (m_state.interpolation() == CounterclockwiseCircular && stop <= start)
stop += 2.0 * M_PI;
stop += 2.0 * pi;

double angle = qAbs(stop - start);
double steps = qMax(static_cast<int>(ceil(angle / (2.0 * M_PI) * intSteps)), 2);
double steps = qMax(static_cast<int>(ceil(angle / (2.0 * pi) * intSteps)), 2);
double delta_angle = da_sign[m_state.interpolation()] * angle * 1.0 / steps;
for (int i = 0; i < steps; i++) {
double theta = start + delta_angle * (i + 1);
Expand Down Expand Up @@ -857,7 +853,7 @@ bool Parser::parseCircularInterpolation(const QString& gLine)
const double start = atan2(-j, -i);
const double stop = atan2(-centerPos[c].Y + y, -centerPos[c].X + x);
const double angle = arcAngle(start, stop);
if (angle < (M_PI + 1e-5) * 0.5) {
if (angle < (pi + 1e-5) * 0.5) {
arcPolygon = arc(IntPoint(centerPos[c].X, centerPos[c].Y), radius1, start, stop);
// Replace with exact values
m_state.setCurPos({ x, y });
Expand Down
10 changes: 6 additions & 4 deletions clang-format.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
For /R %%S IN (*.cpp *.h) do (
rem Echo %%S
rem -style="{key: value, ...}
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\clang-format.exe" -i --style=WebKit %%S
rem set PATH="%PATH%C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin"
for /R %%S in (*.cpp *.c *.hpp *.h) do (
rem echo %PATH%
rem echo %%S
rem -style="{key: value, ...}
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\clang-format.exe" -i --style=WebKit %%S
)
pause
4 changes: 2 additions & 2 deletions file_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ link_directories(
../libs${SUFFIX}
)

#add_subdirectory(dxf)
#add_subdirectory(excellon)
add_subdirectory(dxf)
add_subdirectory(excellon)
add_subdirectory(gerber)
#add_subdirectory(hpgl)

Expand Down
2 changes: 1 addition & 1 deletion file_plugins/dxf/entities/dxf_entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ std::tuple<QPointF, double, double, double> bulgeToArc(QPointF start_point, QPoi
Tuple: (center, start_angle, end_angle, radius)
*/
double r = signedBulgeRadius(start_point, end_point, bulge);
double a = angle(start_point, end_point) + (M_PI / 2.0 - atan(bulge) * 2.0);
double a = angle(start_point, end_point) + (pi / 2.0 - atan(bulge) * 2.0);
QPointF c = polar(start_point, a, r);
if (bulge < 0.0)
return { c, angle(c, end_point), angle(c, start_point), abs(r) };
Expand Down
2 changes: 1 addition & 1 deletion file_plugins/dxf/entities/dxf_graphicobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void GraphicObject::setScale(double scaleX, double scaleY)
auto scale = [](Path& path, double sx, double sy, const IntPoint& center = {}) {
const bool fl = Area(path) < 0;
for (IntPoint& pt : path) {
const double dAangle = (M_PI * 2) - center.angleRadTo(pt);
const double dAangle = (pi * 2) - center.angleRadTo(pt);
const double length = center.distTo(pt);
pt = IntPoint(static_cast<cInt>(cos(dAangle) * length * sx), static_cast<cInt>(sin(dAangle) * length * sy));
pt.X += center.X;
Expand Down
10 changes: 5 additions & 5 deletions file_plugins/dxf/entities/dxf_spline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ inline double qwtFastAtan2(double y, double x)

if (x < 0) {
const double d = qwtFastAtan(y / x);
return (y >= 0) ? d + M_PI : d - M_PI;
return (y >= 0) ? d + pi : d - pi;
}

if (y < 0.0)
Expand All @@ -373,13 +373,13 @@ inline double qwtFastAtan2(double y, double x)
//! Translate degrees into radians
inline double qwtRadians(double degrees)
{
return degrees * M_PI / 180.0;
return degrees * pi / 180.0;
}

//! Translate radians into degrees
inline double qwtDegrees(double degrees)
{
return degrees * 180.0 / M_PI;
return degrees * 180.0 / pi;
}

inline double qwtGetMin(const double* array, int size)
Expand Down Expand Up @@ -418,9 +418,9 @@ inline double qwtGetMax(const double* array, int size)
*/
inline double qwtNormalizeRadians(double radians)
{
double a = ::fmod(radians, 2.0 * M_PI);
double a = ::fmod(radians, 2.0 * pi);
if (a < 0.0)
a += 2.0 * M_PI;
a += 2.0 * pi;

return a;
}
Expand Down
2 changes: 1 addition & 1 deletion file_plugins/excellon/excellon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Name" : "GCode",
"Version" : "1.0",
"Version" : "1.1",
"VendorAuthor" : "X-Ray aka Bakiev Damir",
"Info" : "Info"
}
17 changes: 9 additions & 8 deletions file_plugins/excellon/exparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,17 @@ bool Parser::parsePos(const QString& line)
if (!X.size() && !Y.size())
return false;

if (X.size())
if (X.size()) {
m_state.rawPos.X = QString { CtreCapTo(X) };
if (Y.size())
parseNumber(CtreCapTo(X), m_state.pos.rx());
}
if (Y.size()) {
m_state.rawPos.Y = QString { CtreCapTo(Y) };
parseNumber(CtreCapTo(Y), m_state.pos.ry());
}
if (A.size())
m_state.rawPos.A = QString { CtreCapTo(A) };

parseNumber(CtreCapTo(X), m_state.pos.rx());
parseNumber(CtreCapTo(Y), m_state.pos.ry());

switch (m_state.wm) {
case DrillMode:
file->append(Hole(m_state, file));
Expand Down Expand Up @@ -492,12 +493,12 @@ QPolygonF Parser::arc(QPointF p1, QPointF p2, QPointF center)
const int intSteps = App::settings().clpCircleSegments(radius * dScale); //MinStepsPerCircle;

if (m_state.gCode == G02 && stop >= start)
stop -= 2.0 * M_PI;
stop -= 2.0 * pi;
else if (m_state.gCode == G03 && stop <= start)
stop += 2.0 * M_PI;
stop += 2.0 * pi;

double angle = qAbs(stop - start);
double steps = qMax(static_cast<int>(ceil(angle / (2.0 * M_PI) * intSteps)), 2);
double steps = qMax(static_cast<int>(ceil(angle / (2.0 * pi) * intSteps)), 2);
double delta_angle = da_sign[m_state.gCode] * angle * 1.0 / steps;
for (int i = 0; i < steps; i++) {
double theta = start + delta_angle * (i + 1);
Expand Down
6 changes: 0 additions & 6 deletions file_plugins/excellon/explugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@

namespace Excellon {

#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif

//const int id1 = qRegisterMetaType<Gerber::File*>("Gerber::GFile*");

Plugin::Plugin(QObject* parent)
: QObject(parent)
, Parser(this)
Expand Down
2 changes: 1 addition & 1 deletion file_plugins/gerber/gbraperture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ QString ApPolygon::name() const { return QString("P(Ø%1, N%2)").arg(m_diam).arg

ApertureType ApPolygon::type() const { return Polygon; }

bool ApPolygon::fit(double toolDiam) const { return m_diam * cos(M_PI / m_verticesCount) > toolDiam; }
bool ApPolygon::fit(double toolDiam) const { return m_diam * cos(pi / m_verticesCount) > toolDiam; }

void ApPolygon::read(QDataStream& stream)
{
Expand Down
12 changes: 6 additions & 6 deletions file_plugins/gerber/gbrparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ mvector<QString> Parser::cleanAndFormatFile(QString data)
double Parser::arcAngle(double start, double stop)
{
if (m_state.interpolation() == CounterclockwiseCircular && stop <= start)
stop += 2.0 * M_PI;
stop += 2.0 * pi;
if (m_state.interpolation() == ClockwiseCircular && stop >= start)
stop -= 2.0 * M_PI;
stop -= 2.0 * pi;
return qAbs(stop - start);
}

Expand Down Expand Up @@ -547,12 +547,12 @@ Path Parser::arc(const IntPoint& center, double radius, double start, double sto
const int intSteps = App::settings().clpCircleSegments(radius * dScale); //MinStepsPerCircle;

if (m_state.interpolation() == ClockwiseCircular && stop >= start)
stop -= 2.0 * M_PI;
stop -= 2.0 * pi;
else if (m_state.interpolation() == CounterclockwiseCircular && stop <= start)
stop += 2.0 * M_PI;
stop += 2.0 * pi;

double angle = qAbs(stop - start);
double steps = qMax(static_cast<int>(ceil(angle / (2.0 * M_PI) * intSteps)), 2);
double steps = qMax(static_cast<int>(ceil(angle / (2.0 * pi) * intSteps)), 2);
double delta_angle = da_sign[m_state.interpolation()] * angle * 1.0 / steps;
for (int i = 0; i < steps; i++) {
double theta = start + delta_angle * (i + 1);
Expand Down Expand Up @@ -1025,7 +1025,7 @@ bool Parser::parseCircularInterpolation(const QString& gLine)
const double start = atan2(-j, -i);
const double stop = atan2(-centerPos[c].Y + y, -centerPos[c].X + x);
const double angle = arcAngle(start, stop);
if (angle < (M_PI + 1e-5) * 0.5) {
if (angle < (pi + 1e-5) * 0.5) {
arcPolygon = arc(IntPoint(centerPos[c].X, centerPos[c].Y), radius1, start, stop);
// Replace with exact values
m_state.setCurPos({ x, y });
Expand Down
8 changes: 2 additions & 6 deletions file_plugins/gerber/gbrplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@

namespace Gerber {

#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif

const int id1 = qRegisterMetaType<File*>("G::GFile*");

Plugin::Plugin(QObject* parent)
Expand Down Expand Up @@ -151,7 +147,7 @@ QJsonObject Plugin::info() const
{
return QJsonObject {
{ "Name", "Gerber X3" },
{ "Version", "1.0" },
{ "Version", "1.1" },
{ "VendorAuthor", "X-Ray aka Bakiev Damir" },
{ "Info", "Opening GerberX3 files, with support for all kinds of aperture macros and components." },
};
Expand Down Expand Up @@ -374,7 +370,7 @@ class ThermalPreviewItem final : public AbstractThermPrGi {
const auto fp(sourcePath.toFillPolygons());
for (int i = 0; i < m_node->count(); ++i) { // Gaps
ClipperOffset offset;
double angle = i * 2 * M_PI / m_node->count() + qDegreesToRadians(m_node->angle());
double angle = i * 2 * pi / m_node->count() + qDegreesToRadians(m_node->angle());
offset.AddPath({ center,
IntPoint(
static_cast<cInt>((cos(angle) * radius) + center.X),
Expand Down
2 changes: 1 addition & 1 deletion file_plugins/gerber/gerber.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Name" : "GCode",
"Version" : "1.0",
"Version" : "1.1",
"VendorAuthor" : "X-Ray aka Bakiev Damir",
"Info" : "Info"
}
6 changes: 2 additions & 4 deletions shape_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(SUFFIX "_msvc")
endif()

#if("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
#if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(SUFFIX "${SUFFIX}_x64")
set(PLUGINS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../bin_x64/plugins")
set(PLUGINS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../bin_x64")
else()
set(SUFFIX "${SUFFIX}_x32")
set(PLUGINS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../bin_x32/plugins")
set(PLUGINS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../bin_x32")
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand Down
Loading

0 comments on commit 4ccf3d2

Please sign in to comment.