fillet_prompt.txt 1.4 KB

1234567891011121314151617181920
  1. When asked to add a fillet/rounded corner between two flat faces in OpenSCAD:
  2. Build the shape as a single extruded 2D cross-section rather than unioning separate solids.
  3. To place a circular arc exactly tangent to two planar faces meeting at a known angle:
  4. 1. Express both face planes as line equations in the 2D cross-section plane.
  5. 2. Solve for the circle centre that sits at distance r from both lines simultaneously. For two faces meeting where one is y=0 and the other is some line az + by = c, this is a system of two distance equations.
  6. 3. The tangent point on each face is the foot of the perpendicular from the centre to that face — giving exact arc start/end angles via atan2.
  7. 4. The arc sweeps between those two angles using a for loop inside a concat()-built polygon.
  8. 5. Extrude the profile with linear_extrude, rotating as needed so extrusion goes in the correct world axis.
  9. For a specific common case — two panels of thickness t meeting at angle ang degrees, with the outer junction at the origin — the fillet centre is:
  10. - centre_y = r
  11. - centre_z = junction_z + r * (1 - 1/sin(ang/2 + 45)) (or derive directly from the two distance equations)
  12. The arc spans 180° down to 180° - ang° (for a junction where one face is vertical and the other tilts by ang).
  13. ---
  14. The core lesson: don't round a sharp boolean union — compute the exact tangent circle analytically and build it into the profile from the start.