Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line automation #40

Open
robertshearing opened this issue Sep 25, 2015 · 4 comments
Open

Command line automation #40

robertshearing opened this issue Sep 25, 2015 · 4 comments

Comments

@robertshearing
Copy link

I'd like to create and automated process where I can get the mScara to draw some svg graphics on demand.

Is it possible to send an svg file location with some position/scale data to trigger the robot to begin drawing via command line interface? Alternatively can this be dome by sending the data over the serial directly? I have had a brief glance at the source code but I'm not familiar with python and I can't see there the serial comms are.

Any help would be really appreciated.

@tur0kk
Copy link

tur0kk commented Dec 21, 2015

I don't think it is possible to start mDraw with parameters via command line. What you can do is to send gcode commands to the mScara directly via a serial connection.

Python code which sends commands in a file named out.gcode to device:

import serial
import time
# Open grbl serial port
s = serial.Serial('INSERT_YOUR_PORT_HERE',115200)
# Open g-code file
f = open('out.gcode','r');
# Wake up firmware
s.write("\r\n\r\n")
time.sleep(2)   # Wait for firmware to initialize 
s.flushInput()  # Flush startup text in serial input
# Stream g-code to firmware
for line in f:
    l = line.strip() # Strip all EOL characters for consistency
    print 'Sending: ' + l,
    s.write(l + '\n') # Send g-code block to firmware
    s.flushInput() 
    grbl_out = s.readline() # Wait for firmware response with carriage return
    print ' : ' + grbl_out.strip()
# Wait here until firmware is finished to close serial port and file.
raw_input("  Press <Enter> to exit and disable firmware.") 
# Close file and serial port
f.close()
s.close()   

Then the only thing you have to do is to translate your image to gcode accepted by mScara.

@luispinedaaguirre
Copy link

@robertshearing were you able to automate the process? if so, can you share the code you use or give me advice on how to do it. I am working on a project that would need automation. Thank you in advance.

@luispinedaaguirre
Copy link

@tur0kk Do you have a C or C++ code instead of Python that has the same function? Thank you in advance

@tur0kk
Copy link

tur0kk commented Apr 20, 2016

No sorry, I only have the python code for this basic sending functionality.

But I wrote a plugin for an open source laser cutter software called VisiCut. It can read in vector files, generate gcode, and send it to a laser cutter. With this plugin it is possible to use VisiCut with the MakeBlock laser cutter. Find an explanation on my blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants