Skip to content

Commit

Permalink
Added WCS Mapping, Version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
will1742 committed Oct 25, 2021
1 parent dc050ba commit b30bdb0
Showing 1 changed file with 40 additions and 27 deletions.
67 changes: 40 additions & 27 deletions Autodesk_Setup_BIDC/setup-sheet.cps
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ properties = {
}
};

var staticProperties = {
postVersion: "BIDC-NGC.G10.K21"
}

var showToolpath = false;
var useToolNumber = true;

Expand Down Expand Up @@ -405,7 +409,7 @@ function onOpen() {
c += "<style type=\"text/css\">" + ".preview img {width: " + getProperty("previewWidth") + ";}" + "</style>";
c += script;
if (programName) {
c += "<title>" + localize("Setup Sheet for Program") + " " + programName + "</title>";
c += "<title>" + getGlobalParameter("document-path") + "</title>";
} else {
c += "<title>" + localize("Setup Sheet") + "</title>";
}
Expand All @@ -414,7 +418,7 @@ function onOpen() {

write("<body onload=\"onLoad()\">");
if (programName) {
write("<h1>" + localize("Setup Sheet for Program") + " " + programName + "</h1>");
write("<h1>" + getGlobalParameter("document-path") + ": " + programName + "</h1>");
} else {
write("<h1>" + localize("Setup Sheet") + "</h1>");
}
Expand Down Expand Up @@ -490,6 +494,13 @@ function getCoolantDescription(coolant) {
}
}

var offsetMapping = {
0: "G54",
1: "G54",
2: "G55",
3: "G56",
}

/** Formats WCS to text. */
function formatWCS(id) {
/*
Expand All @@ -501,7 +512,7 @@ function formatWCS(id) {
}
return "G" + (getAsInt(id) + 53);
*/
return "#" + id;
return "#" + id + " (" + offsetMapping[id] + ")";;
}

function isProbeOperation(section) {
Expand Down Expand Up @@ -1264,19 +1275,21 @@ function onSectionEnd() {
if (isFirstSection()) {
var c = "";
c += makeRow(makeColumn(d(localize("User") + ": ") + v(getGlobalParameter("username"))));
c += makeRow(makeColumn(d(localize("Date") + ": ") + v(getGlobalParameter("generated-at"))));
c += makeRow(makeColumn(d(localize("User Name: ")) + v(getGlobalParameter("username"))));
c += makeRow(makeColumn(d(localize("Date: ")) + v(getGlobalParameter("generated-at"))));
c += makeRow(makeColumn(d(localize("Post Version: ")) + v(staticProperties.postVersion)));
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("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");
Expand All @@ -1285,21 +1298,21 @@ function onSectionEnd() {
}
}

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("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");
Expand Down Expand Up @@ -1358,7 +1371,7 @@ function onSectionEnd() {
}

c += makeRow(makeColumn(
d(localize("Stock")) + ": <br>&nbsp;&nbsp;" + v(localize("DX") + ": " + spatialFormat.format(delta.x) + getUnitSymbolAsString()) + "<br>&nbsp;&nbsp;" + v(localize("DY") + ": " + spatialFormat.format(delta.y) + getUnitSymbolAsString()) + "<br>&nbsp;&nbsp;" + v(localize("DZ") + ": " + spatialFormat.format(delta.z) + getUnitSymbolAsString())
d(localize("Stock")) + ": <br>&nbsp;&nbsp;" + v(localize("X Size") + ": " + spatialFormat.format(delta.x) + getUnitSymbolAsString()) + "<br>&nbsp;&nbsp;" + v(localize("Y Size") + ": " + spatialFormat.format(delta.y) + getUnitSymbolAsString()) + "<br>&nbsp;&nbsp;" + v(localize("Z Size") + ": " + spatialFormat.format(delta.z) + getUnitSymbolAsString())
));

// if (hasParameter("part-lower-x") && hasParameter("part-lower-y") && hasParameter("part-lower-z") &&
Expand Down

0 comments on commit b30bdb0

Please sign in to comment.