Non-circular boring. (Linuxcnc fun)


Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: Non-circular boring. (Linuxcnc fun)

  1. #1
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Non-circular boring. (Linuxcnc fun)

    Andy created a hex on his lathe by slaving his x axis to the spindle rotation. I wondered if I could do something similar on the mill....

    bore a hex hole anyone?



    I created a hal component (realtime module within linuxcnc) that takes the spindle angle and calculates where x/y needs to be to create a polygon. (hex in this case but you can do almost any sided polygon)

    Similar Threads:


  2. #2
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    testing the component...





  3. #3
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    This machine is being run with a rpi4+mesa 7i92.

    working well so far.



  4. #4
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    First couple tries in plastic. (painfully slow - just testing) (and the hole size should be way closer to the inscribed polygon diameter...)







    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;




  5. #5
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4256
    Downloads
    4
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    OK, that's a new one on me. Very clever.
    You need a servo-controlled spindle for it: mine cannot do that.

    Cheers
    Roger



  6. #6
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    No... The axis are slaved to the spindle. You see me.turnung the spindle by hand and the 2 axis moving.



  7. #7
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4256
    Downloads
    4
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Encoder on the spindle then?

    Cheers
    Roger



  8. #8
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Yes - exactly.



  9. #9
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Now rotatable...





  10. #10
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Added the ability to change the radius of the polygon by moving the X axis. (so you can create profiles..) The resolution of the spindle encoder is visible in the cut you could also just do round profiles. Sort of like lathe turning profiles on a mill.







  11. #11
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    video coming... one gcode program - chamfer, hex and hole all poly-bored..







  12. #12
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    another high quality video..





  13. #13
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    surprised how well it worked considering what I am working with mechanics wise...





  14. #14
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Aluminum!!







  15. #15
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4256
    Downloads
    4
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    OK, aluminium: now seriously impressed!

    Cheers
    Roger



  16. #16
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    And just to see if it could be done....







  17. #17
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4256
    Downloads
    4
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Keep that up and fairly soon people will be refusing to believe the photos!

    Cheers
    Roger



  18. #18
    Member CitizenOfDreams's Avatar
    Join Date
    Nov 2012
    Location
    USA
    Posts
    1267
    Downloads
    4
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    I've seen THAT shape before.





  19. #19
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Pay no attention to the man behind the curtain....

    Quote Originally Posted by RCaffin View Post
    Keep that up and fairly soon people will be refusing to believe the photos!

    Cheers
    Roger




  20. #20
    Member samco's Avatar
    Join Date
    Jul 2003
    Posts
    1754
    Downloads
    2
    Uploads
    0

    Default Re: Non-circular boring. (Linuxcnc fun)

    Lathe mode



    - - - Updated - - -

    start at upgrading the spindle encoder...





Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Non-circular boring.  (Linuxcnc fun)

Non-circular boring.  (Linuxcnc fun)