Skip to content

Instantly share code, notes, and snippets.

@simonjamain
Last active September 12, 2023 15:42
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save simonjamain/beeca3f692b087e0e27712971aa0842b to your computer and use it in GitHub Desktop.
Save simonjamain/beeca3f692b087e0e27712971aa0842b to your computer and use it in GitHub Desktop.
Custom timelapse script for CURA postprocessing plugin
@simonjamain
Copy link
Author

Hi and sorry for the late response, thank you for you message.
I have currently no intentions to make it work for delta printers as I don't even have one but I am very open to include external code.

I am currently not able to make evolutions but I will in a near future

@shinzuriki
Copy link

helo, I have problem how to put this code on my cura 4.7
I put in plugin folder, or even script
but there is nothing change on my Cura.

Thank you

@Grosu21
Copy link

Grosu21 commented Nov 23, 2020

Hi, thanks for this script.
There is a possibility to increase the extruder return speed ?

@Qierre21
Copy link

Hi and sorry for the late response, thank you for you message.
I have currently no intentions to make it work for delta printers as I don't even have one but I am very open to include external code.

I am currently not able to make evolutions but I will in a near future

@simonjamain sorry for the late response as well. If you ever have time to drop an external code it would be amazing!
Thanks man, all best!

@simonjamain
Copy link
Author

Hi, thanks for this script.
There is a possibility to increase the extruder return speed ?

I added the capability and taken this opportunity to move to a proper repo -> https://github.com/simonjamain/CustomTimelapseCuraPlugin
image
I didn't test this code with a print tho ^^, can you tell me if it is ok ?

@simonjamain
Copy link
Author

Hi and sorry for the late response, thank you for you message.
I have currently no intentions to make it work for delta printers as I don't even have one but I am very open to include external code.
I am currently not able to make evolutions but I will in a near future

@simonjamain sorry for the late response as well. If you ever have time to drop an external code it would be amazing!
Thanks man, all best!

I am sorry I don't have the time to set my mind to it, furthermore I have a very minimal understanding of cura scripts I just stole some code here and there so I won't be able to help you on you initial request (to complex for me) :( , I hope someone does tho.

@Qierre21
Copy link

No worries man, thanks anyways! :)

@FlyingSuricate
Copy link

Hi, thanks for this awsome plugin.
I try to use my Ultimaker 3 and its internal cam to capture an timelapse (Octoprint like and without any switches). I programm my own programm in Python to do this. Unfortunatly it need some more work to work with dualprint printer settings. The G-Code from your plugin did not work for me. The G91 and G90 together with the M83 and M82 did some wierd stuff while printing. For example my retraction lenght added with each layer. So i ended on layer XXX with en empty printer. I needed to change some lines in your plugin to use it with my Ultimaker and reduce completly the stringing while moving.

  1. next x and y coordinate is an M205 (for me) commands so i added in the funktion "is there an G1?"
  2. in the same funktion i added an new variable "e" for the next extruded length
  3. Added some M400 commands special for my own programm
  4. reduce some added G-Code commands
  5. replace the E=-retraction_lenght with E=e-retraction_lenght
  6. added after the return speed line the same line but with an defined speed

My G-Code is now:

;CustomTimelapse Begin
; STEP 1 : retraction
G1 F1500 E279.2263;Retraction (this is based on my layer with this special print)
; STEP 2 : Move the head to "display" position and wait
G0 X190 Y215 F7000;GCODE for the first position(display position)
M400;Wait for moves to finish
G0 X200 Y215 F7000;GCODE for the second position(trigger position)
M400;Wait for moves to finish
G4 P700;Wait for camera
; STEP 3 : send photo trigger command if set
; STEP 4 : Move the head back in its original place
G0 F7000 X130.106 Y113.382
M400
G0 F1500 X130.106 Y113.382
;CustomTimelapse End

Thanks for your work.

@simonjamain
Copy link
Author

