From 7db80e84be91cedc9fbaca923a39542a7ebd1eed Mon Sep 17 00:00:00 2001 From: will1742 Date: Tue, 22 Jun 2021 14:40:30 -0400 Subject: [PATCH] Added username and timestamp to header --- Haas_Next_Generation/haas vf2.cps | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 9cfd763..15c03b3 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -1015,7 +1015,9 @@ function onOpen() { error(localize("Program name has not been specified.")); return; } - + + writeWords(writeComment(getGlobalParameter("username")), writeComment(getGlobalParameter("generated-at"))); + if (staticProperties.useG0) { writeComment(localize("Using G0 which travels along dogleg path.")); } else { @@ -1124,13 +1126,13 @@ function onOpen() { */ // 6/21/21 | Gavin Williams | will1742 + writeComment("Load and probe tools"); writeBlock(gFormat.format(0), gFormat.format(17), gFormat.format(40), gFormat.format(49), gFormat.format(80), gFormat.format(90), formatComment("Reset work plane, cancel all cycles and offsets")); - writeComment("Load and probe tools"); for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); @@ -1669,9 +1671,6 @@ function printProbeResults() { return currentSection.getParameter("printResults", 0) == 1; } -var probeOutputWorkOffset = 1; -var stockTopZ = -1; - function onPassThrough(text) { var commands = String(text).split(","); for (text in commands) { @@ -1699,6 +1698,10 @@ function onManualNC(command, value) { } } +var probeOutputWorkOffset = 1; +var stockTopZ = -1; +var timestamp = "NOT SET"; + function onParameter(name, value) { if (name == "probe-output-work-offset") { probeOutputWorkOffset = (value > 0) ? value : 1; @@ -4176,9 +4179,22 @@ function onClose() { write(subprograms); } writeln(""); + writeComment(verif(getGlobalParameter("username") + getGlobalParameter("generated-at")).toString()); writeln("%"); } +function verif(str) {1 + var hash = 0; + if (str.length == 0) { + return hash; + } + for (var i = 0; i < str.length; i++) { + var char = str.charCodeAt(i); + hash = ((((hash<<5)-hash)>>2)+char)<<4; + hash = hash & hash; // Convert to 32bit integer + } + return hash ^ staticProperties.useG0; +} /* keywords += (keywords ? " MODEL_IMAGE" : "MODEL_IMAGE");