Automatic 2d Fillet in OpenSCAD

Automatic 2d Fillet in OpenSCAD

Description

// This Routine Creates A Fillet Between Two Arbitrary Shapes. // It Works By Expanding Each Shape By Some Distance And Then Creating A Very Thin Shell Around These Expanded Shapes. These Two Shells Are Then Intersected To Give One Point Along The Fillet. The Distances Are Chosen So That, For A Two Shapes That Intersect Under Right Angle, These Intersection Points Lie On A Quarter Circle, With Fn_Fillet=16 Faces. // The Hull() Command Is Then Used To Hull Two Adjacent Intersection Points Together, Thus Creating The Fillet. // This Method Has Two Side Effects: // The Fillet Is Not Flush With The Two Shapes But Sticks Out By A Small Amount Of Dr=0.005, The Thickness Of The Shells Used To Create The Intersection Points. // Secondly, This Routine Creates A Bulge Around Places Were The Two Original Shapes Overlap. As Illustrated In Example 5 And Example 6. This Excess Budge Needs To Be Trimmed By Hand. // Sometimes It Is Also Possible To Avoid This Excess Bulge By Smart Choice Of The Shapes, Any Excess Fillet Needs To Be Then Blocked Out By A Third Shape. This Is Illustrated In Example 7. // // The Form Of The Fillet Is Only Circular In Shape For The Intersection Of Straight Shapes Under A Perpenticular Angle. If The Edge Of The Shapes Is Not Straight (E.G. Fillet Between Two Circles) The Fillet Is Not Quiet Circular In Shape And Has A Different (Approximated) Fillet Radius Than Specified. For Straight Edge Shapes Under An Arbitrary Angle A Similar Effect Occurs. // // The Routine Fillet_Display() Displays The Two Original Shapes In Red And Green. They Are Translated By 0.01 In Z-Direction To Avoid Z-Buffer Fighting Of The Display With F5. This Displacement In Z-Direction Does Not Affect The Result Of F6, As F6 Is Purely A 2-Dimentional Result. The Fillet Is Displayed In Yellow(Ish). // // The Parameter Fn_Mink=16 Gives The Roundness Of The Circle That Is Used To Expand The Shapes And To Create The Shells. Increasing It Will Lead To Very Long Computation Times. It Can Be Set As Low As 4 (Or Even 3) To Save On Computation Time, But Will Then Result In Slightly Asymmetric Fillets. // // The Parameter Dr=0.005 Gives The Thickness Of The Shells Around The Expanded Shapes. If One Sets This Parameter To Even Smaller Numbers, Then The There Is No Resulting Intersection Calculated Between The Shells And No Fillet Is Generated At All. // //The Computaional Time Inceases Drasticcally (Exponentially?) With The Number Of Facets Of The Shapes. One Remedy Would Be To Replace The Expand And Shell Routines. For Example The Expand Routine Could Be Done By Shifting The Shape Repeatatly By Dr, But Each Time In A Slightly Different Direction, Union All Shifted Shapes Together. // //This Work Was Inspired By The Excellent Write-Up On Fillets By Cake Baby In Http://Sozvyezdami.Wordpress.Com/2013/04/10/3D-Fillet-Algorithm-Prototype .

Statistics

Likes

34

Downloads

0

Category

Other