587,427 active members*
5,112 visitors online*
Register for free
Login
Page 1 of 2 12
Results 1 to 20 of 38
  1. #1
    Join Date
    Jul 2004
    Posts
    90

    Source code needed!

    Does anyone know where I can find the source code that would print out the g-code for an arc? The g-code would look something like this, "N30 G2 X115 Y113.3 I-43 J25.52". Maybe someone know's the math behind this. My little bitty brain just can't quit get a grasp on it. Any help would be very much appreciated.

    Gary

  2. #2
    Join Date
    Mar 2003
    Posts
    35538
    If you know the start pint, endpoint, and radius of the arc, you should be able to google to find the math. You'll also need to know if it's CW or CCW.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  3. #3
    Join Date
    Mar 2003
    Posts
    35538
    Actually, if you know the startpoint, endpoint, and radius, the only math you would need is to find the center.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  4. #4
    Join Date
    Jul 2004
    Posts
    90
    That's what I need. The user would put in the startpoint, endpoint, and radius. Then the algorithym would find the center. Correct?

    Gary

  5. #5
    Join Date
    Jun 2003
    Posts
    1365
    do you have a drawing in say autocad? you can dimention off of the arc.


    Jon

  6. #6
    Join Date
    Mar 2003
    Posts
    35538
    This should get you in the right direction. http://mathforum.org/dr.math/faq/faq...e.segment.html
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  7. #7
    Join Date
    Jul 2004
    Posts
    90
    Jon,

    The only cad program I have is Turbocad!
    Gerry I will check that out, thank you.

    Gary

  8. #8
    Join Date
    Mar 2003
    Posts
    765
    Gary,

    A while back I posted some Visual Basic source code in the Coding forum. You didn't say what programming language you were looking for, but hopefully you can decipher what you need from it. It includes a function for calculating the arc center from start, end and radius.

    http://www.cnczone.com/forums/showthread.php?t=12783

    Regards,
    Scott

  9. #9
    Join Date
    Jul 2004
    Posts
    90
    MetLHead,

    Thanks, that's what I have been looking for.

    Gary

  10. #10

  11. #11
    Join Date
    Jul 2004
    Posts
    90
    widgitmaster,

    Thanks for the link. I am trying to figure out how to use MetlHead's Geometry module to use in a program I am trying to write. I ain't figured it out yet but I'm trying. Must be nice not to be so darn dumb.

    Gary

  12. #12

    Cool

    The best experience is what you learn from major screw ups!

    Eric

  13. #13
    Join Date
    Mar 2003
    Posts
    765
    Quote Originally Posted by GaryM
    widgitmaster,

    Thanks for the link. I am trying to figure out how to use MetlHead's Geometry module to use in a program I am trying to write. I ain't figured it out yet but I'm trying. Must be nice not to be so darn dumb.

    Gary
    I'll post some sample code later today to help get you going.

    Scott

  14. #14
    Join Date
    Jun 2003
    Posts
    2103
    Quote Originally Posted by widgitmaster
    The best experience is what you learn from major screw ups!

    Eric

    If that is the case, I am the most experienced person there is!

    Mike
    No greater love can a man have than this, that he give his life for a friend.

  15. #15
    Join Date
    Mar 2003
    Posts
    765
    Gary,

    Here's a quick sample project in VB. On the form there are text boxes for entering a start point, end point and radius. There are also two option buttons for specifying arc direction. Just enter values and click either 'Add Line' to insert a G01 block or 'Add Arc' to insert a G02/G03 block. You might want to step through it a few times to see what's going on.

    Hope this helps,
    Scott
    Attached Files Attached Files

  16. #16
    Join Date
    Jul 2004
    Posts
    90
    MetLHead,

    You are all right. That is exacly what I needed. I was getting close but I missed it a little bit. When I get the program cleaned up a little bit I will post it for people to try out. Thanks again!

    Gary

  17. #17
    Join Date
    Jul 2004
    Posts
    90
    Boy do I need HELP! I figured out how to use MetlHead's code, but how to actually use this to draw an arc? Here is the G-code
    G01 F30 X10 Y10
    G01 Z-2
    G02 X70 Y60 I73.3 J-26.96
    I tried using this to draw an arc, e.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle)
    Still can't get it to draw an arc the way cncsimulator does. Anyone have a hint or clue?
    Sorry I ask these dumb questions, I have only messed around with programming a little bit, nothing this complex.

    Gary

  18. #18
    Join Date
    Mar 2004
    Posts
    761
    GaryM,

    I posted a G-Code to DXF program converter with open source a while back:

    http://www.cnczone.com/forums/showthread.php?t=8814

    Looks close to the same method that MetLHead used. Great minds think alike
    Wayne Hill

  19. #19
    Join Date
    Oct 2004
    Posts
    742
    Quote Originally Posted by WayneHill
    GaryM,

    I posted a G-Code to DXF program converter with open source a while back:

    http://www.cnczone.com/forums/showthread.php?t=8814

    Looks close to the same method that MetLHead used. Great minds think alike
    Hey Guys:
    I want to compliment Wayne on his program. I have used it and recommend it. If you need a conversion program, this is the one.

    Jerry

  20. #20
    Join Date
    Jul 2004
    Posts
    90
    Wayne,

    Thanks I'll check it out.

    Gary

Page 1 of 2 12

Posting Permissions

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