Igor Chudov wrote:
Andy and Kirk, thanks a lot.
How is Z set up on lathe: does Z increase as I get closer to the lathe chuck?
No, the RS274-D definition is the same, moving the tool toward the chuck
is -Z.
Is there a canned cycle or some available subroutine to do so?
I have attached a C program that I used for my ball turning. I see some
comments that indicate it
was adapted from a different program, and these comments probably no
longer make sense.
Jon
/* makering.c */
#include <p2c/p2c.h>
Static double CenterX, CenterY, ToolDia, BallDia, BallRadius, FeedRate,
doc, FinishWOC, FinishFeed, Offset, CurRadius,
X, Y, Z, I, DepthPerPass, BoreDepth, CurFeed, OldFeed,
J, NX, NY, NR, CurX, CurY, CurZ, CentDist, ToolRadius;
Static double CurRad,FastFeed;
Static double zero = 0;
Static double ArcCent, ArcRadius, OldRadius;
Static double LineNo;
Static Char FileName[256];
Static boolean Done;
Static FILE *OutFile;
Static Void OutNum(RealNum, SigFrac)
double RealNum;
long SigFrac;
{
double i;
int j;
char format[8];
for (i = 1.0, j = 0; i <= 6 || i<= abs(RealNum); i *= 10.0, j++)
{}
if (SigFrac > 0)
j += SigFrac+1; /* J <= # int digits + 1 for decimal pt + #frac digits */
if (RealNum < 0.0 )
j += 1; /* add a position for the minus sign */
sprintf(format,"%%%d.%df",j,SigFrac);
fprintf(OutFile, format, (RealNum));
}
Static Void WriteLineNo()
{
putc('N', OutFile);
OutNum(LineNo, 0L);
LineNo += 10.0;
putc(' ', OutFile);
}
main(argc, argv)
int argc;
Char *argv[];
{
OutFile = NULL;
printf("Enter Starting X,Y (real):");
scanf("%lg%lg%*[^\n]", &CenterX, &CenterY);
getchar();
printf("\nEnter Tool Diameter, Ball Diameter (real):");
scanf("%lg%lg%*[^\n]", &ToolDia, &BallDia);
getchar();
printf("\nEnter Feed Rate (IPM), Depth of Cut (real):");
scanf("%lg%lg%*[^\n]", &FeedRate,&doc);
getchar();
printf("\nEnter Finish Feed Rate, Depth of Cut (real):");
scanf("%lg%lg%*[^\n]", &FinishFeed, &FinishWOC);
getchar();
printf("\nEnter File Name for CAM output:");
scanf("%s",FileName);
putchar('\n');
OutFile = fopen(FileName,"w");
if (OutFile != NULL)
rewind(OutFile);
else
OutFile = tmpfile();
if (OutFile == NULL)
exit(EXIT_FAILURE);
LineNo = 10.0;
FastFeed = 30.0;
ToolRadius = ToolDia / 2.0;
BallRadius = BallDia / 2.0;
/* safety test on Width of cut */
/* if (BoreRadius - ToolRadius - FinishWOC <= WidthOfCut)
{
printf("Width of Cut too large to spiral out to requested bore.\n");
exit(EXIT_FAILURE);
} */
/* loop to cut ball by succeding depths of cut */
WriteLineNo();
fprintf(OutFile, " G18"); /* Select plane of arc motion */
putc('\n', OutFile);
for (CurRadius = BallRadius*1.414 + ToolRadius;
CurRadius >= BallRadius+ToolRadius-doc; CurRadius -= doc)
{
CurRad = CurRadius;
if (CurRad < BallRadius+ToolRadius)
{
CurRad = BallRadius+ToolRadius;
}
printf("radius is %f\n",CurRad);
CurFeed = FeedRate;
WriteLineNo();
fprintf(OutFile, "G01 "); /* Linear Interpolation */
putc('F', OutFile); /*set feedrate */
OutNum(FastFeed, 3L);
putc(' ', OutFile);
putc('X', OutFile); /* Move to clearance */
OutNum((BallRadius+ToolRadius+0.1), 4L);
fprintf(OutFile, " Y");
OutNum(zero, 4L);
putc('\n', OutFile);
WriteLineNo();
fprintf(OutFile, " Z"); /* LOWER tool */
OutNum(CurRad-BallRadius-ToolRadius,4L);
putc('\n', OutFile);
WriteLineNo();
fprintf(OutFile, " X"); /* go to center */
OutNum(zero,4L);
putc('\n', OutFile);
WriteLineNo();
fprintf(OutFile, " G03 X"); /* make arc */
OutNum(CurRad*0.866,4L);
fprintf(OutFile, " Z");
OutNum(-CurRad*0.5-BallRadius-ToolRadius,4L);
fprintf(OutFile, " R");
OutNum(CurRad,4L);
fprintf(OutFile," F");
OutNum(CurFeed,4L);
putc('\n', OutFile);
}
WriteLineNo();
fprintf(OutFile, "G01 F30 X"); /* raise spindle above work */
OutNum(BallRadius+ToolRadius+.1, 4L);
putc('\n',OutFile);
fprintf(OutFile, "M02\n"); /*End of Program */
if (OutFile != NULL)
fclose(OutFile);
OutFile = NULL;
if (OutFile != NULL)
fclose(OutFile);
exit(EXIT_SUCCESS);
}
/* End. */
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users