Exemple #1
0
def main():
    from CoreXY import CoreXY
    from SimpleMagnetToolhead import SimpleMagnetToolhead

    app = QtGui.QApplication(sys.argv)

    cxy = CoreXY()
    tool = SimpleMagnetToolhead(4,5)
    cxy.set_toolhead(tool)

    gui = MagicTableMainWindow(cxy)
    gui.show()

    sys.exit(app.exec_())
            elif e.key() ==QtCore.Qt.Key_Left:
                self.onMoveLeftButton()
            elif e.key() ==QtCore.Qt.Key_Right:
                self.onMoveRightButton()
            else:
                e.ignore()
        else:
            e.ignore()

    def closeEvent(self, event):
        if self.machine:
            self.machine.disconnect()
        event.accept()

    def focusOutEvent(self, event):
        self.setFocus()


if __name__ == '__main__':
    from SimpleMagnetToolhead import SimpleMagnetToolhead

    app = QtGui.QApplication(sys.argv)

    cxy = CoreXY()
    tool = SimpleMagnetToolhead(4,5)
    cxy.set_toolhead(tool)

    gui = ControllerGUI(None, cxy)
    gui.show()

    sys.exit(app.exec_())
Exemple #3
0
    cleanup_movements = [('H7', 'H1'), ('D2', 'D1'), ('B0', 'A1'), ('F8', 'F4'), ('D8', 'H8'), ('F4', 'A8')]
    for origin, destination in cleanup_movements:
        pick_and_place(machine, chess_to_coord(origin, table), chess_to_coord(destination, table))
        t.sleep(5)
    machine.home()

    # End
    machine.home()

    try:
        cxy.save_to_file('chess.gcode')
    except AttributeError:
        pass
    machine.disconnect()


if __name__ == '__main__':
    mockup = True

    if not mockup:
        cxy = CoreXY()
        tool = SimpleMagnetToolhead(4,5)
    else:
        cxy = CoreXYMockup()
        tool = SimpleMagnetToolheadMockup(4,5)

    cxy.set_toolhead(tool)
    try:
        main(cxy)
    except:
        cxy.disconnect()
Exemple #4
0
            elif e.key() == QtCore.Qt.Key_Left:
                self.onMoveLeftButton()
            elif e.key() == QtCore.Qt.Key_Right:
                self.onMoveRightButton()
            else:
                e.ignore()
        else:
            e.ignore()

    def closeEvent(self, event):
        if self.machine:
            self.machine.disconnect()
        event.accept()

    def focusOutEvent(self, event):
        self.setFocus()


if __name__ == '__main__':
    from SimpleMagnetToolhead import SimpleMagnetToolhead

    app = QtGui.QApplication(sys.argv)

    cxy = CoreXY()
    tool = SimpleMagnetToolhead(4, 5)
    cxy.set_toolhead(tool)

    gui = ControllerGUI(None, cxy)
    gui.show()

    sys.exit(app.exec_())
                    time.sleep(0.1)
                    i += 1
                    if self.trajectory_controller.isFinished():
                        print "Abort: Finished thread"
                        break
                else:
                    print "Terminating move thread"
                    self.trajectory_controller.terminate()

        super(TrajectoryWidget, self).abort()


if __name__ == '__main__':
    from TrajectoryController import TrajectoryController
    from CoreXY import CoreXY
    from SimpleMagnetToolhead import SimpleMagnetToolhead

    app = QtGui.QApplication(sys.argv)

    tj = TrajectoryController()
    cxy = CoreXY()
    tool = SimpleMagnetToolhead(4,5)
    cxy.set_toolhead(tool)
    cxy.connect()
    cxy.home()
    cxy.toolhead.set_magnet(0, 'on')
    cxy.toolhead.set_magnet(1, 'on')
    gui = TrajectoryWidget(None, cxy)
    gui.start()
    sys.exit(app.exec_())
    for origin, destination in cleanup_movements:
        pick_and_place(machine, chess_to_coord(origin, table),
                       chess_to_coord(destination, table))
        t.sleep(5)
    machine.home()

    # End
    machine.home()

    try:
        cxy.save_to_file('chess.gcode')
    except AttributeError:
        pass
    machine.disconnect()


if __name__ == '__main__':
    mockup = True

    if not mockup:
        cxy = CoreXY()
        tool = SimpleMagnetToolhead(4, 5)
    else:
        cxy = CoreXYMockup()
        tool = SimpleMagnetToolheadMockup(4, 5)

    cxy.set_toolhead(tool)
    try:
        main(cxy)
    except:
        cxy.disconnect()
Exemple #7
0
                    time.sleep(0.1)
                    i += 1
                    if self.trajectory_controller.isFinished():
                        print "Abort: Finished thread"
                        break
                else:
                    print "Terminating move thread"
                    self.trajectory_controller.terminate()

        super(TrajectoryWidget, self).abort()


if __name__ == '__main__':
    from TrajectoryController import TrajectoryController
    from CoreXY import CoreXY
    from SimpleMagnetToolhead import SimpleMagnetToolhead

    app = QtGui.QApplication(sys.argv)

    tj = TrajectoryController()
    cxy = CoreXY()
    tool = SimpleMagnetToolhead(4, 5)
    cxy.set_toolhead(tool)
    cxy.connect()
    cxy.home()
    cxy.toolhead.set_magnet(0, 'on')
    cxy.toolhead.set_magnet(1, 'on')
    gui = TrajectoryWidget(None, cxy)
    gui.start()
    sys.exit(app.exec_())
                widget = QtGui.QCheckBox('Magnet %d' % i)
                widget.setChecked(False)
                fn = lambda state, magnet_id = i: self.toolhead.set_magnet(magnet_id, self.state_dict[state])
                widget.stateChanged.connect(fn)
                self.addWidget(widget)
            self.addStretch(1)

except ImportError:
    print "[Warning] PySide not installed, widget not loaded"

if __name__ == '__main__':
    from CoreXY import CoreXY
    import time

    # CoreXY startup
    cxy = CoreXY()
    cxy.reset()
    cxy.connect()
    time.sleep(2)

    # Add toolhead
    tool = SimpleMagnetToolhead(4, 5)
    cxy.set_toolhead(tool)
    if len(cxy.toolhead.magnets) == 2:
        if cxy.toolhead.magnets[0]['pin'] != 4 or cxy.toolhead.magnets[0]['status'] != 'off':
            print '[Error] Toolhead configuration of magnet 0 went wrong'
        if cxy.toolhead.magnets[1]['pin'] != 5 or cxy.toolhead.magnets[1]['status'] != 'off':
            print '[Error] Toolhead configuration of magnet 0 went wrong'
    else:
        print '[Error] Toolhead configuration went wrong: incorrect number of magnets'