Skip to content

Commit 1712ab5

Browse files
committed
fix lint issues
1 parent 62e2587 commit 1712ab5

15 files changed

Lines changed: 2673 additions & 884 deletions

bin/STEPtoBREP.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1+
const occ = require("../lib/occ");
12

2-
var occ = require('../lib/occ');
3+
const pace = require("pace")(1000);
34

4-
var pace = require("pace")(1000);
5+
const filename = process.argv[2];
6+
let message;
57

6-
filename = process.argv[2];
8+
occ.readSTEP(filename, function (err, solids) {
9+
pace.op(100000);
10+
if (!err) {
11+
console.log(" \n\ndone y----> ", solids.length, " solids read");
712

8-
occ.readSTEP(filename,function (err,solids) {
9-
pace.op(100000);
10-
if (!err) {
11-
console.log( " \n\ndone y----> ", solids.length , " solids read");
13+
// write to BREP
14+
occ.writeBREP(filename + ".brep", solids, function done() {
15+
});
16+
} else {
17+
message = solids
18+
console.log("\n\n ERROR =", message);
19+
}
1220

13-
// write to BREP
14-
occ.writeBREP(filename+".brep",solids,function done() { });
15-
} else {
16-
message = solids
17-
console.log("\n\n ERROR =" , message);
18-
}
19-
20-
}, function progress(percent,incr) {
21-
pace.op(percent*100*10)
22-
// console.log("tick ", incr,bar1.step)
23-
// bar1.tick(incr);
21+
}, function progress(percent, incr) {
22+
pace.op(percent * 100 * 10)
23+
// console.log("tick ", incr,bar1.step)
24+
// bar1.tick(incr);
2425
});
2526

2627
console.log(process.argv[0]);

lib/fastbuilder.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ const occ = require("./occ");
44
const shapeFactory = require("../lib/shapeFactory");
55
const assert = require("assert");
66

7-
const verboseOutput = false;
87
function debugLog() {
9-
arguments;
108
/* implement me*/
119
}
1210

@@ -41,7 +39,7 @@ class Cache {
4139

4240
}
4341

44-
Object.defineProperty(obj, methodName, { value: performOperation, enumerable: false });
42+
Object.defineProperty(obj, methodName, {value: performOperation, enumerable: false});
4543

4644
// xx obj[methodName] = performOperation;=
4745

@@ -106,11 +104,7 @@ class Cache {
106104

107105
}
108106

109-
__performedCachedOperation(originalObject,
110-
originalMethod,
111-
methodName,
112-
theArguments,
113-
callAsConstructor) {
107+
__performedCachedOperation(originalObject, originalMethod, methodName, theArguments, callAsConstructor) {
114108

115109
assert(theArguments.hasOwnProperty("length"));
116110

@@ -232,9 +226,7 @@ function replaceObjectsByGUUID(arg) {
232226
}
233227
}
234228

235-
function calculateOperationHash(methodName, theArguments, callAsConstructor) {
236-
237-
callAsConstructor;
229+
function calculateOperationHash(methodName, theArguments) {
238230

239231

240232
// build the signature of the function + arguments
@@ -274,7 +266,7 @@ function replaceFunc(proxyObj, Obj, methodName) {
274266
if (isFunction(Obj[methodName])) {
275267

276268
assert(isFunction(Obj[methodName]), `methodName = ${methodName} ${typeof Obj[methodName]}`);
277-
const fn = function() {
269+
const fn = function () {
278270

279271
// http://stackoverflow.com/questions/367768/how-to-detect-if-a-function-is-called-as-constructor
280272
// Xx console.log(this.constructor.name == methodName, (this.constructor === fn), this.constructor.name);

lib/occ.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ exports.demo = function () {
3030
function f(a, w, p) {
3131
return (" " + (a + 0).toFixed(p)).substr(-w);
3232
}
33+
3334
occ.Point3D.prototype.toString = function () {
3435

3536
return "{" +
@@ -49,9 +50,9 @@ occ.Edge.prototype.toString = function () {
4950

5051
return "Edge => { \n" +
5152
" numVertices: " + this.numVertices + "\n" +
52-
" vertices: " + this.getVertices().map(function (f) {
53+
" vertices: " +
54+
this.getVertices().map(function (f) {
5355
return f.toString();
54-
}).join(" ") +
55-
"}";
56+
}).join(" ") + "}";
5657
};
5758

lib/shapeFactory.js

Lines changed: 41 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,9 @@ exports.makePan = function (csg, _height, _radius) {
109109
const s4 = csg.fuse(s1, s2);
110110
const s5 = csg.common(s4, s3);
111111

112-
const handle = csg.makeCylinder(
113-
[radius - 2 * thickness, 0, height - handleRadius * 1.1],
114-
[handleLength + radius - 2 * thickness, 0, height - handleRadius * 1.1],
115-
handleRadius);
112+
const pt1 = [radius - 2 * thickness, 0, height - handleRadius * 1.1];
113+
const pt2 = [handleLength + radius - 2 * thickness, 0, height - handleRadius * 1.1];
114+
const handle = csg.makeCylinder(pt1, pt2, handleRadius);
116115

117116
const s6 = csg.fuse(s5, handle);
118117

@@ -195,7 +194,7 @@ exports.makeRoundedPlate = function (csg, R1, R2, L, thickness) {
195194
v = csg.cut(v, csg.makeBox(q0, p1).rotate(p2, [0, 0, 1], -angle));
196195
v = csg.cut(v, csg.makeBox(q3, p3).rotate(p2, [0, 0, 1], angle));
197196

198-
// return v;
197+
// return v;
199198
const c1 = csg.makeCylinder([0, 0, 0], [0, 0, thickness], R1);
200199
v = csg.fuse(v, c1);
201200
const c2 = csg.makeCylinder([0, L, 0], [0, L, thickness], R2);
@@ -430,15 +429,14 @@ exports.makeLegoBrickSlow = function (csg, nX, nY, h) {
430429
let innerBlock = csg.makeBox([0, 0, 0], [innerWidth, innerLength, innerHeight]);
431430
innerBlock = innerBlock.translate([u, u, 0]);
432431
let hollowBlock = csg.cut(outerBlock, innerBlock);
433-
let h1 = csg.makeCylinder(
434-
[2.5 * u, 2.5 * u, outerHeight - 3 * u],
435-
[2.5 * u, 2.5 * u, outerHeight + 3 * u],
436-
0.75 * u);
437432

438-
let h2 = csg.makeCylinder(
439-
[2.5 * u, 2.5 * u, outerHeight],
440-
[2.5 * u, 2.5 * u, outerHeight + u],
441-
1.5 * u);
433+
const pt1 = [2.5 * u, 2.5 * u, outerHeight - 3 * u];
434+
const pt2 = [2.5 * u, 2.5 * u, outerHeight + 3 * u];
435+
let h1 = csg.makeCylinder(pt1, pt2, 0.75 * u);
436+
437+
const pt3 = [2.5 * u, 2.5 * u, outerHeight];
438+
const pt4 = [2.5 * u, 2.5 * u, outerHeight + u];
439+
let h2 = csg.makeCylinder(pt3, pt4, 1.5 * u);
442440

443441
// installer la grille
444442
for (let y = 0; y < nY; y++) {
@@ -455,16 +453,14 @@ exports.makeLegoBrickSlow = function (csg, nX, nY, h) {
455453
h2 = h2.translate([0, 5 * u, 0]);
456454
}
457455

458-
let pinOuter = csg.makeCylinder(
459-
[2.5 * u, 2.5 * u, 0],
460-
[2.5 * u, 2.5 * u, outerHeight - u],
461-
u
462-
);
463-
let pinInner = csg.makeCylinder(
464-
[2.5 * u, 2.5 * u, 0],
465-
[2.5 * u, 2.5 * u, outerHeight - u],
466-
0.5 * u
467-
);
456+
const pt5 = [2.5 * u, 2.5 * u, 0];
457+
const pt6 = [2.5 * u, 2.5 * u, outerHeight - u];
458+
let pinOuter = csg.makeCylinder(pt5, pt6, u);
459+
460+
const pt7 = [2.5 * u, 2.5 * u, 0];
461+
const pt8 = [2.5 * u, 2.5 * u, outerHeight - u];
462+
let pinInner = csg.makeCylinder(pt7, pt8, 0.5 * u);
463+
468464
let p = csg.cut(pinOuter, pinInner);
469465
let pp;
470466
if (nY == 1) {
@@ -484,16 +480,14 @@ exports.makeLegoBrickSlow = function (csg, nX, nY, h) {
484480
}
485481
if (nX > 1 && nY > 1) {
486482

487-
pinOuter = csg.makeCylinder(
488-
[5 * u, 5 * u, 0],
489-
[5 * u, 5 * u, outerHeight - u],
490-
4.07 / 2.0 * u
491-
);
492-
pinInner = csg.makeCylinder(
493-
[5 * u, 5 * u, 0],
494-
[5 * u, 5 * u, outerHeight - u],
495-
1.5 * u
496-
);
483+
const pt9 = [5 * u, 5 * u, 0];
484+
const pt10 = [5 * u, 5 * u, outerHeight - u];
485+
pinOuter = csg.makeCylinder(pt9, pt10, 4.07 / 2.0 * u);
486+
487+
const pt11 = [5 * u, 5 * u, 0];
488+
const pt12 = [5 * u, 5 * u, outerHeight - u];
489+
pinInner = csg.makeCylinder(pt11, pt12, 1.5 * u);
490+
497491
let pin = csg.cut(pinOuter, pinInner);
498492

499493
for (let x = 0; x < nX - 1; x++) {
@@ -546,34 +540,29 @@ exports.makeLegoBrick = function (csg, nX, nY, h) {
546540
let brick = csg.makeBox([0, 0, 0], [outerWidth, outerLength, outerHeight]);
547541
brick = csg.makeThickSolid(brick, brick.faces.bottom, -u);
548542

549-
const h2 = csg.makeCylinder(
550-
[2.5 * u, 2.5 * u, outerHeight],
551-
[2.5 * u, 2.5 * u, outerHeight + u],
552-
1.5 * u);
543+
const pt1 = [2.5 * u, 2.5 * u, outerHeight];
544+
const pt2 = [2.5 * u, 2.5 * u, outerHeight + u];
545+
const h2 = csg.makeCylinder(pt1, pt2, 1.5 * u);
553546

554547
let tetons = makeRepetition(csg, h2, 5 * u, nX, 5 * u, nY);
555548
brick = csg.fuse(brick, tetons);
556549

557-
const h1 = csg.makeCylinder(
558-
[2.5 * u, 2.5 * u, outerHeight - 3 * u],
559-
[2.5 * u, 2.5 * u, outerHeight + 0.75],
560-
0.74 * u);
550+
const pt3 = [2.5 * u, 2.5 * u, outerHeight - 3 * u];
551+
const pt4 = [2.5 * u, 2.5 * u, outerHeight + 0.75];
552+
const h1 = csg.makeCylinder(pt3, pt4, 0.74 * u);
561553
tetons = makeRepetition(csg, h1, 5 * u, nX, 5 * u, nY);
562554
brick = csg.cut(brick, tetons);
563555

564556
//xx console.log(Object.keys(brick.faces));//.bottom);
565557

566558
// small pins
567-
let pinOuter = csg.makeCylinder(
568-
[2.5 * u, 2.5 * u, 0],
569-
[2.5 * u, 2.5 * u, outerHeight - u],
570-
u
571-
);
572-
let pinInner = csg.makeCylinder(
573-
[2.5 * u, 2.5 * u, 0],
574-
[2.5 * u, 2.5 * u, outerHeight - u],
575-
0.5 * u
576-
);
559+
const pt5 = [2.5 * u, 2.5 * u, 0];
560+
const pt6 = [2.5 * u, 2.5 * u, outerHeight - u];
561+
let pinOuter = csg.makeCylinder(pt5, pt6, u);
562+
563+
const pt7 = [2.5 * u, 2.5 * u, 0];
564+
const pt8 = [2.5 * u, 2.5 * u, outerHeight - u];
565+
let pinInner = csg.makeCylinder(pt7, pt8, 0.5 * u);
577566

578567
let pin = csg.cut(pinOuter, pinInner);
579568

@@ -748,8 +737,7 @@ exports.makeTutorialPart = function (occ) {
748737
const lastVertex = edge.lastVertex;
749738
return ( samePoint(firstVertex, p) || samePoint(lastVertex, p)) &&
750739
same(firstVertex.x, lastVertex.x, 0.01) &&
751-
same(firstVertex.y, lastVertex.y, 0.01)
752-
;
740+
same(firstVertex.y, lastVertex.y, 0.01);
753741
});
754742
return results[0];
755743
}

0 commit comments

Comments
 (0)