brepjs 8.8.7 → 8.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs.cjs +15 -23
- package/dist/brepjs.js +15 -23
- package/dist/topology/surfaceFns.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -245,10 +245,11 @@ function surfaceFromGrid(heights, options = {}) {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
function buildBSplineSurface(heights, rows, cols, dx, dy, scaleZ) {
|
|
248
|
-
|
|
249
|
-
const OC = oc;
|
|
250
|
-
const pntArray = new OC.TColgp_Array2OfPnt_2(1, rows, 1, cols);
|
|
248
|
+
var _stack = [];
|
|
251
249
|
try {
|
|
250
|
+
const oc = occtBoundary.getKernel().oc;
|
|
251
|
+
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
252
|
+
const pntArray = scope.register(new oc.TColgp_Array2OfPnt_2(1, rows, 1, cols));
|
|
252
253
|
for (let r = 0; r < rows; r++) {
|
|
253
254
|
for (let c = 0; c < cols; c++) {
|
|
254
255
|
const row = heights[r];
|
|
@@ -258,33 +259,24 @@ function buildBSplineSurface(heights, rows, cols, dx, dy, scaleZ) {
|
|
|
258
259
|
pnt.delete();
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
|
-
const fitter = new
|
|
262
|
+
const fitter = scope.register(new oc.GeomAPI_PointsToBSplineSurface_2(pntArray, 3, 8, 0, 1e-3));
|
|
262
263
|
const surface = fitter.Surface();
|
|
263
|
-
const faceMaker = new
|
|
264
|
-
let result2;
|
|
264
|
+
const faceMaker = scope.register(new oc.BRepBuilderAPI_MakeFace_8(surface, 1e-6));
|
|
265
265
|
if (faceMaker.IsDone()) {
|
|
266
266
|
const shape2 = shapeTypes.castShape(faceMaker.Face());
|
|
267
267
|
if (shapeTypes.isFace(shape2)) {
|
|
268
|
-
|
|
269
|
-
} else {
|
|
270
|
-
shape2[Symbol.dispose]();
|
|
271
|
-
result2 = errors.err(
|
|
272
|
-
errors.occtError(errors.BrepErrorCode.SURFACE_FAILED, "B-spline surface did not produce a face")
|
|
273
|
-
);
|
|
268
|
+
return errors.ok(shape2);
|
|
274
269
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
errors.occtError(
|
|
278
|
-
errors.BrepErrorCode.SURFACE_FAILED,
|
|
279
|
-
"BRepBuilderAPI_MakeFace failed for B-spline surface"
|
|
280
|
-
)
|
|
281
|
-
);
|
|
270
|
+
shape2[Symbol.dispose]();
|
|
271
|
+
return errors.err(errors.occtError(errors.BrepErrorCode.SURFACE_FAILED, "B-spline surface did not produce a face"));
|
|
282
272
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
273
|
+
return errors.err(
|
|
274
|
+
errors.occtError(errors.BrepErrorCode.SURFACE_FAILED, "BRepBuilderAPI_MakeFace failed for B-spline surface")
|
|
275
|
+
);
|
|
276
|
+
} catch (_) {
|
|
277
|
+
var _error = _, _hasError = true;
|
|
286
278
|
} finally {
|
|
287
|
-
|
|
279
|
+
__callDispose(_stack, _error, _hasError);
|
|
288
280
|
}
|
|
289
281
|
}
|
|
290
282
|
function buildTriangulatedSurface(heights, rows, cols, dx, dy, scaleZ) {
|
package/dist/brepjs.js
CHANGED
|
@@ -258,10 +258,11 @@ function surfaceFromGrid(heights, options = {}) {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
function buildBSplineSurface(heights, rows, cols, dx, dy, scaleZ) {
|
|
261
|
-
|
|
262
|
-
const OC = oc;
|
|
263
|
-
const pntArray = new OC.TColgp_Array2OfPnt_2(1, rows, 1, cols);
|
|
261
|
+
var _stack = [];
|
|
264
262
|
try {
|
|
263
|
+
const oc = getKernel().oc;
|
|
264
|
+
const scope = __using(_stack, new DisposalScope());
|
|
265
|
+
const pntArray = scope.register(new oc.TColgp_Array2OfPnt_2(1, rows, 1, cols));
|
|
265
266
|
for (let r11 = 0; r11 < rows; r11++) {
|
|
266
267
|
for (let c7 = 0; c7 < cols; c7++) {
|
|
267
268
|
const row = heights[r11];
|
|
@@ -271,33 +272,24 @@ function buildBSplineSurface(heights, rows, cols, dx, dy, scaleZ) {
|
|
|
271
272
|
pnt.delete();
|
|
272
273
|
}
|
|
273
274
|
}
|
|
274
|
-
const fitter = new
|
|
275
|
+
const fitter = scope.register(new oc.GeomAPI_PointsToBSplineSurface_2(pntArray, 3, 8, 0, 1e-3));
|
|
275
276
|
const surface = fitter.Surface();
|
|
276
|
-
const faceMaker = new
|
|
277
|
-
let result;
|
|
277
|
+
const faceMaker = scope.register(new oc.BRepBuilderAPI_MakeFace_8(surface, 1e-6));
|
|
278
278
|
if (faceMaker.IsDone()) {
|
|
279
279
|
const shape2 = castShape(faceMaker.Face());
|
|
280
280
|
if (isFace(shape2)) {
|
|
281
|
-
|
|
282
|
-
} else {
|
|
283
|
-
shape2[Symbol.dispose]();
|
|
284
|
-
result = err(
|
|
285
|
-
occtError(BrepErrorCode.SURFACE_FAILED, "B-spline surface did not produce a face")
|
|
286
|
-
);
|
|
281
|
+
return ok(shape2);
|
|
287
282
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
occtError(
|
|
291
|
-
BrepErrorCode.SURFACE_FAILED,
|
|
292
|
-
"BRepBuilderAPI_MakeFace failed for B-spline surface"
|
|
293
|
-
)
|
|
294
|
-
);
|
|
283
|
+
shape2[Symbol.dispose]();
|
|
284
|
+
return err(occtError(BrepErrorCode.SURFACE_FAILED, "B-spline surface did not produce a face"));
|
|
295
285
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
286
|
+
return err(
|
|
287
|
+
occtError(BrepErrorCode.SURFACE_FAILED, "BRepBuilderAPI_MakeFace failed for B-spline surface")
|
|
288
|
+
);
|
|
289
|
+
} catch (_2) {
|
|
290
|
+
var _error = _2, _hasError = true;
|
|
299
291
|
} finally {
|
|
300
|
-
|
|
292
|
+
__callDispose(_stack, _error, _hasError);
|
|
301
293
|
}
|
|
302
294
|
}
|
|
303
295
|
function buildTriangulatedSurface(heights, rows, cols, dx, dy, scaleZ) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfaceFns.d.ts","sourceRoot":"","sources":["../../src/topology/surfaceFns.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"surfaceFns.d.ts","sourceRoot":"","sources":["../../src/topology/surfaceFns.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAIzD,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,EAC7C,OAAO,GAAE,sBAA2B,GACnC,MAAM,CAAC,QAAQ,CAAC,CAsDlB;AA0HD,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACrE,6DAA6D;IAC7D,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,WAAW,CAAC;IACxC,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAqG3B"}
|