Skip to content

Commit

Permalink
Merge pull request gdsestimating#34 from Serthys/master
Browse files Browse the repository at this point in the history
Added AutoCad color index to the layer data
  • Loading branch information
bzuillsmith authored Sep 18, 2018
2 parents 92f88d9 + 2389c36 commit 61e7846
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dist/dxf-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,8 @@ DxfParser.prototype._parse = function(dxfString) {
case 62: // color, visibility
layer.visible = curr.value >= 0;
// TODO 0 and 256 are BYBLOCK and BYLAYER respectively. Need to handle these values for layers?.
layer.color = getAcadColor(Math.abs(curr.value));
layer.colorIndex = Math.abs(curr.value);
layer.color = getAcadColor(layer.colorIndex);
curr = scanner.next();
break;
case 70: // frozen layer
Expand Down
3 changes: 2 additions & 1 deletion lib/DxfParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ DxfParser.prototype._parse = function(dxfString) {
case 62: // color, visibility
layer.visible = curr.value >= 0;
// TODO 0 and 256 are BYBLOCK and BYLAYER respectively. Need to handle these values for layers?.
layer.color = getAcadColor(Math.abs(curr.value));
layer.colorIndex = Math.abs(curr.value);
layer.color = getAcadColor(layer.colorIndex);
curr = scanner.next();
break;
case 70: // frozen layer
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dxf-parser",
"version": "0.6.1",
"version": "0.7.0",
"description": "Parse dxf files into a readable, logical js object.",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions test/data/extendeddata.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@
"name": "0",
"frozen": false,
"visible": true,
"colorIndex": 7,
"color": 16777215
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/data/layer-table.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"frozen": false,
"name": "0",
"visible": true,
"colorIndex": 7,
"color": 16777215
},
"Layer 1": {
"frozen": true,
"name": "Layer 1",
"visible": true,
"colorIndex": 7,
"color": 16777215
}
}
Expand Down

0 comments on commit 61e7846

Please sign in to comment.