コード例 #1
0
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

pyRepRap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with pyRepRap.  If not, see <http://www.gnu.org/licenses/>.
"""

import reprap

# Initialise serial port, here the first port (0) is used, timeout 60 seconds.
reprap.openSerial( 0, 19200, 60 )
# These devices are present in network, will automatically scan in the future.
reprap.cartesian.x.active = True
reprap.cartesian.y.active = True
reprap.cartesian.z.active = True
reprap.extruder.active = True

reprap.cartesian.x.setNotify()
reprap.cartesian.y.setNotify()
reprap.cartesian.z.setNotify()

reprap.cartesian.setSpeed(220)
reprap.cartesian.setPower( int( 83 * 0.63 ) )
reprap.cartesian.homeReset()

コード例 #2
0
    def run(self):
        self.alive = True

        self.feedbackHandler.setStatus("Configuring RepRap...")
        if self.pref_enableLimit:
            reprap.cartesian.x.limit = self.pref_limitX
            reprap.cartesian.y.limit = self.pref_limitY
        else:
            reprap.cartesian.x.limit = 0
            reprap.cartesian.y.limit = 0

        try:
            # Initialise serial port.
            reprap.openSerial(self.pref_serialPort, self.pref_baudRate,
                              self.pref_timeout)
        except reprap._RepRapError:
            self.feedbackHandler.showMessagePopup(
                "You do not have the required permissions to access the serial port.\nTry granting your user permissions (recommended) or run as root (less recommended)."
            )
            self.alive = False
            self.feedbackHandler.aborted()

        if self.alive:
            # Prepare reprap for use
            reprap.cartesian.x.active = True
            reprap.cartesian.y.active = True
            reprap.cartesian.z.active = True
            reprap.cartesian.x.setNotify()
            reprap.cartesian.y.setNotify()
            reprap.cartesian.z.setNotify()
            reprap.cartesian.setSpeed(self.pref_speed)
            reprap.cartesian.setPower(self.pref_torque)
            self.feedbackHandler.setStatus("Reseting axies...")
            reprap.cartesian.homeReset()

            self.toolhead.prepare()
            self.feedbackHandler.setStatus("Starting plot...")

            # Start plot
            for layer in self.toolpath.layers:
                reprap.cartesian.homeReset()
                self.curX, self.curY = 0, 0
                for ip, polygon in enumerate(layer.polygons):
                    if not self.alive:
                        self.feedbackHandler.aborted()
                        break
                    progress = int(
                        float(ip) / float(len(layer.polygons)) * 100)
                    self.feedbackHandler.setStatus("Plotting polygons..." +
                                                   str(progress) + "%")
                    self.toolhead.ready()
                    x1, y1 = polygon.points[
                        0].x + self.toolpath.offsetX, polygon.points[
                            0].y + self.toolpath.offsetY
                    #x2, y2 = reprap.cartesian.x.getPos(), reprap.cartesian.y.getPos()
                    # If we are not in the polygon start place, switch off tool and move there
                    if (x1 != self.curX) or (y1 != self.curY):
                        self.toolhead.stop()
                        self.cartesianMove(x1, y1, None)
                    # Start tool
                    self.toolhead.start()
                    polygon.pointsPlotted = 0
                    # Plot polygon
                    for p in polygon.points[1:]:
                        if not self.alive:
                            self.feedbackHandler.aborted()
                            break
                        x2, y2 = p.x + self.toolpath.offsetX, p.y + self.toolpath.offsetY
                        # If we need to move somwhere, do it
                        if (x1 != x2) or (y1 != y2):
                            self.cartesianMove(x2, y2, None)
                        polygon.pointsPlotted += 1
                    #x1, y1 = x2, y2

            self.toolhead.stop()
            self.toolhead.idle()
            reprap.cartesian.homeReset()
            reprap.cartesian.free()
            reprap.closeSerial()

        if self.alive:
            # Tell gui that plot is complete (redraw screen)
            self.feedbackHandler.plotComplete()
コード例 #3
0
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

pyRepRap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with pyRepRap.  If not, see <http://www.gnu.org/licenses/>.
"""

