@buerli.io/headless 0.6.0 → 0.6.1-beta.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.
@@ -1452,6 +1452,15 @@ class CAD {
1452
1452
  return null;
1453
1453
  }, partId);
1454
1454
  },
1455
+ getGeometryInformation: (productOrSolidId) => {
1456
+ return this.resolve(async ([rProductOrSolidId]) => {
1457
+ const values = await baseModelerAPI.getGeometryInformation(drawingId, rProductOrSolidId);
1458
+ if (values !== null) {
1459
+ return { centerOfGravity: values[0], volume: values[1] };
1460
+ }
1461
+ return null;
1462
+ }, productOrSolidId);
1463
+ },
1455
1464
  removeNodes: (...nodes) => {
1456
1465
  return this.resolve(async ([...rNodes]) => {
1457
1466
  return assemblyBuilderAPI.removeNodes(drawingId, rNodes);
@@ -1427,6 +1427,15 @@ export default class CAD {
1427
1427
  return null;
1428
1428
  }, partId);
1429
1429
  },
1430
+ getGeometryInformation: (productOrSolidId) => {
1431
+ return this.resolve(async ([rProductOrSolidId]) => {
1432
+ const values = await baseModelerAPI.getGeometryInformation(drawingId, rProductOrSolidId);
1433
+ if (values !== null) {
1434
+ return { centerOfGravity: values[0], volume: values[1] };
1435
+ }
1436
+ return null;
1437
+ }, productOrSolidId);
1438
+ },
1430
1439
  removeNodes: (...nodes) => {
1431
1440
  return this.resolve(async ([...rNodes]) => {
1432
1441
  return assemblyBuilderAPI.removeNodes(drawingId, rNodes);
@@ -1083,6 +1083,16 @@ export declare type ApiHistory = {
1083
1083
  * @example // tbd
1084
1084
  */
1085
1085
  getFeatureByName: (partId: VID, featureName: string) => ID;
1086
+ /**
1087
+ * Returns an object containing the center of gravity and the volume of the given
1088
+ * product, node or solid. Depending on the input parameter the calculations were made
1089
+ * on a single solid, a part, a subassembly, the whole model, ... E.g. the center of gravity of
1090
+ * a root assembly, will be the sum of all solid's center of gravity over the whole assembly structure
1091
+ *
1092
+ * @param productOrSolidId id of the product, node or solid to get the information from
1093
+ * @example // tbd
1094
+ */
1095
+ getGeometryInformation: (productOrSolidId: VID) => Promise<ModelInfo | null>;
1086
1096
  /**
1087
1097
  * Writes the current drawing to a stream and returns the data.
1088
1098
  *
@@ -1258,6 +1268,10 @@ declare type Point = {
1258
1268
  y: number;
1259
1269
  z: number;
1260
1270
  };
1271
+ declare type ModelInfo = {
1272
+ centerOfGravity: PointMemValue;
1273
+ volume: number;
1274
+ };
1261
1275
  declare type MateParam = {
1262
1276
  matePath: VID[];
1263
1277
  wcsId: VID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/headless",
3
- "version": "0.6.0",
3
+ "version": "0.6.1-beta.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.6.0",
33
+ "@buerli.io/classcad": "0.6.1-beta.0",
34
34
  "flat-promise": "^1.0.3"
35
35
  }
36
36
  }