<p>How can I write G-code for a triangle without sharp tips?</p>

<p><a href="https://i.stack.imgur.com/T0hpu.jpg" rel="nofollow noreferrer" title="Example of required triangle"><img src="https://i.stack.imgur.com/T0hpu.jpg" alt="Example of required triangle" title="Example of required triangle"></a></p>

<p>I want to generate the corners manually, rather than using a slicer to generate them, just to know how it is done.</p>

[{'answer_id': 10494, 'author': 'Tom van der Zanden', 'author_id': 26, 'author_profile': 'https://3dprinting.stackexchange.com/users/26', 'pm_score': 2, 'selected': False, 'text': '<p>Marlin has <code>G2</code> (clockwise arc) and <code>G3</code> (counterclockwise arc) commands that could be used to do this. <a href="http://marlinfw.org/docs/gcode/G002-G003.html" rel="nofollow noreferrer">You can find detailed documentation for the command here.</a></p>\n\n<p>Basically, you can use</p>\n\n<blockquote>\n  <p>G2 R1 X5 Y5</p>\n</blockquote>\n\n<p>to draw a (clockwise) arc from the current position to <span class="math-container">$(X,Y)=(5,5)$</span> with a radius of <span class="math-container">$1$</span>.</p>\n\n<p>So, your rounded triangle could be drawn with 3 straight line moves and 3 arc moves. Figuring out the exact coordinates for each move would be a quite challenging geometry exercise, as you\'d need to know where the straight line portion of each side ends and the rounded portion starts.</p>\n'}, {'answer_id': 10497, 'author': 'Trish', 'author_id': 8884, 'author_profile': 'https://3dprinting.stackexchange.com/users/8884', 'pm_score': 3, 'selected': False, 'text': '<p>First, convert the given measurements into a sketch...</p>\n<p><a href="https://i.stack.imgur.com/ivxIW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ivxIW.png" alt="Sketched out dimensions" /></a></p>\n<h2>G-code shenanigans</h2>\n<p>we actually have the printer do circles.. let\'s plot that out...</p>\n<p><a href="https://i.stack.imgur.com/hGFSc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hGFSc.png" alt="Plotted all start-ends and centers" /></a></p>\n<p>Using that, it\'s easy to write the G-code using the Documentation for <a href="http://marlinfw.org/docs/gcode/G000-G001.html" rel="nofollow noreferrer">G1</a> and <a href="http://marlinfw.org/docs/gcode/G002-G003.html" rel="nofollow noreferrer">G2</a>. You\'ll have to add the E values to extrude something along the paths, but your sketch would turn into this path:</p>\n<pre><code>G92 X0 Y0 ; the current position is now (0,0) on the XY\nG90 ;Abolute mode for everything...\nM83 ;...but for the E-argument, so you can just put the length into the extrusions that are to be done\nG0 X10.66 Y2 \nG2 R5 X6.33 Y9.5 ; Alternate: G3 I0 J5 X6.33 Y9.5\nG1 X45.66 Y77.638 \nG2 R5 X54.33 Y77.638 ; Alternate: G3 I4.33 Y-2.5 X54.33 Y77.638\nG1 93.67 Y9.5\nG2 R5 X89.33 Y2 ; Alternate: G3 I-4.33 Y-2.5 X89.33 Y2\nG1 X10.66 Y2\nG0 X0 Y0\nG91 ; return to relative coordinates\n</code></pre>\n<p><strong>This code has to be prefixed by a move to where you want to start the pattern</strong> and will <strong>not</strong> know if you move it off the build plate, so keep 100\xa0mm X and 87\xa0mm in Y of the allowable build plate. It will end exactly where you started it.</p>\n<h2>Iterative approach</h2>\n<p>In many uses of g-code, <em>rounded</em> corners are actually n-gons with a very high number n. then we only need <code>G1</code> and can easily calculate the length of the stretches and fill in the G1. We need to iterate down to somewhat circular...</p>\n<p>Let\'s start iterating with n=3 aka a triangle, which gives a direct line over the corner gives this:</p>\n<p><a href="https://i.stack.imgur.com/ANEnx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ANEnx.png" alt="Iteration 1" /></a></p>\n<p>going to n=6 (hexagon) follows the curve a lot better...</p>\n<p><a href="https://i.stack.imgur.com/JRSMV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JRSMV.png" alt="Iteration 2" /></a></p>\n<p>going to n=12 looks almost round on a larger scale...</p>\n<p><a href="https://i.stack.imgur.com/STTXL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/STTXL.png" alt="Iteration 3" /></a></p>\n<p>and when we reach n=24, we are pretty close to the circle..</p>\n<p><a href="https://i.stack.imgur.com/rO7dr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rO7dr.png" alt="iteration 4" /></a></p>\n<p>And as we go above n=6, we also get easier math for the corners, as we always get the same lengths of movement along X and Y just swapped around due to symmetry.</p>\n<p>With all these stretches defined, we could start to work in <em>relative</em> coordinates easily, again without E, and only for the bottom left corner:</p>\n<pre><code>G0 X10.66 Y2 \nG1 X-1.294 Y0.17\nG1 X-1.206 Y0.5\nG1 X-1.036 Y0.795\nG1 X-0.795 X1.036\nG1 X-0.5 Y1.206\nG1 X-0.17 Y1.294\nG1 X0.17 Y1.294\nG1 X0.5 Y1.036\n...\n</code></pre>\n'}]
['https://3dprinting.stackexchange.com/questions/10488', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/16948/']