import reprap

# Initialise serial port, here the first port (0) is used, timeout 60 seconds.
reprap.openSerial(0, 19200, 60)
# These devices are present in network, will automatically scan in the future.
reprap.cartesian.x.active = True
reprap.cartesian.y.active = True
reprap.cartesian.z.active = True
reprap.extruder.active = True

reprap.cartesian.x.setNotify()
reprap.cartesian.y.setNotify()
reprap.cartesian.z.setNotify()

reprap.cartesian.setSpeed(220)
reprap.cartesian.setPower(int(83 * 0.63))
reprap.cartesian.homeReset()

reprap.cartesian.free()
コード例 #4
0
	def run(self):
		self.alive = True
		
		self.feedbackHandler.setStatus("Configuring RepRap...")
		if self.pref_enableLimit:
			reprap.cartesian.x.limit = self.pref_limitX
			reprap.cartesian.y.limit = self.pref_limitY
		else:
			reprap.cartesian.x.limit = 0
			reprap.cartesian.y.limit = 0
		
		
		
		try:
			# Initialise serial port.
			reprap.openSerial( self.pref_serialPort, self.pref_baudRate, self.pref_timeout )
		except reprap._RepRapError:
			self.feedbackHandler.showMessagePopup("You do not have the required permissions to access the serial port.\nTry granting your user permissions (recommended) or run as root (less recommended).")
			self.alive = False
			self.feedbackHandler.aborted()
		
		if self.alive:
			# Prepare reprap for use
			reprap.cartesian.x.active = True
			reprap.cartesian.y.active = True
			reprap.cartesian.z.active = True
			reprap.cartesian.x.setNotify()
			reprap.cartesian.y.setNotify()
			reprap.cartesian.z.setNotify()
			reprap.cartesian.setSpeed(self.pref_speed)
			reprap.cartesian.setPower(self.pref_torque)
			self.feedbackHandler.setStatus("Reseting axies...")
			reprap.cartesian.homeReset()
		
			self.toolhead.prepare()
			self.feedbackHandler.setStatus("Starting plot...")
		
			# Start plot
			for layer in self.toolpath.layers:
				reprap.cartesian.homeReset()
				self.curX, self.curY =  0, 0
				for ip, polygon in enumerate(layer.polygons):
					if not self.alive:
						self.feedbackHandler.aborted()
						break
					progress = int( float(ip) / float( len(layer.polygons) ) * 100 )
					self.feedbackHandler.setStatus("Plotting polygons..." + str(progress) + "%")
					self.toolhead.ready()
					x1, y1 = polygon.points[0].x + self.toolpath.offsetX, polygon.points[0].y + self.toolpath.offsetY
					#x2, y2 = reprap.cartesian.x.getPos(), reprap.cartesian.y.getPos()
					# If we are not in the polygon start place, switch off tool and move there
					if (x1 != self.curX) or (y1 != self.curY):
						self.toolhead.stop()
						self.cartesianMove(x1, y1, None)
					# Start tool
					self.toolhead.start()
					polygon.pointsPlotted = 0
					# Plot polygon
					for p in polygon.points[ 1: ]:
						if not self.alive:
							self.feedbackHandler.aborted()
							break
						x2, y2 = p.x + self.toolpath.offsetX, p.y + self.toolpath.offsetY
						# If we need to move somwhere, do it
						if (x1 != x2) or (y1 != y2):
							self.cartesianMove(x2, y2, None)
						polygon.pointsPlotted += 1
					#x1, y1 = x2, y2
		
			self.toolhead.stop()
			self.toolhead.idle()
			reprap.cartesian.homeReset()
			reprap.cartesian.free()
			reprap.closeSerial()
		
		if self.alive:
			# Tell gui that plot is complete (redraw screen)
			self.feedbackHandler.plotComplete()