- added flipx and flipy functions
This commit is contained in:
parent
cae8f35154
commit
e5dab6f9c3
|
@ -536,6 +536,8 @@ class App(QtCore.QObject):
|
||||||
self.ui.menuoptions_transfer_p2a.triggered.connect(self.on_options_project2app)
|
self.ui.menuoptions_transfer_p2a.triggered.connect(self.on_options_project2app)
|
||||||
self.ui.menuoptions_transfer_o2p.triggered.connect(self.on_options_object2project)
|
self.ui.menuoptions_transfer_o2p.triggered.connect(self.on_options_object2project)
|
||||||
self.ui.menuoptions_transfer_p2o.triggered.connect(self.on_options_project2object)
|
self.ui.menuoptions_transfer_p2o.triggered.connect(self.on_options_project2object)
|
||||||
|
self.ui.menuoptions_transform_flipx.triggered.connect(self.on_flipx)
|
||||||
|
self.ui.menuoptions_transform_flipy.triggered.connect(self.on_flipy)
|
||||||
self.ui.menuviewdisableall.triggered.connect(self.disable_plots)
|
self.ui.menuviewdisableall.triggered.connect(self.disable_plots)
|
||||||
self.ui.menuviewdisableother.triggered.connect(lambda: self.disable_plots(except_current=True))
|
self.ui.menuviewdisableother.triggered.connect(lambda: self.disable_plots(except_current=True))
|
||||||
self.ui.menuviewenable.triggered.connect(self.enable_all_plots)
|
self.ui.menuviewenable.triggered.connect(self.enable_all_plots)
|
||||||
|
@ -1485,6 +1487,88 @@ class App(QtCore.QObject):
|
||||||
|
|
||||||
# self.options2form()
|
# self.options2form()
|
||||||
|
|
||||||
|
def on_flipx(self):
|
||||||
|
obj_list = self.collection.get_selected()
|
||||||
|
xminlist = []
|
||||||
|
yminlist = []
|
||||||
|
xmaxlist = []
|
||||||
|
ymaxlist = []
|
||||||
|
|
||||||
|
if not obj_list:
|
||||||
|
self.inform.emit("WARNING: No object selected.")
|
||||||
|
msg = "Please Select an object to flip!"
|
||||||
|
warningbox = QtGui.QMessageBox()
|
||||||
|
warningbox.setText(msg)
|
||||||
|
warningbox.setWindowTitle("Warning ...")
|
||||||
|
warningbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
|
||||||
|
warningbox.setStandardButtons(QtGUi.QMessageBox.Ok)
|
||||||
|
warningbox.setDefaultButton(QtGui.QMessageBox.Ok)
|
||||||
|
warningbox.exec_()
|
||||||
|
else:
|
||||||
|
# first get a bounding box to fit all
|
||||||
|
for obj in obj_list:
|
||||||
|
xmin, ymin, xmax, ymax = obj.bounds()
|
||||||
|
xminlist.append(xmin)
|
||||||
|
yminlist.append(ymin)
|
||||||
|
xmaxlist.append(xmax)
|
||||||
|
ymaxlist.append(ymax)
|
||||||
|
|
||||||
|
# get the minimum x,y and maximum x,y for all objects selected
|
||||||
|
xminimal = min(xminlist)
|
||||||
|
yminimal = min(yminlist)
|
||||||
|
xmaximal = max(xmaxlist)
|
||||||
|
ymaximal = max(ymaxlist)
|
||||||
|
|
||||||
|
px = 0.5 * (xminimal + xmaximal)
|
||||||
|
py = 0.5 * (yminimal + ymaximal)
|
||||||
|
|
||||||
|
# execute mirroring
|
||||||
|
for obj in obj_list:
|
||||||
|
obj.mirror('X', [px, py])
|
||||||
|
obj.plot()
|
||||||
|
self.info('Flipped on the X axis ...')
|
||||||
|
|
||||||
|
def on_flipy(self):
|
||||||
|
obj_list = self.collection.get_selected()
|
||||||
|
xminlist = []
|
||||||
|
yminlist = []
|
||||||
|
xmaxlist = []
|
||||||
|
ymaxlist = []
|
||||||
|
|
||||||
|
if not obj_list:
|
||||||
|
self.inform.emit("WARNING: No object selected.")
|
||||||
|
msg = "Please Select an object to flip!"
|
||||||
|
warningbox = QtGui.QMessageBox()
|
||||||
|
warningbox.setText(msg)
|
||||||
|
warningbox.setWindowTitle("Warning ...")
|
||||||
|
warningbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
|
||||||
|
warningbox.setStandardButtons(QtGui.QMessageBox.Ok)
|
||||||
|
warningbox.setDefaultButton(QtGui.QMessageBox.Ok)
|
||||||
|
warningbox.exec_()
|
||||||
|
else:
|
||||||
|
# first get a bounding box to fit all
|
||||||
|
for obj in obj_list:
|
||||||
|
xmin, ymin, xmax, ymax = obj.bounds()
|
||||||
|
xminlist.append(xmin)
|
||||||
|
yminlist.append(ymin)
|
||||||
|
xmaxlist.append(xmax)
|
||||||
|
ymaxlist.append(ymax)
|
||||||
|
|
||||||
|
# get the minimum x,y and maximum x,y for all objects selected
|
||||||
|
xminimal = min(xminlist)
|
||||||
|
yminimal = min(yminlist)
|
||||||
|
xmaximal = max(xmaxlist)
|
||||||
|
ymaximal = max(ymaxlist)
|
||||||
|
|
||||||
|
px = 0.5 * (xminimal + xmaximal)
|
||||||
|
py = 0.5 * (yminimal + ymaximal)
|
||||||
|
|
||||||
|
# execute mirroring
|
||||||
|
for obj in obj_list:
|
||||||
|
obj.mirror('Y', [px, py])
|
||||||
|
obj.plot()
|
||||||
|
self.info('Flipped on the Y axis ...')
|
||||||
|
|
||||||
def on_delete(self):
|
def on_delete(self):
|
||||||
"""
|
"""
|
||||||
Delete the currently selected FlatCAMObjs.
|
Delete the currently selected FlatCAMObjs.
|
||||||
|
|
|
@ -105,7 +105,7 @@ class FlatCAMGUI(QtGui.QMainWindow):
|
||||||
|
|
||||||
### Options ###
|
### Options ###
|
||||||
self.menuoptions = self.menu.addMenu('&Options')
|
self.menuoptions = self.menu.addMenu('&Options')
|
||||||
self.menuoptions_transfer = self.menuoptions.addMenu('Transfer options')
|
self.menuoptions_transfer = self.menuoptions.addMenu(QtGui.QIcon('share/transfer.png'), 'Transfer options')
|
||||||
self.menuoptions_transfer_a2p = self.menuoptions_transfer.addAction("Application to Project")
|
self.menuoptions_transfer_a2p = self.menuoptions_transfer.addAction("Application to Project")
|
||||||
self.menuoptions_transfer_p2a = self.menuoptions_transfer.addAction("Project to Application")
|
self.menuoptions_transfer_p2a = self.menuoptions_transfer.addAction("Project to Application")
|
||||||
self.menuoptions_transfer_p2o = self.menuoptions_transfer.addAction("Project to Object")
|
self.menuoptions_transfer_p2o = self.menuoptions_transfer.addAction("Project to Object")
|
||||||
|
@ -113,6 +113,13 @@ class FlatCAMGUI(QtGui.QMainWindow):
|
||||||
self.menuoptions_transfer_a2o = self.menuoptions_transfer.addAction("Application to Object")
|
self.menuoptions_transfer_a2o = self.menuoptions_transfer.addAction("Application to Object")
|
||||||
self.menuoptions_transfer_o2a = self.menuoptions_transfer.addAction("Object to Application")
|
self.menuoptions_transfer_o2a = self.menuoptions_transfer.addAction("Object to Application")
|
||||||
|
|
||||||
|
### Transform Object ###
|
||||||
|
self.menuoptions_transform = self.menuoptions.addMenu(QtGui.QIcon('share/transform.png'), '&Transform Object')
|
||||||
|
self.menuoptions_transform_flipx = self.menuoptions_transform.addAction(QtGui.QIcon('share/flipx.png'),
|
||||||
|
"Flip Selection on &X axis")
|
||||||
|
self.menuoptions_transform_flipy = self.menuoptions_transform.addAction(QtGui.QIcon('share/flipy.png'),
|
||||||
|
"Flip Selection on &Y axis")
|
||||||
|
|
||||||
### View ###
|
### View ###
|
||||||
self.menuview = self.menu.addMenu('&View')
|
self.menuview = self.menu.addMenu('&View')
|
||||||
self.menuviewdisableall = self.menuview.addAction(QtGui.QIcon('share/clear_plot16.png'), 'Disable all plots')
|
self.menuviewdisableall = self.menuview.addAction(QtGui.QIcon('share/clear_plot16.png'), 'Disable all plots')
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 522 B |
Binary file not shown.
After Width: | Height: | Size: 514 B |
Binary file not shown.
After Width: | Height: | Size: 684 B |
Binary file not shown.
After Width: | Height: | Size: 551 B |
Loading…
Reference in New Issue