Need some help with conditional expressions, I'm lost.
Hello, I should probably preface this and say that I'm not a programmer, and I can't seem to find out how to make this work, so here it goes, hopefully someone can help.
I've got a situation with my 3d stereo lithography printer where I'm in need of different feedrates and/or travel distance depending on the current layer being printed.
$CURSLICE reports the current layer. How would I format the code to accomplish the following....
if the $CURSLICE is less than 10 layers, use this value, if between 10-100 layers, use this value, and if greater than 100 layers, use this value?
Thanks in advance.
-Mike
Re: Need some help with conditional expressions, I'm lost.
You would need to look into your software manual. Should be pretty simple.
Re: Need some help with conditional expressions, I'm lost.
if X <= 10 then
Do
else if X >10 and <= 100
Do
else
Do
end if
Re: Need some help with conditional expressions, I'm lost.
Quote:
Originally Posted by
Louis_Cannell
if X <= 10 then
Do
else if X >10 and <= 100
Do
else
Do
end if
Not sure if it supports If & end if, I will give it a shot this weekend and see.
Quote:
sinha_nsit
You would need to look into your software manual. Should be pretty simple.
The firmware is called Marlin https://github.com/MarlinFirmware/Marlin, lots of 3d printers use it. Here is the wiki page explaining the Gcode, but it doesn't go into detail https://github.com/MarlinFirmware/Ma...Code-in-Marlin. I can't seem to find any examples anywhere showing some of the more advanced code either to see how to format it.
The software is pretty unique, it was made for SLA 3d printers, it's called Creation Workshop. It makes mention of expressions on page 18. https://dl.dropboxusercontent.com/u/...UserManual.pdf
This is from the manual....
In addition to using thevariables noted above, you can also perform simple expression evaluation using the variables along withconstants. The following operators are supported:Numeric operators:+, -, /, *, %Equality operators:<, >, >=, <=, !=Grouping:(,)There is also an if-then expression that can be used. This takes the form of:[condition]?[true statement]:[false statement]
Re: Need some help with conditional expressions, I'm lost.
if in marlin you should set up in slicer very simple in simply 3d that I use/
Re: Need some help with conditional expressions, I'm lost.
Quote:
Originally Posted by
Louis_Cannell
if in marlin you should set up in slicer very simple in simply 3d that I use/
Do you have an example of this type of expression so I can see how the expression is formatted? I have the ability to manually add Gcode to different parts of the sliced model using Creation workshop. So if you have it working and you are using Marlin, it shouldn't matter what program creates the code, it should all work. What I'm looking for is to change the X motor feed rate depending on the current layer being printed, I would need this changed three times throughout the model, for example a feedrate of 10 for the first 10 layers, feedrate of 25 between layers 10-100, and finally a feedrate of 100 after layer 100.
I can get two changes with this expression (curslice is reporting the current layer), this is a simple true/false expression.....
F{$CURSLICE < 10?10:100}
This says that if the current slice is less than 10 layers, use 10 as the feedrate, if over 10 layers, use a feedrate of 100. This works great, but I need to add the third margin of layers so I can have it change feedrate three times throughout the entire print.
Re: Need some help with conditional expressions, I'm lost.
do you not already have the ability to set bottom layer exposure times in options for the first 10 layers, then use your true false to control the 2nd 3rd
Only getting minute whilst compiling system to look at this but from a brief scan I would guess the format may well be nested along the lines of
F{$CURSLICE < 10?10:F{$CURSLICE > 100?100:25}}
Re: Need some help with conditional expressions, I'm lost.
Quote:
Originally Posted by
Louis_Cannell
do you not already have the ability to set bottom layer exposure times in options for the first 10 layers, then use your true false to control the 2nd 3rd
Only getting minute whilst compiling system to look at this but from a brief scan I would guess the format may well be nested along the lines of
F{$CURSLICE < 10?10:F{$CURSLICE > 100?100:25}}
Yes! That is exactly what I'm looking for. That should work perfectly. Thanks you!!!