Does RRF support 3d arcs?
-
@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/running-gcode-cnc-on-duet-wifi/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 G5-command, 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 non-trivial, 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 highly-detailed faceted polylines would be the easy/perhaps best approach. Thus, we could steal the length from that prototype high-resolution polyline.
Currently, the mesh limits the polyline resultion. If no mesh were limiting the resolution, then the douglas-peucker algorithm limits the polyline resolution.
We can generate an overly-high-resolution 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 to-the-micron 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 smooth-as-silk 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 g-code 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 t-parameter (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 arc-like 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 B-splines 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 G-code 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 higher-order 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 close-enough curves that could fit into what would otherwise be the offset of a single ideal single b-spline. 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. Zig-zag infill needs at least two perimeters to hide. So, the faceted inner segmentation would reveal itself at spots through a single curved perimeter.