Jump to content

Settings to reduce size of G-code


mkutvytskyi
Go to solution Solved by ahoeben,

Recommended Posts

Posted (edited) · Settings to reduce size of G-code

Hello!

 

I have a problem with G-code size. I start CuraEngine via command line arguments, passing it an STL model and custom print settings. From the 42KB STL model, I get 147MB of G-code. If I generate G-code from Cura UI with the same settings, I get 1.1 MB of G-code. Also, when previewing the generated G-code in Cura, there is a big difference between the two generated codes.

 

Below is an image of preview of the G-code, generated by running CuraEngine with command line arguments.

image.thumb.png.7274945ace0be58862320011c1e1d253.png

 

Below is an image of preview of the G-code, generated via Cura UI

image.thumb.png.f147d26df9c4de93603335375e2cc94d.png

 

I assume that I do not fully understand the print settings and made a mistake in them. What settings should I look at to solve this problem, and what settings should I tweak to reduce the G-code size?

 

Also below is the settings, that I override:

 image.thumb.png.a770c6bafe6b6dccefae155ca9747470.pngimage.png.d16dff1a44e091613d7bd4ac564fae28.png

 

Thank you

Edited by mkutvytskyi
  • Link to post
    Share on other sites

    Posted · Settings to reduce size of G-code

    It's related to either "nozzle size" or "line width".  In the second image your line width is about 35mm and in the first your line width seems to be about something more reasonable.  Around .35mm.  Or maybe you really do have a 35mm nozzle?  Are you printing full scale houses?

     

    the other parameter to look at carefully is layer height.  How many layers are in each file.

  • Link to post
    Share on other sites

    Posted · Settings to reduce size of G-code
    16 minutes ago, gr5 said:

    Please post your command line argument exactly how you used it and also post the override file you used.

    Thanks for your reply. Here are the files you requested. Unfortunately, I can't share some information due to NDA restrictions, so the command line arguments aren't quite the same as I used them, but the gist is the same.

    26 minutes ago, gr5 said:

    It's related to either "nozzle size" or "line width".  In the second image your line width is about 35mm and in the first your line width seems to be about something more reasonable.  Around .35mm.  Or maybe you really do have a 35mm nozzle?  Are you printing full scale houses?

     

    the other parameter to look at carefully is layer height.  How many layers are in each file.

    I really have a 35mm nozzle.

    Settings.zip

  • Link to post
    Share on other sites

    Posted · Settings to reduce size of G-code
    "C:\Program Files\Ultimaker Cura 4.13.1\CuraEngine.exe" slice -p -j "[...]\CustomPrinter.print.def.json" -l "[...]\SampleModel.stl" -o "[...]\SampleModel.gcode" 2> "[...]\Log.log"

     

    did you really put in the [...] parts or is that just redacted for privacy?  I guess it's a stupic question because you wouldn't be able to load the gcode file if you had the [...] in there.  never mind.

     

    @ahoeben - did he do the correct command line and does his json file look correct?  It's not taking his nozzle size.

     

    @mkutvytskyi - I don't know much about using cura from the command line.  I know linux and programming but not cura json files.

     

    - I'd try removing the space from the extruder 0 filename

    - I'd try to set the line width more explicitly versus just setting the nozzle size and hoping the line width follows (in cura UI there is no nozzle width mentioned and it's ignored anyway and "line width" is used).  I don't know how to do that in the json file.

    - I'd put some other parameter in there like making layer height 1 meter to see if the file is even being read or if it is being ignored.

    - I'd put the files through a json tester which will let you know if you have a misplaced bracket or comma - there are free web pages where you can drag and drop your json file and it will report syntax errors.

     

    ahoeben is much more of an expert and hopefully he can help you.  I'll tag someone else as well:

    @nallath

    • Like 2
    Link to post
    Share on other sites

    • Solution
    Posted · Settings to reduce size of G-code

    I think that the major thing that goes wrong is that there are a lot of values that are getting calculated in the UI, which are not calculated in your command-line usage. CuraEngine does not understand Python, so "value" fields in the .def.json need to be evaluated.

    • Like 2
    Link to post
    Share on other sites

    Posted · Settings to reduce size of G-code
    14 hours ago, ahoeben said:

    I think that the major thing that goes wrong is that there are a lot of values that are getting calculated in the UI, which are not calculated in your command-line usage. CuraEngine does not understand Python, so "value" fields in the .def.json need to be evaluated.

    Apparently this was the problem, I changed the settings in the UI, replacing the automatically calculated parameters with the default ones and got almost the same result as when starting slicing through command line arguments

     

    Thanks for your help!

    • Like 2
    Link to post
    Share on other sites

    Posted · Settings to reduce size of G-code

    Is there a way to achieve the same output from command line Cura Engine as that from the GUI. I am facing the same problem as stated in the first post. My stl file is of ~3MB and after conversion the obtained gcode is of ~22-25MB that too inappropriate.

     

    I used the following command for slicing and received an abnormal output-

    ./build/Debug/CuraEngine slice -j ./resources/definitions/creality_ender3pro.def.json -s roofing_layer_count=0 -s roofing_monotonic=true -s cool_min_temperature=0 -o '/home/<username>/Dev/test/outputs/non_support.gcode' -l '/home/<username>/Dev/test/static/Test.stl'
    

     

    I got the 'resource' directory from the official Cura repository in Github.

     

    I understand that the problem lies around the in-compatibality with 'value' field inside the definition in json format. How do you suggest I overcome this problem.

     

    Any help is much appreciated.

    Thanks!

  • 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

      • 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
          • Like
        • 2 replies
      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 26 replies
    ×
    ×
    • Create New...