G76 Threading cycle code location want to cut taper thread

More
06 Jul 2017 17:22 #95441 by snujcnc
Hi All
I want to make taper thread on pipe OD and ID , issue is g76 work for straight thread only ,i make taper thread with G33 but for that i need software like master-cam ...
can any one get me to g76 actual code location so i can try to understand in source ...
or make comment on this thought ....
or is there any ready available solution for my problem please tell me .....

thanks

Please Log in or Create an account to join the conversation.

More
07 Jul 2017 14:11 - 07 Jul 2017 14:54 #95472 by massimodamassa
(Example 60 ° M20x2.5 metric thread)

(P = thread pitch)
(Z = thread end length in Z)
(I = safety distance from starting X, negative for external thread, positive for internal thread)
(NB abs (I) = safety diameter - thread diameter)
(J = Initial Cutting Depth)
(K = Total Threaded Depth = 0.613x2x Pass)

(Optional)

(R = 1 = steady constant increase, 2 = constant section)
(Q = semi angle of thread 30 for iso 27.5 per inch)

(H = number of finishing passes)
(E = stretch length for softening)
(L = if 0 = ripping, 1 = incoming, 2 = outgoing, 3 = both)


NB i, j, k These values are diameters in G7 (diametrical mode)

You can fool him with parameters E and L :-)


example

G7 G18 G21 G40 G54 G61 G80 G90 G95
T1 M6 G43
G97 M3 S500
G0 X22 Z50 M8
G76 P 2.5 Z0 I-2 J0.5 K3.065 H1 R1 Q30 E50 L2
G0 X22 M5
Z5 M9
M30
Last edit: 07 Jul 2017 14:54 by massimodamassa.

Please Log in or Create an account to join the conversation.

More
07 Jul 2017 15:45 #95474 by snujcnc
thanks for reply

