Jump to content

Conditional Settings in Global PLA setting


clemensk
Go to solution Solved by Slashee_the_Cow,

Recommended Posts

Posted · Conditional Settings in Global PLA setting

Hi,

 

I'm using a Snapmaker Artisan and would like to find a way to accommodate different nozzle sizes with different materials. My solution would need a conditional argument in the global material file.

Example: artisan_PLA_Normal.inst.cfg

 

Line:

speed_print = 120

 

I already figured out:

speed_print = =100 if machine_nozzle_size <0.5 else 50  works and

speed_print = =130 if machine_nozzle_size ==0.4 else 50 

works too. But I can't figure out how to create a switch case similar setting.

 

For Example:

 

speed_print = =130 if machine_nozzle_size ==0.4 else =60 if machine_nozzle_size == 0.8 else =180 if machine_nozzle_size ==0.2

 

nothing close to this works. How can I create a conditional statement that uses a different speed depending on the nozzle size?

 

Thanks a lot! 

  • Link to post
    Share on other sites

    • Solution
    Posted · Conditional Settings in Global PLA setting

    I think it's just evaluating Python, but it will only accept single lines (not blocks, which takes using a match statement off the table).

     

    You may have to go into what programmers might all "ternary hell". Or just a big mess. Also I'm pretty sure you don't need the = sign in front of absolute values, just ones drawn programmatically. That could be confusing the Python interpreter. You also need a fallback parameter on your last ternary or it will read the "if" as a statement, not part of an operator.

     

    Try:

    speed_print = 130 if machine_nozzle_size == 0.4 else 60 if machine_nozzle_size  == 0.8 else 180 if machine_nozzle_size == 0.2 else 100

  • Link to post
    Share on other sites

    Posted · Conditional Settings in Global PLA setting

    Works!

     

    speed_print = =180 if machine_nozzle_size == 0.2 else 100 if machine_nozzle_size == 0.4 else 70 if machine_nozzle_size == 0.6 else 50

     

    changes the speed depending on nozzle size!

    Oddly enough, the = before the 180 is needed...

  • 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...