@FlyingSuricate thank you for your feedback. I'm interested in your code if you don't mind it, I think I could improve my code with this.
Have a good day

@FlyingSuricate
Copy link

@simonjamain
Copy link
Author

@S7EVIN-SHAFE7
Copy link

@simonjamain Thank you for your scrpt. That solve my strings problem from cura Gcode edit. But give me shake picture because i cant select the position when picture is taked and position when triger is realised.
I have creality Cr10 v3.

@S7EVIN-SHAFE7
Copy link

S7EVIN-SHAFE7 commented Jan 11, 2021

@simonjamain Thank you for your scrpt. That solve my strings problem from cura Gcode edit. But give me shake picture because i cant select the position when picture is taked and position when triger is realised.
I have creality Cr10 v3.

Solved swaping shuter realease.

cura_4_8_0_customtimelapse_v2

@Yasuharu-Factry
Copy link

Hi, thanks for this awsome plugin.
I am Japanese. I am not good at English.

We changed the retraction.
Added work to return the filament after pressing the shutter.
I changed it because it was necessary for me.
Added the work to restore the drawn filament.

Gcode:
; STEP 5 : Move the head back in its original place
G0 F9000 X137.909 Y129.816
M83 ; switch to relative E values for any needed retraction
G1 F1800 E5;Retraction
M82;Switch back to absolute E values

Python:
# TODO skip steps 5 and 6 for the last layer
gcode_to_append += "; STEP 5 : Move the head back in its original place\n"
if enable_custom_return_speed:
gcode_to_append += self.putValue(G = 0, X = x, Y = y, F = return_speed) + "\n"
else:
gcode_to_append += self.putValue(G = 0, X = x, Y = y) + "\n"
gcode_to_append += self.putValue(M = 83) + " ; switch to relative E values for any needed retraction\n"
if enable_retraction:
gcode_to_append += self.putValue(G = 1, F = 1800, E = retraction_distance) + ";Retraction\n"
gcode_to_append += self.putValue(M = 82) + ";Switch back to absolute E values\n"

Please try to reference.

My machine is TRONXY XY-2 PRO.

@simonjamain
Copy link
Author

@simonjamain Thank you for your scrpt. That solve my strings problem from cura Gcode edit. But give me shake picture because i cant select the position when picture is taked and position when triger is realised.
I have creality Cr10 v3.

Solved swaping shuter realease.

cura_4_8_0_customtimelapse_v2

