Identify the direction of arc's

  • Thread starter bsharp
  • Start date
  • Tags
    Direction
In summary, the conversation discusses the process of translating a file from one format to another, specifically in the context of converting APT code to G code. The main focus is on determining the direction of arcs, which is done by calculating the angle between the direction vector and the arc points. The sign of this angle determines the direction of the arc, which is important in G code. The conversation also mentions the use of VB and the development of a G code post processor.
  • #1
bsharp
7
0
I am trying to translate a file from one format to another. The file I am trying to read from gives me the coordinates of arcs like this.

A three arc circle going clockwise:
GOTO / 0.80353, -0.60825, 0.75000, 0.000000, 0.000000, 1.000000
INDIRV/ -0.86603, 0.50000, 0.00000
TLON,GOFWD/ (CIRCLE/ 0.86603, -0.50000, 0.75000,$
0.12500),ON,(LINE/ 0.86603, -0.50000, 0.75000,$
0.92853, -0.39175, 0.75000)
INDIRV/ 0.86603, -0.50000, 0.00000
TLON,GOFWD/ (CIRCLE/ 0.86603, -0.50000, 0.75000,$
0.12500),ON,(LINE/ 0.86603, -0.50000, 0.75000,$
0.97428, -0.56250, 0.75000)
INDIRV/ -0.50000, -0.86603, 0.00000
TLON,GOFWD/ (CIRCLE/ 0.86603, -0.50000, 0.75000,$
0.12500),ON,(LINE/ 0.86603, -0.50000, 0.75000,$
0.80353, -0.60825, 0.75000)
The same three arc circle going counterclockwise:
GOTO / 0.80353, -0.60825, 0.75000, 0.000000, 0.000000, 1.000000
INDIRV/ 0.86603, -0.50000, 0.00000
TLON,GOFWD/ (CIRCLE/ 0.86603, -0.50000, 0.75000,$
0.12500),ON,(LINE/ 0.86603, -0.50000, 0.75000,$
0.92853, -0.39175, 0.75000)
INDIRV/ -0.86603, 0.50000, 0.00000
TLON,GOFWD/ (CIRCLE/ 0.86603, -0.50000, 0.75000,$
0.12500),ON,(LINE/ 0.86603, -0.50000, 0.75000,$
0.75777, -0.43750, 0.75000)
INDIRV/ -0.50000, -0.86603, 0.00000
TLON,GOFWD/ (CIRCLE/ 0.86603, -0.50000, 0.75000,$
0.12500),ON,(LINE/ 0.86603, -0.50000, 0.75000,$
0.80353, -0.60825, 0.75000)

The “GOTO” command is a linear move followed by it’s cords “X,Y,Z”
The “INDRV” is from what I can figure is a direction vector “X,Y,Z”?
The TLON,GOFWD line specifies the arc center cords “X,Y,Z”
The line after specifies the radius “0.12500” and arc center cords
The next line specifies the ending cords “X,Y,Z”.

Some how I need to determine the direction of each arc. I have tried comparing the starting and ending cords but it will not always work.
If the arc is 360 deg the “INDRV” cord will be positive or negative the corresponding arc center cord.
I think I have to calculate the direction from the “INDRV” based on the starting or ending cords some how.
If you look at the last arc in each example the only thing different is the starting cords “the ending cords from the previous arc”. If some one could help me out with this it would be great.
 
Computer science news on Phys.org
  • #2
Since not one sole answered this ugly question. And after asking a thirty year mechanical engineer veteran and also a 4 year degree physics major.
This is how I solved it on my own. Once plotted out on a graph it is a lot more obvious. Just calculate the angle from the Direction Vector to the center of the arc. This will basically be two vectors. One being the direction vector start point to arc start point and the second as arc start to arc center. Once you can reliably calculate the angle it will be a negative value for one direction and a positive value for the opposite.

http://www.vb-helper.com/howto_find_angles.html"
Basically the sign of the solution will give you the direction.
It also works regardless of quadrant position in Cartesian space.
 
Last edited by a moderator:
  • #3
Looks like BasicA... But no, it's VB.
 
  • #4
mugaliens said:
Looks like BasicA... But no, it's VB.

The "three arc circle" code posted above is actualy APT
http://en.wikipedia.org/wiki/APT_%28programming_language%29"

I wrote a translator in VB to convert APT code to G code http://en.wikipedia.org/wiki/G-code.
The problem I was having with the arc direction was that in G code the direction is specified in a prefix of ether G03 "cw" or G02 "ccw" and in APT the arc direction is specified by a direction vector's relationship with the arc points. so to translate the "APT" arc direction vector to the "G code" equivalent prefix. I needed to calculate the angle between the direction Vector and the Arc points and the sign of the angle will determine the direction "cw or ccw". With this it is easy in VB to say "If arcsign <0 than gcode = G03" or something like that.
It took a lot of learning and turning of some pretty rusty gears but I got it and now I am proud to say I have a G code post processor that I wrote myself and is faster and more precise than any commercial one out there.
 
Last edited by a moderator:

FAQ: Identify the direction of arc's

What is the direction of an arc?

The direction of an arc is the direction in which the arc is traced, either clockwise or counterclockwise.

How do you identify the direction of an arc?

To identify the direction of an arc, you can use the right-hand rule. Place your right hand with your fingers pointing in the direction of the arc, and your thumb will point in the direction of the arc's direction.

Can an arc have both clockwise and counterclockwise directions?

No, an arc can only have one direction. However, if an arc is traced in the opposite direction, it becomes a different arc with a different measure.

Why is it important to identify the direction of an arc?

Identifying the direction of an arc is important for calculating the angle measure of the arc, as well as for understanding the relationship between different arcs in a circle.

Do all arcs have a direction?

Yes, all arcs have a direction. Even a full circle can be considered as an arc with a direction, either clockwise or counterclockwise.

Similar threads

Replies
1
Views
700
Replies
2
Views
1K
Replies
39
Views
3K
Replies
3
Views
2K
Replies
25
Views
808
Back
Top