i tried with your suggestions
but if i enter E value more then z langth or similar to z length i can see there is taper movement in whole thread
my component entry diameter is 55.2 mm and exit diameter is 66.35 mm
so total taper required (if measured radially) is 66.35(diger diameter)-55.2(smaller diameter) mm = 13.85 (diameter distance /2 = 6.925 radial distance

angle is 8.6 degree

but there is no relation between My requirement and E value

my cycle is
G76 p1 z-74 i-0.1 k1.5 h0 E74 r2 q30 l1
this run in taper that is ok but not my required taper i get from this E value

but if i run
G76 p1 z-74 i-0.1 k1.5 h0 E37(exact half value of z length) r2 q30 l1
This run in taper around half of z travel and after thread become straight

can you explain me what this E value does in cycle

any other way to use g76 in taper with my given taper value in angle or

i can put x axis and z axis value in g76 cycle

Please Log in or Create an account to join the conversation.

More
07 Jul 2017 16:06 #95475 by snujcnc
i check again
and found that k value is maximum value that we can g from E = Z value

that means if we keep E=Z then i can get full taper on given z length

but maximum taper i can get isot more then K value

difference between minor diameter and mejor diameter is = not more then K value
g0x0z0
G76 p1 z-74 i-0.1 k1.5 h0 E74 r2 q30 l1

above program i can get only 1.5 mm difference between minor and major diameter my requirement is 6.25 mm difference

any suggestions

Please Log in or Create an account to join the conversation.

More
07 Jul 2017 18:42 - 07 Jul 2017 21:00 #95479 by massimodamassa
Give me the parameters of the thread, after i can do it with the cam and put you the various XZ of G33

or look here forum.linuxcnc.org/lathe-subroutines-lib...pipe-threading#94309
Last edit: 07 Jul 2017 21:00 by massimodamassa.
The following user(s) said Thank You: snujcnc

Please Log in or Create an account to join the conversation.

More
08 Jul 2017 01:29 #95491 by snujcnc
Thanks for your offer ...

I can make g33 with Mastercam
Actually I make g33 program with Mastercam in past and sucessfully I use ....

But I want to use g76 x z to make taper thread

Please Log in or Create an account to join the conversation.

More
09 Jul 2017 14:05 #95540 by snujcnc
Finally I Solved issue with g76 with tapered and straight in same cycle
G76 p x z i j k e r h l
Pitch
X taper value in x axis difference between minor and major diameter
I -ve value for od
J k e r h l is normal value

I tested on machine and work fine

Make some changes in source file

Now I am not available so once I am in factory I will upload code

Thanks everyone for help
The following user(s) said Thank You: massimodamassa

Please Log in or Create an account to join the conversation.

More
09 Jul 2017 19:40 #95550 by massimodamassa
Interestingly, practically enough to indicate the final value of the diameter (X) and the G76 understands that it is conical?
The manual does not explain this.
PS but do you use an overrun lathe with emc? I'd like to know how to handle the tool table.
Look for help and in the end you helped others.

Please Log in or Create an account to join the conversation.

More
09 Jul 2017 22:45 #95559 by snujcnc
#define AABBCC settings->AA_current, settings->BB_current, settings->CC_current, settings->u_current, settings->v_current, settings->w_current

int Interp::convert_threading_cycle(block_pointer block,
setup_pointer settings,
double end_x, double end_y, double end_z) {

// G76 P- Z- I- J- K- R- Q- H- E- L- D~

// TODO: check active plane? G17 seems to be active no matter what is selected
// TODO: errors out with y word, but not with x

// CHKS((settings->cutter_comp_side), //snujcnc for d word error
// (_("Cannot use G76 threading cycle with cutter radius compensation on")));//snujcnc for d word error

CHKS((block->p_number <= 0),
(_("In G76, P must be greater than 0")));
double lead = block->p_number;
lead *= 0.001;

CHKS((block->i_number == 0),
(_("In G76, I must not be 0")));
double i_number = block->i_number;
int boring = (i_number > 0.0) ? 1 : -1;
i_number = fabs(i_number);

CHKS((block->j_number <= 0),
(_("In G76, J must be greater than 0")));
double j_number = block->j_number;

CHKS((block->k_number <= block->j_number),
(_("In G76, K must be greater than J")));
double k_number = block->k_number;

/* Optional parameters R, Q, H, E, L, D
If parameter exists, validate value, make local copy
If missing, set default value
*/
// R - Depth of cut regression
double doc_dgr = 1.0;
if(block->r_flag) {
CHKS((block->r_number < 1.0),
(_("In G76, if R is used it must be 1.0 or greater")));
doc_dgr = block->r_number;
}

// Q - Compound slide angle
double compound_angle = block->q_flag ? block->q_number : 0;
compound_angle *= M_PIl/180.0; // convert from degrees to radians
if(end_z > settings->current_z) compound_angle = -compound_angle;

// H - Number of spring passes
int spring_cuts = block->h_flag ? block->h_number : 0;

// E - Z distance from Z Start or Z End for entry or exit taper
double end_taper = 0.0;
if(block->e_flag) {
CHKS((block->e_number < 0.0 || block->e_number > (fabs(end_z - settings->current_z) / 2)),
(_("In G76, if E is used it must be between 0 and half the distance to Z end, inclusive.")));
end_taper = block->e_number;
}

// L - Indicator for which tapers are needed
int end_taper_flags = 0;
if(block->l_flag) {
CHKS((block->l_number < 0 || block->l_number > 3),
(_("In G76, if L is used it must be: 0 = no taper, 1 = entry, 2 = exit, 3 = both.")));
end_taper_flags = block->l_number;
}
int entry_taper = end_taper_flags & 1;
int exit_taper = end_taper_flags & 2;

// D - X distance at far end of synchronized pass for thread taper //snujcnc
double x_number = block->x_flag ? block->x_number : 0;
int main_taper_flag = (fabs(x_number) > 0) ? 1 : 0;

// convert X values to radius format from diameter mode if needed
if(_setup.lathe_diameter_mode){
i_number /= 2;
j_number /= 2;
k_number /= 2;
x_number /= 1;
}

/* Let there be a basic tool path made up of six points.
The first point, pA, is set with a move just prior to invoking G76. It
is the base from which the rest of the points are set based on the
command parameters.

Leg 1 - pA to pB - rapid from tool clearance to beginning of
synchronized motion
Leg 2 - pB to pC - sync motion across entry taper if needed
Leg 3 - pC to pD - sync motion to cut main thread, may be tapered.
Taper is parallel to the line through pA and pF (tool clearance line)
Leg 4 - pD to pE - sync motion across exit taper if needed
Leg 5 - pE to pF - rapid to tool clearance line
Leg 6 - pF to pA - return to start
*/

/* constant points - two points on the tool clearance line
base point, pA; retract point, pF
*/
double pAx = settings->current_x;
double pAy = settings->current_y;
double pAz = settings->current_z;
double pFx = pAx + x_number;
double pFz = end_z;

/* The synchronized path shape is set by the final threading pass. This
shape is then shifted to the starting points of previous passes.
The sync path is made up of three legs -- entry taper, main
thread, and exit taper, or pB to pC to pD to pE.
If the entry or exit taper are omitted, pCb and/or pDb are used instead.
*/
double pCbx = pAx + (boring * (i_number + k_number));
double pCbz = pAz;
double pDbx = pCbx + x_number;
double pDbz = end_z;

int z_dir = (pAz > pFz) ? -1 : 1;
double z_len = fabs(pFz - pAz);
double tx = end_taper * (x_number / z_len);

double pBx, pBz, pCx, pCz, pDx, pDz, pEx, pEz;
if(entry_taper) {
pBx = pCbx - (boring * k_number);
pBz = pCbz;
pCx = pCbx + tx;
pCz = pCbz + (z_dir * end_taper);
}

if(exit_taper) {
pDx = pDbx - tx;
pDz = pDbz - (z_dir * end_taper);
pEx = pDbx - (boring * k_number);
pEz = pDbz;
}

double lead_et = (end_taper_flags > 0) ?
lead *(hypot(end_taper, k_number)/end_taper) : lead;
double lead_mt = (main_taper_flag > 0) ?
lead *(hypot(z_len, x_number)/z_len) : lead;

double x_factor, pBxi, pCbxi, pCxi, pDbxi, pDxi, pExi;
double czi , pBzi, pCbzi, pCzi, pDbzi, pDzi, pEzi;

double ji = j_number;

int pass = 1;
while (ji < k_number) {
// start of first pass for external threads = last pass pos + K, then -J,
// -boring adjusts for internal threads
x_factor = -boring * (k_number - ji);
printf("--- i %d Xf %8.4f ji %8.4f\n", pass, x_factor, ji);

pBxi = pBx + x_factor;
pCbxi = pCbx + x_factor;
pCxi = pCx + x_factor;
pDbxi = pDbx + x_factor;
pDxi = pDx + x_factor;
pExi = pEx + x_factor;

czi = (k_number - ji) * tan(compound_angle);
pBzi = pBz + czi;
pCbzi = pCbz + czi;
pCzi = pCz + czi;
pDbzi = pDbz + czi;
pDzi = pDz + czi;
pEzi = pEz + czi;

if(entry_taper) {
// pA to pB, entry leg
STRAIGHT_TRAVERSE(block->line_number, pBxi, pAy, pBzi, AABBCC);
} else {
// pA to pCb, entry leg
STRAIGHT_TRAVERSE(block->line_number, pCbxi, pAy, pCbzi, AABBCC);
}
DISABLE_FEED_OVERRIDE();
if(entry_taper) {
START_SPEED_FEED_SYNCH(lead_et, 0);
STRAIGHT_FEED(block->line_number, pCxi, pAy, pCzi, AABBCC); // to pC
}
if(exit_taper) {
START_SPEED_FEED_SYNCH(lead_mt, 0);
STRAIGHT_FEED(block->line_number, pDxi, pAy, pDzi, AABBCC); // to pD
START_SPEED_FEED_SYNCH(lead_et, 0);
STRAIGHT_FEED(block->line_number, pExi, pAy, pEzi, AABBCC); // to pE
} else {
START_SPEED_FEED_SYNCH(lead_mt, 0);
STRAIGHT_FEED(block->line_number, pDbxi, pAy, pDbzi, AABBCC); // to pDb
}
STOP_SPEED_FEED_SYNCH();
// to pF, retract leg
STRAIGHT_TRAVERSE(block->line_number, pFx, pAy, pFz, AABBCC);
ENABLE_FEED_OVERRIDE();
// pF to pA, return to the start
STRAIGHT_TRAVERSE(block->line_number, pAx, pAy, pAz, AABBCC);
ENABLE_FEED_OVERRIDE();

ji = j_number * pow(++pass, 1.0/doc_dgr); // distance of next cut from pass zero
// prevents excessive time spent in looping, may need adjustment if
// there is a pracical application that needs more passes.
if(pass > 100) break;
}

// Do final path
for(int i = 0; i<spring_cuts+1; i++) {
if(entry_taper) {
// pA to pB, entry leg
STRAIGHT_TRAVERSE(block->line_number, pBx, pAy, pBz, AABBCC);
} else {
// pA to pCb, entry leg
STRAIGHT_TRAVERSE(block->line_number, pCbx, pAy, pCbz, AABBCC);
}
DISABLE_FEED_OVERRIDE();
START_SPEED_FEED_SYNCH(lead, 0);
if(entry_taper) {
STRAIGHT_FEED(block->line_number, pCx, pAy, pCz, AABBCC); // to pC
}
if(exit_taper) {
STRAIGHT_FEED(block->line_number, pDx, pAy, pDz, AABBCC); // to pD
STRAIGHT_FEED(block->line_number, pEx, pAy, pEz, AABBCC); // to pE
} else {
STRAIGHT_FEED(block->line_number, pDbx, pAy, pDbz, AABBCC); // to pDb
}
STOP_SPEED_FEED_SYNCH();
// to pF, retract leg
STRAIGHT_TRAVERSE(block->line_number, pFx, pAy, pFz, AABBCC);
ENABLE_FEED_OVERRIDE();
// pF to pA, return to the start
STRAIGHT_TRAVERSE(block->line_number, pAx, pAy, pAz, AABBCC);
ENABLE_FEED_OVERRIDE();
}


#undef AABBCC
return INTERP_OK;
}

Please Log in or Create an account to join the conversation.

More
09 Jul 2017 22:58 #95560 by snujcnc
Above code is from emc > rs274>interpr_converter.cc
This code is taken from one website link provided on forum of linuxcnc

I make some changes in code ....which I commented with // snujcnc
If you put this code in file it works
If u use x value it make taper thread
If u don't use x value it make straight thread

With this code you also can make entry taper and exit taper like before you can with g76

Thanks everyone for reading my post ....I am not programmer but I can understand what I need to do with code

Still I am looking for g71 g 72 cycle work directly from linuxcnc without subroutine call

I don't know how to add support for g codes

If someone does g71 and g72 please let me know
The following user(s) said Thank You: massimodamassa

Please Log in or Create an account to join the conversation.

Moderators: piasdom
Time to create page: 0.173 seconds
Powered by Kunena Forum