Does RRF support 3d arcs?

Simple question  I'm trying to carve some fairly intricate stuff and noticed that the Fusion360 postprocessor I'm using switches off 3d arcs for Reprap. Is this old and does, by any chance, RRF 3.x support 3d arcs?
Thanks.

@markz G2 and G3 commands are supported in RepRapFirmware.

@oliof said in Does RRF support 3d arcs?:
G2 and G3 commands are supported in RepRapFirmware.
I believe the OP means helical interpolation, moving on all three axes?
I've found a reference to that on here from a few years ago, which implies helical is supported:
https://forum.duet3d.com/topic/1662/runninggcodecnconduetwifi/25
From the current gcode list, G17/18/19 plane selection is also supported now.
https://duet3d.dozuki.com/Wiki/Gcode#Section_G17_Select_XY_plane_for_arc_moves

@rjenkinsgb I can verify that G2 and G3 with x y z i j work perfectly.

@alankilian @rjenkinsgb Thank you both very much. Sweet, I'll upgrade my postprocessor.

Let's get some cubic splines now!

@bot said in Does RRF support 3d arcs?:
Let's get some cubic splines now!
Does any slicer actually generate them?

@dc42 Not that I am aware of. Fusion 360 should be able to, but it does not afaik.
By the year 2030 at the latest, I plan to have PrusaSlicer slicing STEP files directly, and outputting fitted bezier curves for all perimeters (that are not perfectly straight nor simple arcs).
So, no rush.

From what I have understood, the tricky thing to get right when extruding along Bézier curves is the filament extrusion rate. The G5command, as it is defined in Marlin, gets the total amount of extrusion for the curve, but to calculate the extrusion rate you also need the length of the curve. The problem is that there, apparently, exists no closed formula for the curve length. The length can be estimated numerically by simulating the move, but this is hard to realize in real time; you can not start the move without knowing the entire curve length.
I have not looked into the Marlin source code recently, so I do not know how they solve this.

@örjane This, among other difficulties, is why the ETA has been pushed to 2030.
Also, offsetting bezier curves is nontrivial, e.g., for the inner perimeters (and the outer perimeter, too, because it must be offset in by half an extrusion width).
I spoke with merill of SuperSlicer once about it, and we agreed that forcing approximations of the correct bezier curve to fit highlydetailed faceted polylines would be the easy/perhaps best approach. Thus, we could steal the length from that prototype highresolution polyline.
Currently, the mesh limits the polyline resultion. If no mesh were limiting the resolution, then the douglaspeucker algorithm limits the polyline resolution.
We can generate an overlyhighresolution polyline to fit bezier curves to. Basically, the slicing would work as it does now, but using STEP files as input and discretizing the polylines to very high detail. The perimeters would be offset like normal. It is only after we have the properly offset segmented polylines for all perimeters that we then generate and force to fit approximations of the required bezier curve  they would technically not be the identical tothemicron bezier curve that the STEP model has on its outer surface, but it would be close.
The purpose of the bezier curves is not to get higher resolution curves: we can already max out the resolution of the mesh and get smoothassilk curves.
Instead, the point of bezier curves is to print those smooth curves fast, because hopefully the throughput of processing those splines would be faster than the many gcode moves required to define a high resolution sequence of G1 moves.

@bot I looked briefly into the Marlin source code for G5 and, as expected, they do not solve the problem with extrusion rate. They seem to use the tparameter (that runs from zero to one along a Bézier curve) to linearly control extrusion. That code is actually marked with a "FIXME" comment. For simple arclike curves, this may be good enough, but for wilder Bézier curves the extrusion rate will vary considerably along the curve.
Since the slicer does not have to work in real time, and, as you say, often already has the curve represented as line segments, it would be good if the slicer had some way of telling the firmware what the curve length is. One obvious solution would be to have the curve length as an extra parameter to G5.

That is interesting info thank you for looking at the marlin source.
One thing I forgot to mention: when merill and I were discussing it, we realized that the beziers would have to be chopped up arbitrarily. As in, there might be multiple fitted "close enough" bezier curves for what would ideally be a single curve. This is because the offset of a bezier curve can, I think, never (or maybe just not always) be represented by a slightly different single curve.
I forget the specifics, I may be misremembering, but the information seemed to be somewhat common knowledge when I was googling it a year or so ago.

@bot You might be interested spending 30 minutes watching this: https://youtu.be/aVwxzDHniEw . I enjoyed it a lot!

Well, that came out just great  smooth and all the detail showed up. Thanks. For scale the nearer lizard is about 1.5" long.

That looks awesome!

This post is deleted! 
@alankilian Thanks. The finish is really glossy so it shows the machining ripples well in this light and they're just spot on.

