MoonCactus / gcode_postprocessors

Some g-code post-processors for 3D printing. This repository hosts the "famous" wood pattern.
106 stars 51 forks source link

Cura plugin not working #12

Open TobiasReich opened 1 year ago

TobiasReich commented 1 year ago

I added your Wood-Cura python script, restarted and then applied it (with default configuration). I even see the script (< / >) symbol at the bottom. However the model looks exactly as before. Tested it with the standalone python script though and there it works flawlessly.

Any idea what might be the issue? Cura is the latest version 5.2.2. Nothing else configured (e.g. no other scripts modifying G-Code etc.)

Errandir-of-Gondolin commented 1 year ago

I'm having issues myself, my Cura won't even see the script, the cura.log file contains errors. I've appended the log to this post, see below. I'd really appreciate it if the creator could have a look and potentially fix the issue. I'm using Cura 5.2.1.

I've also tried the online generator (https://tecrd.com/tools/stl_wood/), but that didn't do anything to the file. When I looked through the gcode after processing it via the website, there were no additional M104 commands, only the one at the start and end of the file (set temp and turn temp off, standard gcode from slicing in Cura).

cura.log

MoonCactus commented 1 year ago

Hi there guy, sorry for not keeping up with this 10+ year old script ;) Actually I completely ignore Cura support as a plugin, because they kept on breaking their requirements at each revision. The online version may or may not work, I should check by myself, but here again when I need some CPU power on my server, I sometimes disable the tool and there is no way to see it. I will check to see if it is still viable

todd-herbert commented 11 months ago

@Errandir-of-Gondolin

I'm having issues myself, my Cura won't even see the script, the cura.log file contains errors. I've appended the log to this post, see below. I'd really appreciate it if the creator could have a look and potentially fix the issue. I'm using Cura 5.2.1.

I've also tried the online generator (https://tecrd.com/tools/stl_wood/), but that didn't do anything to the file. When I looked through the gcode after processing it via the website, there were no additional M104 commands, only the one at the start and end of the file (set temp and turn temp off, standard gcode from slicing in Cura).

cura.log

I was not able to reproduce the issue in Cura 5.2.1.

Thank you for posting your log file. I notice the following lines:

2023-02-04 17:29:05,560 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]: Traceback (most recent call last):
2023-02-04 17:29:05,560 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "C:\Program Files\Ultimaker Cura 5.2.1\share\cura\plugins\PostProcessingPlugin\PostProcessingPlugin.py", line 201, in loadScripts
2023-02-04 17:29:05,561 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:     spec.loader.exec_module(loaded_script)  # type: ignore
2023-02-04 17:29:05,561 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap_external>", line 879, in exec_module
2023-02-04 17:29:05,562 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap_external>", line 1017, in get_code
2023-02-04 17:29:05,563 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
2023-02-04 17:29:05,563 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2023-02-04 17:29:05,564 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "C:\Users\Nargothrond\AppData\Roaming\cura\5.2\scripts\Woodgrain_Cura.py", line 72
2023-02-04 17:29:05,565 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:     <title>gcode_postprocessors/Woodgrain_Cura.py at master · MoonCactus/gcode_postprocessors</title>
2023-02-04 17:29:05,566 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:                                                             ^
2023-02-04 17:29:05,567 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]: SyntaxError: invalid character '·' (U+00B7)
2023-02-04 17:29:05,568 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]: Exception: Exception occurred while loading post processing plugin: invalid character '·' (U+00B7) (wood.py, line 72)
2023-02-04 17:29:05,569 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]: Traceback (most recent call last):
2023-02-04 17:29:05,570 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "C:\Program Files\Ultimaker Cura 5.2.1\share\cura\plugins\PostProcessingPlugin\PostProcessingPlugin.py", line 201, in loadScripts
2023-02-04 17:29:05,570 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:     spec.loader.exec_module(loaded_script)  # type: ignore
2023-02-04 17:29:05,571 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap_external>", line 879, in exec_module
2023-02-04 17:29:05,571 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap_external>", line 1017, in get_code
2023-02-04 17:29:05,572 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
2023-02-04 17:29:05,572 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2023-02-04 17:29:05,573 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:   File "C:\Users\Nargothrond\AppData\Roaming\cura\5.2\scripts\wood.py", line 72
2023-02-04 17:29:05,574 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:     <title>gcode_postprocessors/wood.py at master · MoonCactus/gcode_postprocessors</title>
2023-02-04 17:29:05,575 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]:                                                   ^
2023-02-04 17:29:05,576 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [221]: SyntaxError: invalid character '·' (U+00B7)

Can you confirm that you have placed only the file Woodgrain_Cura.py in your scripts folder, and that Woodgrain_Cura.py is the raw python script found here?

todd-herbert commented 11 months ago

@TobiasReich

I was unable to reproduce the issue on my machine (tested: Cura 5.2.2, Windows 10)

I even see the script (< / >) symbol at the bottom. However the model looks exactly as before.

To clarify, the script will not modify the model shown as a preview. It only begins processing when the .gcode file is saved. Is it possible that this explains the behaviour you were seeing?

paulbeard commented 2 weeks ago

Checking in almost a year later…I am trying this but I don't think it's working. I ran a piece with Hatchbox wood pla, with and without this script, and I am not seeing the difference in the "with" version which is almost complete. Cura showed it was running the post-processing script before saving. The script is in the right place, I think. Cura sees it, obviously.

