584,865 active members*
4,985 visitors online*
Register for free
Login Register
TDM Systems Forum

Digital. Experienced. Powerful. - 100% Tool Management

G-Code Programing > G02 draw circle
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2010
    Posts
    0

    G02 draw circle

    hello
    sorry.my English is very weak i hope that you understand my message
    i am trying to write a program g-code with delphi
    but i have problems about G02 and draw a circle becuse i can not use Arc
    and i had to draw a circle with lines.please help me to find a solution for this
    problem.how draw line and what kind of parameters i need?
    please help me

  2. #2
    Join Date
    Aug 2010
    Posts
    0
    Hi
    In order to draw a circle using lines consider the equation of the circle X^2+Y^2 = R^2
    You know the radius of the circle. Consider a point on circle. Let it be (X1,Y1).

    Now increment the X1 value to X2 = X1+0.01 and calculate the corresponding Y2 value from equation Y2 = squareroot(R^2 - X2^2).

    Iterate the process by incrementing the X value to 0.01 until Xn = X1 + 2R.

    So now u will get a set points and by joining those points you will get a semicircle.

    Proceed in the reverse way i.e. from Xn to X1 to get the other semicircle.

  3. #3
    Join Date
    Sep 2010
    Posts
    0
    Quote Originally Posted by praneshkumarpj View Post
    Hi
    In order to draw a circle using lines consider the equation of the circle X^2+Y^2 = R^2
    You know the radius of the circle. Consider a point on circle. Let it be (X1,Y1).

    Now increment the X1 value to X2 = X1+0.01 and calculate the corresponding Y2 value from equation Y2 = squareroot(R^2 - X2^2).

    Iterate the process by incrementing the X value to 0.01 until Xn = X1 + 2R.

    So now u will get a set points and by joining those points you will get a semicircle.

    Proceed in the reverse way i.e. from Xn to X1 to get the other semicircle.
    Thankyou
    u mean the new equation of the circle is x2^2+y2^2=R2^2
    but i want to write this equation in delphi or other programming langauge.for
    example in delphi it write by lineto(x,y)
    so how i can write it?

  4. #4
    Join Date
    Feb 2007
    Posts
    314
    i dont think it is a good idea to set a linear increment, cause it is a trigonometric function. With a linear increment, acuracy won't be the same all aroud the circle.Instead, use an angular increment.

    A=Angle
    R=radius
    I=increment

    Do this loop while A is less that the value you want to reach
    X=cosA*R
    y=sinA*R
    lineto(x,y)
    A=A+I

  5. #5
    Join Date
    Feb 2006
    Posts
    1792
    Right.

  6. #6
    Join Date
    Aug 2010
    Posts
    0
    Quote Originally Posted by Farzaneh_2010 View Post
    Thankyou
    u mean the new equation of the circle is x2^2+y2^2=R2^2
    but i want to write this equation in delphi or other programming langauge.for
    example in delphi it write by lineto(x,y)
    so how i can write it?
    you have to iterate the equation several times and use the numeric values arrived from the equation

Similar Threads

  1. Draw Bar
    By g29cc in forum Novakon
    Replies: 2
    Last Post: 08-12-2010, 02:58 PM
  2. How to draw this?
    By SPEEDRE in forum Solidworks
    Replies: 9
    Last Post: 06-16-2009, 03:10 AM
  3. cut circle
    By bbrown2005 in forum Mach Wizards, Macros, & Addons
    Replies: 2
    Last Post: 02-05-2009, 01:41 AM
  4. ?s on How to draw a Hex.
    By Stampede in forum BobCad-Cam
    Replies: 12
    Last Post: 02-04-2009, 03:26 AM
  5. okk-mha-400 draw bar
    By Ethan H in forum OKK
    Replies: 0
    Last Post: 10-08-2008, 02:39 AM

Posting Permissions

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