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

Problem when using prusa slicer and standalone script #46

Open
jonschke opened this issue Mar 16, 2021 · 0 comments
Open

Problem when using prusa slicer and standalone script #46

jonschke opened this issue Mar 16, 2021 · 0 comments
Assignees
Labels
bug Something isn't working refactor Refactor code reproduced bug was reproduced by dev

Comments

@jonschke
Copy link

If I try to join the two appended gcodes I get this error

Converting additive gcode to relative positioning...
Traceback (most recent call last):
  File "main.py", line 26, in <module>
    asmbl_parser = Parser(args.config)
  File "C:\Users\Jonat\Desktop\ASMBL-master\src\ASMBL_parser.py", line 34, in __init__
    self.main()
  File "C:\Users\Jonat\Desktop\ASMBL-master\src\ASMBL_parser.py", line 51, in main
    self.gcode_add = utils.convert_relative(self.gcode_add)
  File "C:\Users\Jonat\Desktop\ASMBL-master\src\utils.py", line 46, in convert_relative
    extrusion_diff = float(current_extrusion) - float(last_e[last_tool])
ValueError: could not convert string to float: '-1.50000 F1800.000'

The problem seems to be that the sequence of the gcode from the prusa slicer (G1 E0.5 F1800.00) is different to the sequence generated by the fusion slicer (G1 F1800 E0.5)
I already looked into the function convert_relative in utils.py and altered the absolute section to get the current extrusion:

if absolute_mode:
            if line_start == 'G0' or line_start == 'G1':
                try:
                    line_split = line.split(' ')
                    current_extrusion = 0
                    for section in range(0, len(line_split)):
                        if (line_split[section].find("E") == 0):
                            current_extrusion = line_split[section].split("E")[1]
                            break
                    extrusion_diff = float(current_extrusion) - float(last_e[last_tool])
                    extrusion_diff = round(extrusion_diff, 3)
                    last_e[last_tool] = current_extrusion
                    line_split[section] = "E" + str(extrusion_diff)
                    line = " ".join(line_split)
                except IndexError:
                    pass
        gcode_rel += line + '\n'

But then I this error comes next:

parsing files...
Opening files...
Converting additive gcode to relative positioning...
Spliting additive gcode layers...
Traceback (most recent call last):
  File "main.py", line 26, in <module>
    asmbl_parser = Parser(args.config)
  File "C:\Users\Jonat\Documents\Persoehnliche Dokumente\Engineering\ToolChanger\ASMBL-master\src\ASMBL_parser.py", line 34, in __init__
    self.main()
  File "C:\Users\Jonat\Documents\Persoehnliche Dokumente\Engineering\ToolChanger\ASMBL-master\src\ASMBL_parser.py", line 57, in main
    self.gcode_add_layers = self.split_additive_layers(self.gcode_add)
  File "C:\Users\Jonat\Documents\Persoehnliche Dokumente\Engineering\ToolChanger\ASMBL-master\src\ASMBL_parser.py", line 115, in split_additive_layers
    gcode_add_layers.append(AdditiveGcodeLayer(layer, name))
  File "C:\Users\Jonat\Documents\Persoehnliche Dokumente\Engineering\ToolChanger\ASMBL-master\src\additive_gcode.py", line 18, in __init__
    self.layer_height = self.get_layer_height(self.gcode)
  File "C:\Users\Jonat\Documents\Persoehnliche Dokumente\Engineering\ToolChanger\ASMBL-master\src\additive_gcode.py", line 43, in get_layer_height
    height = min(line_heights)
ValueError: min() arg is an empty sequence

I think there is again an issue with the way the gcode is parsed

Wuerfel2matadd.zip

@AndyEveritt AndyEveritt added bug Something isn't working refactor Refactor code labels Apr 7, 2021
@AndyEveritt AndyEveritt self-assigned this Apr 7, 2021
@AndyEveritt AndyEveritt added the reproduced bug was reproduced by dev label Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor Refactor code reproduced bug was reproduced by dev
Projects
None yet
Development

No branches or pull requests

2 participants