Free 186 More Best Homemade Tools eBook:  
New: 300+ fresh build posts/day from 275 forums → BuildThreads.com

User Tag List

Results 1 to 10 of 32

Thread: Non-circular boring. (Linuxcnc fun)

Threaded View

  1. #3

    Join Date
    Jul 2019
    Posts
    33
    Thanks
    0
    Thanked 35 Times in 10 Posts
    First couple tries in plastic. (painfully slow - just testing) (and the hole size should be way closer to the inscribed polygon diameter...)






    Quote Originally Posted by dagrizz View Post
    Definitely an interesting use of a boring tool. Care to share the code for generating the toolpath?

    This is the hal component for linuxcnc... WIP use at your own risk.

    Code:
    //   This is a component for Linuxcnc HAL
    //   Copyright 2020 Sam Sokolik <samcoinc@gmail.com>
    //
    //   This program is free software; you can redistribute it and/or modify
    //   it under the terms of the GNU General Public License as published by
    //   the Free Software Foundation; either version 2 of the License, or
    //   (at your option) any later version.
    //
    //   This program is distributed in the hope that it will be useful,
    //   but WITHOUT ANY WARRANTY; without even the implied warranty of
    //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    //   GNU General Public License for more details.
    //
    //   You should have received a copy of the GNU General Public License
    //   along with this program; if not, write to the Free Software
    //   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    component polygon "Create a spindle synced motion that carves a polygon using eoffset inputs.  Assumes positive rotation.";
     
    pin in bit enable;
    pin in unsigned numsides=3 "Number of sides in the polygon";
    pin in float inscribedradius=1 "inscribed radius of the polygon";
    pin in float cutterdiam "cutter diameter";
    pin in float eoffsetscale "scale that eoffset is set to.";
    pin in float toolang "angle difference between index and actual tool poition";
    pin in float spindlepos "Spindle position scaled to 1 per rev";
    pin out float spindlerad "Spindle postion in radians";
    pin out float polyradius "radious of the polygon at given spindle position";
    pin out float xoffset "x offset to send to offset componant";
    pin out float yoffset "y offset to send to the offset componant";
    pin out signed xeoffset "x eoffset output";
    pin out signed yeoffset "y eoffset output";
    pin out bit isindex "set index enable only once";
    pin io bit indexenable "hooked to index enable of encoder";
     
    function _;
    license "GPL";
    ;;
    #include  <rtapi_math.h>
    #define  PI 3.14159265358979323846
    float spinang;
    float scale;
    float spinangoffset;
     
        if (!enable) {
            xoffset=0;
            yoffset=0;
            xeoffset=0;
            yeoffset=0;
            isindex = false;
            return;
        }
     
    // only set index enable once
        if (enable && !isindex) {
        isindex = true;
        indexenable = true;
            return;
        }
     
    // wait for spindle index before actually enabling
        if (enable && isindex && indexenable){
            return;
        }
     
    //convert spinangoffset to ratio.. for adding to spindle pos - plus a couple rotations
    //so the spindle position isn't negative
    spinangoffset = (toolang/360)+2;
     
    //formual I found is for circumscribed - convert to inscribed - makes more sense.
    scale=inscribedradius/cos(PI/numsides);
     
    spinang = ((spindlepos + spinangoffset) - (int)(spindlepos + spinangoffset))*2*PI;
    polyradius = (cos(PI/numsides)/cos((fmod(spinang, (2*PI/numsides))-PI/numsides)))*scale-cutterdiam/2;
     
    //actual offsets applied - could be used for offset componant.
    xoffset = cos(spinang)*polyradius * -1;
    yoffset = sin(spinang)*polyradius;
     
    //counts for use with eoffset functionality
    xeoffset = xoffset / eoffsetscale;
    yeoffset = yoffset / eoffsetscale;
     
    spindlerad = spinang;
    Last edited by skunkworks; Mar 10, 2020 at 09:12 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •