make a arc mid-point coördinaten for kuka robot

]Hello, i have try to get the arc center/ midpoint coördinaten but i dont know how i can get
its for an kuka robot arm the straight lines will work but on an Circular move the robot will run away

i need to place acr midle point and arc end point the start point is where the robot is already

this i need to get
CIRC {X 50,Y 55,Z -5,A 0,B 0,C 0} , {X -5,Y 0,Z -5,A 0,B 0,C 0} C_DIS
this is what i get from sheetcam
CIRC { X -55, Y -0, Z -5.0000 } , { X -5.0000, Y 0.0000, Z -5.0000 }
this example is a half circle of 100mm wide with a tool diameter of 10mm


function OnArc()
   if(arcAngle <0) then
      post.Text ("CIRC {")
   else
      post.Text ("CIRC {")
   end
      local needComma = false
      
   if(arcCentreX < 1e17) then
      post.Text(" X ")
      post.Number ((arcCentreX - currentX), "0.##")
      needComma = true
   end
   
   if(arcCentreY < 1e17) then
      if(needComma) then post.Text(",") end
      post.Text(" Y ")
      post.Number ((arcCentreY - currentY), "0.##")
      needComma = true
   end
      if(endZ < 1e17) then
      if(needComma) then post.Text(",") end         
      post.Text(" Z ")
      post.Number(endZ * scale,  "0.0000")
      needComma = true
   end
   
   post.Text (" } , { ")


   if(endX < 1e17) then
      post.Text(" X ")
      post.Number(endX * scale,  "0.0000")
      needComma = true
   end
   if(endY < 1e17) then
      if(needComma) then post.Text(",") end         
      post.Text(" Y ")
      post.Number(endY * scale,  "0.0000")
      needComma = true
   end
   if(endZ < 1e17) then
      if(needComma) then post.Text(",") end         
      post.Text(" Z ")
      post.Number(endZ * scale,  "0.0000")
      needComma = true
   end
   post.Text (" }\n")
   post.ModalNumber ("$VEL.CP=", feedRate * scale, "0.0###\n")
   post.Eol()
   
end

this is what the robot need to do on an Circular move
CIRC – Circular – Motion at a defined velocity and accerlation along a circular path or a portion of a circular path. This motion requires the programmer to “teach” two points, the mid-point and the end point. Using the start point of the robot (defined as the end point in the previous motion command) the robot interpolates a circular path through the mid-point and to the end point
Kuka.scpost (4.47 KB)

Do you need absolute or or relative arc center points? Your code outputs the arc center relative to the start point.
A couple of extra thoughts - you don’t need to check if the coordinates are less than 1e17 when cutting arcs. 1e17 indicates the number is unknown. This can only happen for the first few rapid moves.
If those trailing zeros are a problem use the number format “0.##”. This only puts in trailing digits if they are needed.

i need the a absolute position of the arc center point

Where you have code like this:

post.Number ((arcCentreX - currentX), "0.##")

Change it to:

post.Number (arcCentreX, "0.##")

did not work it neet the center position from X and y zero location

https://www.youtube.com/watch?v=HEanVlT0VgA&ab_channel=AleksandarTomic like on this video

if i will make a half circle of 100mm and i start the circle on X100 Y100 the center point will be X150 Y150 and the end point will be X200 Y100

but i dont know how i can get this out sheetcam most machines use I and J code

Did you change the code for the Y arc centre as well?

If your robot has plenty of memory you could get the post to break arcs into lots of short lines. Replace your function OnArc() with this one:

function OnArc()
   post.ArcAsMoves(0.1)
end

Increasing the number will reduce the number of lines of code but it will also reduce accuracy.

yes this will work is it also possible to change arcCentreY to anyting else that it will take for the center real x and y coördinaten
now with post.ArcAsMoves(0.1) it is indeed too busy for the memory

post.Number ((arcCentreY), "0.##")

I found a Kuka manual and I now see what the problem is. The reference point is a point on the arc other than the start or end point. It is not the centre point. Give the attached post a try.
Kuka-2.scpost (3.83 KB)

i have try works good thank you very much

i see today that on an circle this will not work beause the start and endpoint will be the same i see on other cadcam post it will be make a circle with 2 start and 2 end points to make an compleet circle 2 time a half circle

if i make a jet cutting and use microcut the circle will be cutted but on milling i dont get started beause start and end point are the same

from other cadcam

LIN {X 197.5,Y 100,Z -2.5,A 0,B 0,C 0} C_DIS
CIRC {X 100,Y 197.5,Z -2.5,A 0,B 0,C 0} , {X 2.5,Y 100,Z -2.5,A 0,B 0,C 0} C_DIS
CIRC {X 100,Y 2.5,Z -2.5,A 0,B 0,C 0} , {X 197.5,Y 100,Z -2.5,A 0,B 0,C 0} C_DIS

from sheetcam

LIN { X 100, Y 2.5, Z -2.5}
CIRC { X 100, Y 197.5, Z -2.5 } , {  X 100, Y 2.5, Z -2.5 }, CA 360

This should fix it.
Kuka-3.scpost (4.21 KB)

yes now it works fine i have set THE CA function off
it was not necessary to mention this sometimes it changes to - if it is + and vice versa then the robot will walk the other way

thank you very much for the support :mrgreen: