diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt index 00db25d4cd..9f71f3fce7 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/Path/CMakeLists.txt @@ -270,8 +270,9 @@ SET(Path_Images ) SET(PathData_Threads - Data/Threads/metric-internal.csv Data/Threads/imperial-internal.csv + Data/Threads/metric-external.csv + Data/Threads/metric-internal.csv ) SET(Path_Data diff --git a/src/Mod/Path/Data/Threads/metric-external.csv b/src/Mod/Path/Data/Threads/metric-external.csv new file mode 100644 index 0000000000..df7f054fdc --- /dev/null +++ b/src/Mod/Path/Data/Threads/metric-external.csv @@ -0,0 +1,350 @@ +name,pitch,tol,dMajorMax,dMajorMin,dPitchMax,dPitchMin,dMinorMax,dMinorMin +M1.6 x 0.35,0.35,6g,1.581,1.496,1.354,1.291,1.202,1.075 +M1.6 x 0.35,0.35,4g6g,1.581,1.496,1.354,1.314,1.202,1.098 +M1.6 x 0.3,0.3,6g,1.582,1.507,1.387,1.342,1.257,1.157 +M1.6 x 0.3,0.3,4g6g,1.582,1.507,1.387,1.359,1.257,1.174 +M1.6 x 0.2,0.2,6g,1.583,1.527,1.453,1.403,1.366,1.28 +M1.6 x 0.2,0.2,4g6g,1.583,1.527,1.453,1.421,1.366,1.298 +M1.7 x 0.35,0.35,6g,1.681,1.596,1.454,1.391,1.302,1.175 +M1.7 x 0.35,0.35,4g6g,1.681,1.596,1.454,1.414,1.302,1.198 +M1.8 x 0.35,0.35,6g,1.781,1.696,1.554,1.491,1.402,1.275 +M1.8 x 0.35,0.35,4g6g,1.781,1.696,1.554,1.514,1.402,1.298 +M1.8 x 0.2,0.2,6g,1.783,1.727,1.653,1.603,1.566,1.48 +M1.8 x 0.2,0.2,4g6g,1.783,1.727,1.653,1.621,1.566,1.498 +M2 x 0.4,0.4,6g,1.981,1.886,1.721,1.654,1.548,1.408 +M2 x 0.4,0.4,4g6g,1.981,1.886,1.721,1.679,1.548,1.433 +M2 x 0.25,0.25,6g,1.982,1.915,1.82,1.764,1.711,1.61 +M2 x 0.25,0.25,4g6g,1.982,1.915,1.82,1.784,1.711,1.63 +M2.2 x 0.45,0.45,6g,2.18,2.08,1.888,1.817,1.693,1.54 +M2.2 x 0.45,0.45,4g6g,2.18,2.08,1.888,1.843,1.693,1.566 +M2.2 x 0.25,0.25,6g,2.182,2.115,2.02,1.964,1.911,1.81 +M2.2 x 0.25,0.25,4g6g,2.182,2.115,2.02,1.984,1.911,1.83 +M2.3 x 0.45,0.45,6g,2.28,2.18,1.988,1.917,1.793,1.64 +M2.3 x 0.45,0.45,4g6g,2.28,2.18,1.988,1.943,1.793,1.666 +M2.3 x 0.4,0.4,6g,2.281,2.186,2.021,1.954,1.848,1.708 +M2.3 x 0.4,0.4,4g6g,2.281,2.186,2.021,1.979,1.848,1.733 +M2.5 x 0.45,0.45,6g,2.48,2.38,2.188,2.117,1.993,1.84 +M2.5 x 0.45,0.45,4g6g,2.48,2.38,2.188,2.143,1.993,1.866 +M2.5 x 0.35,0.35,6g,2.481,2.396,2.254,2.191,2.102,1.975 +M2.5 x 0.35,0.35,4g6g,2.481,2.396,2.254,2.214,2.102,1.998 +M2.6 x 0.45,0.45,6g,2.58,2.48,2.288,2.217,2.093,1.94 +M2.6 x 0.45,0.45,4g6g,2.58,2.48,2.288,2.243,2.093,1.966 +M3 x 0.5,0.5,6g,2.98,2.874,2.655,2.58,2.439,2.272 +M3 x 0.5,0.5,4g6g,2.98,2.874,2.655,2.607,2.439,2.299 +M3 x 0.35,0.35,6g,2.981,2.896,2.754,2.687,2.602,2.471 +M3 x 0.35,0.35,4g6g,2.981,2.896,2.754,2.712,2.602,2.496 +M3.5 x 0.6,0.6,6g,3.479,3.354,3.089,3.004,2.829,2.635 +M3.5 x 0.6,0.6,4g6g,3.479,3.354,3.089,3.036,2.829,2.667 +M3.5 x 0.35,0.35,6g,3.481,3.396,3.254,3.187,3.102,2.971 +M3.5 x 0.35,0.35,4g6g,3.481,3.396,3.254,3.212,3.102,2.996 +M4 x 0.7,0.7,6g,3.978,3.838,3.523,3.433,3.22,3.002 +M4 x 0.7,0.7,4g6g,3.978,3.838,3.523,3.467,3.22,3.036 +M4 x 0.5,0.5,6g,3.98,3.874,3.655,3.58,3.439,3.272 +M4 x 0.5,0.5,4g6g,3.98,3.874,3.655,3.607,3.439,3.299 +M4.5 x 0.75,0.75,6g,4.478,4.338,3.991,3.901,3.666,3.439 +M4.5 x 0.75,0.75,4g6g,4.478,4.338,3.991,3.935,3.666,3.473 +M4.5 x 0.5,0.5,6g,4.48,4.374,4.155,4.08,3.939,3.772 +M4.5 x 0.5,0.5,4g6g,4.48,4.374,4.155,4.107,3.939,3.799 +M5 x 0.8,0.8,6g,4.976,4.826,4.456,4.361,4.11,3.869 +M5 x 0.8,0.8,4g6g,4.976,4.826,4.456,4.396,4.11,3.904 +M5 x 0.5,0.5,6g,4.98,4.874,4.655,4.58,4.439,4.272 +M5 x 0.5,0.5,4g6g,4.98,4.874,4.655,4.607,4.439,4.299 +M5.5 x 0.5,0.5,6g,5.48,5.374,5.155,5.065,4.939,4.757 +M5.5 x 0.5,0.5,4g6g,5.48,5.374,5.155,5.099,4.939,4.791 +M6 x 1,1,6g,5.974,5.794,5.324,5.212,4.891,4.596 +M6 x 1,1,4g6g,5.974,5.794,5.324,5.253,4.891,4.637 +M6 x 0.8,0.8,6g,5.976,5.826,5.456,5.376,5.11,4.884 +M6 x 0.8,0.8,4g6g,5.976,5.826,5.456,5.406,5.11,4.914 +M6 x 0.75,0.75,6g,5.978,5.838,5.491,5.391,5.166,4.929 +M6 x 0.75,0.75,4g6g,5.978,5.838,5.491,5.428,5.166,4.966 +M6 x 0.7,0.7,6g,5.978,5.838,5.523,5.428,5.22,4.997 +M6 x 0.7,0.7,4g6g,5.978,5.838,5.523,5.463,5.22,5.032 +M6 x 0.5,0.5,6g,5.98,5.874,5.655,5.57,5.439,5.262 +M6 x 0.5,0.5,4g6g,5.98,5.874,5.655,5.602,5.439,5.294 +M7 x 1,1,6g,6.974,6.794,6.324,6.212,5.891,5.596 +M7 x 1,1,4g6g,6.974,6.794,6.324,6.253,5.891,5.637 +M7 x 0.75,0.75,6g,6.978,6.838,6.491,6.391,6.166,5.929 +M7 x 0.75,0.75,4g6g,6.978,6.838,6.491,6.428,6.166,5.966 +M7 x 0.5,0.5,6g,6.98,6.874,6.655,6.57,6.439,6.262 +M7 x 0.5,0.5,4g6g,6.98,6.874,6.655,6.602,6.439,6.294 +M8 x 1.25,1.25,6g,7.972,7.76,7.16,7.042,6.619,6.272 +M8 x 1.25,1.25,4g6g,7.972,7.76,7.16,7.085,6.619,6.315 +M8 x 1,1,6g,7.974,7.794,7.324,7.212,6.891,6.596 +M8 x 1,1,4g6g,7.974,7.794,7.324,7.253,6.891,6.637 +M8 x 0.8,0.8,6g,7.976,7.826,7.456,7.35,7.11,6.858 +M8 x 0.8,0.8,4g6g,7.976,7.826,7.456,7.389,7.11,6.897 +M8 x 0.75,0.75,6g,7.978,7.838,7.491,7.391,7.166,6.929 +M8 x 0.75,0.75,4g6g,7.978,7.838,7.491,7.428,7.166,6.966 +M8 x 0.5,0.5,6g,7.98,7.874,7.655,7.57,7.439,7.262 +M8 x 0.5,0.5,4g6g,7.98,7.874,7.655,7.602,7.439,7.294 +M9 x 1.25,1.25,6g,8.972,8.76,8.16,8.042,7.619,7.272 +M9 x 1.25,1.25,4g6g,8.972,8.76,8.16,8.085,7.619,7.315 +M9 x 1,1,6g,8.974,8.794,8.324,8.212,7.891,7.596 +M9 x 1,1,4g6g,8.974,8.794,8.324,8.253,7.891,7.637 +M9 x 0.75,0.75,6g,8.978,8.838,8.491,8.391,8.166,7.929 +M9 x 0.75,0.75,4g6g,8.978,8.838,8.491,8.428,8.166,7.966 +M9 x 0.5,0.5,6g,8.98,8.874,8.655,8.57,8.439,8.262 +M9 x 0.5,0.5,4g6g,8.98,8.874,8.655,8.602,8.439,8.294 +M10 x 1.5,1.5,6g,9.968,9.732,8.994,8.862,8.344,7.938 +M10 x 1.5,1.5,4g6g,9.968,9.732,8.994,8.909,8.344,7.985 +M10 x 1.25,1.25,6g,9.972,9.76,9.16,9.042,8.619,8.272 +M10 x 1.25,1.25,4g6g,9.972,9.76,9.16,9.085,8.619,8.315 +M10 x 1.12,1.12,6g,9.973,9.783,9.246,9.128,8.761,8.438 +M10 x 1.12,1.12,4g6g,9.973,9.783,9.246,9.171,8.761,8.481 +M10 x 1,1,6g,9.974,9.794,9.324,9.212,8.891,8.596 +M10 x 1,1,4g6g,9.974,9.794,9.324,9.253,8.891,8.637 +M10 x 0.75,0.75,6g,9.978,9.838,9.491,9.391,9.166,8.929 +M10 x 0.75,0.75,4g6g,9.978,9.838,9.491,9.428,9.166,8.966 +M10 x 0.5,0.5,6g,9.98,9.874,9.655,9.57,9.439,9.262 +M10 x 0.5,0.5,4g6g,9.98,9.874,9.655,9.602,9.439,9.294 +M11 x 1.5,1.5,6g,10.968,10.732,9.994,9.862,9.344,8.938 +M11 x 1.5,1.5,4g6g,10.968,10.732,9.994,9.911,9.344,8.987 +M11 x 1,1,6g,10.974,10.794,10.324,10.212,9.891,9.596 +M11 x 1,1,4g6g,10.974,10.794,10.324,10.253,9.891,9.637 +M11 x 0.75,0.75,6g,10.978,10.838,10.491,10.391,10.166,9.929 +M11 x 0.75,0.75,4g6g,10.978,10.838,10.491,10.428,10.166,9.966 +M11 x 0.5,0.5,6g,10.98,10.874,10.655,10.57,10.439,10.262 +M11 x 0.5,0.5,4g6g,10.98,10.874,10.655,10.602,10.439,10.294 +M12 x 1.75,1.75,6g,11.966,11.701,10.829,10.679,10.072,9.601 +M12 x 1.75,1.75,4g6g,11.966,11.701,10.829,10.734,10.072,9.656 +M12 x 1.5,1.5,6g,11.968,11.732,10.994,10.854,10.344,9.93 +M12 x 1.25,1.25,6g,11.972,11.76,11.16,11.028,10.619,10.258 +M12 x 1.25,1.25,4g6g,11.972,11.76,11.16,11.075,10.619,10.305 +M12 x 1,1,6g,11.974,11.794,11.324,11.206,10.891,10.59 +M12 x 1,1,4g6g,11.974,11.794,11.324,11.249,10.891,10.633 +M12 x 0.75,0.75,6g,11.978,11.838,11.491,11.385,11.166,10.923 +M12 x 0.75,0.75,4g6g,11.978,11.838,11.491,11.424,11.166,10.962 +M12 x 0.5,0.5,6g,11.98,11.874,11.655,11.565,11.439,11.257 +M12 x 0.5,0.5,4g6g,11.98,11.874,11.655,11.598,11.439,11.29 +M14 x 2,2,6g,13.962,13.682,12.663,12.503,11.797,11.271 +M14 x 2,2,4g6g,13.962,13.682,12.663,12.563,11.797,11.331 +M14 x 1.5,1.5,6g,13.968,13.732,12.994,12.854,12.344,11.93 +M14 x 1.5,1.5,4g6g,13.968,13.732,12.994,12.904,12.344,11.98 +M14 x 1.25,1.25,6g,13.972,13.76,13.16,13.028,12.619,12.258 +M14 x 1.25,1.25,4g6g,13.972,13.76,13.16,13.075,12.619,12.305 +M14 x 1,1,6g,13.974,13.794,13.324,13.206,12.891,12.59 +M14 x 1,1,4g6g,13.974,13.794,13.324,13.25,12.891,12.634 +M14 x 0.75,0.75,6g,13.978,13.838,13.491,13.385,13.166,12.923 +M14 x 0.75,0.75,4g6g,13.978,13.838,13.491,13.424,13.166,12.962 +M14 x 0.5,0.5,6g,13.98,13.874,13.655,13.565,13.439,13.257 +M14 x 0.5,0.5,4g6g,13.98,13.874,13.655,13.598,13.439,13.29 +M15 x 1.5,1.5,6g,14.968,14.732,13.994,13.854,13.344,12.93 +M15 x 1.5,1.5,4g6g,14.968,14.732,13.994,13.904,13.344,12.98 +M15 x 1,1,6g,14.974,14.794,14.324,14.206,13.891,13.59 +M15 x 1,1,4g6g,14.974,14.794,14.324,14.249,13.891,13.633 +M16 x 2,2,6g,15.962,15.682,14.663,14.503,13.797,13.271 +M16 x 2,2,4g6g,15.962,15.682,14.663,14.563,13.797,13.331 +M16 x 1.6,1.6,6g,15.968,15.756,14.929,14.824,14.236,13.838 +M16 x 1.6,1.6,4g6g,15.968,15.756,14.929,14.863,14.236,13.877 +M16 x 1.5,1.5,6g,15.968,15.732,14.994,14.854,14.344,13.93 +M16 x 1.5,1.5,4g6g,15.968,15.732,14.994,14.904,14.344,13.98 +M16 x 1.25,1.25,6g,15.972,15.76,15.16,15.028,14.619,14.258 +M16 x 1.25,1.25,4g6g,15.972,15.76,15.16,15.075,14.619,14.305 +M16 x 1,1,6g,15.974,15.794,15.324,15.206,14.891,14.59 +M16 x 1,1,4g6g,15.974,15.794,15.324,15.249,14.891,14.633 +M16 x 0.75,0.75,6g,15.978,15.838,15.491,15.385,15.166,14.923 +M16 x 0.75,0.75,4g6g,15.978,15.838,15.491,15.424,15.166,14.962 +M16 x 0.5,0.5,6g,15.98,15.874,15.655,15.565,15.439,15.257 +M16 x 0.5,0.5,4g6g,15.98,15.874,15.655,15.599,15.439,15.291 +M17 x 1.5,1.5,6g,16.968,16.732,15.994,15.854,15.344,14.93 +M17 x 1.5,1.5,4g6g,16.968,16.732,15.994,15.904,15.344,14.98 +M17 x 1,1,6g,16.974,16.794,16.324,16.206,15.891,15.59 +M17 x 1,1,4g6g,16.974,16.794,16.324,16.249,15.891,15.633 +M18 x 2.5,2.5,6g,17.958,17.623,16.334,16.164,15.252,14.624 +M18 x 2.5,2.5,4g6g,17.958,17.623,16.334,16.228,15.252,14.688 +M18 x 2,2,6g,17.962,17.682,16.663,16.503,15.797,15.271 +M18 x 2,2,4g6g,17.962,17.682,16.663,16.563,15.797,15.331 +M18 x 1.5,1.5,6g,17.968,17.732,16.994,16.854,16.344,15.93 +M18 x 1.5,1.5,4g6g,17.968,17.732,16.994,16.904,16.344,15.98 +M18 x 1.25,1.25,6g,17.972,17.76,17.16,17.028,16.619,16.258 +M18 x 1.25,1.25,4g6g,17.972,17.76,17.16,17.075,16.619,16.305 +M18 x 1,1,6g,17.974,17.794,17.324,17.206,16.891,16.59 +M18 x 1,1,4g6g,17.974,17.794,17.324,17.249,16.891,16.633 +M18 x 0.75,0.75,6g,17.978,17.838,17.491,17.385,17.166,16.923 +M18 x 0.75,0.75,4g6g,17.978,17.838,17.491,17.424,17.166,16.962 +M18 x 0.5,0.5,6g,17.98,17.874,17.655,17.565,17.439,17.257 +M18 x 0.5,0.5,4g6g,17.98,17.874,17.655,17.599,17.439,17.291 +M20 x 2.5,2.5,6g,19.958,19.623,18.334,18.164,17.252,16.624 +M20 x 2.5,2.5,4g6g,19.958,19.623,18.334,18.228,17.252,16.688 +M20 x 2,2,6g,19.962,19.682,18.663,18.503,17.797,17.271 +M20 x 2,2,4g6g,19.962,19.682,18.663,18.562,17.797,17.33 +M20 x 1.5,1.5,6g,19.968,19.732,18.994,18.854,18.344,17.93 +M20 x 1.5,1.5,4g6g,19.968,19.732,18.994,18.904,18.344,17.98 +M20 x 1,1,6g,19.974,19.794,19.324,19.206,18.891,18.59 +M20 x 1,1,4g6g,19.974,19.794,19.324,19.249,18.891,18.633 +M20 x 0.75,0.75,6g,19.978,19.838,19.491,19.385,19.166,18.923 +M20 x 0.75,0.75,4g6g,19.978,19.838,19.491,19.424,19.166,18.962 +M20 x 0.5,0.5,6g,19.98,19.874,19.655,19.565,19.439,19.257 +M20 x 0.5,0.5,4g6g,19.98,19.874,19.655,19.599,19.439,19.291 +M22 x 3,3,6g,21.952,21.577,20.003,19.818,18.704,17.97 +M22 x 3,3,4g6g,21.952,21.577,20.003,19.885,18.704,18.037 +M22 x 2.5,2.5,6g,21.958,21.623,20.334,20.164,19.252,18.624 +M22 x 2.5,2.5,4g6g,21.958,21.623,20.334,20.234,19.252,18.694 +M22 x 2,2,6g,21.962,21.682,20.663,20.503,19.797,19.271 +M22 x 2,2,4g6g,21.962,21.682,20.663,20.563,19.797,19.331 +M22 x 1.5,1.5,6g,21.968,21.732,20.994,20.854,20.344,19.93 +M22 x 1.5,1.5,4g6g,21.968,21.732,20.994,20.904,20.344,19.98 +M22 x 1,1,6g,21.974,21.794,21.324,21.206,20.891,20.59 +M22 x 1,1,4g6g,21.974,21.794,21.324,21.249,20.891,20.633 +M22 x 0.75,0.75,6g,21.978,21.838,21.491,21.385,21.166,20.923 +M22 x 0.75,0.75,4g6g,21.978,21.838,21.491,21.424,21.166,20.962 +M22 x 0.5,0.5,6g,21.98,21.874,21.655,21.565,21.439,21.257 +M22 x 0.5,0.5,4g6g,21.98,21.874,21.655,21.598,21.439,21.29 +M24 x 3,3,6g,23.952,23.577,22.003,21.803,20.704,19.955 +M24 x 3,3,4g6g,23.952,23.557,22.003,21.878,20.704,20.03 +M24 x 2.5,2.5,6g,23.958,23.623,22.334,22.144,21.252,20.604 +M24 x 2.5,2.5,4g6g,23.958,23.623,22.334,22.214,21.252,20.674 +M24 x 2,2,6g,23.962,23.682,22.663,22.493,21.797,21.261 +M24 x 2,2,4g6g,23.962,23.682,22.663,22.557,21.797,21.325 +M24 x 1.5,1.5,6g,23.968,23.732,22.994,22.844,22.344,21.92 +M24 x 1.5,1.5,4g6g,23.968,23.732,22.994,22.899,22.344,21.975 +M24 x 1,1,6g,23.974,23.794,23.324,23.199,22.891,22.583 +M24 x 1,1,4g6g,23.974,23.794,23.324,23.244,22.891,22.628 +M24 x 0.75,0.75,6g,23.978,23.838,23.491,23.379,23.166,22.917 +M24 x 0.75,0.75,4g6g,23.978,23.838,23.491,23.42,23.166,22.958 +M25 x 2,2,6g,24.962,24.682,23.663,23.493,22.797,22.261 +M25 x 2,2,4g6g,24.962,24.682,23.663,23.557,22.797,22.325 +M25 x 1.5,1.5,6g,24.968,24.732,23.994,23.844,23.344,22.92 +M25 x 1.5,1.5,4g6g,24.968,24.732,23.994,23.899,23.344,22.975 +M25 x 1,1,6g,24.974,24.794,24.324,24.199,23.891,23.583 +M25 x 1,1,4g6g,24.974,24.794,24.324,24.244,23.891,23.628 +M26 x 1.5,1.5,6g,25.968,25.732,24.994,24.844,24.344,23.92 +M26 x 1.5,1.5,4g6g,25.968,25.732,24.994,24.899,24.344,23.975 +M27 x 3,3,6g,26.952,26.577,25.003,24.803,23.704,22.955 +M27 x 3,3,4g6g,26.952,26.577,25.003,24.878,23.704,23.03 +M27 x 2,2,6g,26.962,26.682,25.663,25.493,24.797,24.261 +M27 x 2,2,4g6g,29.962,26.682,25.663,25.557,24.797,24.325 +M27 x 1.5,1.5,6g,26.968,26.732,25.994,25.844,25.344,24.92 +M27 x 1.5,1.5,4g6g,26.968,26.732,25.994,25.899,25.344,24.975 +M27 x 1,1,6g,26.974,26.794,26.324,26.199,25.891,25.583 +M27 x 1,1,4g6g,26.974,26.794,26.324,26.244,25.891,25.628 +M27 x 0.75,0.75,6g,26.978,26.838,26.491,26.379,26.166,25.917 +M27 x 0.75,0.75,4g6g,26.978,26.838,26.491,26.42,26.166,25.958 +M28 x 2,2,6g,27.962,27.682,26.663,26.493,25.797,25.261 +M28 x 2,2,4g6g,27.962,27.682,26.663,26.557,25.797,25.325 +M28 x 1.5,1.5,6g,27.968,27.732,26.994,26.844,26.344,25.92 +M28 x 1.5,1.5,4g6g,27.968,27.732,26.994,26.899,26.344,25.975 +M28 x 1,1,6g,27.974,27.794,27.324,27.199,26.891,26.583 +M28 x 1,1,4g6g,27.974,27.794,27.324,27.244,26.891,26.628 +M30 x 3.5,3.5,6g,29.947,29.522,27.674,27.462,26.158,25.306 +M30 x 3.5,3.5,4g6g,29.947,29.522,27.674,27.542,26.158,25.386 +M30 x 3,3,6g,29.952,29.577,28.003,27.803,26.704,25.955 +M30 x 3,3,4g6g,29.952,29.577,28.003,27.878,26.704,26.03 +M30 x 2.5,2.5,6g,29.958,29.623,28.334,28.144,27.252,26.604 +M30 x 2.5,2.5,4g6g,29.958,29.623,28.334,28.214,27.252,26.674 +M30 x 2,2,6g,29.962,29.682,28.663,28.493,27.797,27.261 +M30 x 2,2,4g6g,29.962,29.682,28.663,28.557,27.797,27.325 +M30 x 1.5,1.5,6g,29.968,29.732,28.994,28.844,28.344,27.92 +M30 x 1.5,1.5,4g6g,29.968,29.732,28.994,28.899,28.344,27.975 +M30 x 1,1,6g,29.974,29.794,29.324,29.199,28.891,28.583 +M30 x 1,1,4g6g,29.974,29.794,29.324,29.244,28.891,28.628 +M30 x 0.75,0.75,6g,29.978,29.838,29.491,29.379,29.166,28.917 +M30 x 0.75,0.75,4g6g,29.978,29.838,29.491,29.42,29.166,28.958 +M32 x 2,2,6g,31.962,31.682,30.663,30.493,29.797,29.261 +M32 x 2,2,4g6g,31.962,31.682,30.663,30.557,29.797,29.325 +M32 x 1.5,1.5,6g,31.968,31.732,30.994,30.844,30.344,29.92 +M32 x 1.5,1.5,4g6g,31.968,31.732,30.994,30.899,30.344,29.975 +M33 x 3.5,3.5,6g,32.968,32.543,30.695,30.483,29.179,28.327 +M33 x 3.5,3.5,4g6g,32.968,32.543,30.695,30.563,29.179,28.407 +M33 x 3,3,6g,32.952,32.577,31.003,30.803,29.704,28.955 +M33 x 3,3,4g6g,32.952,32.577,31.003,30.878,29.704,29.03 +M33 x 2,2,6g,32.962,32.682,31.663,31.493,30.797,30.261 +M33 x 2,2,4g6g,32.962,32.682,31.663,31.557,30.797,30.325 +M33 x 1.5,1.5,6g,32.968,32.732,31.994,31.844,31.344,30.92 +M33 x 1.5,1.5,4g6g,32.968,32.732,31.994,31.899,31.344,30.975 +M33 x 1,1,6g,32.974,32.794,32.324,32.199,31.891,31.583 +M33 x 1,1,4g6g,32.974,32.794,32.324,32.244,31.891,31.628 +M33 x 0.75,0.75,6g,32.978,32.838,32.491,32.379,32.166,31.917 +M33 x 0.75,0.75,4g6g,32.978,32.838,32.491,32.42,32.166,31.958 +M35 x 1.5,1.5,6g,34.968,34.732,33.994,33.844,33.344,33.92 +M35 x 1.5,1.5,4g6g,34.968,34.732,33.994,33.899,33.344,32.975 +M36 x 4,4,6g,35.94,35.465,33.342,33.118,31.61,30.654 +M36 x 4,4,4g6g,35.94,35.465,33.342,33.202,31.61,30.738 +M36 x 3,3,6g,35.952,35.577,34.003,33.803,32.704,31.955 +M36 x 3,3,4g6g,35.952,35.577,34.003,33.878,32.704,32.03 +M36 x 2,2,6g,35.962,35.682,34.663,34.493,33.797,33.261 +M36 x 2,2,4g6g,35.962,35.682,34.663,34.557,33.797,33.325 +M36 x 1.5,1.5,6g,35.968,35.732,34.994,34.844,34.344,33.92 +M36 x 1.5,1.5,4g6g,35.968,35.732,34.994,34.899,34.344,33.975 +M36 x 1,1,6g,35.974,35.794,35.324,35.199,34.891,34.583 +M36 x 1,1,4g6g,35.974,35.794,35.324,35.244,34.891,34.628 +M38 x 1.5,1.5,6g,37.968,37.732,36.994,36.844,36.344,35.92 +M38 x 1.5,1.5,4g6g,37.968,37.732,36.994,36.899,36.344,35.975 +M39 x 4,4,6g,38.94,38.465,36.342,36.118,34.61,33.654 +M39 x 4,4,4g6g,38.94,38.465,36.342,36.202,34.61,33.738 +M39 x 3,3,6g,38.952,38.577,37.003,36.803,35.704,34.955 +M39 x 3,3,4g6g,38.952,38.577,37.003,36.878,35.704,35.03 +M39 x 2,2,6g,38.962,38.682,37.663,37.493,36.797,36.261 +M39 x 2,2,4g6g,38.962,38.682,37.663,37.557,36.797,36.325 +M39 x 1.5,1.5,6g,38.968,38.732,37.994,37.844,37.344,36.92 +M39 x 1.5,1.5,4g6g,38.968,38.732,37.994,37.899,37.344,36.975 +M39 x 1,1,6g,38.974,38.794,38.324,38.199,37.891,37.583 +M39 x 1,1,4g6g,38.974,38.794,38.324,38.244,37.891,37.628 +M40 x 3,3,6g,39.952,39.577,38.003,37.803,36.704,35.955 +M40 x 3,3,4g6g,39.952,39.577,38.003,37.878,36.704,36.03 +M40 x 2.5,2.5,6g,39.958,39.623,38.334,38.144,37.252,36.604 +M40 x 2.5,2.5,4g6g,39.958,39.623,38.334,38.215,37.252,36.674 +M40 x 2,2,6g,39.962,39.682,38.663,38.493,37.797,37.261 +M40 x 2,2,4g6g,39.962,39.682,38.663,38.557,37.797,37.325 +M40 x 1.5,1.5,6g,39.968,39.732,38.994,38.844,38.344,37.92 +M40 x 1.5,1.5,4g6g,39.968,39.732,38.994,38.899,38.344,37.975 +M42 x 4.5,4.5,6g,41.937,41.437,39.014,38.778,37.066,36.006 +M42 x 4.5,4.5,4g6g,41.937,41.437,39.014,38.864,37.066,36.092 +M42 x 4,4,6g,41.94,41.465,39.342,39.118,37.61,36.654 +M42 x 4,4,4g6g,41.94,41.465,39.342,39.202,37.61,36.738 +M42 x 3,3,6g,41.952,41.577,40.003,39.803,38.704,37.955 +M42 x 3,3,4g6g,41.952,41.577,40.003,39.878,38.704,38.03 +M42 x 2,2,6g,41.962,41.682,40.663,40.493,39.797,39.261 +M42 x 2,2,4g6g,41.962,41.682,40.663,40.557,39.797,39.325 +M42 x 1.5,1.5,6g,41.968,41.732,40.994,40.844,40.344,39.92 +M42 x 1.5,1.5,4g6g,41.968,41.732,40.994,40.899,40.344,39.975 +M42 x 1,1,6g,41.974,41.794,41.324,41.199,40.891,40.583 +M42 x 1,1,4g6g,41.974,41.794,41.324,41.244,40.891,40.628 +M45 x 4.5,4.5,6g,44.937,44.437,42.014,41.778,40.066,39.006 +M45 x 4.5,4.5,4g6g,44.937,44.437,42.014,41.864,40.066,39.092 +M45 x 4,4,6g,44.94,44.465,42.342,42.118,40.61,39.654 +M45 x 4,4,4g6g,44.94,44.465,42.342,42.202,40.61,39.738 +M45 x 3,3,6g,44.952,44.577,43.003,42.803,41.704,40.955 +M45 x 3,3,4g6g,44.952,44.577,43.003,42.878,41.704,41.03 +M45 x 2,2,6g,44.962,44.682,43.663,43.493,42.797,42.261 +M45 x 2,2,4g6g,44.962,44.682,43.663,43.557,42.797,42.325 +M45 x 1.5,1.5,6g,44.968,44.732,43.994,43.844,43.344,42.92 +M45 x 1.5,1.5,4g6g,44.968,44.732,43.994,43.899,43.344,42.975 +M45 x 1,1,6g,44.974,44.794,44.324,44.199,43.891,43.583 +M45 x 1,1,4g6g,44.974,44.794,44.324,44.244,43.891,43.628 +M48 x 5,5,6g,47.929,47.399,44.681,44.431,42.516,41.351 +M48 x 5,5,4g6g,47.929,47.399,44.681,44.521,42.516,41.441 +M48 x 4,4,6g,47.94,47.465,45.342,45.106,43.61,42.642 +M48 x 4,4,4g6g,47.94,47.465,45.342,45.192,43.61,42.728 +M48 x 3,3,6g,47.952,47.577,46.003,45.791,44.704,43.943 +M48 x 3,3,4g6g,47.952,47.577,46.003,45.871,44.704,44.023 +M48 x 2,2,6g,47.962,47.682,46.663,46.483,45.797,45.251 +M48 x 2,2,4g6g,47.962,47.682,46.663,46.551,45.797,45.319 +M48 x 1.5,1.5,6g,47.968,47.732,46.994,46.834,46.344,45.91 +M48 x 1.5,1.5,4g6g,47.968,47.732,46.994,46.894,46.344,45.97 +M50 x 4,4,6g,49.94,49.465,47.342,47.106,45.61,44.642 +M50 x 4,4,4g6g,49.94,49.465,47.342,47.192,45.61,44.728 +M50 x 3,3,6g,49.952,49.577,48.003,47.791,46.704,45.943 +M50 x 3,3,4g6g,49.952,49.577,48.003,47.871,46.704,46.023 +M50 x 2,2,6g,49.962,49.682,48.663,48.483,47.797,47.251 +M50 x 2,2,4g6g,49.962,49.682,48.663,48.551,47.797,47.319 +M50 x 1.5,1.5,6g,49.968,49.732,48.994,48.834,48.344,47.91 +M50 x 1.5,1.5,4g6g,49.968,49.732,48.994,48.894,48.344,47.97 +M52 x 5,5,6g,51.929,51.399,48.681,48.445,46.516,45.365 +M52 x 5,5,4g6g,51.929,51.399,48.681,48.531,46.516,45.451 +M52 x 4,4,6g,51.94,51.465,49.342,49.106,47.61,46.642 +M52 x 4,4,4g6g,51.94,51.465,49.342,49.192,47.61,46.728 +M52 x 3,3,6g,51.952,51.577,50.003,49.791,48.704,47.943 +M52 x 3,3,4g6g,51.952,51.577,50.003,49.871,48.704,48.023 +M52 x 2,2,6g,51.962,51.682,50.663,50.483,49.797,49.251 +M52 x 2,2,4g6g,51.962,51.682,50.663,50.551,49.797,49.319 +M52 x 1.5,1.5,6g,51.968,51.732,50.994,50.834,50.344,49.91 +M52 x 1.5,1.5,4g6g,51.968,51.732,50.994,50.894,50.344,49.97 +M55 x 4,4,6g,54.94,54.465,52.342,52.106,50.61,49.642 +M55 x 4,4,4g6g,54.94,54.465,52.342,52.192,50.61,49.728 +M55 x 3,3,6g,54.952,54.577,53.003,52.791,51.704,50.943 +M55 x 3,3,4g6g,54.952,54.577,53.003,52.871,51.704,51.023 +M55 x 2,2,6g,54.962,54.682,53.663,53.483,52.797,52.251 +M55 x 2,2,4g6g,54.962,54.682,53.663,53.551,52.797,52.319 +M55 x 1.5,1.5,6g,54.968,54.732,53.994,53.834,53.344,52.91 +M55 x 1.5,1.5,4g6g,54.968,54.732,53.994,53.894,53.344,52.97 diff --git a/src/Mod/Path/Data/Threads/sources.txt b/src/Mod/Path/Data/Threads/sources.txt index 20fb5e92fd..8d26d69461 100644 --- a/src/Mod/Path/Data/Threads/sources.txt +++ b/src/Mod/Path/Data/Threads/sources.txt @@ -2,3 +2,6 @@ https://www.amesweb.info/Screws/Internal-Metric-Thread-Dimensions-Chart.aspx https://www.engineersedge.com/thread_strength/internal_screw_threads_chart.htm dMajorMax = dMajorMin * 1.01 * (dMinorMax - dMinorMin) formula empirically derived from metric tolerances + +https://www.engineersedge.com/hardware/metric-external-thread-sizes1.htm +https://www.engineersedge.com/hardware/metric-external-thread-sizes2.htm diff --git a/src/Mod/Path/PathScripts/PathThreadMilling.py b/src/Mod/Path/PathScripts/PathThreadMilling.py index 3dc5eb02c3..99d69ed2e4 100644 --- a/src/Mod/Path/PathScripts/PathThreadMilling.py +++ b/src/Mod/Path/PathScripts/PathThreadMilling.py @@ -36,7 +36,10 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Path thread milling operation." -if False: +# math.sqrt(3)/2 ... 60deg triangle height +SQRT_3_DIVIDED_BY_2 = 0.8660254037844386 + +if True: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) PathLog.trackModule(PathLog.thisModule()) else: @@ -45,8 +48,8 @@ else: translate = FreeCAD.Qt.translate -def radiiInternal(majorDia, minorDia, toolDia, toolCrest=None): - """internlThreadRadius(majorDia, minorDia, toolDia, toolCrest) ... returns the maximum radius for thread.""" +def threadRadii(internal, majorDia, minorDia, toolDia, toolCrest): + """threadRadii(majorDia, minorDia, toolDia, toolCrest) ... returns the minimum and maximum radius for thread.""" PathLog.track(majorDia, minorDia, toolDia, toolCrest) if toolCrest is None: toolCrest = 0.0 @@ -57,22 +60,28 @@ def radiiInternal(majorDia, minorDia, toolDia, toolCrest=None): # Since we already have the outer diameter it's simpler to just add 1/8 * H # to get the outer tip of the thread. H = ((majorDia - minorDia) / 2.0) * 1.6 # (D - d)/2 = 5/8 * H - outerTip = majorDia / 2.0 + H / 8.0 + if internal: + # mill inside out + outerTip = majorDia / 2.0 + H / 8.0 + # Compensate for the crest of the tool + toolTip = outerTip - toolCrest * SQRT_3_DIVIDED_BY_2 + return ((minorDia - toolDia) / 2.0, toolTip - toolDia / 2.0) + # mill outside in + innerTip = minorDia / 2.0 - H / 4.0 # Compensate for the crest of the tool - toolTip = ( - outerTip - toolCrest * 0.8660254037844386 - ) # math.sqrt(3)/2 ... 60deg triangle height - return ((minorDia - toolDia) / 2.0, toolTip - toolDia / 2.0) + toolTip = innerTip - toolCrest * SQRT_3_DIVIDED_BY_2 + return ((majorDia + toolDia) / 2.0, toolTip + toolDia / 2.0) - -def threadPasses(count, radii, majorDia, minorDia, toolDia, toolCrest=None): - PathLog.track(count, radii, majorDia, minorDia, toolDia, toolCrest) - minor, major = radii(majorDia, minorDia, toolDia, toolCrest) +def threadPasses(count, radii, internal, majorDia, minorDia, toolDia, toolCrest): + PathLog.track(count, radii, internal, majorDia, minorDia, toolDia, toolCrest) + minor, major = radii(internal, majorDia, minorDia, toolDia, toolCrest) dr = float(major - minor) / count - return [major - dr * (count - (i + 1)) for i in range(count)] + if internal: + return [minor + dr * (i + 1) for i in range(count)] + return [major - dr * (i + 1) for i in range(count)] -class _InternalThread(object): +class _ThreadInternal(object): """Helper class for dealing with different thread types""" def __init__(self, cmd, zStart, zFinal, pitch): @@ -112,9 +121,9 @@ class _InternalThread(object): return self.pitch > 0 -def internalThreadCommands(loc, cmd, zStart, zFinal, pitch, radius, leadInOut): - """internalThreadCommands(loc, cmd, zStart, zFinal, pitch, radius) ... returns the g-code to mill the given internal thread""" - thread = _InternalThread(cmd, zStart, zFinal, pitch) +def threadCommandsInternal(loc, cmd, zStart, zFinal, pitch, radius, leadInOut): + """threadCommandsInternal(loc, cmd, zStart, zFinal, pitch, radius) ... returns the g-code to mill the given internal thread""" + thread = _ThreadInternal(cmd, zStart, zFinal, pitch) yMin = loc.y - radius yMax = loc.y + radius @@ -171,23 +180,92 @@ def internalThreadCommands(loc, cmd, zStart, zFinal, pitch, radius, leadInOut): return path +def threadCommandsExternal(loc, cmd, zStart, zFinal, pitch, radius, leadInOut): + """threadCommandsExternal(loc, cmd, zStart, zFinal, pitch, radius) ... returns the g-code to mill the given internal thread""" + thread = _ThreadInternal(cmd, zStart, zFinal, pitch) + + yMin = loc.y - radius + yMax = loc.y + radius + + path = [] + # at this point the tool is at a safe height (depending on the previous thread), so we can move + # into position first, and then drop to the start height. If there is any material in the way this + # op hasn't been setup properly. + path.append(Path.Command("G0", {"X": loc.x, "Y": loc.y})) + path.append(Path.Command("G0", {"Z": thread.zStart})) + if leadInOut: + path.append(Path.Command(thread.cmd, {"Y": yMax, "J": (yMax - loc.y) / 2})) + else: + path.append(Path.Command("G1", {"Y": yMax})) + + z = thread.zStart + r = -radius + i = 0 + while True: + z = thread.zStart + i * thread.hPitch + if thread.overshoots(z): + break + if 0 == (i & 0x01): + y = yMin + else: + y = yMax + path.append(Path.Command(thread.cmd, {"Y": y, "Z": z + thread.hPitch, "J": r})) + r = -r + i = i + 1 + + z = thread.zStart + i * thread.hPitch + if PathGeom.isRoughly(z, thread.zFinal): + x = loc.x + else: + n = math.fabs(thread.zFinal - thread.zStart) / thread.hPitch + k = n - int(n) + dy = math.cos(k * math.pi) + dx = math.sin(k * math.pi) + y = thread.adjustY(loc.y, r * dy) + x = thread.adjustX(loc.x, r * dx) + path.append( + Path.Command(thread.cmd, {"X": x, "Y": y, "Z": thread.zFinal, "J": r}) + ) + + if leadInOut: + path.append( + Path.Command( + thread.cmd, + {"X": loc.x, "Y": loc.y, "I": (loc.x - x) / 2, "J": (loc.y - y) / 2}, + ) + ) + else: + path.append(Path.Command("G1", {"X": loc.x, "Y": loc.y})) + + return path + + class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): """Proxy object for thread milling operation.""" LeftHand = "LeftHand" RightHand = "RightHand" - ThreadTypeCustom = "Custom" - ThreadTypeMetricInternal = "MetricInternal" + ThreadTypeCustomExternal = "CustomExternal" + ThreadTypeCustomInternal = "CustomInternal" + ThreadTypeImperialExternal = "ImperialExternal" ThreadTypeImperialInternal = "ImperialInternal" + ThreadTypeMetricExternal = "MetricExternal" + ThreadTypeMetricInternal = "MetricInternal" DirectionClimb = "Climb" DirectionConventional = "Conventional" ThreadOrientations = [LeftHand, RightHand] - ThreadTypes = [ - ThreadTypeCustom, - ThreadTypeMetricInternal, + ThreadTypesInternal = [ + ThreadTypeCustomInternal, ThreadTypeImperialInternal, - ] + ThreadTypeMetricInternal, + ] + ThreadTypesExternal = [ + ThreadTypeCustomExternal, + ThreadTypeImperialExternal, + ThreadTypeMetricExternal, + ] + ThreadTypes = ThreadTypesInternal + ThreadTypesExternal Directions = [DirectionClimb, DirectionConventional] @classmethod @@ -200,25 +278,26 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): 'raw' is list of (translated_text, data_string) tuples 'translated' is list of translated string literals """ + PathLog.track() # Enumeration lists for App::PropertyEnumeration properties enums = { "ThreadType": [ - (translate("Path_ThreadMilling", "Custom"), "Custom"), - (translate("Path_ThreadMilling", "Metric Internal"), "MetricInternal"), - ( - translate("Path_ThreadMilling", "Imperial Internal"), - "ImperialInternal", - ), - ], # this is the direction that the profile runs + (translate("Path_ThreadMilling", "Custom External"), ObjectThreadMilling.ThreadTypeCustomExternal), + (translate("Path_ThreadMilling", "Custom Internal"), ObjectThreadMilling.ThreadTypeCustomInternal), + (translate("Path_ThreadMilling", "Imperial Internal"), ObjectThreadMilling.ThreadTypeImperialInternal), + (translate("Path_ThreadMilling", "Imperial External"), ObjectThreadMilling.ThreadTypeImperialExternal), + (translate("Path_ThreadMilling", "Metric External"), ObjectThreadMilling.ThreadTypeMetricExternal), + (translate("Path_ThreadMilling", "Metric Internal"), ObjectThreadMilling.ThreadTypeMetricInternal), + ], "ThreadOrientation": [ - (translate("Path_ThreadMilling", "LeftHand"), "LeftHand"), - (translate("Path_ThreadMilling", "RightHand"), "RightHand"), - ], # side of profile that cutter is on in relation to direction of profile + (translate("Path_ThreadMilling", "LeftHand"), ObjectThreadMilling.LeftHand), + (translate("Path_ThreadMilling", "RightHand"), ObjectThreadMilling.RightHand), + ], "Direction": [ - (translate("Path_ThreadMilling", "Climb"), "Climb"), - (translate("Path_ThreadMilling", "Conventional"), "Conventional"), - ], # side of profile that cutter is on in relation to direction of profile + (translate("Path_ThreadMilling", "Climb"), ObjectThreadMilling.DirectionClimb), + (translate("Path_ThreadMilling", "Conventional"), ObjectThreadMilling.DirectionConventional), + ], } if dataType == "raw": @@ -236,9 +315,11 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): return data def circularHoleFeatures(self, obj): + PathLog.track() return PathOp.FeatureBaseGeometry def initCircularHoleOperation(self, obj): + PathLog.track() obj.addProperty( "App::PropertyEnumeration", "ThreadOrientation", @@ -333,48 +414,11 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): for n in self.propertyEnumerations(): setattr(obj, n[0], n[1]) - def threadStartDepth(self, obj): - if obj.ThreadOrientation == self.RightHand: - if obj.Direction == self.DirectionClimb: - PathLog.track(obj.Label, obj.FinalDepth) - return obj.FinalDepth - PathLog.track(obj.Label, obj.StartDepth) - return obj.StartDepth - if obj.Direction == self.DirectionClimb: - PathLog.track(obj.Label, obj.StartDepth) - return obj.StartDepth - PathLog.track(obj.Label, obj.FinalDepth) - return obj.FinalDepth + def _isThreadInternal(self, obj): + return obj.ThreadType in self.ThreadTypesInternal - def threadFinalDepth(self, obj): - PathLog.track(obj.Label) - if obj.ThreadOrientation == self.RightHand: - if obj.Direction == self.DirectionClimb: - PathLog.track(obj.Label, obj.StartDepth) - return obj.StartDepth - PathLog.track(obj.Label, obj.FinalDepth) - return obj.FinalDepth - if obj.Direction == self.DirectionClimb: - PathLog.track(obj.Label, obj.FinalDepth) - return obj.FinalDepth - PathLog.track(obj.Label, obj.StartDepth) - return obj.StartDepth - - def threadDirectionCmd(self, obj): - PathLog.track(obj.Label) - if obj.ThreadOrientation == self.RightHand: - if obj.Direction == self.DirectionClimb: - PathLog.track(obj.Label, "G2") - return "G2" - PathLog.track(obj.Label, "G3") - return "G3" - if obj.Direction == self.DirectionClimb: - PathLog.track(obj.Label, "G3") - return "G3" - PathLog.track(obj.Label, "G2") - return "G2" - - def threadSetup(self, obj): + def _threadSetupInternal(self, obj): + PathLog.track() # the thing to remember is that Climb, for an internal thread must always be G3 if obj.Direction == self.DirectionClimb: if obj.ThreadOrientation == self.RightHand: @@ -384,6 +428,18 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): return ("G2", obj.StartDepth.Value, obj.FinalDepth.Value) return ("G2", obj.FinalDepth.Value, obj.StartDepth.Value) + def threadSetup(self, obj): + PathLog.track() + cmd, zbegin, zend = self._threadSetupInternal(obj) + + if obj.ThreadType in self.ThreadTypesInternal: + return (cmd, zbegin, zend) + + # need to reverse direction for external threads + if cmd == 'G2': + return ('G3', zbegin, zend) + return ('G2', zbegin, zend) + def threadPassRadii(self, obj): PathLog.track(obj.Label) rMajor = (obj.MajorDiameter.Value - self.tool.Diameter) / 2.0 @@ -405,15 +461,15 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): for radius in threadPasses( obj.Passes, - radiiInternal, + threadRadii, + self._isThreadInternal(obj), obj.MajorDiameter.Value, obj.MinorDiameter.Value, float(self.tool.Diameter), float(self.tool.Crest), ): - commands = internalThreadCommands( - loc, gcode, zStart, zFinal, pitch, radius, obj.LeadInOut - ) + commands = threadCommandsInternal(loc, gcode, zStart, zFinal, pitch, radius, obj.LeadInOut) + for cmd in commands: p = cmd.Parameters if cmd.Name in ["G0"]: @@ -454,6 +510,7 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): PathLog.error("No suitable Tool found for thread milling operation") def opSetDefaultValues(self, obj, job): + PathLog.track() obj.ThreadOrientation = self.RightHand obj.ThreadType = self.ThreadTypeMetricInternal obj.ThreadFit = 50 @@ -465,7 +522,9 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): def isToolSupported(self, obj, tool): """Thread milling only supports thread milling cutters.""" - return hasattr(tool, "Diameter") and hasattr(tool, "Crest") + support = hasattr(tool, "Diameter") and hasattr(tool, "Crest") + PathLog.track(tool.Name, support) + return support def SetupProperties(): diff --git a/src/Mod/Path/PathScripts/PathThreadMillingGui.py b/src/Mod/Path/PathScripts/PathThreadMillingGui.py index 7b9c0e3b82..2c37b580a8 100644 --- a/src/Mod/Path/PathScripts/PathThreadMillingGui.py +++ b/src/Mod/Path/PathScripts/PathThreadMillingGui.py @@ -40,7 +40,7 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "UI and Command for Path Thread Milling Operation." -if False: +if True: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) PathLog.trackModule(PathLog.thisModule()) else: @@ -49,17 +49,23 @@ else: translate = FreeCAD.Qt.translate -def fillThreads(combo, dataFile): - combo.blockSignals(True) - combo.clear() +def fillThreads(form, dataFile, defaultSelect): + form.threadName.blockSignals(True) + select = form.threadName.currentText() + PathLog.debug("select = '{}'".format(select)) + form.threadName.clear() with open( "{}Mod/Path/Data/Threads/{}.csv".format(FreeCAD.getHomePath(), dataFile) ) as fp: reader = csv.DictReader(fp) for row in reader: - combo.addItem(row["name"], row) - combo.setEnabled(True) - combo.blockSignals(False) + form.threadName.addItem(row['name'], row) + if select: + form.threadName.setCurrentText(select) + elif defaultSelect: + form.threadName.setCurrentText(defaultSelect) + form.threadName.setEnabled(True) + form.threadName.blockSignals(False) class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage): @@ -134,25 +140,35 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage): self.pitch.updateSpinBox() self.setupToolController(obj, self.form.toolController) + self._updateFromThreadType() - def _isThreadMetric(self): + def _isThreadCustom(self): return ( self.form.threadType.currentData() - == PathThreadMilling.ObjectThreadMilling.ThreadTypeMetricInternal + in [PathThreadMilling.ObjectThreadMilling.ThreadTypeCustomInternal, PathThreadMilling.ObjectThreadMilling.ThreadTypeCustomExternal] ) def _isThreadImperial(self): return ( self.form.threadType.currentData() - == PathThreadMilling.ObjectThreadMilling.ThreadTypeImperialInternal + in [PathThreadMilling.ObjectThreadMilling.ThreadTypeImperialInternal, PathThreadMilling.ObjectThreadMilling.ThreadTypeImperialExternal] ) + def _isThreadMetric(self): + return ( + self.form.threadType.currentData() + in [PathThreadMilling.ObjectThreadMilling.ThreadTypeMetricInternal, PathThreadMilling.ObjectThreadMilling.ThreadTypeMetricExternal] + ) + + def _isThreadInternal(self): + return self.form.threadType.currentData() in PathThreadMilling.ObjectThreadMilling.ThreadTypesInternal + + def _isThreadExternal(self): + return self.form.threadType.currentData() in PathThreadMilling.ObjectThreadMilling.ThreadTypesExternal + def _updateFromThreadType(self): - if ( - self.form.threadType.currentData() - == PathThreadMilling.ObjectThreadMilling.ThreadTypeCustom - ): + if self._isThreadCustom(): self.form.threadName.setEnabled(False) self.form.threadFit.setEnabled(False) self.form.threadFitLabel.setEnabled(False) @@ -169,7 +185,10 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage): self.form.threadTPI.setEnabled(False) self.form.threadTPILabel.setEnabled(False) self.form.threadTPI.setValue(0) - fillThreads(self.form.threadName, "metric-internal") + if self._isThreadInternal(): + fillThreads(self.form, "metric-internal", self.obj.ThreadName) + else: + fillThreads(self.form, "metric-external", self.obj.ThreadName) if self._isThreadImperial(): self.form.threadFit.setEnabled(True) @@ -179,7 +198,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage): self.form.threadTPI.setEnabled(True) self.form.threadTPILabel.setEnabled(True) self.pitch.updateSpinBox(0) - fillThreads(self.form.threadName, "imperial-internal") + fillThreads(self.form, "imperial-internal", self.obj.ThreadName) def _updateFromThreadName(self): thread = self.form.threadName.currentData() diff --git a/src/Mod/Path/PathTests/TestPathThreadMilling.py b/src/Mod/Path/PathTests/TestPathThreadMilling.py index 051c594f57..0a296145bb 100644 --- a/src/Mod/Path/PathTests/TestPathThreadMilling.py +++ b/src/Mod/Path/PathTests/TestPathThreadMilling.py @@ -27,7 +27,7 @@ import math from PathTests.PathTestUtils import PathTestBase -def radii(major, minor, toolDia, toolCrest): +def radii(internal, major, minor, toolDia, toolCrest): """test radii function for simple testing""" return (minor, major) @@ -51,15 +51,26 @@ class TestPathThreadMilling(PathTestBase): def test01(self): """Verify internal radii with tool crest.""" - self.assertRadii(PathThreadMilling.radiiInternal(20, 18, 2, 0.1), (8, 9.113397)) + self.assertRadii(PathThreadMilling.threadRadii(True, 20, 18, 2, 0.1), (8, 9.113397)) def test10(self): - """Verify thread passes.""" - self.assertList(PathThreadMilling.threadPasses(1, radii, 10, 9, 0, 0), [10]) - self.assertList( - PathThreadMilling.threadPasses(2, radii, 10, 9, 0, 0), [9.5, 10] - ) - self.assertList( - PathThreadMilling.threadPasses(5, radii, 10, 9, 0, 0), - [9.2, 9.4, 9.6, 9.8, 10], - ) + '''Verify internal thread passes.''' + self.assertList(PathThreadMilling.threadPasses(1, radii, True, 10, 9, 0, 0), [10]) + self.assertList(PathThreadMilling.threadPasses(2, radii, True, 10, 9, 0, 0), [9.5, 10]) + self.assertList(PathThreadMilling.threadPasses(5, radii, True, 10, 9, 0, 0), [9.2, 9.4, 9.6, 9.8, 10]) + + def test20(self): + '''Verify external radii.''' + self.assertRadii(PathThreadMilling.threadRadii(False, 20, 18, 2, 0), (11, 9.6)) + self.assertRadii(PathThreadMilling.threadRadii(False, 20, 19, 2, 0), (11, 10.3)) + + def test21(self): + '''Verify external radii with tool crest.''' + self.assertRadii(PathThreadMilling.threadRadii(False, 20, 18, 2, 0.1), (11, 9.513397)) + + def test30(self): + '''Verify external thread passes.''' + self.assertList(PathThreadMilling.threadPasses(1, radii, False, 10, 9, 0, 0), [9]) + self.assertList(PathThreadMilling.threadPasses(2, radii, False, 10, 9, 0, 0), [9.5, 9]) + self.assertList(PathThreadMilling.threadPasses(5, radii, False, 10, 9, 0, 0), [9.8, 9.6, 9.4, 9.2, 9]) +