The preview site mentioned above doesn't return anything, just the same page/form it starts with.

pwd /Applications/UltiMaker Cura 2.app/Contents/Resources/share/cura/plugins/PostProcessingPlugin/scripts file Woodgrain_Cura.py Woodgrain_Cura.py: Python script text executable, Unicode text, UTF-8 text, with very long lines (319)

Cura 5.5/MacOS 14.5.

todd-herbert commented 2 weeks ago

I haven't actually tested it out in a little while. I just ran it now with Cura 5.5 on Windows 10. I opened up the resulting .gcode file with a text editor and could see the changes being made (M104 commands). At the bottom of the gcode file too, there's a diagram of what changes the script has made. Are you able to open up your gcode file and see if it has been modified by the plugin?

screenshot of modified gcode file

It might be the case that it's not running correctly on MacOS. I'll definitely give that a go later today and see what happens.

Another thought is that the settings for the plugin are only defaults. Assuming that the script is actually modifying the gcode file correctly, you might have to modify the values to suit your filament / model / printer to get a really good effect.

screenshot of cura plug settings window

paulbeard commented 2 weeks ago

Let me know what log data I can provide. Looking forward to seeing this in action --This space intentionally left blank. On Jun 10, 2024, at 9:05 AM, todd-herbert @.***> wrote: I haven't actually tested it out in a little while. I'll definitely give it a run with Cura 5.5 later today to see if some new issue has popped up.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

paulbeard commented 2 weeks ago

This is the log file from this job. Looks like post processing did run cura.log The gcode has 145 lines prefaced with ;WoodGraph. Are they supposed to be commented out? They seem to come after the job itself.

;WoodGraph: Wood temperature graph (from 190C to 240C, grain size 3.0mm, z-offset 0.0, scanForZHop 5):

paulbeard commented 2 weeks ago

I didn't see your earlier comment…yes, the WoodGraph lines are in my gcode so that work is getting done. But the final workpiece looks no different than the one I ran without the post processing. Not sure what values to change or by how much.

paulbeard commented 2 weeks ago

I decided to run a test and watch the temps in OctoPrint…it's working. Maybe the HatchBox PLA I am using doesn't respond to the heat changes. What filaments have been successful with this?

Screenshot 2024-06-10 at 5 32 10 PM
todd-herbert commented 2 weeks ago

Maybe the HatchBox PLA I am using doesn't respond to the heat changes.

Generally, that sounds like the sign of a good filament to me! Just maybe not ideal for this woodgrain effect.

Not sure what values to change or by how much.

Honestly, I'm not super knowledgeable about it. I just wrapped the original script as a Cura plugin. The original author is @MoonCactus, although it was a long time ago when this was originally put together. You might get a slightly different look by changing the spikiness and average wood grain size values.

Larger nozzle sizes also seem to contribute to a grain look.

What filaments have been successful with this?

I haven't tried a huge variety of wood-grain filaments, and it's been a while since I bought any, but I previously had reasonable results with Creozone Wood PLA, and some generic filament from a local retailer.


Apart from this script, there's another post-processing technique I've had some success with: scratch the finished print with some coarse grain sandpaper to add "texture", then wipe on some thin black poster paint. Quickly wipe off the excess with a paper towel. The paint stays behind in the layer lines and scratches you've added, creating a reasonably convincing wood grain effect. I've also had some success with using a thin coat of Haarlem Danish Oil over this.

For an aged wood effect, I've also found that you can cautiously dab a small amount of acetone to areas of the PLA print, to whiten and damage the area.

paulbeard commented 2 weeks ago

yeah, this filament has outsmarted me, I guess. Maybe others are more amenable to this process.

I can't sand these pieces…they are very detailed terrain forms with lots of details I don't want to lose. I will see if staining picks up the layers at all. after a bunch of reading I may need a different layer height as well. So many details.

Thanks for the help on this.

todd-herbert commented 2 weeks ago

Best of luck!

MoonCactus commented 2 weeks ago

Chiming in, and foremost, thanks @todd-herbert for keeping this poor old script alive :) @paulbeard, I would suggest any filament that includes organic particles that carbonize/darken with heat.

I had really good resulys with Laywood but I am unsure if it is still sold. Got somehow good results with other wood-laden filaments, and some bambu as well.

I did have some results with old and crappy PLA filaments, but I agree with you that nowadays, overall quality of filaments had improved in a way that certainly reduce the effect.

Increasing temp to very high values is risky and it would not suit PLA at it would become too fluid anyhow to be printed correctly. May be more viscous ones can be used (did not try).

paulbeard commented 4 days ago

Looks like Laywood is still sold…I have struck out on two of the other "wood" filaments I have tried so far. The descriptions mention the tree ring effect I am looking for so my quest might be over. Quite a bit more $$ than the other…like 4X…similar price for 25% of the material. Ouch.

https://www.printerplayground.com/light-cherry-wood-laywood-filament

MoonCactus commented 2 days ago

Indeed ! Actually I never bought any Laywoo because its inventor (Kai Parthy) gave it free to me past my very first specimen ! He was the one who triggered all the non-standard filament era, and it happened I made him sell a lot at the time. Blast from the past : https://www.wired.com/2012/11/3d-printer-wood-filament/ Some people had correct results with bamboofill, but ColorFabb stopped prodution as well !

paulbeard commented 2 days ago

I am too late to the party. The one outfit that sells laywood has a broken website that doesn't take orders ("No payment methods are currently available.")