Skip to content

Commit

Permalink
v0.0.35
Browse files Browse the repository at this point in the history
$P_GG[29]
some bugs fixed
  • Loading branch information
staniska committed Apr 11, 2021
1 parent 1ee4d60 commit ea14625
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,8 @@
- WHILE - ENDWILE support
- FOR - ENDFOR support only for R-vars
- [A]MIRROR support
- select containing folder for program file via teletype
- select containing folder for program file via teletype

#### v0.0.35
- $P_GG[29] - only for G group 29 (DIAMOF/DIAMON/DIAM90)
- fix some bugs
40 changes: 32 additions & 8 deletions lib/interpretator.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ function parseRows(programText, programName, variables, firstCall) {
element.blank = true
}
})
if (View.sinumerikView.parseData.canvas[View.sinumerikView.parseData.canvas.length - 1].type === 'pause') {
if (View.sinumerikView.parseData.canvas.length &&
View.sinumerikView.parseData.canvas[View.sinumerikView.parseData.canvas.length - 1].type === 'pause') {
View.sinumerikView.parseData.canvas.pop()
}

Expand Down Expand Up @@ -1032,15 +1033,29 @@ function checkCondition(expression, programName) {
}
}

//Активная функция DIAMON/DIAMOF
while (expression.match(/\$P_GG\[29\]/)) {
let replacer = 1
if (View.sinumerikView.parseData.diamon) {
replacer = 2
}
if (View.sinumerikView.parseData.diam90) {
replacer = 3
}
expression = expression.replace(/\$P_GG\[29\]/, replacer);
// console.log(expression);
}


//Затычка для радиуса инструмента
while (expression.match(/\$P_TOOLR/)) {
expression = expression.replace(/\$P_TOOLR/, 0);
// console.log(expression);
}

//Затычка для длины инструмента
while (expression.match(/\$P_TOOLL/)) {
expression = expression.replace(/\$P_TOOLL/, 0);
while (expression.match(/\$P_TOOLL\[\d\]/)) {
expression = expression.replace(/\$P_TOOLL\[\d\]/, 0);
// console.log(expression);
}

Expand Down Expand Up @@ -3089,9 +3104,18 @@ export function mathParse(expression, programName) {
expression = expression.replace(/\$AA_IW\[[XYZ]\]/,`${AA_value}`);
}

//region Затычка параметров инструмента
//
//TODO Убрать эту затычку и реализовать инструменты
//Активная функция DIAMON/DIAMOF
while (expression.match(/\$P_GG\[29\]/)) {
let replacer = 1
if (View.sinumerikView.parseData.diamon) {
replacer = 2
}
if (View.sinumerikView.parseData.diam90) {
replacer = 3
}
expression = expression.replace(/\$P_GG\[29\]/, replacer);
// console.log(expression);
}

//Затычка для радиуса инструмента
while (expression.match(/\$P_TOOLR/)) {
Expand All @@ -3100,8 +3124,8 @@ export function mathParse(expression, programName) {
}

//Затычка для длины инструмента
while (expression.match(/\$P_TOOLL/)) {
expression = expression.replace(/\$P_TOOLL/, 0);
while (expression.match(/\$P_TOOLL\[\d\]/)) {
expression = expression.replace(/\$P_TOOLL\[\d\]/, 0);
// console.log(expression);
}

Expand Down
3 changes: 3 additions & 0 deletions lib/machine-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export function checkMachine() {
}

const Editor = atom.workspace.getActiveTextEditor();
if (Editor === undefined) {
return
}
var filename = Editor.getTitle().replace(/\./g,'_').toUpperCase();

if (Editor.getTitle().split('.')[1].toUpperCase().match("MPF|SPF")) {
Expand Down
11 changes: 11 additions & 0 deletions lib/single-line-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ function displayCanvasElements(ctx) {

//TODO сделать отрисовку вершины инструмента при включенном slow debug

if (!View.sinumerikView.parseData.canvas.length) {
return
}

if (View.sinumerikView.parseData.canvas[0].blank !== undefined) {
blank = []

Expand All @@ -830,6 +834,10 @@ function displayCanvasElements(ctx) {
}
}

if (!View.sinumerikView.parseData.canvas.length) {
return
}

if (View.sinumerikView.parseData.canvas[0].contour !== undefined) {
contour = []

Expand Down Expand Up @@ -961,6 +969,9 @@ function displayCanvasElements(ctx) {
}

function ctx_draw(element) {
if (element === undefined) {
return
}
if (View.sinumerikView.singleLineDebugInfoDiv.slowDebugCheck.checked || View.sinumerikView.singleLineDebugInfoDiv.pauseCheck.level == 2) {
var pause_level = 3;
if (element.type == 'msg') {
Expand Down
3 changes: 3 additions & 0 deletions lib/sinumerik-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ export default class SinumerikView {
this.machineManagerNewMachineButton.style.width = `${buttonWidth}px`;
this.machineManagerMachineSearchInput.style.width = `${editorWidth * widthFactor - Math.round((editorWidth * widthFactor)*0.7) - 5 - 2 * buttonWidth}px`;
//endregion
if (!atom.workspace.getActiveTextEditor()) {
return
}
if (atom.workspace.getActiveTextEditor().getTitle().split('.')[1].toUpperCase().match("MPF|SPF")) {
//loadMachineData();
loadDataFromComment();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sinumerik-highlight",
"main": "./lib/sinumerik",
"version": "0.0.34",
"version": "0.0.35",
"description": "Sinumerik highlight",
"keywords": [],
"activationCommands": {
Expand Down

0 comments on commit ea14625

Please sign in to comment.