Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sckunkle committed Feb 6, 2020
2 parents 2dca5d8 + e8ce3d3 commit 7e02e60
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Download the exe from [here](https://github.com/sckunkle/mbotmake/releases) and


# REPORTING BUGS
Please supply a copy of your printe config, the generated .makerbot file, the gcode from your slicer, the makerbot you're using, and a detailed description of the bug you're experiencing.
Please supply a copy of your printer config, the generated .makerbot file, the gcode from your slicer, the makerbot you're using, and a detailed description of the bug you're experiencing.

# CURRENTLY SUPPORTED PRINTERS
If you have a makerbot that use .makerbot files that isn't in this list, contact me at [email protected] so that I can test how to properly convert to the printer specifications.
Expand Down
50 changes: 30 additions & 20 deletions mbotmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,26 @@ def createToolpath(filename, temp):
'z': False},
axis,
[])
# get time traveled by the equasion
# time = sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)/feedrate
distance = math.dist([axis['x'], axis['y'], axis['z']],
[prev['x'], prev['y'], prev['z']])
if [axis['x'], axis['y'], axis['z']] == [prev['x'], prev['y'], prev['z']] and axis['a'] != prev['a']:
# retraction takes time as well, add it in
# time = sqrt((e2-e1)^2)/feedrate
distance = math.dist([axis['a']], [prev['a']])
else:
# get time traveled by the equasion
# time = sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)/feedrate
distance = math.dist([axis['x'], axis['y'], axis['z']],
[prev['x'], prev['y'], prev['z']])
printersettings['time'] += distance/axis['feedrate']
elif line[0] == 'G92':
for ax in line[1:]:
if ax[0] == 'E':
printeroffset['a'] += axis['a'] + float(ax[1:])
printeroffset['a'] = axis['a'] + float(ax[1:])
elif ax[0] == 'X':
printeroffset['x'] += axis['x'] + float(ax[1:])
printeroffset['x'] = axis['x'] + float(ax[1:])
elif ax[0] == 'Y':
printeroffset['y'] += axis['y'] + float(ax[1:])
printeroffset['y'] = axis['y'] + float(ax[1:])
elif ax[0] == 'Z':
printeroffset['z'] += axis['z'] + float(ax[1:])
printeroffset['z'] = axis['z'] + float(ax[1:])
elif line[0] == 'M104':
for ax in line[1:]:
if ax[0] == 'T':
Expand Down Expand Up @@ -217,18 +222,23 @@ def packageMBotFile(filename, temp):


def main(argv):
for gcode in argv[1:]:
temp = tempfile.mkdtemp()
print(temp)
output = gcode.replace('.gcode', '.makerbot')
print('Generating toolpath for', output)
vardict = createToolpath(gcode, temp)
print('Generating metadata for', output)
generateMetajson(temp, vardict)
print('Packaging', output)
packageMBotFile(output, temp)
print(output, 'done!')

try:
for gcode in argv[1:]:
temp = tempfile.mkdtemp()
print(temp)
output = gcode.replace('.gcode', '.makerbot')
print('Generating toolpath for', output)
vardict = createToolpath(gcode, temp)
print('Generating metadata for', output)
generateMetajson(temp, vardict)
print('Packaging', output)
packageMBotFile(output, temp)
print(output, 'done!')
except Exception as e:
print('ERROR:', e)
print('Please report this, as this may be a bug.')
print('Go to https://github.com/sckunkle/mbotmake/issues and add a new issue.')


if __name__ == '__main__':
if len(sys.argv) < 2:
Expand Down

0 comments on commit 7e02e60

Please sign in to comment.