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

Question: Loop re-ordering. #43

Open
GilesBathgate opened this issue Jan 27, 2025 · 14 comments
Open

Question: Loop re-ordering. #43

GilesBathgate opened this issue Jan 27, 2025 · 14 comments

Comments

@GilesBathgate
Copy link

GilesBathgate commented Jan 27, 2025

Hi I use PrusaSlicer under linux. The script seems to work, but I am confused about the order of the loops. I expected the script to modify the loops such that it prints the odd perimeters first, and then raizes Z and prints the even perimeters. i.e from internal to external with the ascii-art below first printing 0, 2, 4, and 6, then raizing Z and printing 1, 3, and 5.

   1    3    5
0    2    4    6    

Reloading the gocde into Prusa gcodeviewer seems to show them print them in the order 0,1,2,3,4,5,6. Meaning that perimeter 2 has to undercut the already layed down perimeter 1?

Hope this makes sense. Probably I am just misunderstanding something.

Thanks, Giles

@GilesBathgate
Copy link
Author

GilesBathgate commented Jan 27, 2025

Maybe this image explains it better.

Image

This time the numbers represent the expected perimeter ordering sequence.

@xboxhacker
Copy link

xboxhacker commented Jan 27, 2025

@GilesBathgate it does not reorder the loop walls. It will print them in the normal order as the gcode dictates, only adjusting the Z on every other wall loop.

EDIT:
Try this, the code is modified to print the 'Non-shifted block' first then the 'Shifted block' for each layer, with priority for printing non-shifted first. This will reorder the full gcode file! It works for me on Orca slicer. I don't use PrusaSlicer so I cannot tell.

bricklayersReorderedGcode.py.txt remove the .txt

Image

@GilesBathgate
Copy link
Author

@xboxhacker Thanks for your script. I get an error when I try to view in the prusaslicer gcode viewer:

Configuration block closing tag "; prusaslicer_config = end" not found when reading 

@GilesBathgate
Copy link
Author

@xboxhacker I was able to get it to display in the gcodeviewer:

sed -n '/^; prusaslicer_config = begin/,/^; prusaslicer_config = end/p' test.gcode >> test_modified.gcode

Unfourtunatley the gcode isn't right. I will try tweaking some settings.

@xboxhacker
Copy link

@GilesBathgate Sorry, I totally forgot to tell you, this is also a standalone script. Just double-click on the file to open a GUI. then select the gcode you want to modify. It works outside of the slicer. Also, as I mentioned it was tested with Orca only. I will make a few changes, let's see.

Try this:
bricklayersReorderedGcode.py.txt

Added the config block for prusa. The first layer seems to be messed up, that will take some looking into.

@GilesBathgate
Copy link
Author

@xboxhacker That new version works great W.R.T prusa config block. I look forward to seeing the first layer fixes version.

@GilesBathgate
Copy link
Author

@TengerTechnologies Is it worth making this a feature request? It seems to me that when printing the perimeter numbered 6 in the CNC kitchen image above, under the current implementation this would be trying to print partially under the perimeter labeled 7.

@xboxhacker Has provided the basic implementation to get this working in an arugably better order. It just needs some finalisation and converting back from a standalone script.

@xboxhacker
Copy link

xboxhacker commented Jan 31, 2025

@GilesBathgate So after some more testing, this mod is great for straight vertical walls. Not so great for complex curvy objects.

What we really need is “slicer level” brick layering….

Here is my latest.

bricklayersCMD.py.txt
bricklayersGUI.py.txt

The command line should work in the slicer as a post processor. It will not output a log txt file unless you use the flag -log
This make the processing much faster for big files.

Only tested with Orca slicer, not sure if it will work with prusa yet.

Full transparnecy, Copilot AI helped with this.

@GilesBathgate
Copy link
Author

@xboxhacker Thanks I will give these a try.

What we really need is “slicer level” brick layering….

Brick Layers / Staggered Perimeter implementation

@GilesBathgate
Copy link
Author

@xboxhacker It seems like CoPilot AI removed the perimeter order modifications! 👎 😆

@xboxhacker
Copy link

@GilesBathgate I had to remove it. As I said, this reorder was great for straight vertical walls. Not so great for complex curvy objects, or variable wall thicknesses. It really messed things up for my slices.

@GilesBathgate
Copy link
Author

@xboxhacker I don't understand the point of your scripts then, in the context of my original question.

@xboxhacker
Copy link

@GilesBathgate Incremental implementation. I had to start over. These new versions fix gaps in the outer walls when printing inner/outer wall order.
Now we work on reordering the shifted blocks….

@GilesBathgate
Copy link
Author

@xboxhacker Got it, lol. It was unexpected to me for you to go back to a version that works the same as the original and publish it for testing. However I am happy to test anything, and I am eagerly looking forward the re-ordering feature.

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

2 participants