Nice workaround !
I indeed did not take into account the fact that some picture could be taken on release, I may (or may not, I'm not really active on this right now) add some code to deal with that or add your workaround in the readme.
please use the issues on the new repo to submit your issues -> https://github.com/simonjamain/CustomTimelapseCuraPlugin

@simonjamain
Copy link
Author

Hi, thanks for this awsome plugin.
I am Japanese. I am not good at English.

We changed the retraction.
Added work to return the filament after pressing the shutter.
I changed it because it was necessary for me.
Added the work to restore the drawn filament.

Gcode:
; STEP 5 : Move the head back in its original place
G0 F9000 X137.909 Y129.816
M83 ; switch to relative E values for any needed retraction
G1 F1800 E5;Retraction
M82;Switch back to absolute E values

Python:

TODO skip steps 5 and 6 for the last layer

gcode_to_append += "; STEP 5 : Move the head back in its original place\n"
if enable_custom_return_speed:
gcode_to_append += self.putValue(G = 0, X = x, Y = y, F = return_speed) + "\n"
else:
gcode_to_append += self.putValue(G = 0, X = x, Y = y) + "\n"
gcode_to_append += self.putValue(M = 83) + " ; switch to relative E values for any needed retraction\n"
if enable_retraction:
gcode_to_append += self.putValue(G = 1, F = 1800, E = retraction_distance) + ";Retraction\n"
gcode_to_append += self.putValue(M = 82) + ";Switch back to absolute E values\n"

Please try to reference.

My machine is TRONXY XY-2 PRO.

I'm not english either (french) ^^ Thank you for the contribution, I'll try to test this on my printer and add it to the codebase. A pull request on the repo (https://github.com/simonjamain/CustomTimelapseCuraPlugin) with your edits could certainly make things faster :)

@glen945
Copy link

glen945 commented May 26, 2022

Good afternoon bro, introduce me, Glen, I'm from Indonesia. I want to ask you the code for Creality CR 10 Smart, so how do you get to the right? Please answer immediately, Thank you.

@juanbu123
Copy link

@FlyingSuricate. I am using your script for my UMS5. I was wondering where I can find the pictures of the timelapse. Where are they saved.

@Flying-Suricate
Copy link

Flying-Suricate commented Nov 19, 2022

The Version of the script does not record any pictures. It moves the head on each layer out of the way to a specific point. A different programm is running on my pc and request the head position. If the head is in the right position, a request of the picture get called and stored. Unfortunatly I was not able to use the Camera trigger command on my Ultimaker. Also sometimes the connection get lost from too many request at the same time.

I am working currently on a new Version. Maybe with an GUI and .exe file. And new code with less beginner mistakes.

Direct download link of the program:
https://onedrive.live.com/download?cid=784DD878071E0AC6&resid=784dd878071e0ac6%21190115&authkey=AExf5rasOejQnd8

@juanbu123
Copy link

@Flying-Suricate Do you have a tutorial on how to use the program on the pc. Also, is the program myultimaker?

@Flying-Suricate
Copy link

I changed the file. Just redownload it.
Unzip the folder. Run the main.exe file. All missing folder/files should create itself. Close the terminal. Set the ip in the config.ini file. Reopen main.exe. The program is now running. Just start a print with the custome timelapse script active with default values. This should be all.

@juanbu123
Copy link

@Flying-Suricate Thank you so much

@juanbu123
Copy link

@Flying-Suricate how can i trigger a different camera connected to the u,timaker. im using the ultituner tool that smithy created which allow to add a second camera using the the front usb port.

@Flying-Suricate
Copy link

So my expermental program is working also on an Ultimaker 5. Good to know. To get the image I use an http request of the web stream. I dont know how the ultituner works but if you get the image on the web view, everything should work normaly. There is no configuration currrently to change the connection. You can use the existing connection by changing the camera. The internal camera is connected by microUSB. Just use this connecton to a different camera and this should also work. I rewire this cable back and out of the case threw the bottom of the case.

@juanbu123
Copy link

@Flying-Suricate Do you know if I can connect a DSLR to the printer?

@mortezajorak
Copy link

Hi.
I already used this and its great thanks!
but I have a problem here.
My printer is Creality K1 and the print speed that I using is 300mm/s
whit this script, after each layer the printer will go the shutter position by a very slow speed. how can I add a speed like "Return speed" that you already written it ?
Screenshot 2023-09-12 at 4 20 18 PM

@Flying-Suricate
Copy link

I dont know why It does not retreat the old Speed. I will look it up. It could take some time.

@mortezajorak
Copy link

I dont know why It does not retreat the old Speed. I will look it up. It could take some time.

Please take a look at this video.

71620424513__FFA43DB3-8308-4F67-9468-A15F47FE4D2C.MOV

@mortezajorak
Copy link

image
And here is the result

@Flying-Suricate
Copy link

Hi. I already used this and its great thanks! but I have a problem here. My printer is Creality K1 and the print speed that I using is 300mm/s whit this script, after each layer the printer will go the shutter position by a very slow speed. how can I add a speed like "Return speed" that you already written it ? Screenshot 2023-09-12 at 4 20 18 PM

It seams the 3000000 mm/m get ignored on your machine. Maybe it is too high and then it uses its standard speed. You could try to set the first Gcode line something like: G0 X15 F7000. Maybe this will work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment