Skip to content

Commit 7a54b5d

Browse files
committed
merged dev900b in to dev
2 parents 0365749 + 59e48cd commit 7a54b5d

16 files changed

+335
-30
lines changed

external_dependencies/ChaiScript

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 6939982a0df8114bc426a1b8745f2b811b464fc3

external_dependencies/Clipper2

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit d3fbd4a1d642d0446bdc7739b471159539e3f465
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 903f8ccbfbfad46ade9f851ef138397336f05d43

external_dependencies/pfr_non_boost

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 26623019cc6a2aba2b26489bf9c860cc7a7699f4

plugins/CMakeLists.txt

+23
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,34 @@ else()
1818
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${STATIC_LIBS_DIR})
1919
endif()
2020

21+
set(Enable OFF)
22+
2123
# plugins shape
24+
set(Enable_Circle OFF) #[["Enable_Circle"]]
25+
set(Enable_Circlearc OFF) #[["Enable_Circlearc"]]
26+
set(Enable_Polyline OFF) #[["Enable_Polyline"]]
27+
set(Enable_Rectangle OFF) #[["Enable_Rectangle"]]
28+
set(Enable_Text OFF) #[["Enable_Text"]]
2229
add_subdirectory(shape)
2330

2431
# plugins file
32+
set(Enable_Gerber ON) #[["Enable_Gerber"]]
33+
set(Enable_Dxf OFF) #[["Enable_Dxf"]]
34+
set(Enable_Excellon OFF) #[["Enable_Excellon"]]
2535
add_subdirectory(file)
2636

2737
# plugins gcode
38+
set(Enable_Drill OFF) #[["Enable_Drill"]]
39+
set(Enable_Hatching OFF) #[["Enable_Hatching"]]
40+
set(Enable_Pocketoffset OFF) #[["Enable_Pocketoffset"]]
41+
set(Enable_Pocketraster OFF) #[["Enable_Pocketraster"]]
42+
set(Enable_Profile OFF) #[["Enable_Profile"]]
43+
set(Enable_Thermal OFF) #[["Enable_Thermal"]]
44+
set(Enable_Voroni OFF) #[["Enable_Voroni"]]
2845
add_subdirectory(gcode)
46+
47+
48+
49+
50+
51+

plugins/file/CMakeLists.txt

+16-1
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,28 @@ else()
6262
qt5_add_translation(${QM_FILES} ${TS_FILES})
6363
endif()
6464

65-
65+
if(Enable_Gerber)
6666
add_subdirectory(gerber)
67+
endif()
68+
69+
if(Enable_Dxf)
6770
add_subdirectory(dxf)
71+
endif()
72+
73+
if(Enable_Excellon)
6874
add_subdirectory(excellon)
75+
endif()
76+
77+
# if(Enable_TopoR)
6978
#add_subdirectory(TopoR)
79+
# endif()
7080

81+
# if(Enable_File)
7182
#add_subdirectory(file)
83+
# endif()
84+
85+
# if(Enable_Hpgl)
7286
#add_subdirectory(hpgl)
87+
# endif()
7388

7489

plugins/file/gerber/gbr_aperture.cpp

+16-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include <QDebug>
1717
#include <QLineF>
18+
#include <QtQml/QJSEngine>
19+
#include <QtQml/QJSValue>
1820