I wrote an experimental slicing script for doing parametric slicing. Computing the offset curves is too hard in my opinion. Instead you should only make the outer perimeter a parametric curve and discretize the inner extrusions as usual.
The framework i use for slicing will also output bezier curves (converted from bsplines) that are of degree 5 etc. As I see it Marlin/GCode Standard only supports degree 2/3 which is quadric/cubic. This means you would need support for higher degree curves as well.
So the best way I currently see is doing some sort of curve fitting inside the slicer or the Duet. Maybe even assisted based on a parametric slice. Modern CNCs can already do this kind of fitting. I think I read something about it on a Siemens control unit.

@seeul8er perhaps implementing bsplines in RRF would be a better way forward than implementing bezier curves?

@dc42 I'm not sure, but I do not think Bsplines would be easier to implement or use.
From what I understand, there are two problems with Bézier curves in this context:
 The length of the curve is unknown beforehand.
 Drawing with an offset from a Bézier curve is not itself following a Bézier curve.
The first causes problems to compute the extrusion rate if only the total extrusion is known. The second causes problems when drawing multiple walls or when the outside of an object should follow a Bézier curve.
Both these things can be avoided by defining the Gcode somewhat differently from how Marlin has done it. If the extrusion rate (mm filament per mm movement) is given as a parameter, instead of the extrusion length, this would solve the first issue. The second could be handled by an optional offset parameter to move the tool with an offset (along the normal) to the curve. Both these things would be fairly straightforward to implement (I think...), and potentially useful for a slicer.

@örjane I'm not sure I understand the difficulty in tracking the extrusion amount for the curve. If we specify that the curve have a constant height and width, and we follow the centerline, the extrusion should be a linear function of the length travelled, right?
Maybe I'm not thinking about it enough.
@seeul8er thank you very much for chiming in! It sounds like you have already done some interesting work. I had the same thought of only "curving" the external perimeter, but for a number of reasons I want at least two curved perimeters. I figured that, since we would already stumble on not having higherorder curves, we will be approximating the external perimeter anyway, so why not do the same for internal perimeters? Is it just that difficult to get an approximated offset, even if we output a different/larger number of curves for the inner perimeters? I thought that there should certainly be a (larger) number of closeenough curves that could fit into what would otherwise be the offset of a single ideal single bspline. I'm not an expert with this math or concept at all, so please ignore me if you wish.
If, however, we have to begin splitting the curves into a larger and larger number of curves to get the offset, then we run into the same problem as polylines: too many moves slowing things down.
I would want to at least get two perimeters in curves/splines. A single perimeter, in my experience, is not sufficient to hide the crimes of the perimeter immediately interior to it. Zigzag infill needs at least two perimeters to hide. So, the faceted inner segmentation would reveal itself at spots through a single curved perimeter.

@bot The problem with extrusion amount is that in the G5 command (as implemented in Marlin) it is specified as the total amount that should be extruded until you reach the end of the move. Since you do not know (and can't easily compute) the length of the curve, you do not know how fast you should extrude.
Regarding the need for curved perimeters, my wild idea was to let the firmware handle the offset. The slicer would then generate gcode commands for the same curve for each perimeter, but specify different offset for each perimeter. Then there would be no need to calculate any approximate curve(s) for the inner perimeters. Since the normal of a Bézier curve is simple to compute, it would not be hard for the firmware to move the tool along the offset path.

@örjane I understand now, thank you. I was forgetting that the firmware needs to calculate the move length itself to determine the extrusion rate. So, yes I think the responsible slicer will provide a length.
As for the normal of the bezier being used to automatically offset: that is a great idea. I don't see why that wouldn't work. I'm not sure how I got into thinking that the inner perimeters needed to be discrete curves.
I suppose the problem becomes selfintersection, and cases where the requested number of perimeters don't fit. It's worth experimenting with on (digital) pen and paper. I might play around with some CAD software and see how splines and curves behave more intimately.

@bot Many of the problems seem to come from how the interface between the slicer and the firmware is defined. The extrusion rate is known by the slicer but it is forced to communicate it to the firmware via the Eparameter which is the total extruded amount instead of the rate. When I think about it, this also applies to G1,2,3 moves; the slicer internally translates rate to amount and the firmware translates back to rate. I guess that for most prints, the extrusion rate stays constant over many (hundreds of) G1 moves, so there would be a potential for saving gcode file size here by only sending the rate number when it changes. Well, changing G1 would probably be too disruptive to be realistic.
To somewhat bring this back to the original topic of this thread, perhaps we should also consider Bézier curves in 3D, not only planar ones. The question about offset then becomes a bit more complicated, but not unsolvable (cross products come to mind).
As you point out, self intersections may occur if offsets are used in tight bends, but I would consider that to be the slicers responsibility to detect (when it matters). We should also note that movement along an offset curve will affect the speed and hence (again) the extrusion. Those things (acceleration, jerk, PA, input shaping) are all under the control of the firmware, so this would hopefully be handled by the existing machinery.

@örjane Very good thoughts, thank you. I can confidently say that you've progressed my understanding of the problem forward. Maybe we can move the ETA to 2029 from 2030! I'm still in no position to know where to start coding this, but PrusaSlicer already deals with beziers for SVG, though, so...