Jump to content

Can i change the time format from days to hours in Cura? (v5.6.0)


Go to solution Solved by Slashee_the_Cow,

Recommended Posts

Posted · Can i change the time format from days to hours in Cura? (v5.6.0)

So, what I'm asking is if i can make the "estimated time" stop displaying days, and instead only show hours? like I'd rather see 48 hours than 2 days.

image.png.49b162974b9d7a5db8e0bcd4691e29bd.png

 

I tried to find the setting myself, concidering cura is open source, however, there is not much information of where i could find this preference/parameter, whatever you wanna call it. the closes i got was the "Program Files\UltiMaker Cura 5.6.0\cura\UI\Printinformation.py", but this file from what i could read only set up the framework and operations for the calculation of the time and then stores the total time as an int. I don't know if this int is in minutes or seconds. thus it is not (from what i could read) responsible for loading this info box. Tried to look through a few more files, but found nothing which would load and display these data values.

 

Any help for either how to do it directly or which file i will need to look in would be greatly appreciated.

  • Link to post
    Share on other sites

    Posted · Can i change the time format from days to hours in Cura? (v5.6.0)

    ad on to this question: I found that there is a class called durationformat in the duration.py file in UM which basically has 4 different formats for duration, the one i am looking for in this case is ISO8601.

    image.png.25517b998214ceb42a5aafc9b90ca59a.png

     

    longer down in the file, it gets defined in a getDisplayString. if the format is ISO8601, then it will take the total number of days and times it with 24 and adding it to the total hours, so basically just what i am looking for.

     

    image.thumb.png.14ceba02654afac319c3cad2a6cc74f3.png

     

    I tried to set the default value of the parameter in this definition from "Seconds" to "ISO8601", but still when i slice in cura, it gives days, so some script is overwriting it. The only times i see duration format on the internet is through plugins, so not really what i am looking for, as i don't have any of these plugins and they don't exist in the cura marketplace.

     

    So new question, which file is the config/setting file for slicing?

  • Link to post
    Share on other sites

    Posted (edited) · Can i change the time format from days to hours in Cura? (v5.6.0)

    There is a new post processor (in 5.7.2 but you can copy it to 5.6.0) "DisplayInfoOnLCD" that has an option to display the print time, and the time the print will finish, as a message on screen.  The total time is in "Hr:Min"

     

    DisplayInfo.thumb.png.8b958a6daaac395bda5a4c27bab3ac43.png

    It also gets added to the Gcode that way:


    ;Cura Time Estimate: 61hr 06min  with 1 pause(s)

     

    I used this:

    Application.getInstance().getPrintInformation().currentPrintTime.getDisplayString(DurationFormat.Format.ISO8601

     

     

    Edited by GregValiant
    • Like 1
    Link to post
    Share on other sites

    Posted · Can i change the time format from days to hours in Cura? (v5.6.0)
    4 hours ago, lillehavard123 said:

    So new question, which file is the config/setting file for slicing?

    It's almost certainly one of the .qml files (those define the UI). If you know what you're doing (and you appear to have some idea) QML isn't too hard to pick up just by reading the files. It's entirely possible it doesn't even use the Python scripts for formatting the time there - Qt has its own functions for that.

     

    Unfortunately I only have experience editing one of the UI files - but if you ever want to see the animation in the preview mode run at warp speed so you could see a GIANT print in a minute or two, let me know 🙂

    • Like 1
    Link to post
    Share on other sites

    Posted · Can i change the time format from days to hours in Cura? (v5.6.0)

    To GregValiant, thanks, if i can't find any way to manipulate the original value, then i will probably use this, so thanks for the info 🙂

     

    and thanks Slashee for the answer about the qml files, i have been holding off on reading too much into the qt application, but seems like it's time to go digging a little more. will update if I figure something out. if not then i'll close this topic and use the plugin Greg talked about if i give up.

  • Link to post
    Share on other sites

    • Solution
    Posted · Can i change the time format from days to hours in Cura? (v5.6.0)

    Okay so because I have too much time the file you're looking for is:

    C:\Program Files\UltiMaker Cura 5.7.1\share\cura\resources\qml\ActionPanel\OutputProcessWidget.qml

     

    Lines 54-62:

    Cura.IconWithText
    {
        id: estimatedTime
        width: parent.width
    
        text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long)
        source: UM.Theme.getIcon("Clock")
        font: UM.Theme.getFont("medium_bold")
    }

    You need to change line 59 and replace UM.DurationFormat.Long with UM.DurationFormat.ISO8601

    image.png.64a82a593dbfaa296f9647e873f4a343.png

     

    Note that this change will not persist to newer versions when installed, you'll need to edit the file again for the new version.

     

    The formats themselves are stored in:

    C:\Program Files\UltiMaker Cura 5.7.1\UM\Qt\Duration.py

    I tried adding a new entry to the DurationFormat.Format enum for the style, then going to Duration.getDisplayString() and add a extra elif branch to the if display_format tree based on the Long format but I didn't manage to get it to work. Feel free to try yourself, or just stick to the ISO8601 format.

    • Heart 1
    Link to post
    Share on other sites

    Posted · Can i change the time format from days to hours in Cura? (v5.6.0)

    omg I was so close, but thank you, I did not know what a lot of the terms stand for for like build plate, scene, action, so i would have basically needed to look blindly throguh qml files before finding it, so thank you for saving me 2 hours and helping me with this topic :DD works flawlessly, can even create my own formats with the earlier scripts, so really thank you, and also thank you to Greg for giving a seperate solution 🙂

  • Link to post
    Share on other sites

    Posted · Can i change the time format from days to hours in Cura? (v5.6.0)

    but yes you are right, i also couldn't get a custom format entry to work. tried the same thing without reading that you had tried it already lol. I tried to change an existing entry, in case there is another script which either confirms or checks them to make sure they are usable, and then returns them to be used, but sadly, even doing this wouldn't change their format, so thats sad, but i havent quite given up yet. ISO8601 works just fine, now it is about wether i can do it, a challenge if you will. If I'm unlucky, there could be a handler or something deep in the api which controls these formats and that the actual definition is somewhere hidden rather than just simply being in this qml. if this is the case, then solving that will be way over my head, but we'll see.

  • Link to post
    Share on other sites

    Posted · Can i change the time format from days to hours in Cura? (v5.6.0)

    Pro tip: use Notepad++

    It has a "find in files" feature so you can search a whole directory (and subdirectories) for text in a file. I searched for "ISO8601" in .qml and .py and couldn't find anything that looks like it's checking that anywhere. I could dig deeper if I want because the needle surely must be somewhere in the haystack but since DurationFormat.Long works for me and hopefully DurationFormat.ISO8601 works well enough for you I can devote my time to my other crazy projects 😄 

    • Like 1
    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.8 beta released
        Another Cura release has arrived and in this 5.8 beta release, the focus is on improving Z seams, as well as completing support for the full Method series of printers by introducing a profile for the UltiMaker Method.
          • Like
        • 1 reply
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Thanks
          • Like
        • 3 replies
    ×
    ×
    • Create New...