1921
namespace Gerber {
2022

@@ -394,6 +396,10 @@ void ApMacro::draw() {
394396
try {
395397
// for (int i = 0; i < modifiers_.size(); ++i) {
396398
// QString var(modifiers_[i]);
399+
400+
QJSEngine js;
401+
for(auto&& [name, value]: macroCoefficients)
402+
js.globalObject().setProperty(name, value);
397403
for(QString& var: modifiers_) {
398404
if(var.at(0) == '0') // Skip Comment
399405
continue;
@@ -403,12 +409,20 @@ void ApMacro::draw() {
403409
if(var.contains('=')) {
404410
QList<QString> stringList = var.split('=');
405411
stringList.last().replace(QChar('x'), '*', Qt::CaseInsensitive);
406-
macroCoefficients[stringList.first()] = MathParser(&macroCoefficients).parse(stringList.last());
412+
413+
auto val = js.evaluate(stringList.last());
414+
if(val.errorType()) qWarning() << val.toString();
415+
js.globalObject().setProperty(stringList.first(), val.toNumber());
407416
continue;
408417
} else {
409418
for(auto&& var2: var.split(',')) {
410419
var2.replace(QChar('x'), '*', Qt::CaseInsensitive);
411-
mod.push_back(var2.contains('$') ? MathParser(&macroCoefficients).parse(var2) : var2.toDouble());
420+
if(var2.contains('$')) {
421+
auto val = js.evaluate(var2);
422+
if(val.errorType()) qWarning() << val.toString();
423+
mod.push_back(val.toNumber());
424+
} else
425+
mod.push_back(var2.toDouble());
412426
}
413427
}
414428

plugins/file/gerber/gbr_aperture.h

+6
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
*******************************************************************************/
1111
#pragma once
1212
#include "gbr_types.h"
13+
<<<<<<< HEAD
1314
#define MT 3
1415
#include "mathparser.h"
16+
=======
17+
// #define MT 1
18+
// #include "mathparser.h"
19+
>>>>>>> refs/heads/dev900b
1520

1621
#include <QtMath>
1722
#include <numbers>
@@ -183,6 +188,7 @@ class ApPolygon final : public AbstractAperture {
183188
/////////////////////////////////////////////////////
184189
/// \brief The GAMacro class
185190
///
191+
using VarMap = std::map<QString, double>;
186192
class ApMacro final : public AbstractAperture {
187193
public:
188194
ApMacro(const QString& macro, const QList<QString>& modifiers, const VarMap& coefficients, const File* file);

plugins/gcode/CMakeLists.txt

+22
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,37 @@ else()
6767
qt5_add_translation(${QM_FILES} ${TS_FILES})
6868
endif()
6969

70+
71+
if(Enable_Pocketoffset)
7072
add_subdirectory(pocketoffset)
73+
endif()
74+
75+
if(Enable_Profile)
7176
add_subdirectory(profile)
77+
endif()
78+
79+
if(Enable_Drill)
7280
add_subdirectory(drill)
81+
endif()
7382

83+
if(Enable_Hatching)
7484
add_subdirectory(hatching)
85+
endif()
86+
87+
if(Enable_Pocketraster)
7588
add_subdirectory(pocketraster)
89+
endif()
90+
91+
if(Enable_Voroni)
7692
add_subdirectory(voroni)
93+
endif()
7794

95+
if(Enable_Thermal)
7896
add_subdirectory(thermal)
97+
endif()
7998

99+
if(Enable_Thread)
80100
# add_subdirectory(thread)
101+
endif()
102+
81103

plugins/shape/CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,23 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
5050
Qt${QT_VERSION_MAJOR}::Widgets
5151
)
5252

53+
if(Enable_Circle)
5354
add_subdirectory(circle)
55+
endif()
56+
57+
if(Enable_Circlearc)
5458
add_subdirectory(circlearc)
59+
endif()
60+
61+
if(Enable_Polyline)
5562
add_subdirectory(polyline)
63+
endif()
64+
65+
if(Enable_Rectangle)
5666
add_subdirectory(rectangle)
67+
endif()
68+
69+
if(Enable_Text)
5770
add_subdirectory(text)
71+
endif()
5872

static_libs/common/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set(CMAKE_AUTOUIC ON)
2121
set(CMAKE_AUTOMOC ON)
2222
set(CMAKE_AUTORCC ON)
2323

24-
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED)
24+
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Qml REQUIRED)
2525

2626
file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
2727
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
@@ -39,6 +39,7 @@ target_link_libraries(common PRIVATE
3939
gi
4040
graphicsview
4141
Qt${QT_VERSION_MAJOR}::Core
42+
Qt${QT_VERSION_MAJOR}::Qml
4243
Qt${QT_VERSION_MAJOR}::Gui
4344
Qt${QT_VERSION_MAJOR}::Widgets
4445
)

0 commit comments

Comments
 (0)