@buerli.io/headless 0.5.0-beta.4 → 0.5.0
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/build/cjs/history.js +40 -34
- package/build/esm/history.js +40 -34
- package/build/types/history.d.ts +12 -4
- package/package.json +2 -2
package/build/cjs/history.js
CHANGED
|
@@ -40,8 +40,11 @@ const featureAPI = classcad_1.ccAPI.feature;
|
|
|
40
40
|
const sketcherAPI = classcad_1.ccAPI.sketcher;
|
|
41
41
|
const baseModelerAPI = classcad_1.ccAPI.baseModeler;
|
|
42
42
|
const assemblyBuilderAPI = classcad_1.ccAPI.assemblyBuilder;
|
|
43
|
+
const drawing2DAPI = classcad_1.ccAPI.drawing2D;
|
|
44
|
+
const geometryAPI = classcad_1.ccAPI.geometry;
|
|
43
45
|
const baseUtils = classcad_1.ccUtils.base;
|
|
44
46
|
const asmUtils = classcad_1.ccUtils.assembly;
|
|
47
|
+
const partUtils = classcad_1.ccUtils.part;
|
|
45
48
|
let BufferGeometryUtils = BufferGeometryUtils_;
|
|
46
49
|
if (BufferGeometryUtils.BufferGeometryUtils) {
|
|
47
50
|
BufferGeometryUtils = BufferGeometryUtils.BufferGeometryUtils;
|
|
@@ -108,7 +111,7 @@ const createRecursiveBufferGeometry = async (object, drawingId, bufferGeomArray)
|
|
|
108
111
|
}
|
|
109
112
|
else {
|
|
110
113
|
// else get visualisation from classcad
|
|
111
|
-
await
|
|
114
|
+
await baseModelerAPI.requestVisualisationOfEntities(drawingId, [solid]);
|
|
112
115
|
cDrawing = (0, core_1.getDrawing)(drawingId); // get current drawing state after request
|
|
113
116
|
cachedSolid = cDrawing.geometry.cache[solid];
|
|
114
117
|
if (cachedSolid) {
|
|
@@ -163,7 +166,7 @@ const createRecursiveScene = async (object, drawingId, root, result, options) =>
|
|
|
163
166
|
let cachedEntity = cDrawing.geometry.cache[entity];
|
|
164
167
|
if (!cachedEntity) {
|
|
165
168
|
// else get visualisation from classcad
|
|
166
|
-
await
|
|
169
|
+
await baseModelerAPI.requestVisualisationOfEntities(drawingId, [entity]);
|
|
167
170
|
cDrawing = (0, core_1.getDrawing)(drawingId); // get current drawing state after request
|
|
168
171
|
cachedEntity = cDrawing.geometry.cache[entity];
|
|
169
172
|
}
|
|
@@ -312,7 +315,7 @@ class CAD {
|
|
|
312
315
|
}
|
|
313
316
|
finally { if (e_1) throw e_1.error; }
|
|
314
317
|
}
|
|
315
|
-
return
|
|
318
|
+
return assemblyBuilderAPI.addNodes(drawingId, nodesToAdd);
|
|
316
319
|
},
|
|
317
320
|
addDimensions: async (...dimensions) => {
|
|
318
321
|
var e_2, _a;
|
|
@@ -349,13 +352,13 @@ class CAD {
|
|
|
349
352
|
}
|
|
350
353
|
finally { if (e_2) throw e_2.error; }
|
|
351
354
|
}
|
|
352
|
-
return
|
|
355
|
+
return drawing2DAPI.addDimensions(drawingId, dimParamsToAdd);
|
|
353
356
|
},
|
|
354
357
|
create2DViews: (productId, viewTypes, viewOptions) => {
|
|
355
358
|
return this.resolve(async ([rProductId]) => {
|
|
356
|
-
const viewIds = await
|
|
359
|
+
const viewIds = await drawing2DAPI.create2DViews(drawingId, rProductId, viewTypes, viewOptions);
|
|
357
360
|
if (viewIds !== null) {
|
|
358
|
-
await
|
|
361
|
+
await drawing2DAPI.centerAllViews(drawingId, rProductId, viewTypes);
|
|
359
362
|
return viewIds;
|
|
360
363
|
}
|
|
361
364
|
return null;
|
|
@@ -363,30 +366,30 @@ class CAD {
|
|
|
363
366
|
},
|
|
364
367
|
getBoundaryBoxFromViews: (productId, viewTypes) => {
|
|
365
368
|
return this.resolve(async ([rProductId]) => {
|
|
366
|
-
const bbs = await
|
|
369
|
+
const bbs = await drawing2DAPI.getBoundaryBoxFromViews(drawingId, rProductId, viewTypes);
|
|
367
370
|
return bbs;
|
|
368
371
|
}, productId);
|
|
369
372
|
},
|
|
370
373
|
place2DViews: (productId, viewPositions) => {
|
|
371
374
|
return this.resolve(async ([rProductId]) => {
|
|
372
|
-
return
|
|
375
|
+
return drawing2DAPI.place2DViews(drawingId, rProductId, viewPositions);
|
|
373
376
|
}, productId);
|
|
374
377
|
},
|
|
375
378
|
exportDXF: (productId, dxfTemplateFilename) => {
|
|
376
379
|
return this.resolve(async ([rProductId]) => {
|
|
377
|
-
return
|
|
380
|
+
return drawing2DAPI.exportDXF(drawingId, rProductId, dxfTemplateFilename);
|
|
378
381
|
}, productId);
|
|
379
382
|
},
|
|
380
383
|
exportSVG: (productId, modus, renderSize, dxfTemplateFilename) => {
|
|
381
384
|
return this.resolve(async ([rProductId]) => {
|
|
382
385
|
modus = modus ? modus : classcad_1.SVGModusType.FIT_WHOLE_DRAWING;
|
|
383
386
|
const renderSizeParam = (renderSize === null || renderSize === void 0 ? void 0 : renderSize.x) && (renderSize === null || renderSize === void 0 ? void 0 : renderSize.y) ? [renderSize.x, renderSize.y] : undefined;
|
|
384
|
-
return
|
|
387
|
+
return drawing2DAPI.exportSVG(drawingId, rProductId, modus, renderSizeParam, dxfTemplateFilename);
|
|
385
388
|
}, productId);
|
|
386
389
|
},
|
|
387
390
|
removeDimensions: (dimensionIds) => {
|
|
388
391
|
return this.resolve(async ([...rDimensionIds]) => {
|
|
389
|
-
return
|
|
392
|
+
return drawing2DAPI.removeDimensions(drawingId, rDimensionIds);
|
|
390
393
|
}, ...dimensionIds);
|
|
391
394
|
},
|
|
392
395
|
linearPattern: (partId, entities, references1, params1, references2, params2) => {
|
|
@@ -477,14 +480,11 @@ class CAD {
|
|
|
477
480
|
return null;
|
|
478
481
|
}, partId, entities, ...references);
|
|
479
482
|
},
|
|
480
|
-
extrusion: (partId,
|
|
481
|
-
return this.resolve(async ([rPartId,
|
|
483
|
+
extrusion: (partId, sketchOrRegionIds, type, limit1, limit2, taperAngle, direction, capEnds) => {
|
|
484
|
+
return this.resolve(async ([rPartId, rSketchOrRegionIds]) => {
|
|
482
485
|
const extrusion = await featureAPI.createExtrusion(drawingId, rPartId);
|
|
483
486
|
if (extrusion) {
|
|
484
|
-
const
|
|
485
|
-
const sketchLines = [];
|
|
486
|
-
// TODO: Which sketch lines need to be included, is CCClasses.CCCurve and its derivation enough?
|
|
487
|
-
sketchLines.push(...baseUtils.getChildren(rSketchId, classcad_1.CCClasses.CCCurve, cDrawing.structure.tree));
|
|
487
|
+
const sketchLines = partUtils.getSketchlines(drawingId, rSketchOrRegionIds);
|
|
488
488
|
if (sketchLines) {
|
|
489
489
|
const limit1Param = { value: limit1, isExpr: typeof limit1 === 'string' };
|
|
490
490
|
const limit2Param = { value: limit2, isExpr: typeof limit2 === 'string' };
|
|
@@ -500,16 +500,13 @@ class CAD {
|
|
|
500
500
|
return extrusion;
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
}, partId,
|
|
503
|
+
}, partId, sketchOrRegionIds);
|
|
504
504
|
},
|
|
505
|
-
revolve: (partId,
|
|
506
|
-
return this.resolve(async ([rPartId,
|
|
505
|
+
revolve: (partId, sketchOrRegionIds, axisIds, angle1, angle2, inverted) => {
|
|
506
|
+
return this.resolve(async ([rPartId, rSketchOrRegionIds, ...rAxisIds]) => {
|
|
507
507
|
const revolve = await featureAPI.createRevolve(drawingId, rPartId);
|
|
508
508
|
if (revolve) {
|
|
509
|
-
const
|
|
510
|
-
const sketchLines = [];
|
|
511
|
-
sketchLines.push(...baseUtils.getChildren(rSketchId, classcad_1.CCClasses.CCCircle, cDrawing.structure.tree));
|
|
512
|
-
sketchLines.push(...baseUtils.getChildren(rSketchId, classcad_1.CCClasses.CCLine, cDrawing.structure.tree));
|
|
509
|
+
const sketchLines = partUtils.getSketchlines(drawingId, rSketchOrRegionIds);
|
|
513
510
|
if (sketchLines) {
|
|
514
511
|
const angle1Param = { value: angle1, isExpr: typeof angle1 === 'string' };
|
|
515
512
|
const angle2Param = { value: angle2, isExpr: typeof angle2 === 'string' };
|
|
@@ -517,7 +514,7 @@ class CAD {
|
|
|
517
514
|
return revolve;
|
|
518
515
|
}
|
|
519
516
|
}
|
|
520
|
-
}, partId,
|
|
517
|
+
}, partId, sketchOrRegionIds, ...axisIds);
|
|
521
518
|
},
|
|
522
519
|
boolean: (partId, type, entities) => {
|
|
523
520
|
return this.resolve(async ([rPartId, rEntities]) => {
|
|
@@ -1257,11 +1254,11 @@ class CAD {
|
|
|
1257
1254
|
break;
|
|
1258
1255
|
}
|
|
1259
1256
|
const geometries = positions
|
|
1260
|
-
? await
|
|
1257
|
+
? await geometryAPI.findGeometriesByPoints(drawingId, rPartId, type, positions)
|
|
1261
1258
|
: await (0, selection_1.waitForSelect)(length, filter, (resolveSelection, items, diff) => {
|
|
1262
1259
|
if (items.length > length - 1) {
|
|
1263
1260
|
resolveSelection(items.map(i => i.data.graphicId));
|
|
1264
|
-
|
|
1261
|
+
geometryAPI
|
|
1265
1262
|
.getPointsByGeometries(drawingId, items.map(i => i.data.graphicId))
|
|
1266
1263
|
.then(points => {
|
|
1267
1264
|
logPoints(points);
|
|
@@ -1311,7 +1308,7 @@ class CAD {
|
|
|
1311
1308
|
},
|
|
1312
1309
|
setCurrentProduct: (productId) => {
|
|
1313
1310
|
return this.resolve(async ([rProductId]) => {
|
|
1314
|
-
await
|
|
1311
|
+
await baseModelerAPI.setCurrentProduct(drawingId, rProductId);
|
|
1315
1312
|
}, productId);
|
|
1316
1313
|
},
|
|
1317
1314
|
getCurrentProduct: () => {
|
|
@@ -1339,6 +1336,15 @@ class CAD {
|
|
|
1339
1336
|
return null;
|
|
1340
1337
|
}, refId);
|
|
1341
1338
|
},
|
|
1339
|
+
getSketchRegion: (refId, sketchRegionName) => {
|
|
1340
|
+
return this.resolve(async ([rRefId]) => {
|
|
1341
|
+
const sRIds = partUtils.getSketchRegion(drawingId, rRefId, sketchRegionName);
|
|
1342
|
+
if (sRIds != undefined) {
|
|
1343
|
+
return Array.isArray(sRIds) ? sRIds : [sRIds];
|
|
1344
|
+
}
|
|
1345
|
+
return null;
|
|
1346
|
+
}, refId);
|
|
1347
|
+
},
|
|
1342
1348
|
getWorkGeometry: (refId, type, wgName) => {
|
|
1343
1349
|
return this.resolve(async ([rRefId]) => {
|
|
1344
1350
|
const wgIds = asmUtils.getWorkGeometry(drawingId, rRefId, type, wgName);
|
|
@@ -1579,22 +1585,22 @@ class CAD {
|
|
|
1579
1585
|
}, translationId);
|
|
1580
1586
|
},
|
|
1581
1587
|
save: (type) => {
|
|
1582
|
-
return
|
|
1588
|
+
return baseModelerAPI.save(drawingId, type);
|
|
1583
1589
|
},
|
|
1584
1590
|
saveToUrl: (url, filetype) => {
|
|
1585
|
-
return
|
|
1591
|
+
return baseModelerAPI.saveToUrl(drawingId, url, filetype);
|
|
1586
1592
|
},
|
|
1587
1593
|
load: (content, type) => {
|
|
1588
|
-
return
|
|
1594
|
+
return baseModelerAPI.load(drawingId, content, type);
|
|
1589
1595
|
},
|
|
1590
1596
|
loadFromUrl: (url, filetype) => {
|
|
1591
|
-
return
|
|
1597
|
+
return baseModelerAPI.loadFromUrl(drawingId, url, filetype, true);
|
|
1592
1598
|
},
|
|
1593
1599
|
loadProduct: (content, type) => {
|
|
1594
|
-
return
|
|
1600
|
+
return assemblyBuilderAPI.loadProduct(drawingId, content, type);
|
|
1595
1601
|
},
|
|
1596
1602
|
loadProductFromUrl: (url, filetype) => {
|
|
1597
|
-
return
|
|
1603
|
+
return assemblyBuilderAPI.loadProductFromUrl(drawingId, url, filetype);
|
|
1598
1604
|
},
|
|
1599
1605
|
pick: (partId, type, points) => {
|
|
1600
1606
|
return this.resolve(async ([rPartId]) => {
|
package/build/esm/history.js
CHANGED
|
@@ -15,8 +15,11 @@ const featureAPI = ccAPI.feature;
|
|
|
15
15
|
const sketcherAPI = ccAPI.sketcher;
|
|
16
16
|
const baseModelerAPI = ccAPI.baseModeler;
|
|
17
17
|
const assemblyBuilderAPI = ccAPI.assemblyBuilder;
|
|
18
|
+
const drawing2DAPI = ccAPI.drawing2D;
|
|
19
|
+
const geometryAPI = ccAPI.geometry;
|
|
18
20
|
const baseUtils = ccUtils.base;
|
|
19
21
|
const asmUtils = ccUtils.assembly;
|
|
22
|
+
const partUtils = ccUtils.part;
|
|
20
23
|
let BufferGeometryUtils = BufferGeometryUtils_;
|
|
21
24
|
if (BufferGeometryUtils.BufferGeometryUtils) {
|
|
22
25
|
BufferGeometryUtils = BufferGeometryUtils.BufferGeometryUtils;
|
|
@@ -83,7 +86,7 @@ const createRecursiveBufferGeometry = async (object, drawingId, bufferGeomArray)
|
|
|
83
86
|
}
|
|
84
87
|
else {
|
|
85
88
|
// else get visualisation from classcad
|
|
86
|
-
await
|
|
89
|
+
await baseModelerAPI.requestVisualisationOfEntities(drawingId, [solid]);
|
|
87
90
|
cDrawing = getDrawing(drawingId); // get current drawing state after request
|
|
88
91
|
cachedSolid = cDrawing.geometry.cache[solid];
|
|
89
92
|
if (cachedSolid) {
|
|
@@ -138,7 +141,7 @@ const createRecursiveScene = async (object, drawingId, root, result, options) =>
|
|
|
138
141
|
let cachedEntity = cDrawing.geometry.cache[entity];
|
|
139
142
|
if (!cachedEntity) {
|
|
140
143
|
// else get visualisation from classcad
|
|
141
|
-
await
|
|
144
|
+
await baseModelerAPI.requestVisualisationOfEntities(drawingId, [entity]);
|
|
142
145
|
cDrawing = getDrawing(drawingId); // get current drawing state after request
|
|
143
146
|
cachedEntity = cDrawing.geometry.cache[entity];
|
|
144
147
|
}
|
|
@@ -287,7 +290,7 @@ export default class CAD {
|
|
|
287
290
|
}
|
|
288
291
|
finally { if (e_1) throw e_1.error; }
|
|
289
292
|
}
|
|
290
|
-
return
|
|
293
|
+
return assemblyBuilderAPI.addNodes(drawingId, nodesToAdd);
|
|
291
294
|
},
|
|
292
295
|
addDimensions: async (...dimensions) => {
|
|
293
296
|
var e_2, _a;
|
|
@@ -324,13 +327,13 @@ export default class CAD {
|
|
|
324
327
|
}
|
|
325
328
|
finally { if (e_2) throw e_2.error; }
|
|
326
329
|
}
|
|
327
|
-
return
|
|
330
|
+
return drawing2DAPI.addDimensions(drawingId, dimParamsToAdd);
|
|
328
331
|
},
|
|
329
332
|
create2DViews: (productId, viewTypes, viewOptions) => {
|
|
330
333
|
return this.resolve(async ([rProductId]) => {
|
|
331
|
-
const viewIds = await
|
|
334
|
+
const viewIds = await drawing2DAPI.create2DViews(drawingId, rProductId, viewTypes, viewOptions);
|
|
332
335
|
if (viewIds !== null) {
|
|
333
|
-
await
|
|
336
|
+
await drawing2DAPI.centerAllViews(drawingId, rProductId, viewTypes);
|
|
334
337
|
return viewIds;
|
|
335
338
|
}
|
|
336
339
|
return null;
|
|
@@ -338,30 +341,30 @@ export default class CAD {
|
|
|
338
341
|
},
|
|
339
342
|
getBoundaryBoxFromViews: (productId, viewTypes) => {
|
|
340
343
|
return this.resolve(async ([rProductId]) => {
|
|
341
|
-
const bbs = await
|
|
344
|
+
const bbs = await drawing2DAPI.getBoundaryBoxFromViews(drawingId, rProductId, viewTypes);
|
|
342
345
|
return bbs;
|
|
343
346
|
}, productId);
|
|
344
347
|
},
|
|
345
348
|
place2DViews: (productId, viewPositions) => {
|
|
346
349
|
return this.resolve(async ([rProductId]) => {
|
|
347
|
-
return
|
|
350
|
+
return drawing2DAPI.place2DViews(drawingId, rProductId, viewPositions);
|
|
348
351
|
}, productId);
|
|
349
352
|
},
|
|
350
353
|
exportDXF: (productId, dxfTemplateFilename) => {
|
|
351
354
|
return this.resolve(async ([rProductId]) => {
|
|
352
|
-
return
|
|
355
|
+
return drawing2DAPI.exportDXF(drawingId, rProductId, dxfTemplateFilename);
|
|
353
356
|
}, productId);
|
|
354
357
|
},
|
|
355
358
|
exportSVG: (productId, modus, renderSize, dxfTemplateFilename) => {
|
|
356
359
|
return this.resolve(async ([rProductId]) => {
|
|
357
360
|
modus = modus ? modus : SVGModusType.FIT_WHOLE_DRAWING;
|
|
358
361
|
const renderSizeParam = (renderSize === null || renderSize === void 0 ? void 0 : renderSize.x) && (renderSize === null || renderSize === void 0 ? void 0 : renderSize.y) ? [renderSize.x, renderSize.y] : undefined;
|
|
359
|
-
return
|
|
362
|
+
return drawing2DAPI.exportSVG(drawingId, rProductId, modus, renderSizeParam, dxfTemplateFilename);
|
|
360
363
|
}, productId);
|
|
361
364
|
},
|
|
362
365
|
removeDimensions: (dimensionIds) => {
|
|
363
366
|
return this.resolve(async ([...rDimensionIds]) => {
|
|
364
|
-
return
|
|
367
|
+
return drawing2DAPI.removeDimensions(drawingId, rDimensionIds);
|
|
365
368
|
}, ...dimensionIds);
|
|
366
369
|
},
|
|
367
370
|
linearPattern: (partId, entities, references1, params1, references2, params2) => {
|
|
@@ -452,14 +455,11 @@ export default class CAD {
|
|
|
452
455
|
return null;
|
|
453
456
|
}, partId, entities, ...references);
|
|
454
457
|
},
|
|
455
|
-
extrusion: (partId,
|
|
456
|
-
return this.resolve(async ([rPartId,
|
|
458
|
+
extrusion: (partId, sketchOrRegionIds, type, limit1, limit2, taperAngle, direction, capEnds) => {
|
|
459
|
+
return this.resolve(async ([rPartId, rSketchOrRegionIds]) => {
|
|
457
460
|
const extrusion = await featureAPI.createExtrusion(drawingId, rPartId);
|
|
458
461
|
if (extrusion) {
|
|
459
|
-
const
|
|
460
|
-
const sketchLines = [];
|
|
461
|
-
// TODO: Which sketch lines need to be included, is CCClasses.CCCurve and its derivation enough?
|
|
462
|
-
sketchLines.push(...baseUtils.getChildren(rSketchId, CCClasses.CCCurve, cDrawing.structure.tree));
|
|
462
|
+
const sketchLines = partUtils.getSketchlines(drawingId, rSketchOrRegionIds);
|
|
463
463
|
if (sketchLines) {
|
|
464
464
|
const limit1Param = { value: limit1, isExpr: typeof limit1 === 'string' };
|
|
465
465
|
const limit2Param = { value: limit2, isExpr: typeof limit2 === 'string' };
|
|
@@ -475,16 +475,13 @@ export default class CAD {
|
|
|
475
475
|
return extrusion;
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
}, partId,
|
|
478
|
+
}, partId, sketchOrRegionIds);
|
|
479
479
|
},
|
|
480
|
-
revolve: (partId,
|
|
481
|
-
return this.resolve(async ([rPartId,
|
|
480
|
+
revolve: (partId, sketchOrRegionIds, axisIds, angle1, angle2, inverted) => {
|
|
481
|
+
return this.resolve(async ([rPartId, rSketchOrRegionIds, ...rAxisIds]) => {
|
|
482
482
|
const revolve = await featureAPI.createRevolve(drawingId, rPartId);
|
|
483
483
|
if (revolve) {
|
|
484
|
-
const
|
|
485
|
-
const sketchLines = [];
|
|
486
|
-
sketchLines.push(...baseUtils.getChildren(rSketchId, CCClasses.CCCircle, cDrawing.structure.tree));
|
|
487
|
-
sketchLines.push(...baseUtils.getChildren(rSketchId, CCClasses.CCLine, cDrawing.structure.tree));
|
|
484
|
+
const sketchLines = partUtils.getSketchlines(drawingId, rSketchOrRegionIds);
|
|
488
485
|
if (sketchLines) {
|
|
489
486
|
const angle1Param = { value: angle1, isExpr: typeof angle1 === 'string' };
|
|
490
487
|
const angle2Param = { value: angle2, isExpr: typeof angle2 === 'string' };
|
|
@@ -492,7 +489,7 @@ export default class CAD {
|
|
|
492
489
|
return revolve;
|
|
493
490
|
}
|
|
494
491
|
}
|
|
495
|
-
}, partId,
|
|
492
|
+
}, partId, sketchOrRegionIds, ...axisIds);
|
|
496
493
|
},
|
|
497
494
|
boolean: (partId, type, entities) => {
|
|
498
495
|
return this.resolve(async ([rPartId, rEntities]) => {
|
|
@@ -1232,11 +1229,11 @@ export default class CAD {
|
|
|
1232
1229
|
break;
|
|
1233
1230
|
}
|
|
1234
1231
|
const geometries = positions
|
|
1235
|
-
? await
|
|
1232
|
+
? await geometryAPI.findGeometriesByPoints(drawingId, rPartId, type, positions)
|
|
1236
1233
|
: await waitForSelect(length, filter, (resolveSelection, items, diff) => {
|
|
1237
1234
|
if (items.length > length - 1) {
|
|
1238
1235
|
resolveSelection(items.map(i => i.data.graphicId));
|
|
1239
|
-
|
|
1236
|
+
geometryAPI
|
|
1240
1237
|
.getPointsByGeometries(drawingId, items.map(i => i.data.graphicId))
|
|
1241
1238
|
.then(points => {
|
|
1242
1239
|
logPoints(points);
|
|
@@ -1286,7 +1283,7 @@ export default class CAD {
|
|
|
1286
1283
|
},
|
|
1287
1284
|
setCurrentProduct: (productId) => {
|
|
1288
1285
|
return this.resolve(async ([rProductId]) => {
|
|
1289
|
-
await
|
|
1286
|
+
await baseModelerAPI.setCurrentProduct(drawingId, rProductId);
|
|
1290
1287
|
}, productId);
|
|
1291
1288
|
},
|
|
1292
1289
|
getCurrentProduct: () => {
|
|
@@ -1314,6 +1311,15 @@ export default class CAD {
|
|
|
1314
1311
|
return null;
|
|
1315
1312
|
}, refId);
|
|
1316
1313
|
},
|
|
1314
|
+
getSketchRegion: (refId, sketchRegionName) => {
|
|
1315
|
+
return this.resolve(async ([rRefId]) => {
|
|
1316
|
+
const sRIds = partUtils.getSketchRegion(drawingId, rRefId, sketchRegionName);
|
|
1317
|
+
if (sRIds != undefined) {
|
|
1318
|
+
return Array.isArray(sRIds) ? sRIds : [sRIds];
|
|
1319
|
+
}
|
|
1320
|
+
return null;
|
|
1321
|
+
}, refId);
|
|
1322
|
+
},
|
|
1317
1323
|
getWorkGeometry: (refId, type, wgName) => {
|
|
1318
1324
|
return this.resolve(async ([rRefId]) => {
|
|
1319
1325
|
const wgIds = asmUtils.getWorkGeometry(drawingId, rRefId, type, wgName);
|
|
@@ -1554,22 +1560,22 @@ export default class CAD {
|
|
|
1554
1560
|
}, translationId);
|
|
1555
1561
|
},
|
|
1556
1562
|
save: (type) => {
|
|
1557
|
-
return
|
|
1563
|
+
return baseModelerAPI.save(drawingId, type);
|
|
1558
1564
|
},
|
|
1559
1565
|
saveToUrl: (url, filetype) => {
|
|
1560
|
-
return
|
|
1566
|
+
return baseModelerAPI.saveToUrl(drawingId, url, filetype);
|
|
1561
1567
|
},
|
|
1562
1568
|
load: (content, type) => {
|
|
1563
|
-
return
|
|
1569
|
+
return baseModelerAPI.load(drawingId, content, type);
|
|
1564
1570
|
},
|
|
1565
1571
|
loadFromUrl: (url, filetype) => {
|
|
1566
|
-
return
|
|
1572
|
+
return baseModelerAPI.loadFromUrl(drawingId, url, filetype, true);
|
|
1567
1573
|
},
|
|
1568
1574
|
loadProduct: (content, type) => {
|
|
1569
|
-
return
|
|
1575
|
+
return assemblyBuilderAPI.loadProduct(drawingId, content, type);
|
|
1570
1576
|
},
|
|
1571
1577
|
loadProductFromUrl: (url, filetype) => {
|
|
1572
|
-
return
|
|
1578
|
+
return assemblyBuilderAPI.loadProductFromUrl(drawingId, url, filetype);
|
|
1573
1579
|
},
|
|
1574
1580
|
pick: (partId, type, points) => {
|
|
1575
1581
|
return this.resolve(async ([rPartId]) => {
|
package/build/types/history.d.ts
CHANGED
|
@@ -213,7 +213,7 @@ export declare type ApiHistory = {
|
|
|
213
213
|
/**
|
|
214
214
|
* Creates an extrusion
|
|
215
215
|
* @param partId Id of the part to create the extrusion in.
|
|
216
|
-
* @param
|
|
216
|
+
* @param sketchOrRegionIds Id of the sketch to extrude or multiple ids of sketch regions
|
|
217
217
|
* @param type Type of extrusion (up, down, symmetric, custom)
|
|
218
218
|
* @param limit1 Start of extrusion (0 = start at sketch, only for type custom necessary)
|
|
219
219
|
* @param limit2 End of extrusion, which is actually the height
|
|
@@ -221,17 +221,17 @@ export declare type ApiHistory = {
|
|
|
221
221
|
* @param direction Direction of extrusion
|
|
222
222
|
* @param capEnds If true, ends will be capped, else a sheet will be created
|
|
223
223
|
*/
|
|
224
|
-
extrusion: (partId: VID,
|
|
224
|
+
extrusion: (partId: VID, sketchOrRegionIds: VID | VIDs, type: ExtrusionType, limit1: number | string, limit2: number | string, taperAngle: number | string, direction: PointMemValue, capEnds: 0 | 1) => ID;
|
|
225
225
|
/**
|
|
226
226
|
* Creates a revolve
|
|
227
227
|
* @param partId Id of the part to create the revolve in.
|
|
228
|
-
* @param
|
|
228
|
+
* @param sketchOrRegionIds Id of the sketch to extrude or multiple ids of sketch regions
|
|
229
229
|
* @param axisIds Array of ids, either [lineId] or [point1Id, point2Id], ids can be both ccId or graphicId
|
|
230
230
|
* @param angle1 Start of revolve in degrees
|
|
231
231
|
* @param angle2 End of revolve in degrees
|
|
232
232
|
* @param inverted flag, whether to invert the axis or not
|
|
233
233
|
*/
|
|
234
|
-
revolve: (partId: VID,
|
|
234
|
+
revolve: (partId: VID, sketchOrRegionIds: VID | VIDs, axisIds: VID[], angle1: number | string, angle2: number | string, inverted: 0 | 1) => ID;
|
|
235
235
|
/**
|
|
236
236
|
* Creates a boolean operation.
|
|
237
237
|
* @param partId id of the part where the operation will be created on
|
|
@@ -972,6 +972,14 @@ export declare type ApiHistory = {
|
|
|
972
972
|
* return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
|
|
973
973
|
*/
|
|
974
974
|
getWorkCoordSystem: (refId: VID, wcsName?: string) => IDs;
|
|
975
|
+
/**
|
|
976
|
+
* Returns the sketch region with the given sketchRegionName from the given reference.
|
|
977
|
+
* If sketchRegionName is not set, all sketch regions of the reference will be returned.
|
|
978
|
+
* @param refId id of the reference to look for the sketch region
|
|
979
|
+
* @param wcsName name of the sketch region to look for
|
|
980
|
+
* @example // tbd
|
|
981
|
+
*/
|
|
982
|
+
getSketchRegion: (refId: VID, sketchRegionName?: string) => IDs;
|
|
975
983
|
/**
|
|
976
984
|
* Returns the work geometry of given type with given name. If the name of the work geometry is empty,
|
|
977
985
|
* all found work geometry of given type is returned
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buerli.io/headless",
|
|
3
|
-
"version": "0.5.0
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A non-manifold CAD workflow for the web",
|
|
5
5
|
"author": "AWV Informatik AG <info@awv-informatik.ch>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"three": ">=0.138"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@buerli.io/classcad": "0.5.0
|
|
33
|
+
"@buerli.io/classcad": "0.5.0",
|
|
34
34
|
"flat-promise": "^1.0.3"
|
|
35
35
|
}
|
|
36
36
|
}
|