Results 1 to 9 of 9

Thread: G02 and problems

  1. #1
    Registered
    Join Date
    Sep 2010
    Location
    iran
    Posts
    29
    Downloads
    0
    Uploads
    0

    G02 and problems

    hello
    i am sorry.i have a question about calculate angle part of circle.I have center points and two point in circle.i need to angle between strart point and end point. i search internet but i did not find any formol.so i think may be you know this. so i want to help me please.


  2. #2
    Registered
    Join Date
    Mar 2009
    Location
    canada
    Posts
    7
    Downloads
    0
    Uploads
    0
    use trig mate
    or send me your points and i will give you angle ok
    or tell me what size you want your hole and with what tool you are using and i will give you code


  3. #3
    Registered samu's Avatar
    Join Date
    Feb 2007
    Location
    quebec
    Posts
    264
    Downloads
    0
    Uploads
    0
    First you have to find your radius. You can use any of the two point on the circle.

    R=sqrt[(x-h)*(x-h)+(y-k)*(y-k)]
    where:
    R=radius
    x=x coordinate of a point on the circle
    y=y coordinate of the same point on the circle
    h=x coordinate of the center
    k=y coordinate of the center
    sqrt=square root

    then you have to find the chord length(the lenght of the line that join the 2 point on the circle)

    L=sqrt[(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)]
    where:
    x1=x coordinate of the first point
    x2=x coordinate of the second point
    y1=y coordinate of the first point
    y2=y coordinate of the second point

    then you can calculate angle between two point

    A=2*arcsin[L/(2*R)


  4. #4
    Registered
    Join Date
    Feb 2006
    Location
    india
    Posts
    1,273
    Downloads
    0
    Uploads
    0
    What do these things have to do with G02?
    G02 is a basic function and it should work on all machines without any problem.
    I could not understand his basic problem.


  • #5
    Registered
    Join Date
    Sep 2010
    Location
    iran
    Posts
    29
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by samu View Post
    First you have to find your radius. You can use any of the two point on the circle.

    R=sqrt[(x-h)*(x-h)+(y-k)*(y-k)]
    where:
    R=radius
    x=x coordinate of a point on the circle
    y=y coordinate of the same point on the circle
    h=x coordinate of the center
    k=y coordinate of the center
    sqrt=square root

    then you have to find the chord length(the lenght of the line that join the 2 point on the circle)

    L=sqrt[(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)]
    where:
    x1=x coordinate of the first point
    x2=x coordinate of the second point
    y1=y coordinate of the first point
    y2=y coordinate of the second point

    then you can calculate angle between two point

    A=2*arcsin[L/(2*R)

    Thankyou very much
    i use this formol but i could not success.because i want to draw a circle with small lines.i mean i start a point and find secend point with increase degree and
    draw a line between them and continue it so simulate a circle.
    i write it in delphi.
    a part of my program is;

    Xs and Ys is start point and Xe and Ye is end point and I1 and J1 are cordinate of center

    alpha:=Pi/180 //1 radian
    L:=SQRT(((Xs-Xe)*(Xs-Xe))+((Ys-Ye)*(Ys-Ye)));
    R1 := SQRT((Xe-I1)*(Xe-I1) + (Ye-J1)*(Ye-J1));
    n:=L/(2*R1);
    A:=2*arcsin(n);
    X:=I1+R1*cos(alpha);
    Y:=J1+R1*sin(alpha);
    Paintbox1.Canvas.MoveTo(Round(X*Scale+OffX), Round(X*Scale+OffY)); // move to start point
    while (alpha<A) do
    begin
    alpha:=alpha+Pi/180; //increase radian
    X:=I1+R1*cos(alpha);
    Y:=J1+R1*sin(alpha);
    Paintbox1.Canvas.LineTo(Round(X*Scale+OffX), Round(X*Scale+OffY)); // draw a line
    end;


    please help me.....


  • #6
    Registered
    Join Date
    Sep 2010
    Location
    iran
    Posts
    29
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by sinha_nsit View Post
    What do these things have to do with G02?
    G02 is a basic function and it should work on all machines without any problem.
    I could not understand his basic problem.

    you are right.but i want to write a program about Gcodes in delphi. i mean i need to write this for windows language and i had to a basic program for machine.i hope that you understand my mean. sorry my english is weak...


  • #7
    Registered samu's Avatar
    Join Date
    Feb 2007
    Location
    quebec
    Posts
    264
    Downloads
    0
    Uploads
    0
    Paintbox1.Canvas.MoveTo(Round(X*Scale+OffX), Round(X*Scale+OffY)); // move to start point

    Paintbox1.Canvas.LineTo(Round(X*Scale+OffX), Round(X*Scale+OffY)); // draw a line

    If your program is written like that, you use X coordinate instead of Y in both line


  • #8
    Registered
    Join Date
    Sep 2010
    Location
    iran
    Posts
    29
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by samu View Post
    Paintbox1.Canvas.MoveTo(Round(X*Scale+OffX), Round(X*Scale+OffY)); // move to start point

    Paintbox1.Canvas.LineTo(Round(X*Scale+OffX), Round(X*Scale+OffY)); // draw a line

    If your program is written like that, you use X coordinate instead of Y in both line

    yes
    i write X insted of Y in this page.but i use Y in my program and i can not success.i can not find my mistake.i think everything is right and it is not error but it draw a extravagant lines that it is not like a circle.if you can please help me i don not have time....


  • #9
    Registered samu's Avatar
    Join Date
    Feb 2007
    Location
    quebec
    Posts
    264
    Downloads
    0
    Uploads
    0
    You forgot one important thing, you have to calculate alpha at start point. your arc could began somewhere else than 0 rad or deg.

    To know your Alpha at start :Arcsin[(Y-J)/R] But arcsin is expressed between 90 and -90 deg (pi/2 -pi/2 rad)

    so calculate Arccos[(X-I)/R] But arccos is expresse beween 0 and 180 deg.

    suppose that
    A1=arccos[(x-i)/R]
    A2=arcsin[(y-J)/R]

    if A1 and A2 are positive Alpha at start point=A1
    if A1 is positive and A2 negative Alpha at start point=2pi-A1
    if A1 is negative and A2 is positive Alpha at start point=A1
    if A1 and A2 are negative Alpha at start point =2Pi-A1

    Also, G02 is clockwise arc and the positive direction of the trigonometric circle is counterclockwise. Cause you add a positive value at each segment, you will turn counter clockwise(G03).

    Why you dont move at Xs Ys to begin your arc. (you calculate the point after the start point and then start there)
    When you calculate angle between start and end point with the formula i gave to you, you obtain a result between 0 and 180 deg (0 and pi rad) because L is always positive(it is the result of a square root)and R also is always positive, you have to determine if it is really the result of the formula or 2pi-(this result). Cause you have to see it from a clockwise point of view.

    Use the same method to find aplha at end point that I suggest to find alpha at start point and you won't need the first formula i gave to you. With that you will get alpha at start point and alpha at end point both wit positive value from 0 to 2pi.
    To find angle between start and end from a clockwise point of view:
    If Alpha start>Alpha end Angle between =(Alpha at start)-(alpha at end)
    If Alpha start< alpha end Angle between=2pi+[(Alpha at start)-(alpha at end)]

    then it is easy enough to program wath you want I know nothing about delphi and you will have to do a couple of IF...Then or something like that to resolve these formula but once its done:
    As=Alpha at start point(angle on the trigonometric circle of start point)
    A=angle between start and End (from a clockwise point of view)
    AI=angular increment between each segment
    At=total increment
    Xs=Xcoordinate at start point
    Ys=y coordinate at start point
    Xe=X coordinate at end point
    Ye=ycoordinate at end point
    I= x center
    J= Y center
    R= Radius
    Paintbox1.Canvas.MoveTo(Round(Xs*Scale+OffX), Round(Ys*Scale+OffY)); // move to start point
    At=AI
    while (At<A) do
    begin
    As=As-At;
    X:=I+1*cos(As);
    Y:=J+R*sin(As);
    Paintbox1.Canvas.LineTo(Round(X*Scale+OffX), Round(Y*Scale+OffY)); // draw a line
    At=At+AI;
    end;
    Paintbox1.Canvas.LineTo(Round(Xe*Scale+OffX), Round(Ye*Scale+OffY)); // draw a line
    Last edited by samu; 09-20-2010 at 01:57 PM.


  • Similar Threads

    1. 5t problems
      By markjb in forum Fanuc
      Replies: 17
      Last Post: 10-30-2012, 12:49 PM
    2. 340 problems
      By cuthy83 in forum Daewoo/Doosan
      Replies: 1
      Last Post: 09-28-2009, 07:44 PM
    3. KMB-1 problems
      By MTMW in forum HURCO
      Replies: 4
      Last Post: 07-22-2007, 04:40 AM
    4. .dwg problems anyone???
      By slideleft in forum BobCad-Cam
      Replies: 10
      Last Post: 03-23-2007, 02:03 PM
    5. Tap Problems
      By Skeeterd5150 in forum General Metal Working Machines
      Replies: 33
      Last Post: 06-07-2006, 04:12 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.