-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtengrave.py
More file actions
120 lines (87 loc) · 3.99 KB
/
tengrave.py
File metadata and controls
120 lines (87 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtWidgets import *
from tools import *
#from tools.modeltool import *
#from tools.tool import *
#from tools.milltask import *
#import pyqtgraph.opengl as gl
#import pyqtgraph as pg
from solids import *
import sys
from guifw.gui_elements import *
#from modeldialog import *
from pathdialog import *
from taskdialog import *
from grbldialog import *
from objectviewer import *
from gcode_editor import *
from tools.textengrave import *
from tools.tool import *
from guifw.abstractparameters import *
import tools.modeltool
class SimpleEngrave(TextEngraveTask):
def __init__(self, viewUpdater = None, model = None, pathdialog = None, **kwargs):
self.laser_tool = Tool(name="Laser", diameter=0.1)
self.path_dialog = pathdialog
TextEngraveTask.__init__(self, model = model, tools = [self.laser_tool], viewUpdater = viewUpdater)
self.output_pathtool = PathTool(name="text_path", path=self.path, model=self.model,
viewUpdater=self.updateOutputView, tool=self.laser_tool,
source=None)
self.output_pathtool.feedrate.updateValue(900)
self.textInput.callback = self.create_path
self.fontsize.updateValue(13)
self.radialOffset.updateValue(0.05)
self.create = ActionParameter(parent = self, name = "create path", callback = self.create_path)
self.parameters = [[self.textInput, self.create],
[self.font, self.fontsize],
[self.output_pathtool.laser_mode,
self.output_pathtool.feedrate],
self.tool,
self.traverseHeight,
self.radialOffset,
]
def updateOutputView(self, path, tool):
self.path_dialog.update_view(path=self.output_pathtool.getCompletePath(), tool=self.laser_tool)
def create_path(self, param):
self.generatePattern()
self.path = self.calcPath()
self.viewUpdater(self.path)
existingPath = self.path_dialog.pathtab.findItem("text_path")
if existingPath is None:
self.path_dialog.pathtab.listmodel.addItem(self.output_pathtool)
else:
# update path
existingPath.updatePath(self.path)
class CAMGui(QtWidgets.QSplitter):
def __init__(self):
QtWidgets.QSplitter.__init__(self)
self.editor = GcodeEditorWidget()
self.objectviewer = ObjectViewer(editor=self.editor)
#self.objectviewer = ObjectViewer()
self.tabs=QtWidgets.QTabWidget()
self.modeltool = tools.modeltool.ModelTool(viewUpdater=self.objectviewer.showPath)
self.availablePathTools = OrderedDict([("Load GCode", PathTool)])
self.pathtab = PathDialog(viewer = self.objectviewer, tools=None, editor=self.editor, availablePathTools = self.availablePathTools)
self.grbltab = GrblDialog(path_dialog=self.pathtab, editor=self.editor)
self.engrave_tool = SimpleEngrave(viewUpdater = self.objectviewer.showPath, model = self.modeltool, pathdialog = self.pathtab )
self.engrave_tab = ToolPropertyWidget(parent = self, tool = self.engrave_tool)
self.left_widget = QtWidgets.QSplitter(Qt.Vertical)
#self.left_layout = QtWidgets.QVBoxLayout()
self.left_widget.addWidget(self.grbltab)
self.left_widget.addWidget(self.engrave_tab)
self.addWidget(self.left_widget)
self.centerWidget = QtWidgets.QSplitter(Qt.Vertical)
self.centerWidget.addWidget(self.objectviewer)
self.centerWidget.addWidget(self.editor)
self.addWidget(self.centerWidget)
self.setWindowTitle('Machine Interface')
self.updateGeometry()
self.resize(1600, 1200)
## Display the widget as a new window
app = QtWidgets.QApplication([])
camgui=CAMGui()
camgui.show()
if len(sys.argv)>1 and sys.argv[1]=="-f":
camgui.showFullScreen()
## Start the Qt event loop
app.exec_()