Welcome! Log In Create A New Profile

Advanced

pyRepRap - Reprap Python Module

Posted by greenarrow 
pyRepRap - Reprap Python Module
February 11, 2008 11:19AM
I've been working on a python module to control reprap. I've tested it with the generation one electronics but it should work with the arduino too, as the comms protocol is the same. The module provides full control over the cartesian robot, the extruder control is incomplete, but this is less of a priority anyway as I do not aim to replicate all the FDM capabilities of the java software in python. I have created the module to assist in developing other uses for the reprap.

The file demo.py is a simple example that moves the axies arround. In linux you will either need to configure user access to the serial port or just run demo.py as root. The module requires pySerial, see the included documentation for more info.

I hope this is of some use to someone.

Download from SVN:
[reprap.svn.sourceforge.net]

Example program (demo.py):
import serial, reprap, time							# Import the reprap and pySerial modules.
reprap.serial = serial.Serial(0, 19200, timeout = reprap.snap.messageTimeout)	# Initialise serial port, here the first port (0) is used.
reprap.cartesian.x.active = True						# These devices are present in network, will automatically scan in the future.
reprap.cartesian.y.active = True
reprap.cartesian.z.active = True
reprap.extruder.active = True
# The module is now ready to recieve commands #
moveSpeed = 220
reprap.cartesian.homeReset( moveSpeed, True )					# Send all axies to home position. Wait until arrival.
reprap.cartesian.seek( (1000, 1000, 0), moveSpeed, True )			# Seek to (1000, 1000, 0). Wait until arrival.
time.sleep(2)									# Pause.
reprap.cartesian.seek( (500, 1000, 0), moveSpeed, True )			# Seek to (500, 1000, 0). Wait until arrival.
time.sleep(2)
reprap.cartesian.seek( (1000, 500, 0), moveSpeed, True )			# Seek to (1000, 500, 0). Wait until arrival.
time.sleep(2)
reprap.cartesian.seek( (100, 100, 0), moveSpeed, True )				# Seek to (100, 100, 0). Wait until arrival.
reprap.cartesian.homeReset( moveSpeed, True )					# Send all axies to home position. Wait until arrival.
reprap.cartesian.free()								# Shut off power to all motors.

Edited 2 time(s). Last edit at 04/16/2008 11:11AM by greenarrow.
Re: pyRepRap - Reprap Python Module
February 13, 2008 07:34AM
awesome. very cool and very useful!

would you like subversion access to put your files up there?
Re: pyRepRap - Reprap Python Module
February 13, 2008 08:31AM
The OLPC uses Python, right?
Yes, it has python builtin everywhere.
I liked pyRepRap so much, I wrote a couple of python scripts for it and saved the combined zipped folder at:
[members.axion.net]

The first is fillet.py, a script that bevels or fillets gcode, to provide smooth extruder movement. It can either bevel, arc segment, arc point or arc radius. After either bevel or arc segment, only linear commands are added. After arc point or arc radius, the linear gcode move commands are transformed into respectively helical arc point or arc radius commands.

The second is extrude.py, a script to display and extrude a gcode file. It controls the extruder and movement. It can read linear and helical move commands. It saves a log file with the suffix _log.

Also included is Hollow Square.gcode, a gcode test file for fillet or extrude, and the docs doc_extrude.html and doc_fillet.html.

Fillet can operate with only the gcode file. Extrude needs a reprap to control, and since I don't got one, could someone with a reprap please test extrude.py? In theory it should work, but in theory we should have flying cars.

Greenarrow, could you please email me? I'd like to add this to your module, but don't have your email address.

Cheers,
E
Re: pyRepRap - Reprap Python Module
April 16, 2008 02:24PM
This looks great! I haven't got around to trying out gcode yet so tying out this script is a great excuse for me to. I've just got back from Canada, I'll try and find some time in the next couple of days to try out your script with my reprap. Have you been using the zip file from this thread or the subversion code? The zip file is now somewhat out of date so i've deleted it and put this link at the top of the page:
[reprap.svn.sourceforge.net]
Re: pyRepRap - Reprap Python Module
April 17, 2008 11:49PM
greenarrow,

Attached is the latest version of extrude and fillet, based on the pyreprap module in subversion on April 17th. Please add the files which work to pyreprap.

By the way, your code has already helped build an object:
[forums.reprap.org]

E
Attachments:
open | download - extrude_fillet.zip (13.3 KB)
Re: pyRepRap - Reprap Python Module
April 18, 2008 10:16AM
wow an actual printout! Both the gcode generator and your gcode plotter are doing a good job.

I tried to add your files today but I kept getting 'authorization failed' from the SVN server. I haven't used it in a couple of months as I've been away in Canada, I'll message Zach and see if anything has changed.

I'm thinking of re-arranging pyRepRap a bit so that all code to do things is in libraries (my CAD plotter is a program at the moment), then having a program (command line and gui) that will be able to load up CAD files, gcode files etc and print them from there. Your code is already in library form so that is perfect to be be used by the new progam.
I m trying to recognize all the fillets at a time from a CAD geometry. How can i get it in python?
Sorry, only registered users may post in this forum.

Click here to login