1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 | /** Copyright (C) 2012-2024 by Autodesk, Inc. All rights reserved. Setup sheet configuration. $Revision: 44115 86f283c49a2bb5324a205abec3cea6ae68b4e30e $ $Date: 2024-03-12 15:03:07 $ FORKID {BC98C807-412C-4ffc-BD2B-ABB3F0A59DB8} */ description = "Setup Sheet (HTML)" ; vendor = "Autodesk" ; legal = "Copyright (C) 2012-2024 by Autodesk, Inc." ; certificationLevel = 2; minimumRevision = 45948; longDescription = "Setup sheet for generating an HTML document with the relevant details for the setup, tools, and individual operations. You can print the document directly or alternatively convert it to a PDF file for later reference." ; capabilities = CAPABILITY_SETUP_SHEET; extension = "html" ; mimetype = "text/html" ; keywords = "MODEL_IMAGE PREVIEW_IMAGE" ; setCodePage( "utf-8" ); dependencies = "setup-sheet.css" ; allowMachineChangeOnSection = true ; properties = { embedStylesheet: { title : "Embed stylesheet" , description: "Embeds the stylesheet in the HTML code." , type : "boolean" , value : true , scope : "post" }, useUnitSymbol: { title : "Use unit symbol" , description: "Specifies that symbols should be used for units (some printers may not support this)." , type : "boolean" , value : false , scope : "post" }, showDocumentPath: { title : "Show document path" , description: "Specifies that the document path should be output." , type : "boolean" , value : true , scope : "post" }, showModelImage: { title : "Show model image" , description: "If enabled, a model image will be included in the setup sheet." , type : "boolean" , value : true , scope : "post" }, showToolImage: { title : "Show tool images" , description: "If enabled, tool images will be included in the seutp sheet." , type : "boolean" , value : true , scope : "post" }, showPreviewImage: { title : "Show preview image" , description: "If enabled, a preview image will be included in the setup sheet." , type : "boolean" , value : true , scope : "post" }, previewWidth: { title : "Preview width" , description: "Specifies the width of the preview image." , type : "string" , value : "8cm" , scope : "post" }, showPercentages: { title : "Show percentages" , description: "Specifies that the percentage of the total cycle time should be shown for each operation cycle time." , type : "boolean" , value : true , scope : "post" }, showFooter: { title : "Show footer" , description: "Specifies whether a footer should be included in the HTML setup sheet." , type : "boolean" , value : true , scope : "post" }, showRapidDistance: { title : "Show rapid distance" , description: "Specifies whether the rapid distance should be output." , type : "boolean" , value : true , scope : "post" }, rapidFeed: { title : "Rapid feed" , description: "Sets the rapid traversal feedrate. Set this to get more accurate cycle times." , type : "number" , value : 5000, scope : "post" }, toolChangeTime: { title : "Tool change time" , description: "Sets the tool change time in seconds. Set this to get more accurate cycle times." , type : "number" , value : 15, scope : "post" }, showNotes: { title : "Show notes" , description: "Writes operation notes as comments in the outputted code." , type : "boolean" , value : true , scope : "post" }, forcePreview: { title : "Force preview" , description: "Enable to force a preview picture for all instances of a pattern." , type : "boolean" , value : false , scope : "post" }, showOperations: { title : "Show operations" , description: "Enable to output information for each operation." , type : "boolean" , value : true , scope : "post" }, showTools: { title : "Show tools" , description: "Enable to see information for each tool." , type : "boolean" , value : true , scope : "post" }, showTotals: { title : "Show totals" , description: "Enable to see total information." , type : "boolean" , value : true , scope : "post" }, embedImages: { title : "Embed images" , description: "If enabled, images are embedded into the HTML file." , type : "boolean" , value : true , scope : "post" } }; var showToolpath = false ; var useToolNumber = true ; var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4)}); var feedFormat = createFormat({decimals:(unit == MM ? 3 : 5)}); var toolFormat = createFormat({decimals:0}); var rpmFormat = createFormat({decimals:0}); var secFormat = createFormat({decimals:3}); var angleFormat = createFormat({decimals:0, scale:DEG}); var degFormat = createFormat({decimals:0}); var pitchFormat = createFormat({decimals:3}); var spatialFormat = createFormat({decimals:(unit == MM ? 2 : 3)}); var percentageFormat = createFormat({decimals:1, scale:100}); var timeFormat = createFormat({decimals:2}); var taperFormat = angleFormat; // share format var supportedImageTypes = { "bmp" : "image/bmp" , "gif" : "image/gif" , "jpg" : "image/jpeg" , "jpeg" : "image/jpeg" , "png" : "image/png" , "tif" : "image/tiff" , "tiff" : "image/tiff" }; // collected state var zRanges = {}; var totalCycleTime = 0; var exportedTools = {}; var toolRenderer; function getUnitSymbolAsString() { switch (unit) { case MM: return getProperty( "useUnitSymbol" ) ? "㎜" : "mm" ; case IN: return getProperty( "useUnitSymbol" ) ? "∳" : "in" ; default : error(localize( "Unit is not supported." )); return undefined; } } function getFeedSymbolAsString() { switch (unit) { case MM: return getProperty( "useUnitSymbol" ) ? "㎜/min" : "mm/min" ; case IN: return getProperty( "useUnitSymbol" ) ? "∳/min" : "in/min" ; // return getProperty("useUnitSymbol") ? "′/min" : "ft/min"; default : error(localize( "Unit is not supported." )); return undefined; } } function getFPRSymbolAsString() { switch (unit) { case MM: return getProperty( "useUnitSymbol" ) ? "㎜" : "mm" ; case IN: return getProperty( "useUnitSymbol" ) ? "∳" : "in" ; default : error(localize( "Unit is not supported." )); return undefined; } } function toString(value) { if ( typeof value == "string" ) { return "'" + value + "'" ; } else { return value; } } function makeRow(content, classId) { if (classId) { return "" + content + "" ; } else { return "" + content + "" ; } } function makeHeading(content, classId) { if (classId) { return "" + content + "" ; } else { return "" + content + "" ; } } function makeColumn(content, classId) { if (classId) { return "" + content + "" ; } else { return "" + content + "" ; } } function bold(content, classId) { if (classId) { return "<b class=" \"" " +=" " classid=" " " \ "=" ">" + content + "</b>" ; } else { return "<b>" + content + "</b>" ; } } function d(content) { return "<div class=" \"description\" " style=" \"display: " inline;\"=" ">" + content + "</div>" ; } function v(content) { return "<div class=" \"value\" " style=" \"display: " inline;\"=" ">" + content + "</div>" ; } function vWrap(content) { return "<div class=" \"value\" " style=" \"display: " inline;=" " white-space:=" " normal;\"=" ">" + content + "</div>" ; } function p(content, classId) { if (classId) { return "<p class=" \"value\" ">" + content + "</p>" ; } else { return "<p>" + content + "</p>" ; } } var cachedParameters = {}; var patternIds = {}; var seenPatternIds = {}; function formatPatternId(id) { var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; var result = "" ; while (id >= 0) { result += chars.charAt(id % chars.length); id -= chars.length; } return result; } /** Loads the given image as a img data snippet. Returns empty string if unsupported. */ function getImageAsImgSrc(path) { if (( typeof BinaryFile == "function" ) && ( typeof Base64 == "function" )) { var extension = path.slice(path.lastIndexOf( "." ) + 1, path.length).toLowerCase(); var mimetype = supportedImageTypes[extension]; if (mimetype) { var data = BinaryFile.loadBinary(path); return "data:" + mimetype + ";base64," + Base64.btoa(data); } } return "" ; } function onParameter(name, value) { cachedParameters[name] = value; } function onOpen() { cachedParameters = {}; if ((revision < 41366) || !getProperty( "embedImages" ) && (getPlatform() == "WIN32" )) { // use SVG instead of image toolRenderer = createToolRenderer(); if (toolRenderer) { toolRenderer.setBackgroundColor( new Color(1, 1, 1)); toolRenderer.setFluteColor( new Color(40.0 / 255, 40.0 / 255, 40.0 / 255)); toolRenderer.setShoulderColor( new Color(80.0 / 255, 80.0 / 255, 80.0 / 255)); toolRenderer.setShaftColor( new Color(80.0 / 255, 80.0 / 255, 80.0 / 255)); toolRenderer.setHolderColor( new Color(40.0 / 255, 40.0 / 255, 40.0 / 255)); } } if (is3D()) { var numberOfSections = getNumberOfSections(); for ( var i = 0; i < numberOfSections; ++i) { var section = getSection(i); var zRange = section.getGlobalZRange(); var tool = section.getTool(); if (zRanges[tool.number]) { zRanges[tool.number].expandToRange(zRange); } else { zRanges[tool.number] = zRange; } } } write( "\n" ); write( "" ); // header var c = "" ; c += "<meta http-equiv=" \"Content-Type\" " content=" \"text/html; " charset=" utf-8\" ">" ; if (getProperty( "embedStylesheet" )) { c += "<style type=" \"text/css\" ">" + loadText( "setup-sheet.css" , "utf-8" ) + "</style>" ; } else { c += "<link rel=" \"StyleSheet\" " href=" \"setup-sheet.css\" " type=" \"text/css\" " media=" \"print, " screen\"=" ">" ; } var script = "<script type=" \"text/javascript\" ">" + "function detectIE() {\n" + " var ua = window.navigator.userAgent;\n" + " var msie = ua.indexOf('MSIE ');\n" + " if (msie > 0) {\n" + " // IE 10 or older => return version number\n" + " return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);\n" + " }\n" + " var trident = ua.indexOf('Trident/');\n" + " if (trident > 0) {\n" + " // IE 11 => return version number\n" + " var rv = ua.indexOf('rv:');\n" + " return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);\n" + " }\n" + " var edge = ua.indexOf('Edge/');\n" + " if (edge > 0) {\n" + " // Edge (IE 12+) => return version number\n" + " return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);\n" + " }\n" + " return false;\n" + "}\n" + "\n" + "function onLoad() {\n" + " if (detectIE()) {\n" + " var paths = document.getElementsByTagName(\"path\")\n" + " for (var i in paths) {\n" + " var path = paths[i];\n" + " if (path.getAttribute(\"class\") == \"holder\") {\n" + " path.setAttribute(\"class\", \"holderIE\"); \n" + " } else if (path.getAttribute(\"class\") == \"cutter\") {\n" + " path.setAttribute(\"class\", \"cutterIE\"); \n" + " }\n" + " }\n" + " }\n" + "}\n" + "</script>" ; c += "<style type=" \"text/css\" ">" + ".preview img {width: " + getProperty( "previewWidth" ) + ";}" + "</style>" ; c += script; if (programName) { c += "<title>" + localize( "Setup Sheet for Program" ) + " " + programName + "</title>" ; } else { c += "<title>" + localize( "Setup Sheet" ) + "</title>" ; } c += "" ; write(c); write( "" ); if (programName) { write( "<h1>" + localize( "Setup Sheet for Program" ) + " " + programName + "</h1>" ); } else { write( "<h1>" + localize( "Setup Sheet" ) + "</h1>" ); } patternIds = {}; var numberOfSections = getNumberOfSections(); var j = 0; for ( var i = 0; i < numberOfSections; ++i) { var section = getSection(i); if (section.isPatterned()) { var id = section.getPatternId(); if (patternIds[id] == undefined) { patternIds[id] = formatPatternId(j); ++j; } } } } /** Returns the specified coolant as a string. */ function getCoolantDescription(coolant) { switch (coolant) { case COOLANT_OFF: return localize( "Off" ); case COOLANT_FLOOD: return localize( "Flood" ); case COOLANT_MIST: return localize( "Mist" ); case COOLANT_THROUGH_TOOL: return localize( "Through tool" ); case COOLANT_AIR: return localize( "Air" ); case COOLANT_AIR_THROUGH_TOOL: return localize( "Air through tool" ); case COOLANT_SUCTION: return localize( "Suction" ); case COOLANT_FLOOD_MIST: return localize( "Flood and mist" ); case COOLANT_FLOOD_THROUGH_TOOL: return localize( "Flood and through tool" ); default : return localize( "Unknown" ); } } /** Formats WCS to text. */ function formatWCS(id) { /* if (id == 0) { id = 1; } if (id > 6) { return "G54.1P" + (id - 6); } return "G" + (getAsInt(id) + 53); */ return "#" + id; } var svg; /** Returns the SVG representation for the current toolpath. */ function getToolpathAsSVG() { var fragment = "" ; if (!svg) { return "" ; } var pageWidth = 120; var pageHeight = 100; var box = currentSection.getGlobalBoundingBox(); // for turning only for now box = {lower: new Vector(box.lower.z, box.lower.x, 0), upper: new Vector(box.upper.z, box.upper.x, 0)}; var width = box.upper.x - box.lower.x; var height = box.upper.y - box.lower.y; var dx = toMM(width); var dy = toMM(height); var dimension = Math.min(width, height); var margin = toPreciseUnit(1, MM); var backgroundColor = "#f0f0f0" ; fragment += "<svg class=" \"toolpathimage\" " width=" \"" " +=" " xyzformat.format(pagewidth)=" " " mm\ "=" " height=" \"" " xyzformat.format(pageheight)=" " viewBox=" \"" " xyzformat.format(box.lower.x=" " -=" " margin)=" " " = "" xyzformat.format(box.lower.y= "" xyzformat.format(width= "" 2= "" *= "" xyzformat.format(height= "" "\"=" " style=" \"background:" " backgroundcolor=" " " \ "" = "" > "; /* fragment += " <defs> "; fragment += " <path id= "\"c\"" stroke= "\"#f00\"" stroke-width= "\"1px\"" color= "\"blue\"" ></path> "; fragment += " <path id= "\"l\"" stroke= "\"#f00\"" stroke-width= "\"1px\"" color= "\"green\"" ></path> "; fragment += " <path id= "\"r\"" stroke= "\"#f00\"" stroke-width= "\"1px\"" color= "\"yellow\"" ></path> "; fragment += " <path id= "\"ramp\"" stroke= "\"#f00\"" stroke-width= "\"1px\"" color= "\"red\"" ></path> "; fragment += " </defs> "; */ // invert y axis fragment += " <g transform= "\"translate("" += "" xyzformat.format(0)= "" ",=" " " = "" xyzformat.format(height= "" 2= "" *= "" margin)= "" ")\"=" ">" ; fragment += "<g transform=" \"scale(1, " -1)\"=" ">" ; fragment += svg.toString(); fragment += "</g>" ; fragment += "</g>" ; fragment += "</svg>" ; // add support for tool animation return fragment; } function onSection() { if (showToolpath && (currentSection.getType() == TYPE_TURNING)) { // var remaining = currentSection.workPlane; var map2XY = new Matrix( new Vector(0, 0, 1), new Vector(1, 0, 0), new Vector(0, -1, 0)); setRotation(map2XY.getTransposed()); svg = new StringBuffer(); // add start position svg.append("<circle cx="\""" +="" xyzformat.format(x)="" "\"="" cy="\""" xyzformat.format(y)="" r="\""" xyzformat.format(radius)="" stroke="\""" color="" stroke-width="\""" width="">"); } else { skipRemainingSection(); } } function writeLine(x, y) { if (radiusCompensation != RADIUS_COMPENSATION_OFF) { return ; } var color; switch (movement) { case MOVEMENT_CUTTING: case MOVEMENT_REDUCED: case MOVEMENT_FINISH_CUTTING: color = "blue" ; break ; case MOVEMENT_RAPID: case MOVEMENT_HIGH_FEED: color = "yellow" ; break ; case MOVEMENT_LEAD_IN: case MOVEMENT_LEAD_OUT: case MOVEMENT_LINK_TRANSITION: case MOVEMENT_LINK_DIRECT: color = "green" ; break ; default : color = "red" ; } var start = getCurrentPosition(); if ((xyzFormat.format(start.x) == xyzFormat.format(x)) && (xyzFormat.format(start.y) == xyzFormat.format(y))) { return ; // ignore vertical } svg.append( "<line x1=" \"" " +=" " xyzformat.format(start.x)=" " " \ "=" " y1=" \"" " xyzformat.format(start.y)=" " x2=" \"" " xyzformat.format(x)=" " y2=" \"" " xyzformat.format(y)=" " stroke=" \"" " color=" ">" ); } function onRapid(x, y, z) { writeLine(x, y); } function onLinear(x, y, z, feed) { writeLine(x, y); } function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { // linearize(tolerance); // return; if (radiusCompensation != RADIUS_COMPENSATION_OFF) { return ; } var color; switch (movement) { case MOVEMENT_CUTTING: case MOVEMENT_REDUCED: case MOVEMENT_FINISH_CUTTING: color = "blue" ; break ; case MOVEMENT_RAPID: case MOVEMENT_HIGH_FEED: color = "yellow" ; break ; case MOVEMENT_LEAD_IN: case MOVEMENT_LEAD_OUT: case MOVEMENT_LINK_TRANSITION: case MOVEMENT_LINK_DIRECT: color = "green" ; break ; default : color = "red" ; } var start = getCurrentPosition(); var largeArc = (getCircularSweep() > Math.PI) ? 1 : 0; var sweepFlag = isClockwise() ? 1 : 0; // turning is flipped var dpath = [ "M" , xyzFormat.format(start.x), xyzFormat.format(start.y), "A" , xyzFormat.format(getCircularRadius()), xyzFormat.format(getCircularRadius()), 0, largeArc, sweepFlag, xyzFormat.format(x), xyzFormat.format(y) ].join( " " ); svg.append( "<path d=" \"" " +=" " dpath=" " " \ "=" " fill=" \"none\" " stroke=" \"" " color=" ">" ); } function onCyclePoint(x, y, z) { var color = "green" ; var radius = tool.diameter * 0.5; svg.append( "<circle cx=" \"" " +=" " xyzformat.format(x)=" " " \ "=" " cy=" \"" " xyzformat.format(y)=" " r=" \"" " xyzformat.format(radius)=" " stroke=" \"" " color=" " stroke-width=" \"" " " 1px "=" ">" ); } function pageWidthFitPath(path) { var PAGE_WIDTH = 70; if (path.length < PAGE_WIDTH) { return path; } var newPath = "" ; var tempPath = "" ; var flushPath = "" ; var offset = 0; var ids = "" ; for ( var i = 0; i < path.length; ++i) { var cv = path[i]; if (i > (PAGE_WIDTH + offset)) { if (flushPath.length == 0) { // No good place to break flushPath = tempPath; tempPath = "" ; } newPath += flushPath + "<br>" ; offset += flushPath.length - 1; flushPath = "" ; } if ((cv == "\\" ) || (cv == "/" ) || (cv == " " ) || (cv == "_" )) { flushPath += tempPath + cv; tempPath = "" ; } else { tempPath += cv; } } newPath += flushPath + tempPath; return newPath; } /** Returns the given spatial value in MM. */ function toMM(value) { return value * ((unit == IN) ? 25.4 : 1); } /** Returns the SVG representation of the given tool. */ function getToolAsSVG(tool) { var fragment = "" ; var pageWidth = 30; var pageHeight = 35; var box = tool.getExtent( true ); var width = box.upper.x - box.lower.x; var height = box.upper.y - box.lower.y; var dx = toMM(width); var dy = toMM(height); var dimension = Math.min(width, height); var margin = toPreciseUnit(1, MM); var backgroundColor = "#ffffff" ; fragment += "<svg class=" \"toolimage\" " width=" \"" " +=" " xyzformat.format(pagewidth)=" " " mm\ "=" " height=" \"" " xyzformat.format(pageheight)=" " viewBox=" \"" " xyzformat.format(box.lower.x=" " -=" " margin)=" " " = "" xyzformat.format(box.lower.y= "" xyzformat.format(width= "" 2= "" *= "" xyzformat.format(height= "" "\"=" " style=" \"background:" " backgroundcolor=" " " \ "" = "" > "; fragment += " <defs> "; fragment += " <linearGradient id= "holderGrad" x1= "0%" y1= "0%" x2= "100%" y2= "0%" > "; fragment += " <stop offset= "0%" style= "stop-color:rgb(120,120,120);stop-opacity:1" ></stop> "; fragment += " <stop offset= "50%" style= "stop-color:rgb(180,180,180);stop-opacity:0.5" ></stop> "; fragment += " <stop offset= "100%" style= "stop-color:rgb(150,150,150);stop-opacity:1" ></stop> "; fragment += " </linearGradient> "; if (!tool.isJetTool()) { // we only show cutting head fragment += " <linearGradient id= "cutterGrad" x1= "0%" y1= "0%" x2= "100%" y2= "0%" > "; fragment += " <stop offset= "0%" style= "stop-color:rgb(228,175,52);stop-opacity:1" ></stop> "; fragment += " <stop offset= "50%" style= "stop-color:rgb(240,240,240);stop-opacity:1" ></stop> "; fragment += " <stop offset= "100%" style= "stop-color:rgb(228,175,52);stop-opacity:1" ></stop> "; fragment += " </linearGradient> "; } fragment += " </defs> "; if (!tool.isTurningTool()) { // invert y axis fragment += " <g transform= "\"translate("" += "" xyzformat.format(0)= "" ",=" " " = "" xyzformat.format(height)= "" ")\"=" ">" ; fragment += "<g transform=" \"scale(1, " -1)\"=" ">" ; } var holder = tool.getHolderProfileAsSVGPath(); if (holder) { fragment += "<path class=" \"holder\" " d=" \"" " +=" " holder=" " " \ "=" " style=" \"fill:url( #holderGrad);vector-effect:non-scaling-stroke;stroke:black;stroke-opacity:0.9\"/">"; } var cutter = !tool.isJetTool() ? tool.getCutterProfileAsSVGPath() : undefined; if (cutter) { // indicate if insert is on the other side stroke-dasharray=\"3px,3px\" fragment += "<path class= "\"cutter\"" d= "\""" += "" cutter= "" "\"=" " style=" \"fill:url( #cutterGrad);vector-effect:non-scaling-stroke;stroke:black;fill-opacity:1.0;stroke-opacity:0.9\"/">"; } if ( false && tool.isTurningTool()) { // mark the compensation point var offset = tool.getCompensationDisplacement(); fragment += "<circle cx=" \"" " +=" " xyzformat.format(offset.x)=" " " \ "=" " cy=" \"" " xyzformat.format(offset.y)=" " r=" \"" " " 2.5px "=" " style=" \"fill:red;fill-opacity:0.5;vector-effect:non-scaling-stroke\"/ ">" ; } if (!tool.isTurningTool()) { fragment += "</circle></path></path></g>" ; fragment += "</g>" ; } fragment += "</svg>" ; return fragment; } var TURNING_RELIEF_ANGLES = [ {id: "N" , value:0}, {id: "A" , value:3}, {id: "B" , value:5}, {id: "C" , value:7}, {id: "P" , value:11}, {id: "D" , value:15}, {id: "E" , value:20}, {id: "F" , value:25}, {id: "G" , value:30} ]; /** Returns the turning ISO tool code. */ function getTurningToolISO(tool) { if (!((tool.type == TOOL_TURNING_GENERAL) || (tool.type == TOOL_TURNING_BORING))) { return "" ; } var reliefAngleCode = "?" ; for ( var e in TURNING_RELIEF_ANGLES) { if (Math.abs(e.value - tool.reliefAngle) < 1e-3) { reliefAngleCode = e.id; break ; } } var name = "?" ; name += reliefAngleCode; return name; } var insertDescriptions = [ localize( "User defined" ), localize( "ISO A 85deg" ), localize( "ISO B 82deg" ), localize( "ISO C 80deg" ), localize( "ISO D 55deg" ), localize( "ISO E 75deg" ), localize( "ISO H 120deg" ), localize( "ISO K 55deg" ), localize( "ISO L 90deg" ), localize( "ISO M 86deg" ), localize( "ISO O 135deg" ), localize( "ISO P 108deg" ), localize( "ISO R round" ), localize( "ISO S square" ), localize( "ISO T triangle" ), localize( "ISO V 35deg" ), localize( "ISO W 80deg" ), localize( "Round" ), localize( "Radius" ), localize( "Square" ), localize( "Chamfer" ), localize( "40deg" ), localize( "ISO double" ), localize( "ISO triple" ), localize( "UTS double" ), localize( "UTS triple" ), localize( "ISO double V" ), localize( "ISO triple V" ), localize( "UTS double V" ), localize( "UTS triple V" ) ]; var holderDescriptions = [ localize( "No holder" ), localize( "ISO A" ), localize( "ISO B" ), localize( "ISO C" ), localize( "ISO D" ), localize( "ISO E" ), localize( "ISO F" ), localize( "ISO G" ), localize( "ISO H" ), localize( "ISO J" ), localize( "ISO K" ), localize( "ISO L" ), localize( "ISO M" ), localize( "ISO N" ), localize( "ISO P" ), localize( "ISO Q" ), localize( "ISO R" ), localize( "ISO S" ), localize( "ISO T" ), localize( "ISO U" ), localize( "ISO V" ), localize( "ISO W" ), localize( "ISO Y" ), localize( "Offset" ), localize( "Straight" ), localize( "External" ), localize( "Internal" ), localize( "Face" ), localize( "Straight" ), localize( "Offset" ), localize( "Face" ), localize( "Boring bar ISO F" ), localize( "Boring bar ISO G" ), localize( "Boring bar ISO J" ), localize( "Boring bar ISO K" ), localize( "Boring bar ISO L" ), localize( "Boring bar ISO P" ), localize( "Boring bar ISO Q" ), localize( "Boring bar ISO S" ), localize( "Boring bar ISO U" ), localize( "Boring bar ISO W" ), localize( "Boring bar ISO Y" ), localize( "Boring bar ISO X" ) ]; /** Returns a HTML link if text looks like a link. */ function autoLink(link, description) { if (!description) { description = "" ; } if (!link) { if ((description.toLowerCase().indexOf( "https://" ) == 0) || (description.toLowerCase().indexOf( "http://" ) == 0)) { link = description; if (description.length > 16) { description = localize( "click to visit" ); } } } if (!link) { return description; } if (!description) { description = link.substr(8); if (description.length > 16) { description = localize( "click to visit" ); } } return "<a href=" \"" " +=" " link=" " " \ "=" ">" + description + "</a>" ; if (!description) { description = link.substr(7); if (description.length > 16) { description = localize( "click to visit" ); } } return "<a href=" \"" " +=" " link=" " " \ "=" ">" + description + "</a>" ; } else { if (!description) { description = link; if (description.length > 16) { description = localize( "click to visit" ); } } return "<a href=" \"http: //"" +="" link="" "\"="">" + description + "</a>"; } } function getSectionParameterForTool(tool, id) { var numberOfSections = getNumberOfSections(); for ( var i = 0; i < numberOfSections; ++i) { var section = getSection(i); if (section.getTool().number == tool.number) { return section.hasParameter(id) ? section.getParameter(id) : undefined; } } return undefined; } function getToolAngle(tool) { var toolAngle = getSectionParameterForTool(tool, "operation:tool_angle" ); if (toolAngle != undefined) { switch (toolAngle) { case 0: return "Radial" ; case 90: case -90: return "Axial" ; default : return toolAngle + " deg" ; } } return "" ; } /** Returns a HTML table with the common tool information. Note that the table is not closed! */ function presentTool(tool) { var c1 = "" ; if (!tool.isJetTool()) { c1 += makeRow( makeColumn( bold(localize( "T" ) + toolFormat.format(tool.number)) + " " + localize( "D" ) + toolFormat.format(!tool.isTurningTool() ? tool.diameterOffset : tool.compensationOffset) + " " + conditional(!tool.isTurningTool(), localize( "L" ) + toolFormat.format(tool.lengthOffset)) ) ); } else if (tool.isJetTool()) { c1 += makeRow(makeColumn( " " )); // move 1 row down } if (tool.manualToolChange) { c1 += makeRow(makeColumn(d(bold(localize( "Manual tool change" ))))); } if (tool.isLiveTool && !tool.isTurningTool() && (machineConfiguration.getTurning() || isTurning())) { c1 += makeRow(makeColumn(d(localize( "Type" ) + ": " ) + v(getToolTypeName(tool.type) + " " + (tool.isLiveTool() ? localize( "LIVE" ) : localize( "STATIC" ))))); } else { // dont show for old versions or is non turning c1 += makeRow(makeColumn(d(localize( "Type" ) + ": " ) + v(getToolTypeName(tool.type)))); } if (!tool.isTurningTool()) { c1 += makeRow(makeColumn(d(localize(tool.isJetTool() ? "Kerf Diameter" : "Diameter" ) + ": " ) + v(spatialFormat.format(tool.isJetTool() ? tool.jetDiameter : tool.diameter) + getUnitSymbolAsString()))); if (tool.cornerRadius) { c1 += makeRow(makeColumn(d(localize( "Corner Radius" ) + ": " ) + v(spatialFormat.format(tool.cornerRadius) + getUnitSymbolAsString()))); } if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { if (tool.isDrill()) { c1 += makeRow(makeColumn(d(localize( "Tip Angle" ) + ": " ) + v(taperFormat.format(tool.taperAngle) + "°" ))); } else { c1 += makeRow(makeColumn(d(localize( "Taper Angle" ) + ": " ) + v(taperFormat.format(tool.taperAngle) + "°" ))); } } if (!tool.isJetTool()) { c1 += makeRow(makeColumn(d(localize( "Length" ) + ": " ) + v(spatialFormat.format(tool.bodyLength) + getUnitSymbolAsString()))); if (tool.numberOfFlutes > 0) { c1 += makeRow(makeColumn(d(localize( "Flutes" ) + ": " ) + v(tool.numberOfFlutes))); } } } else { if (tool.getInsertType() < insertDescriptions.length) { c1 += makeRow(makeColumn(d(localize( "Insert" ) + ": " ) + v(insertDescriptions[tool.getInsertType()]))); } if (tool.getHolderType() < holderDescriptions.length) { var hand = "" ; switch (tool.hand) { case "L" : hand = localize( "Left" ); break ; case "R" : hand = localize( "Right" ); break ; case "N" : hand = localize( "Neutral" ); break ; } if (!getProperty( "showTools" )) { c1 += makeRow(makeColumn(d(localize( "Holder" ) + ": " ) + v(holderDescriptions[tool.getHolderType()] + " " + hand))); } if ( false && tool.clamping) { c1 += makeRow(makeColumn(d(localize( "Clamping" ) + ": " ) + v(tool.clamping))); } } switch (tool.type) { case TOOL_TURNING_GENERAL: case TOOL_TURNING_BORING: if ((tool.inscribedCircleDiameter !== undefined) && (tool.edgeLength !== undefined)) { var edgeLength = tool.edgeLength; if ((unit == MM) && (edgeLength > 0)) { c1 += makeRow(makeColumn(d(localize( "Edge length" ) + ": " ) + v(spatialFormat.format(edgeLength) + getUnitSymbolAsString()))); } else { c1 += makeRow(makeColumn(d(localize( "Inscribed circle" ) + ": " ) + v(spatialFormat.format(tool.inscribedCircleDiameter) + getUnitSymbolAsString()))); } } if (tool.noseRadius !== undefined) { var NOSE_RADII = [ {idi: "X0" , idm: "X0" , vi:0.0015, vm:0.04}, {idi: "00" , idm: "01" , vi:0.004, vm:0.1}, {idi: "0.5" , idm: "02" , vi:0.008, vm:0.2}, {idi: "01" , idm: "04" , vi:1.0 / 64, vm:0.4}, {idi: "02" , idm: "08" , vi:2.0 / 64, vm:0.8}, {idi: "03" , idm: "12" , vi:3.0 / 64, vm:1.2}, {idi: "04" , idm: "16" , vi:4.0 / 64, vm:1.6}, {idi: "05" , idm: "20" , vi:5.0 / 64, vm:2.0}, {idi: "06" , idm: "24" , vi:6.0 / 64, vm:2.4}, {idi: "07" , idm: "28" , vi:7.0 / 64, vm:2.8}, {idi: "08" , idm: "32" , vi:8.0 / 64, vm:3.2}, {idi: "00" , idm: "M0" , vi:0, vm:0} // round ]; var id = "" ; var value = tool.noseRadius; /* for (var i in NOSE_RADII) { var e = NOSE_RADII[i]; var _value = (unit == MM) ? e.mi : e.vi; // we dont have a tool unit for now if (Math.abs(_value - value) < 1e-3) { id = (unit == MM) ? e.idm : e.idi; value = _value; break; } } */ var text = spatialFormat.format(value) + getUnitSymbolAsString(); if (id) { text = id + " " + text; } c1 += makeRow(makeColumn(d(localize( "Nose radius" ) + ": " ) + v(text))); } if (tool.crossSection !== undefined) { c1 += makeRow(makeColumn(d(localize( "Cross section" ) + ": " ) + v(tool.crossSection))); } if (tool.tolerance !== undefined) { c1 += makeRow(makeColumn(d(localize( "Tolerance" ) + ": " ) + v(tool.tolerance))); } if (tool.reliefAngle !== undefined) { var id = localize( "Custom" ); var value = tool.reliefAngle; for ( var ir in TURNING_RELIEF_ANGLES) { var re2 = TURNING_RELIEF_ANGLES[ir]; if (Math.abs(re2.value - value) < 1e-3) { id = re2.id; value = re2.value; break ; } } c1 += makeRow(makeColumn(d(localize( "Relief" ) + ": " ) + v(id + " " + degFormat.format(value) + "deg" ))); } break ; case TOOL_TURNING_THREADING: if ((tool.pitch !== undefined) && (tool.pitch > 0)) { c1 += makeRow(makeColumn(d(localize( "Pitch" ) + ": " ) + v(spatialFormat.format(tool.pitch) + getUnitSymbolAsString()))); } // internal/external info break ; case TOOL_TURNING_GROOVING: // show shape also if (tool.grooveWidth !== undefined) { c1 += makeRow(makeColumn(d(localize( "Width" ) + ": " ) + v(spatialFormat.format(tool.grooveWidth) + getUnitSymbolAsString()))); } if ((tool.noseRadius !== undefined) && (tool.noseRadius > 0)) { c1 += makeRow(makeColumn(d(localize( "Nose radius" ) + ": " ) + v(spatialFormat.format(tool.noseRadius) + getUnitSymbolAsString()))); } break ; case TOOL_TURNING_CUSTOM: break ; } var compensationDescription; switch (tool.getCompensationMode()) { case TOOL_COMPENSATION_INSERT_CENTER: compensationDescription = localize( "Insert center" ); break ; case TOOL_COMPENSATION_TIP: compensationDescription = localize( "Tip" ); break ; case TOOL_COMPENSATION_TIP_CENTER: compensationDescription = localize( "Tip center" ); break ; case TOOL_COMPENSATION_TIP_TANGENT: compensationDescription = localize( "Tip tangent" ); break ; } if (compensationDescription) { c1 += makeRow(makeColumn(d(localize( "Compensation" ) + ": " ) + v(compensationDescription))); } } if (tool.material) { c1 += makeRow(makeColumn(d(localize( "Material" ) + ": " ) + v(getMaterialName(tool.material)))); } if (tool.description) { c1 += makeRow(makeColumn(d(localize( "Description" ) + ": " ) + v(tool.description))); } if (tool.comment) { c1 += makeRow(makeColumn(d(localize( "Comment" ) + ": " ) + v(tool.comment))); } if (tool.vendor) { c1 += makeRow(makeColumn(d(localize( "Vendor" ) + ": " ) + v(tool.vendor))); } var productLink = getSectionParameterForTool(tool, "operation:tool_productLink" ); if (tool.productId || productLink) { c1 += makeRow(makeColumn(d(localize( "Product" ) + ": " ) + v(autoLink(productLink, tool.productId)))); } if (!getProperty( "showTools" ) && tool.holderDescription) { c1 += makeRow(makeColumn(d(localize( "Holder" ) + ": " ) + v(tool.holderDescription))); } // c1 += ""; // fixed width // c1 += "<table class="\"info\""><tbody><tr class="\"thin\""><td width="\"6cm\""> </td></tr></tbody></table>"; return c1; } function writeTools() { writeln( "" ); var colgroup = "" ; write(colgroup); write(makeRow( "" )); var tools = getToolList( "number" , "lengthOffset" ); if (tools.length > 0) { var numberOfTools = useToolNumber ? tools.length : getNumberOfSections(); for ( var i = 0; i < numberOfTools; ++i) { var tool = useToolNumber ? tools[i].tool : getSection(i).getTool(); var c1 = presentTool(tool); c1 += "<table class=" \"sheet\" " cellspacing=" \"0\" " align=" \"center\" "><colgroup span=" \"3\" "><col width=" \"1*\"/ "><col width=" \"1*\"/ "><col width=" \"120\"/ "></colgroup><tbody><tr><th colspan=" \"4\" ">" + localize( "Tools" ) + "</th></tr></tbody></table>" ; var c2 = "" ; c2 += makeRow(makeColumn( " " )); // move 1 row down if (getToolAngle(tool)) { c2 += makeRow(makeColumn(d(localize( "Tool Orientation in Turret" ) + ": " ) + v(getToolAngle(tool)))); } if (zRanges[tool.number]) { c2 += makeRow(makeColumn(d(localize( "Minimum Z" ) + ": " ) + v(spatialFormat.format(zRanges[tool.number].getMinimum()) + getUnitSymbolAsString()))); } var maximumFeed = 0; var maximumSpindleSpeed = 0; var cuttingDistance = 0; var rapidDistance = 0; var cycleTime = 0; for ( var j = 0; j < getNumberOfSections(); ++j) { var section = getSection(j); if (!isProbeOperation(section)) { if (section.getTool().number == tool.number) { maximumFeed = Math.max(maximumFeed, section.getMaximumFeedrate()); if ((section.type == TYPE_MILLING) || (section.type == TYPE_TURNING)) { if (maximumSpindleSpeed !== undefined) { maximumSpindleSpeed = (section.type == TYPE_MILLING) ? Math.max(maximumSpindleSpeed, section.getMaximumSpindleSpeed()) : Math.max(maximumSpindleSpeed, section.getTool().getMaximumSpindleSpeed()); } else { maximumSpindleSpeed = (section.type == TYPE_MILLING) ? section.getMaximumSpindleSpeed() : section.getTool().getMaximumSpindleSpeed(); } } cuttingDistance += section.getCuttingDistance(); rapidDistance += section.getRapidDistance(); cycleTime += section.getCycleTime(); } } } if (getProperty( "rapidFeed" ) > 0) { cycleTime += rapidDistance / getProperty( "rapidFeed" ) * 60; } c2 += makeRow(makeColumn(d(localize( "Maximum Feed" ) + ": " ) + v(feedFormat.format(maximumFeed) + getFeedSymbolAsString()))); if (maximumSpindleSpeed !== undefined) { c2 += makeRow(makeColumn(d(localize( "Maximum Spindle Speed" ) + ": " ) + v(rpmFormat.format(maximumSpindleSpeed) + localize( "rpm" )))); } c2 += makeRow(makeColumn(d(localize( "Cutting Distance" ) + ": " ) + v(spatialFormat.format(cuttingDistance) + getUnitSymbolAsString()))); if (getProperty( "showRapidDistance" )) { c2 += makeRow(makeColumn(d(localize( "Rapid Distance" ) + ": " ) + v(spatialFormat.format(rapidDistance) + getUnitSymbolAsString()))); } var additional = "" ; if ((getNumberOfSections() > 1) && getProperty( "showPercentages" )) { if (totalCycleTime > 0) { additional = "<div class=" \"percentage\" ">(" + percentageFormat.format(cycleTime / totalCycleTime) + "%)</div>" ; } } c2 += makeRow(makeColumn(d(localize( "Estimated Cycle Time" ) + ": " ) + v(formatCycleTime(cycleTime) + " " + additional))); // c2 += ""; // fixed width c2 += "<table class=" \"info\" "><tbody><tr class=" \"thin\" "><td width=" \"6cm\" "> </td></tr></tbody></table>" ; var c3 = "" ; c3 += makeRow(makeColumn( " " )); // move 1 row down if (tool.isTurningTool()) { if (tool.getHolderType() < holderDescriptions.length) { var hand = "" ; switch (tool.hand) { case "L" : hand = localize( "Left" ); break ; case "R" : hand = localize( "Right" ); break ; case "N" : hand = localize( "Neutral" ); break ; } c3 += makeRow(makeColumn(d(localize( "Holder" ) + ": " ) + v(holderDescriptions[tool.getHolderType()] + " " + hand))); if ( false && tool.clamping) { c3 += makeRow(makeColumn(d(localize( "Clamping" ) + ": " ) + v(tool.clamping))); } } } else { if (tool.holderDescription) { c3 += makeRow(makeColumn(d(localize( "Holder" ) + ": " ) + v(tool.holderDescription))); } if (tool.holderComment) { c3 += makeRow(makeColumn(d(localize( "Comment" ) + ": " ) + v(tool.holderComment))); } if (tool.holderVendor) { c3 += makeRow(makeColumn(d(localize( "Vendor" ) + ": " ) + v(tool.holderVendor))); } var holderLink = getSectionParameterForTool(tool, "operation:holder_productLink" ); if (tool.holderProductId || holderLink) { c3 += makeRow(makeColumn(d(localize( "Product" ) + ": " ) + v(autoLink(holderLink, tool.holderProductId)))); } } c3 += "<table class=" \"info\" "></table>" ; var c4 = "" ; if (getProperty( "showToolImage" )) { if (toolRenderer) { var id = useToolNumber ? tool.number : (i + 1); var path = "tool" + id + ".png" ; var width = 2.5 * 100; var height = 2.5 * 133; var mimetype = "image/png" ; if (getProperty( "embedImages" ) && (revision >= 41366)) { if (!exportedTools[id]) { if (toolRenderer.getAsBinary) { var data = toolRenderer.getAsBinary(mimetype, tool, width, height); exportedTools[id] = data; // do not export twice } } } else { try { if (!exportedTools[id]) { toolRenderer.exportAs(path, mimetype, tool, width, height); exportedTools[id] = true ; // do not export twice } } catch (e) { // ignore } } if (getProperty( "embedImages" ) && (revision >= 41366)) { src = "data:" + mimetype + ";base64," + Base64.btoa(exportedTools[id]); } else { src = encodeURIComponent(path); } c4 = "" + makeRow( "" ) + "<table class=" \"info\" " cellspacing=" \"0\" "><tbody><tr><td class=" \"image\" "><img width=" \"100px\" " src=" \"" " +=" " " \ "=" "></td></tr></tbody></table>" ; } else { if (getProperty( "embedImages" )) { c4 = getToolAsSVG(tool); } } } writeln( "" ); write( makeRow( "" + c1 + "" + "" + c2 + "" + "" + c3 + "" + "" + c4 + "" , "info" ) ); if ((i + 1) < tools.length) { write( " " ); } writeln( "" ); writeln( "" ); } } writeln( "" ); writeln( "" ); } function getCrossSections() { var CROSS_SECTIONS = [ {id: "A" , d:localize( "Type A" ), image: "" }, {id: "B" , d:localize( "Type B" ), image: "" }, {id: "C" , d:localize( "Type C" ), image: "" }, {id: "F" , d:localize( "Type F" ), image: "" }, {id: "G" , d:localize( "Type G" ), image: "" }, {id: "H" , d:localize( "Type H" ), image: "" }, {id: "J" , d:localize( "Type J" ), image: "" }, {id: "M" , d:localize( "Type M" ), image: "" }, {id: "N" , d:localize( "Type N" ), image: "" }, {id: "Q" , d:localize( "Type Q" ), image: "" }, {id: "R" , d:localize( "Type R" ), image: "" }, {id: "T" , d:localize( "Type T" ), image: "" }, {id: "U" , d:localize( "Type U" ), image: "" }, {id: "W" , d:localize( "Type W" ), image: "" } ]; return CROSS_SECTIONS; } function getTurningTolerance() { var TOLERANCES = [ {id: "A" , d:localize( "Type A" ), image: "" }, {id: "B" , d:localize( "Type B" ), image: "" }, {id: "C" , d:localize( "Type C" ), image: "" }, {id: "F" , d:localize( "Type F" ), image: "" }, {id: "G" , d:localize( "Type G" ), image: "" }, {id: "H" , d:localize( "Type H" ), image: "" }, {id: "J" , d:localize( "Type J" ), image: "" }, {id: "M" , d:localize( "Type M" ), image: "" }, {id: "N" , d:localize( "Type N" ), image: "" }, {id: "Q" , d:localize( "Type Q" ), image: "" }, {id: "R" , d:localize( "Type R" ), image: "" }, {id: "T" , d:localize( "Type T" ), image: "" }, {id: "U" , d:localize( "Type U" ), image: "" }, {id: "W" , d:localize( "Type W" ), image: "" } ]; return TOLERANCES; } function onSectionEnd() { var toolpathSVG = getToolpathAsSVG(); svg = undefined; if (isFirstSection()) { var c = "" ; if (programComment) { c += makeRow(makeColumn(d(localize( "Program Comment" ) + ": " ) + v(programComment))); } if (hasParameter( "job-description" )) { var description = getParameter( "job-description" ); if (description) { c += makeRow(makeColumn(d(localize( "Job Description" ) + ": " ) + v(description))); } } if (hasParameter( "iso9000/document-control" )) { var id = getParameter( "iso9000/document-control" ); if (id) { c += makeRow(makeColumn(d(localize( "Job ISO-9000 Control" ) + ": " ) + v(id))); } } if (getProperty( "showDocumentPath" )) { if (hasParameter( "document-path" )) { var path = getParameter( "document-path" ); if (path) { c += makeRow(makeColumn(d(localize( "Document Path" ) + ": " ) + v(pageWidthFitPath(path)))); } } if (hasParameter( "document-version" )) { var version = getParameter( "document-version" ); if (version) { c += makeRow(makeColumn(d(localize( "Document Version" ) + ": " ) + v(version))); } } } if (getProperty( "showNotes" ) && hasParameter( "job-notes" )) { var notes = getParameter( "job-notes" ); if (notes) { c += "" + d(localize( "Notes" )) + ": <pre>" + getParameter( "job-notes" ) + "</pre>" ; } } if (c) { write( "" + c + "<table class=" \"jobhead\" " align=" \"center\" "></table>" ); write( "<br>" ); writeln( "" ); writeln( "" ); } var workpiece = getWorkpiece(); var delta = Vector.diff(workpiece.upper, workpiece.lower); if (delta.isNonZero() || modelImagePath && getProperty( "showModelImage" )) { write( "" ); write(makeRow( "" )); write( "" ); var numberOfColumns = 0; { // stock - workpiece if (delta.isNonZero()) { var c = "<table class=" \"job\" " cellspacing=" \"0\" " align=" \"center\" "><tbody><tr><th colspan=" \"2\" ">" + localize( "Setup" ) + "</th></tr><tr></tr></tbody></table>" ; var workOffset = undefined; var multipleWCS = false ; var numberOfSections = getNumberOfSections(); var workOffsets = []; for ( var i = 0; i < numberOfSections; ++i) { var section = getSection(i); if (!workOffsets[section.workOffset]) { workOffsets[section.workOffset] = true ; } if (!workOffset) { workOffset = section.workOffset; } if (workOffset != section.workOffset) { multipleWCS = true ; } } var text = "" ; for ( var id in workOffsets) { text += " " + formatWCS(id); } c += makeRow(makeColumn(d(localize( "WCS" )) + ":" + text)); if (multipleWCS) { c += makeRow(makeColumn(d(localize( "Program uses multiple WCS!" )))); } c += makeRow(makeColumn( d(localize( "Stock" )) + ": <br> " + v(localize( "DX" ) + ": " + spatialFormat.format(delta.x) + getUnitSymbolAsString()) + "<br> " + v(localize( "DY" ) + ": " + spatialFormat.format(delta.y) + getUnitSymbolAsString()) + "<br> " + v(localize( "DZ" ) + ": " + spatialFormat.format(delta.z) + getUnitSymbolAsString()) )); if (hasParameter( "part-lower-x" ) && hasParameter( "part-lower-y" ) && hasParameter( "part-lower-z" ) && hasParameter( "part-upper-x" ) && hasParameter( "part-upper-y" ) && hasParameter( "part-upper-z" )) { var lower = new Vector(getParameter( "part-lower-x" ), getParameter( "part-lower-y" ), getParameter( "part-lower-z" )); var upper = new Vector(getParameter( "part-upper-x" ), getParameter( "part-upper-y" ), getParameter( "part-upper-z" )); var delta = Vector.diff(upper, lower); c += makeRow(makeColumn( d(localize( "Part" )) + ": <br> " + v(localize( "DX" ) + ": " + spatialFormat.format(delta.x) + getUnitSymbolAsString() + "<br> " + v(localize( "DY" ) + ": " + spatialFormat.format(delta.y) + getUnitSymbolAsString()) + "<br> " + v(localize( "DZ" ) + ": " + spatialFormat.format(delta.z) + getUnitSymbolAsString())) )); } c += makeRow(makeColumn( d(localize( "Stock Lower in WCS" ) + " " + formatWCS(workOffset)) + ": <br> " + v( "X: " + spatialFormat.format(workpiece.lower.x) + getUnitSymbolAsString()) + "<br> " + v( "Y: " + spatialFormat.format(workpiece.lower.y) + getUnitSymbolAsString()) + "<br> " + v( "Z: " + spatialFormat.format(workpiece.lower.z) + getUnitSymbolAsString()) )); c += makeRow(makeColumn( d(localize( "Stock Upper in WCS" ) + " " + formatWCS(workOffset)) + ": <br> " + v( "X: " + spatialFormat.format(workpiece.upper.x) + getUnitSymbolAsString()) + "<br> " + v( "Y: " + spatialFormat.format(workpiece.upper.y) + getUnitSymbolAsString()) + "<br> " + v( "Z: " + spatialFormat.format(workpiece.upper.z) + getUnitSymbolAsString()) )); c += "<table class=" \"info\" " cellspacing=" \"0\" "></table>" ; write(makeColumn(c)); ++numberOfColumns; } } if (modelImagePath && getProperty( "showModelImage" )) { var path = FileSystem.getCombinedPath(FileSystem.getFolderPath(getOutputPath()), modelImagePath); var src = "" ; if (!FileSystem.isFile(path)) { warning(subst(localize( "Model image doesn't exist '%1'." ), path)); } else { if (getProperty( "embedImages" ) && (revision >= 41366)) { // add support for image from database instead src = getImageAsImgSrc(path); FileSystem.remove(path); } else { src = encodeURIComponent(modelImagePath); } } ++numberOfColumns; var alignment = (numberOfColumns <= 1) ? "center" : "right" ; write( "<img src=" \"" " +=" " " \ "=" ">" ); } write( "" ); write( "" ); write( "<br>" ); writeln( "" ); writeln( "" ); } if (getProperty( "showTotals" )) { writeTotals(); write( "<br>" ); writeln( "" ); writeln( "" ); } if (getProperty( "showTools" )) { writeTools(); write( "<br>" ); writeln( "" ); writeln( "" ); } } if (!getProperty( "showOperations" )) { return ; // skip } if (isFirstSection()) { writeln( "" ); var colgroup = "" ; write(colgroup); write(makeRow( "" )); } var c1 = "<table class=" \"sheet\" " cellspacing=" \"0\" " align=" \"center\" "><colgroup span=" \"4\" "><col width=" \"1*\"/ "><col width=" \"1*\"/ "><col width=" \"120\"/ "></colgroup><tbody><tr><th colspan=" \"5\" ">" + localize( "Operations" ) + "</th></tr></tbody></table>" ; c1 += makeRow( makeColumn(v(localize( "Operation" ) + " " + (currentSection.getId() + 1) + "/" + getNumberOfSections())) ); if (hasParameter( "operation-comment" )) { c1 += makeRow( makeColumn(d(localize( "Description" ) + ": " ) + v(getParameter( "operation-comment" ))) ); } if (hasParameter( "operation-strategy" )) { var strategies = { "drill" : localize( "Drilling" ), "probe" : localize( "Probe" ), "face" : localize( "Facing" ), "path3d" : localize( "3D Path" ), "pocket2d" : localize( "Pocket 2D" ), "contour2d" : localize( "Contour 2D" ), "adaptive2d" : localize( "Adaptive 2D" ), "slot" : localize( "Slot" ), "circular" : localize( "Circular" ), "bore" : localize( "Bore" ), "thread" : localize( "Thread" ), "jet2d" : localize( "Profile 2D" ), "contour_new" : localize( "Contour" ), "contour" : localize( "Contour" ), "parallel_new" : localize( "Parallel" ), "parallel" : localize( "Parallel" ), "pocket_new" : localize( "Pocket" ), "pocket" : localize( "Pocket" ), "adaptive" : localize( "Adaptive" ), "horizontal_new" : localize( "Horizontal" ), "horizontal" : localize( "Horizontal" ), "blend" : localize( "Blend" ), "flow" : localize( "Flow" ), "morph" : localize( "Morph" ), "pencil_new" : localize( "Pencil" ), "pencil" : localize( "Pencil" ), "project" : localize( "Project" ), "ramp" : localize( "Ramp" ), "radial_new" : localize( "Radial" ), "radial" : localize( "Radial" ), "scallop_new" : localize( "Scallop" ), "scallop" : localize( "Scallop" ), "morphed_spiral" : localize( "Morphed Spiral" ), "spiral_new" : localize( "Spiral" ), "spiral" : localize( "Spiral" ), "swarf5d" : localize( "Multi-Axis Swarf" ), "multiAxisContour" : localize( "Multi-Axis Contour" ), "multiAxisBlend" : localize( "Multi-Axis Blend" ), "turningRoughing" : localize( "Turning Profile" ), "turningProfileGroove" : localize( "Turning Profile Groove" ), "turningPart" : localize( "Turning Part" ), "turningFace" : localize( "Turning Face" ), "turningGroove" : localize( "Turning Groove" ), "turningChamfer" : localize( "Turning Chamfer" ), "turningThread" : localize( "Turning Thread" ), "turningStockTransfer" : localize( "Turning Stock Transfer" ), "turningSecondarySpindleGrab" : localize( "Turning Spindle Grab" ), "turningSecondarySpindlePull" : localize( "Turning Spindle Pull" ), "turningSecondarySpindleReturn" : localize( "Turning Spindle Return" ) }; if (strategies[getParameter( "operation-strategy" )]) { var description = strategies[getParameter( "operation-strategy" )]; c1 += makeRow( makeColumn(d(localize( "Strategy" ) + ": " ) + v(description)) ); } } var newWCS = !isFirstSection() && (currentSection.workOffset != getPreviousSection().workOffset); c1 += makeRow( makeColumn(d(localize( "WCS" ) + ": " ) + v(formatWCS(currentSection.workOffset) + (newWCS ? ( " " + bold(localize( "NEW!" ))) : "" ))) ); if (currentSection.isPatterned()) { var id = patternIds[currentSection.getPatternId()]; c1 += makeRow( makeColumn(d(localize( "Pattern Group" ) + ": " ) + v(id)) ); } var tolerance = cachedParameters[ "operation:tolerance" ]; var stockToLeave = cachedParameters[ "operation:stockToLeave" ]; var axialStockToLeave = cachedParameters[ "operation:verticalStockToLeave" ]; var maximumStepdown = cachedParameters[ "operation:maximumStepdown" ]; var maximumStepover = cachedParameters[ "operation:maximumStepover" ] ? cachedParameters[ "operation:maximumStepover" ] : cachedParameters[ "operation:stepover" ]; var optimalLoad = cachedParameters[ "operation:optimalLoad" ]; var loadDeviation = cachedParameters[ "operation:loadDeviation" ]; if (tolerance != undefined) { c1 += makeRow(makeColumn(d(localize( "Tolerance" ) + ": " ) + v(spatialFormat.format(tolerance) + getUnitSymbolAsString()))); } if (stockToLeave != undefined) { if ((axialStockToLeave != undefined) && (stockToLeave != axialStockToLeave)) { c1 += makeRow( makeColumn( d(localize( "Stock to Leave" ) + ": " ) + v(spatialFormat.format(stockToLeave) + getUnitSymbolAsString()) + "/" + v(spatialFormat.format(axialStockToLeave) + getUnitSymbolAsString()) ) ); } else { c1 += makeRow(makeColumn(d(localize( "Stock to Leave" ) + ": " ) + v(spatialFormat.format(stockToLeave) + getUnitSymbolAsString()))); } } if ((maximumStepdown != undefined) && (maximumStepdown > 0)) { c1 += makeRow(makeColumn(d(localize( "Maximum stepdown" ) + ": " ) + v(spatialFormat.format(maximumStepdown) + getUnitSymbolAsString()))); } if ((optimalLoad != undefined) && (optimalLoad > 0)) { c1 += makeRow(makeColumn(d(localize( "Optimal load" ) + ": " ) + v(spatialFormat.format(optimalLoad) + getUnitSymbolAsString()))); if ((loadDeviation != undefined) && (loadDeviation > 0)) { c1 += makeRow(makeColumn(d(localize( "Load deviation" ) + ": " ) + v(spatialFormat.format(loadDeviation) + getUnitSymbolAsString()))); } } else if ((maximumStepover != undefined) && (maximumStepover > 0)) { c1 += makeRow(makeColumn(d(localize( "Maximum stepover" ) + ": " ) + v(spatialFormat.format(maximumStepover) + getUnitSymbolAsString()))); } var compensationType = hasParameter( "operation:compensationType" ) ? getParameter( "operation:compensationType" ) : "computer" ; if (compensationType != "computer" ) { var compensationDeltaRadius = hasParameter( "operation:compensationDeltaRadius" ) ? getParameter( "operation:compensationDeltaRadius" ) : 0; var compensation = hasParameter( "operation:compensation" ) ? getParameter( "operation:compensation" ) : "center" ; var COMPENSATIONS = {left:localize( "left" ), right:localize( "right" ), center:localize( "center" )}; var compensationText = localize( "unspecified" ); if (COMPENSATIONS[compensation]) { compensationText = COMPENSATIONS[compensation]; } var DESCRIPTIONS = {computer:localize( "computer" ), control:localize( "control" ), wear:localize( "wear" ), inverseWear:localize( "inverse wear" )}; var description = localize( "unspecified" ); if (DESCRIPTIONS[compensationType]) { description = DESCRIPTIONS[compensationType]; } c1 += makeRow(makeColumn(d(localize( "Compensation" ) + ": " ) + v(description + " (" + compensationText + ")" ))); c1 += makeRow(makeColumn(d(localize( "Safe Tool Diameter" ) + ": " ) + v( "< " + spatialFormat.format(tool.diameter + 2 * compensationDeltaRadius) + getUnitSymbolAsString()))); } c1 += "<table class=" \"info\" " cellspacing=" \"0\" "></table>" ; var c2 = "" ; c2 += makeRow(makeColumn(v( " " ))); // move 1 row down if (is3D()) { var zRange = currentSection.getGlobalZRange(); c2 += makeRow(makeColumn(d(localize( "Maximum Z" ) + ": " ) + v(spatialFormat.format(zRange.getMaximum()) + getUnitSymbolAsString()))); c2 += makeRow(makeColumn(d(localize( "Minimum Z" ) + ": " ) + v(spatialFormat.format(zRange.getMinimum()) + getUnitSymbolAsString()))); } if (!isProbeOperation(currentSection)) { var maximumFeed = currentSection.getMaximumFeedrate(); var maximumSpindleSpeed = currentSection.getMaximumSpindleSpeed(); var cuttingDistance = currentSection.getCuttingDistance(); var rapidDistance = currentSection.getRapidDistance(); var cycleTime = currentSection.getCycleTime(); if (currentSection.getType() == TYPE_TURNING) { if (currentSection.getTool().getSpindleMode() == SPINDLE_CONSTANT_SURFACE_SPEED) { c2 += makeRow(makeColumn(d(localize( "Surface Speed" ) + ": " ) + v(rpmFormat.format(currentSection.getTool().surfaceSpeed * ((unit == MM) ? 1 / 1000.0 : 1 / 12.0)) + ((unit == MM) ? localize( "m/min" ) : localize( "ft/min" ))))); } else { c2 += makeRow(makeColumn(d(localize( "Maximum Spindle Speed" ) + ": " ) + v(rpmFormat.format(maximumSpindleSpeed) + localize( "rpm" )))); } if (currentSection.feedMode == FEED_PER_REVOLUTION) { if (hasParameter( "operation:tool_feedCuttingRel" )) { var feed = getParameter( "operation:tool_feedCuttingRel" ); c2 += makeRow(makeColumn(d(localize( "Feedrate per Rev" ) + ": " ) + v(feedFormat.format(feed) + getFPRSymbolAsString()))); } } else { c2 += makeRow(makeColumn(d(localize( "Maximum Feedrate" ) + ": " ) + v(feedFormat.format(maximumFeed) + getFeedSymbolAsString()))); } } else if (currentSection.getType() == TYPE_MILLING) { c2 += makeRow(makeColumn(d(localize( "Maximum Spindle Speed" ) + ": " ) + v(rpmFormat.format(maximumSpindleSpeed) + localize( "rpm" )))); c2 += makeRow(makeColumn(d(localize( "Maximum Feedrate" ) + ": " ) + v(feedFormat.format(maximumFeed) + getFeedSymbolAsString()))); } else if (currentSection.getType() == TYPE_JET) { c2 += makeRow(makeColumn(d(localize( "Maximum Feedrate" ) + ": " ) + v(feedFormat.format(maximumFeed) + getFeedSymbolAsString()))); } c2 += makeRow(makeColumn(d(localize( "Cutting Distance" ) + ": " ) + v(spatialFormat.format(cuttingDistance) + getUnitSymbolAsString()))); if (getProperty( "showRapidDistance" )) { c2 += makeRow(makeColumn(d(localize( "Rapid Distance" ) + ": " ) + v(spatialFormat.format(rapidDistance) + getUnitSymbolAsString()))); } if (getProperty( "rapidFeed" ) > 0) { cycleTime += rapidDistance / getProperty( "rapidFeed" ) * 60; } var additional = "" ; if ((getNumberOfSections() > 1) && getProperty( "showPercentages" )) { if (totalCycleTime > 0) { additional = "<div class=" \"percentage\" ">(" + percentageFormat.format(cycleTime / totalCycleTime) + "%)</div>" ; } } c2 += makeRow(makeColumn(d(localize( "Estimated Cycle Time" ) + ": " ) + v(formatCycleTime(cycleTime) + " " + additional))); if ((currentSection.getType() != TYPE_JET) || (tool.coolant != COOLANT_OFF)) { c2 += makeRow(makeColumn(d(localize( "Coolant" ) + ": " ) + v(getCoolantDescription(tool.coolant)))); } } c2 += "<table class=" \"info\" " cellspacing=" \"0\" "></table>" ; var c3 = presentTool(currentSection.getTool()); if (currentSection.getType() == TYPE_JET) { switch (currentSection.jetMode) { case JET_MODE_THROUGH: c3 += makeRow(makeColumn(d(localize( "Cutting Type" ) + ": " ) + v(localize( "Through cutting" )))); break ; case JET_MODE_ETCHING: c3 += makeRow(makeColumn(d(localize( "Cutting Type" ) + ": " ) + v(localize( "Etching" )))); break ; case JET_MODE_VAPORIZE: c3 += makeRow(makeColumn(d(localize( "Cutting Type" ) + ": " ) + v(localize( "Vaporize" )))); break ; } c3 += makeRow(makeColumn(d(localize( "Quality" ) + ": " ) + v(currentSection.quality))); } c3 += "" ; var c4 = "" ; if (getProperty( "showToolImage" )) { if (toolRenderer) { var id = useToolNumber ? tool.number : (currentSection.getId() + 1); var path = "tool" + id + ".png" ; var width = 2.5 * 100; var height = 2.5 * 133; var mimetype = "image/png" ; if (getProperty( "embedImages" ) && (revision >= 41366)) { if (!exportedTools[id]) { if (toolRenderer.getAsBinary) { var data = toolRenderer.getAsBinary(mimetype, tool, width, height); exportedTools[id] = data; // do not export twice } } } else { try { if (!exportedTools[id]) { toolRenderer.exportAs(path, mimetype, tool, width, height); exportedTools[id] = true ; // do not export twice } } catch (e) { // ignore } } if (getProperty( "embedImages" ) && (revision >= 41366)) { src = "data:" + mimetype + ";base64," + Base64.btoa(exportedTools[id]); } else { src = encodeURIComponent(path); } c4 = "" + makeRow( "" ) + "<table class=" \"info\" " cellspacing=" \"0\" "><tbody><tr><td class=" \"image\" "><img width=" \"100px\" " src=" \"" " +=" " " \ "=" "></td></tr></tbody></table>" ; } else { if (getProperty( "embedImages" )) { c4 = getToolAsSVG(tool); } } } var c5 = "" ; if (cachedParameters[ "operation:associatedView" ] != undefined) { path = FileSystem.getCombinedPath(FileSystem.getFolderPath(getOutputPath()), cachedParameters[ "operation:associatedView" ]); src = getImageAsImgSrc(path); c5 = "<img src=" \"" " +=" " " \ "=" ">" ; } write( "" + "" + c1 + "" + "" + c2 + "" + "" + c3 + "" + (c4 ? "" + c4 + "" : "" ) + (c5 ? "" + c5 + "" : "" ) + "" ); if (toolpathSVG) { write( "" + "" + toolpathSVG + "" + "" ); } if (getProperty( "showPreviewImage" )) { var patternId = currentSection.getPatternId(); var show = false ; if (getProperty( "forcePreview" ) || !seenPatternIds[patternId]) { show = true ; seenPatternIds[patternId] = true ; } if (show && currentSection.hasParameter( "autodeskcam:preview-name" )) { var path = currentSection.getParameter( "autodeskcam:preview-name" ); var absPath = FileSystem.getCombinedPath(FileSystem.getFolderPath(getOutputPath()), path); if (FileSystem.isFile(absPath)) { if (getProperty( "embedImages" ) && (revision >= 41366)) { src = getImageAsImgSrc(absPath); FileSystem.remove(absPath); } else { src = encodeURIComponent(path); } var r2 = "" + makeRow( "" ) + "<table class=" \"info\" " cellspacing=" \"0\" "><tbody><tr><td class=" \"preview\" "><img src=" \"" " +=" " " \ "=" "></td></tr></tbody></table>" ; write( "" + "" + r2 + "" + "" ); } } } if (getProperty( "showNotes" ) && hasParameter( "notes" )) { var notes = getParameter( "notes" ); if (notes) { write( "" + d(localize( "Notes" )) + ": <pre>" + getParameter( "notes" ) + "</pre>" ); } } if (!isLastSection()) { write( " " ); } writeln( "" ); writeln( "" ); cachedParameters = {}; } function formatCycleTime(cycleTime) { cycleTime += 0.5; // round up var seconds = cycleTime % 60 | 0; var minutes = ((cycleTime - seconds) / 60 | 0) % 60; var hours = (cycleTime - minutes * 60 - seconds) / (60 * 60) | 0; if (hours > 0) { return subst(localize( "%1h:%2m:%3s" ), hours, minutes, seconds); } else if (minutes > 0) { return subst(localize( "%1m:%2s" ), minutes, seconds); } else { return subst(localize( "%1s" ), seconds); } } function writeTotals() { var zRange; var maximumFeed = 0; var maximumSpindleSpeed; var cuttingDistance = 0; var rapidDistance = 0; var cycleTime = 0; var numberOfSections = getNumberOfSections(); var currentTool; for ( var i = 0; i < numberOfSections; ++i) { var section = getSection(i); if (is3D()) { var _zRange = section.getGlobalZRange(); if (zRange) { zRange.expandToRange(_zRange); } else { zRange = _zRange; } } if (!isProbeOperation(section)) { maximumFeed = Math.max(maximumFeed, section.getMaximumFeedrate()); if ((section.type == TYPE_MILLING) || (section.type == TYPE_TURNING)) { if (maximumSpindleSpeed !== undefined) { maximumSpindleSpeed = (section.type == TYPE_MILLING) ? Math.max(maximumSpindleSpeed, section.getMaximumSpindleSpeed()) : Math.max(maximumSpindleSpeed, section.getTool().getMaximumSpindleSpeed()); } else { maximumSpindleSpeed = (section.type == TYPE_MILLING) ? section.getMaximumSpindleSpeed() : section.getTool().getMaximumSpindleSpeed(); } } cuttingDistance += section.getCuttingDistance(); rapidDistance += section.getRapidDistance(); cycleTime += section.getCycleTime(); if (getProperty( "toolChangeTime" ) > 0) { var tool = section.getTool(); if (currentTool != tool.number) { currentTool = tool.number; cycleTime += getProperty( "toolChangeTime" ); } } } } if (getProperty( "rapidFeed" ) > 0) { cycleTime += rapidDistance / getProperty( "rapidFeed" ) * 60; } totalCycleTime = cycleTime; writeln( "" ); write(makeRow( "" )); var c1 = "<table class=" \"sheet\" " cellspacing=" \"0\" " align=" \"center\" "><tbody><tr><th>" + localize( "Total" ) + "</th></tr></tbody></table>" ; var tools = getToolList( "number" , "lengthOffset" ); c1 += makeRow(makeColumn(d(localize( "Number Of Operations" ) + ": " ) + v(getNumberOfSections()))); var text = "" ; var gotTool = false ; var toolList = []; for ( var i = 0; i < tools.length; ++i) { var tool = tools[i].tool; if (i > 0) { text += " " ; } gotTool |= tool.number != 0; if (toolList.indexOf(tool.number) == -1) { toolList.push(tool.number); text += bold(localize( "T" ) + toolFormat.format(tool.number)); } else { text += bold(localize( "T" ) + toolFormat.format(tool.number)) + "(" + localize( "D" ) + toolFormat.format(!tool.isTurningTool() ? tool.diameterOffset : tool.compensationOffset) + conditional(!tool.isTurningTool(), localize( " L" ) + toolFormat.format(tool.lengthOffset)) + ")" ; } } if ((section.type == TYPE_MILLING) || (section.type == TYPE_TURNING) || gotTool) { c1 += makeRow(makeColumn(d(localize( "Number Of Tools" ) + ": " ) + v(tools.length))); c1 += makeRow(makeColumn(d(localize( "Tools" ) + ": " ) + vWrap(text))); } if (zRange) { c1 += makeRow(makeColumn(d(localize( "Maximum Z" ) + ": " ) + v(spatialFormat.format(zRange.getMaximum()) + getUnitSymbolAsString()))); c1 += makeRow(makeColumn(d(localize( "Minimum Z" ) + ": " ) + v(spatialFormat.format(zRange.getMinimum()) + getUnitSymbolAsString()))); } c1 += makeRow(makeColumn(d(localize( "Maximum Feedrate" ) + ": " ) + v(feedFormat.format(maximumFeed) + getFeedSymbolAsString()))); if (maximumSpindleSpeed !== undefined) { c1 += makeRow(makeColumn(d(localize( "Maximum Spindle Speed" ) + ": " ) + v(rpmFormat.format(maximumSpindleSpeed) + localize( "rpm" )))); } c1 += makeRow(makeColumn(d(localize( "Cutting Distance" ) + ": " ) + v(spatialFormat.format(cuttingDistance) + getUnitSymbolAsString()))); if (getProperty( "showRapidDistance" )) { c1 += makeRow(makeColumn(d(localize( "Rapid Distance" ) + ": " ) + v(spatialFormat.format(rapidDistance) + getUnitSymbolAsString()))); } c1 += makeRow(makeColumn(d(localize( "Estimated Cycle Time" ) + ": " ) + v(formatCycleTime(cycleTime)))); c1 += "<table class=" \"info\" " cellspacing=" \"0\" "></table>" ; write( "" + "" + c1 + "" + "" ); write( "" ); writeln( "" ); writeln( "" ); } function onClose() { if (getProperty( "showOperations" )) { writeln( "" ); } // footer if (getProperty( "showFooter" )) { write( "<br>" ); write( "<div class=" \"footer\" ">" ); var src = findFile( "../graphics/logo.png" ); if (getProperty( "embedImages" ) && (revision >= 41366)) { var data = getImageAsImgSrc(src); if (data) { write( "<img class=" \"logo\" " src=" \"" " +=" " data=" " " \ "=" ">" ); } } else { var dest = "logo.png" ; if (FileSystem.isFile(src)) { FileSystem.copyFile(src, FileSystem.getCombinedPath(FileSystem.getFolderPath(getOutputPath()), dest)); write( "<img class=" \"logo\" " src=" \"" " +=" " dest=" " " \ "=" ">" ); } } var now = new Date(); var product = "Autodesk CAM" ; if (hasGlobalParameter( "generated-by" )) { product = getGlobalParameter( "generated-by" ); } if (product) { if ((product.indexOf( "HSMWorks" ) == 0) || (product.indexOf( "HSMXpress" ) == 0)) { } } write(localize( "Generated by" ) + " <a href=" \"" " +=" " producturl=" " " \ "=" ">" + product + "</a>" + " " + now.toLocaleDateString() + " " + now.toLocaleTimeString()); write( "" ); write( "" ); } function quote(text) { var result = "" ; for ( var i = 0; i < text.length; ++i) { var ch = text.charAt(i); switch (ch) { case "\\" : case "\"" : result += "\\" ; } result += ch; } return "\"" + result + "\"" ; } function onTerminate() { // add this to print automatically - you could print to XPS and PDF writer /* var device = "Microsoft XPS Document Writer"; if (device) { executeNoWait("rundll32.exe", "mshtml.dll,PrintHTML " + quote(getOutputPath()) + quote(device), false, ""); } else { executeNoWait("rundll32.exe", "mshtml.dll,PrintHTML " + quote(getOutputPath()), false, ""); } */ } </div></circle></path></line></circle> |