@buerli.io/headless 0.9.1-beta.0 → 0.10.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.
@@ -578,7 +578,7 @@ class CAD {
578
578
  return null;
579
579
  }, partId, ...references);
580
580
  },
581
- createFastenedConstraint: async (id, mate1, mate2, xOffset, yOffset, zOffset, name) => {
581
+ createFastenedConstraint: async (id, mate1, mate2, xOffset, yOffset, zOffset, name, xRotation, yRotation, zRotation) => {
582
582
  const [rId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), id, mate1.wcsId, mate2.wcsId));
583
583
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...mate1.matePath));
584
584
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...mate2.matePath));
@@ -587,6 +587,9 @@ class CAD {
587
587
  const xOffsetParam = { value: xOffset, isExpr: typeof xOffset === 'string' };
588
588
  const yOffsetParam = { value: yOffset, isExpr: typeof yOffset === 'string' };
589
589
  const zOffsetParam = { value: zOffset, isExpr: typeof zOffset === 'string' };
590
+ const xRotationParam = { value: xRotation || 0, isExpr: typeof xRotation === 'string' };
591
+ const yRotationParam = { value: yRotation || 0, isExpr: typeof yRotation === 'string' };
592
+ const zRotationParam = { value: zRotation || 0, isExpr: typeof zRotation === 'string' };
590
593
  await assemblyBuilderAPI.updateFastenedConstraints(drawingId, [
591
594
  {
592
595
  constrId: constraintId,
@@ -595,6 +598,9 @@ class CAD {
595
598
  xOffset: xOffsetParam,
596
599
  yOffset: yOffsetParam,
597
600
  zOffset: zOffsetParam,
601
+ xRotation: xRotationParam,
602
+ yRotation: yRotationParam,
603
+ zRotation: zRotationParam,
598
604
  },
599
605
  ]);
600
606
  return constraintId;
@@ -613,6 +619,18 @@ class CAD {
613
619
  const xOffsetParam = { value: constr.xOffset, isExpr: typeof constr.xOffset === 'string' };
614
620
  const yOffsetParam = { value: constr.yOffset, isExpr: typeof constr.yOffset === 'string' };
615
621
  const zOffsetParam = { value: constr.zOffset, isExpr: typeof constr.zOffset === 'string' };
622
+ const xRotationParam = {
623
+ value: constr.xRotation || 0,
624
+ isExpr: typeof constr.xRotation === 'string',
625
+ };
626
+ const yRotationParam = {
627
+ value: constr.yRotation || 0,
628
+ isExpr: typeof constr.yRotation === 'string',
629
+ };
630
+ const zRotationParam = {
631
+ value: constr.zRotation || 0,
632
+ isExpr: typeof constr.zRotation === 'string',
633
+ };
616
634
  constrToAdd.push({
617
635
  constrId: rConstrId,
618
636
  mate1: {
@@ -630,6 +648,9 @@ class CAD {
630
648
  xOffset: xOffsetParam,
631
649
  yOffset: yOffsetParam,
632
650
  zOffset: zOffsetParam,
651
+ xRotation: xRotationParam,
652
+ yRotation: yRotationParam,
653
+ zRotation: zRotationParam,
633
654
  });
634
655
  }
635
656
  }
@@ -642,7 +663,7 @@ class CAD {
642
663
  }
643
664
  await assemblyBuilderAPI.updateFastenedConstraints(drawingId, constrToAdd);
644
665
  },
645
- createFastenedOriginConstraint: async (id, mate1, xOffset, yOffset, zOffset, name) => {
666
+ createFastenedOriginConstraint: async (id, mate1, xOffset, yOffset, zOffset, name, xRotation, yRotation, zRotation) => {
646
667
  const [rId, rWcs1] = await new Promise(res => this.resolve(ids => res(ids), id, mate1.wcsId));
647
668
  const rMatePath = await new Promise(res => this.resolve(paths => res(paths), ...mate1.matePath));
648
669
  const constraintId = await assemblyBuilderAPI.create3DConstraint(drawingId, rId, classcad_1.CCClasses.CCFastenedOriginConstraint, name);
@@ -650,6 +671,9 @@ class CAD {
650
671
  const xOffsetParam = { value: xOffset, isExpr: typeof xOffset === 'string' };
651
672
  const yOffsetParam = { value: yOffset, isExpr: typeof yOffset === 'string' };
652
673
  const zOffsetParam = { value: zOffset, isExpr: typeof zOffset === 'string' };
674
+ const xRotationParam = { value: xRotation || 0, isExpr: typeof xRotation === 'string' };
675
+ const yRotationParam = { value: yRotation || 0, isExpr: typeof yRotation === 'string' };
676
+ const zRotationParam = { value: zRotation || 0, isExpr: typeof zRotation === 'string' };
653
677
  await assemblyBuilderAPI.updateFastenedOriginConstraints(drawingId, [
654
678
  {
655
679
  constrId: constraintId,
@@ -657,6 +681,9 @@ class CAD {
657
681
  xOffset: xOffsetParam,
658
682
  yOffset: yOffsetParam,
659
683
  zOffset: zOffsetParam,
684
+ xRotation: xRotationParam,
685
+ yRotation: yRotationParam,
686
+ zRotation: zRotationParam,
660
687
  },
661
688
  ]);
662
689
  return constraintId;
@@ -674,6 +701,18 @@ class CAD {
674
701
  const xOffsetParam = { value: constr.xOffset, isExpr: typeof constr.xOffset === 'string' };
675
702
  const yOffsetParam = { value: constr.yOffset, isExpr: typeof constr.yOffset === 'string' };
676
703
  const zOffsetParam = { value: constr.zOffset, isExpr: typeof constr.zOffset === 'string' };
704
+ const xRotationParam = {
705
+ value: constr.xRotation || 0,
706
+ isExpr: typeof constr.xRotation === 'string',
707
+ };
708
+ const yRotationParam = {
709
+ value: constr.yRotation || 0,
710
+ isExpr: typeof constr.yRotation === 'string',
711
+ };
712
+ const zRotationParam = {
713
+ value: constr.zRotation || 0,
714
+ isExpr: typeof constr.zRotation === 'string',
715
+ };
677
716
  constraintsToAdd.push({
678
717
  constrId: rConstrId,
679
718
  mate1: {
@@ -685,6 +724,9 @@ class CAD {
685
724
  xOffset: xOffsetParam,
686
725
  yOffset: yOffsetParam,
687
726
  zOffset: zOffsetParam,
727
+ xRotation: xRotationParam,
728
+ yRotation: yRotationParam,
729
+ zRotation: zRotationParam,
688
730
  });
689
731
  }
690
732
  }
@@ -1406,6 +1448,9 @@ class CAD {
1406
1448
  xOffset: constraint.xOffset.value,
1407
1449
  yOffset: constraint.yOffset.value,
1408
1450
  zOffset: constraint.zOffset.value,
1451
+ xRotation: constraint.xRotation.value,
1452
+ yRotation: constraint.yRotation.value,
1453
+ zRotation: constraint.zRotation.value,
1409
1454
  };
1410
1455
  }
1411
1456
  return null;
@@ -1421,6 +1466,9 @@ class CAD {
1421
1466
  xOffset: constraint.xOffset.value,
1422
1467
  yOffset: constraint.yOffset.value,
1423
1468
  zOffset: constraint.zOffset.value,
1469
+ xRotation: constraint.xRotation.value,
1470
+ yRotation: constraint.yRotation.value,
1471
+ zRotation: constraint.zRotation.value,
1424
1472
  };
1425
1473
  }
1426
1474
  return null;
@@ -1722,10 +1770,13 @@ class CAD {
1722
1770
  return null;
1723
1771
  }, partId);
1724
1772
  },
1725
- setExpressions: (...expressions) => {
1726
- return this.resolve(async ([...rExpressions]) => {
1727
- const expressionsToSet = [];
1728
- rExpressions.forEach(expr => {
1773
+ setExpressions: async (...expressions) => {
1774
+ var e_13, _a;
1775
+ const expressionsToSet = [];
1776
+ try {
1777
+ for (var expressions_1 = __asyncValues(expressions), expressions_1_1; expressions_1_1 = await expressions_1.next(), !expressions_1_1.done;) {
1778
+ const expr = expressions_1_1.value;
1779
+ const [rPartId] = await new Promise(res => this.resolve(id => res(id), expr.partId));
1729
1780
  const membersToModify = [];
1730
1781
  expr.members.forEach((mem) => {
1731
1782
  const isExpr = typeof mem.value === 'string'; // TODO Expression unterscheiden von normalen Strings
@@ -1736,17 +1787,22 @@ class CAD {
1736
1787
  membersToModify.push({ name: mem.name, value: featureAPIParam });
1737
1788
  });
1738
1789
  // Looking for the partId given by an identifier or name
1739
- let part = expr.partId;
1790
+ let part = rPartId;
1740
1791
  if (typeof part === 'string') {
1741
- const products = asmUtils.getPartTemplate(drawingId, part);
1742
- if (products.length > 1) {
1743
- throw 'More than one product has been found for given name or ident: ' + part;
1792
+ const foundPart = baseUtils.findObject(drawingId, { ident: part, name: part });
1793
+ if (!foundPart) {
1794
+ throw 'No part found to set expressions on for given name or ident: ' + part;
1744
1795
  }
1745
- else if (products.length < 1) {
1746
- throw 'No product found for given name or ident: ' + part;
1796
+ const clazz = (0, core_1.getDrawing)(drawingId).structure.tree[foundPart].class;
1797
+ if (!baseUtils.isA(clazz, classcad_1.CCClasses.CCPart)) {
1798
+ throw ('The part to set expressions on given by name or ident "' +
1799
+ part +
1800
+ '" is of the wrong type "' +
1801
+ clazz +
1802
+ '". Make sure the object is a part.');
1747
1803
  }
1748
1804
  else {
1749
- part = products[0];
1805
+ part = foundPart;
1750
1806
  }
1751
1807
  }
1752
1808
  expressionsToSet.push({
@@ -1755,10 +1811,17 @@ class CAD {
1755
1811
  toModifyMembers: membersToModify,
1756
1812
  toDeleteList: [],
1757
1813
  });
1758
- });
1759
- const success = await featureAPI.updateExpressions(drawingId, expressionsToSet);
1760
- return success;
1761
- }, ...expressions);
1814
+ }
1815
+ }
1816
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1817
+ finally {
1818
+ try {
1819
+ if (expressions_1_1 && !expressions_1_1.done && (_a = expressions_1.return)) await _a.call(expressions_1);
1820
+ }
1821
+ finally { if (e_13) throw e_13.error; }
1822
+ }
1823
+ const success = await featureAPI.updateExpressions(drawingId, expressionsToSet);
1824
+ return success;
1762
1825
  },
1763
1826
  deleteExpressions: (partId, members) => {
1764
1827
  return this.resolve(async ([rPartId]) => {
@@ -576,7 +576,7 @@ export default class CAD {
576
576
  return null;
577
577
  }, partId, ...references);
578
578
  },
579
- createFastenedConstraint: async (id, mate1, mate2, xOffset, yOffset, zOffset, name) => {
579
+ createFastenedConstraint: async (id, mate1, mate2, xOffset, yOffset, zOffset, name, xRotation, yRotation, zRotation) => {
580
580
  const [rId, rWcs1, rWcs2] = await new Promise(res => this.resolve(ids => res(ids), id, mate1.wcsId, mate2.wcsId));
581
581
  const rMatePath1 = await new Promise(res => this.resolve(paths => res(paths), ...mate1.matePath));
582
582
  const rMatePath2 = await new Promise(res => this.resolve(paths => res(paths), ...mate2.matePath));
@@ -585,6 +585,9 @@ export default class CAD {
585
585
  const xOffsetParam = { value: xOffset, isExpr: typeof xOffset === 'string' };
586
586
  const yOffsetParam = { value: yOffset, isExpr: typeof yOffset === 'string' };
587
587
  const zOffsetParam = { value: zOffset, isExpr: typeof zOffset === 'string' };
588
+ const xRotationParam = { value: xRotation || 0, isExpr: typeof xRotation === 'string' };
589
+ const yRotationParam = { value: yRotation || 0, isExpr: typeof yRotation === 'string' };
590
+ const zRotationParam = { value: zRotation || 0, isExpr: typeof zRotation === 'string' };
588
591
  await assemblyBuilderAPI.updateFastenedConstraints(drawingId, [
589
592
  {
590
593
  constrId: constraintId,
@@ -593,6 +596,9 @@ export default class CAD {
593
596
  xOffset: xOffsetParam,
594
597
  yOffset: yOffsetParam,
595
598
  zOffset: zOffsetParam,
599
+ xRotation: xRotationParam,
600
+ yRotation: yRotationParam,
601
+ zRotation: zRotationParam,
596
602
  },
597
603
  ]);
598
604
  return constraintId;
@@ -611,6 +617,18 @@ export default class CAD {
611
617
  const xOffsetParam = { value: constr.xOffset, isExpr: typeof constr.xOffset === 'string' };
612
618
  const yOffsetParam = { value: constr.yOffset, isExpr: typeof constr.yOffset === 'string' };
613
619
  const zOffsetParam = { value: constr.zOffset, isExpr: typeof constr.zOffset === 'string' };
620
+ const xRotationParam = {
621
+ value: constr.xRotation || 0,
622
+ isExpr: typeof constr.xRotation === 'string',
623
+ };
624
+ const yRotationParam = {
625
+ value: constr.yRotation || 0,
626
+ isExpr: typeof constr.yRotation === 'string',
627
+ };
628
+ const zRotationParam = {
629
+ value: constr.zRotation || 0,
630
+ isExpr: typeof constr.zRotation === 'string',
631
+ };
614
632
  constrToAdd.push({
615
633
  constrId: rConstrId,
616
634
  mate1: {
@@ -628,6 +646,9 @@ export default class CAD {
628
646
  xOffset: xOffsetParam,
629
647
  yOffset: yOffsetParam,
630
648
  zOffset: zOffsetParam,
649
+ xRotation: xRotationParam,
650
+ yRotation: yRotationParam,
651
+ zRotation: zRotationParam,
631
652
  });
632
653
  }
633
654
  }
@@ -640,7 +661,7 @@ export default class CAD {
640
661
  }
641
662
  await assemblyBuilderAPI.updateFastenedConstraints(drawingId, constrToAdd);
642
663
  },
643
- createFastenedOriginConstraint: async (id, mate1, xOffset, yOffset, zOffset, name) => {
664
+ createFastenedOriginConstraint: async (id, mate1, xOffset, yOffset, zOffset, name, xRotation, yRotation, zRotation) => {
644
665
  const [rId, rWcs1] = await new Promise(res => this.resolve(ids => res(ids), id, mate1.wcsId));
645
666
  const rMatePath = await new Promise(res => this.resolve(paths => res(paths), ...mate1.matePath));
646
667
  const constraintId = await assemblyBuilderAPI.create3DConstraint(drawingId, rId, CCClasses.CCFastenedOriginConstraint, name);
@@ -648,6 +669,9 @@ export default class CAD {
648
669
  const xOffsetParam = { value: xOffset, isExpr: typeof xOffset === 'string' };
649
670
  const yOffsetParam = { value: yOffset, isExpr: typeof yOffset === 'string' };
650
671
  const zOffsetParam = { value: zOffset, isExpr: typeof zOffset === 'string' };
672
+ const xRotationParam = { value: xRotation || 0, isExpr: typeof xRotation === 'string' };
673
+ const yRotationParam = { value: yRotation || 0, isExpr: typeof yRotation === 'string' };
674
+ const zRotationParam = { value: zRotation || 0, isExpr: typeof zRotation === 'string' };
651
675
  await assemblyBuilderAPI.updateFastenedOriginConstraints(drawingId, [
652
676
  {
653
677
  constrId: constraintId,
@@ -655,6 +679,9 @@ export default class CAD {
655
679
  xOffset: xOffsetParam,
656
680
  yOffset: yOffsetParam,
657
681
  zOffset: zOffsetParam,
682
+ xRotation: xRotationParam,
683
+ yRotation: yRotationParam,
684
+ zRotation: zRotationParam,
658
685
  },
659
686
  ]);
660
687
  return constraintId;
@@ -672,6 +699,18 @@ export default class CAD {
672
699
  const xOffsetParam = { value: constr.xOffset, isExpr: typeof constr.xOffset === 'string' };
673
700
  const yOffsetParam = { value: constr.yOffset, isExpr: typeof constr.yOffset === 'string' };
674
701
  const zOffsetParam = { value: constr.zOffset, isExpr: typeof constr.zOffset === 'string' };
702
+ const xRotationParam = {
703
+ value: constr.xRotation || 0,
704
+ isExpr: typeof constr.xRotation === 'string',
705
+ };
706
+ const yRotationParam = {
707
+ value: constr.yRotation || 0,
708
+ isExpr: typeof constr.yRotation === 'string',
709
+ };
710
+ const zRotationParam = {
711
+ value: constr.zRotation || 0,
712
+ isExpr: typeof constr.zRotation === 'string',
713
+ };
675
714
  constraintsToAdd.push({
676
715
  constrId: rConstrId,
677
716
  mate1: {
@@ -683,6 +722,9 @@ export default class CAD {
683
722
  xOffset: xOffsetParam,
684
723
  yOffset: yOffsetParam,
685
724
  zOffset: zOffsetParam,
725
+ xRotation: xRotationParam,
726
+ yRotation: yRotationParam,
727
+ zRotation: zRotationParam,
686
728
  });
687
729
  }
688
730
  }
@@ -1404,6 +1446,9 @@ export default class CAD {
1404
1446
  xOffset: constraint.xOffset.value,
1405
1447
  yOffset: constraint.yOffset.value,
1406
1448
  zOffset: constraint.zOffset.value,
1449
+ xRotation: constraint.xRotation.value,
1450
+ yRotation: constraint.yRotation.value,
1451
+ zRotation: constraint.zRotation.value,
1407
1452
  };
1408
1453
  }
1409
1454
  return null;
@@ -1419,6 +1464,9 @@ export default class CAD {
1419
1464
  xOffset: constraint.xOffset.value,
1420
1465
  yOffset: constraint.yOffset.value,
1421
1466
  zOffset: constraint.zOffset.value,
1467
+ xRotation: constraint.xRotation.value,
1468
+ yRotation: constraint.yRotation.value,
1469
+ zRotation: constraint.zRotation.value,
1422
1470
  };
1423
1471
  }
1424
1472
  return null;
@@ -1720,10 +1768,13 @@ export default class CAD {
1720
1768
  return null;
1721
1769
  }, partId);
1722
1770
  },
1723
- setExpressions: (...expressions) => {
1724
- return this.resolve(async ([...rExpressions]) => {
1725
- const expressionsToSet = [];
1726
- rExpressions.forEach(expr => {
1771
+ setExpressions: async (...expressions) => {
1772
+ var e_13, _a;
1773
+ const expressionsToSet = [];
1774
+ try {
1775
+ for (var expressions_1 = __asyncValues(expressions), expressions_1_1; expressions_1_1 = await expressions_1.next(), !expressions_1_1.done;) {
1776
+ const expr = expressions_1_1.value;
1777
+ const [rPartId] = await new Promise(res => this.resolve(id => res(id), expr.partId));
1727
1778
  const membersToModify = [];
1728
1779
  expr.members.forEach((mem) => {
1729
1780
  const isExpr = typeof mem.value === 'string'; // TODO Expression unterscheiden von normalen Strings
@@ -1734,17 +1785,22 @@ export default class CAD {
1734
1785
  membersToModify.push({ name: mem.name, value: featureAPIParam });
1735
1786
  });
1736
1787
  // Looking for the partId given by an identifier or name
1737
- let part = expr.partId;
1788
+ let part = rPartId;
1738
1789
  if (typeof part === 'string') {
1739
- const products = asmUtils.getPartTemplate(drawingId, part);
1740
- if (products.length > 1) {
1741
- throw 'More than one product has been found for given name or ident: ' + part;
1790
+ const foundPart = baseUtils.findObject(drawingId, { ident: part, name: part });
1791
+ if (!foundPart) {
1792
+ throw 'No part found to set expressions on for given name or ident: ' + part;
1742
1793
  }
1743
- else if (products.length < 1) {
1744
- throw 'No product found for given name or ident: ' + part;
1794
+ const clazz = getDrawing(drawingId).structure.tree[foundPart].class;
1795
+ if (!baseUtils.isA(clazz, CCClasses.CCPart)) {
1796
+ throw ('The part to set expressions on given by name or ident "' +
1797
+ part +
1798
+ '" is of the wrong type "' +
1799
+ clazz +
1800
+ '". Make sure the object is a part.');
1745
1801
  }
1746
1802
  else {
1747
- part = products[0];
1803
+ part = foundPart;
1748
1804
  }
1749
1805
  }
1750
1806
  expressionsToSet.push({
@@ -1753,10 +1809,17 @@ export default class CAD {
1753
1809
  toModifyMembers: membersToModify,
1754
1810
  toDeleteList: [],
1755
1811
  });
1756
- });
1757
- const success = await featureAPI.updateExpressions(drawingId, expressionsToSet);
1758
- return success;
1759
- }, ...expressions);
1812
+ }
1813
+ }
1814
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1815
+ finally {
1816
+ try {
1817
+ if (expressions_1_1 && !expressions_1_1.done && (_a = expressions_1.return)) await _a.call(expressions_1);
1818
+ }
1819
+ finally { if (e_13) throw e_13.error; }
1820
+ }
1821
+ const success = await featureAPI.updateExpressions(drawingId, expressionsToSet);
1822
+ return success;
1760
1823
  },
1761
1824
  deleteExpressions: (partId, members) => {
1762
1825
  return this.resolve(async ([rPartId]) => {
@@ -340,6 +340,9 @@ export declare type ApiHistory = {
340
340
  * @param yOffset defines a offset in y-axis from mate1 to mate2
341
341
  * @param zOffset defines a offset in z-axis from mate1 to mate2
342
342
  * @param name name of the constraint
343
+ * @param xRotation [optional] defines a rotation of mate2 around x-axis of mate1
344
+ * @param yRotation [optional] defines a rotation of mate2 around y-axis of mate1
345
+ * @param zRotation [optional] defines a rotation of mate2 around z-axis of mate1
343
346
  * @example
344
347
  * // Defines some consts
345
348
  * const orig = { x: 0, y: 0, z: 0 }
@@ -369,12 +372,12 @@ export declare type ApiHistory = {
369
372
  * const prt2 = await api.addInstances(partTempl2, rootAsm, [orig, xDir, yDir])
370
373
  *
371
374
  * // Creates a fastened constraint between the instances
372
- * await api.createFastenedConstraint(rootAsm, { matePath: [prt1], wcsId: wcs3 }, { matePath: [prt2], wcsId: wcs2 }, 0, 0, 0, 0, 0, 'FC')
375
+ * await api.createFastenedConstraint(rootAsm, { matePath: [prt1], wcsId: wcs3 }, { matePath: [prt2], wcsId: wcs2 }, 0, 0, 0, 'FC', 0, 0, 0)
373
376
  * const geoms = await api.createBufferGeometry(rootAsm)
374
377
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
375
378
  * @return id of the fastened constraint
376
379
  */
377
- createFastenedConstraint: (id: VID, mate1: MateParam, mate2: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => Promise<ObjectID | null>;
380
+ createFastenedConstraint: (id: VID, mate1: MateParam, mate2: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string, xRotation?: number | string, yRotation?: number | string, zRotation?: number | string) => Promise<ObjectID | null>;
378
381
  /**
379
382
  * Updates multiple fastened constraints
380
383
  * @param constraints array of constraint parameter objects. See following parameter descriptions.
@@ -383,6 +386,9 @@ export declare type ApiHistory = {
383
386
  * @param xOffset defines a offset in x-axis from mate1 to mate2
384
387
  * @param yOffset defines a offset in y-axis from mate1 to mate2
385
388
  * @param zOffset defines a offset in z-axis from mate1 to mate2
389
+ * @param xRotation [optional] defines a rotation of mate2 around x-axis of mate1
390
+ * @param yRotation [optional] defines a rotation of mate2 around y-axis of mate1
391
+ * @param zRotation [optional] defines a rotation of mate2 around z-axis of mate1
386
392
  * @example // tbd
387
393
  */
388
394
  updateFastenedConstraints: (...constraints: {
@@ -392,6 +398,9 @@ export declare type ApiHistory = {
392
398
  xOffset: number | string;
393
399
  yOffset: number | string;
394
400
  zOffset: number | string;
401
+ xRotation?: number | string;
402
+ yRotation?: number | string;
403
+ zRotation?: number | string;
395
404
  }[]) => Promise<void>;
396
405
  /**
397
406
  * Creates a fastened origin constraint for mate1 to the origin (0, 0, 0).
@@ -401,6 +410,9 @@ export declare type ApiHistory = {
401
410
  * @param yOffset defines a offset in y-axis from mate1 to mate2
402
411
  * @param zOffset defines a offset in z-axis from mate1 to mate2
403
412
  * @param name name of the constraint
413
+ * @param xRotation [optional] defines a rotation of mate2 around x-axis of mate1
414
+ * @param yRotation [optional] defines a rotation of mate2 around y-axis of mate1
415
+ * @param zRotation [optional] defines a rotation of mate2 around z-axis of mate1
404
416
  * @example
405
417
  * // Defines some consts
406
418
  * const orig = { x: 0, y: 0, z: 0 }
@@ -423,13 +435,13 @@ export declare type ApiHistory = {
423
435
  * const prt = await api.addInstances(partTempl, rootAsm, [orig, xDir, yDir])
424
436
  *
425
437
  * // Creates a fastened origin constraint. The box of the part will be centered in origin
426
- * await api.createFastenedOriginConstraint(rootAsm, { matePath: [prt], wcsId: wcs2 }, 0, 0, 0, 0, 0, 'FOC')
438
+ * await api.createFastenedOriginConstraint(rootAsm, { matePath: [prt], wcsId: wcs2 }, 0, 0, 0, 'FOC', 0, 0, 0)
427
439
  *
428
440
  * const geoms = await api.createBufferGeometry(rootAsm)
429
441
  * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial({ transparent: true, opacity: 0.5 })))
430
442
  * @return id of the fastened origin constraint
431
443
  */
432
- createFastenedOriginConstraint: (id: VID, mate1: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string) => Promise<ObjectID | null>;
444
+ createFastenedOriginConstraint: (id: VID, mate1: MateParam, xOffset: number | string, yOffset: number | string, zOffset: number | string, name: string, xRotation?: number | string, yRotation?: number | string, zRotation?: number | string) => Promise<ObjectID | null>;
433
445
  /**
434
446
  * Updates multiple fastened origin constraints
435
447
  * @param constraints array of constraint parameter objects. See following descriptions.
@@ -437,6 +449,9 @@ export declare type ApiHistory = {
437
449
  * @param xOffset defines a offset in x-axis from mate1 to mate2
438
450
  * @param yOffset defines a offset in y-axis from mate1 to mate2
439
451
  * @param zOffset defines a offset in z-axis from mate1 to mate2
452
+ * @param xRotation [optional] defines a rotation of mate2 around x-axis of mate1
453
+ * @param yRotation [optional] defines a rotation of mate2 around y-axis of mate1
454
+ * @param zRotation [optional] defines a rotation of mate2 around z-axis of mate1
440
455
  * @example // tbd
441
456
  */
442
457
  updateFastenedOriginConstraints: (...constraints: {
@@ -445,6 +460,9 @@ export declare type ApiHistory = {
445
460
  xOffset: number | string;
446
461
  yOffset: number | string;
447
462
  zOffset: number | string;
463
+ xRotation?: number | string;
464
+ yRotation?: number | string;
465
+ zRotation?: number | string;
448
466
  }[]) => Promise<void>;
449
467
  /**
450
468
  * Creates a cylindrical constraint between mate1 and mate2 within an assembly.
@@ -1477,6 +1495,12 @@ export declare type FastenedOriginConstraintType = {
1477
1495
  yOffset: number | string;
1478
1496
  /** offset in z-direction */
1479
1497
  zOffset: number | string;
1498
+ /** rotation around x-axis */
1499
+ xRotation?: number | string;
1500
+ /** rotation around y-axis */
1501
+ yRotation?: number | string;
1502
+ /** rotation around z-axis */
1503
+ zRotation?: number | string;
1480
1504
  };
1481
1505
  export declare type FastenedConstraintType = {
1482
1506
  /** id of the constraint */
@@ -1491,6 +1515,12 @@ export declare type FastenedConstraintType = {
1491
1515
  yOffset: number | string;
1492
1516
  /** offset in z-direction */
1493
1517
  zOffset: number | string;
1518
+ /** rotation around x-axis */
1519
+ xRotation?: number | string;
1520
+ /** rotation around y-axis */
1521
+ yRotation?: number | string;
1522
+ /** rotation around z-axis */
1523
+ zRotation?: number | string;
1494
1524
  };
1495
1525
  export declare type RevoluteConstraintType = {
1496
1526
  /** id of the constraint */
@@ -1595,6 +1625,9 @@ export declare type ConstraintType = [
1595
1625
  ],
1596
1626
  number,
1597
1627
  number,
1628
+ number,
1629
+ number,
1630
+ number,
1598
1631
  number
1599
1632
  ];
1600
1633
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/headless",
3
- "version": "0.9.1-beta.0",
3
+ "version": "0.10.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",
@@ -32,7 +32,7 @@
32
32
  "three-stdlib": ">=2.11.0"
33
33
  },
34
34
  "dependencies": {
35
- "@buerli.io/classcad": "0.9.1-beta.0",
35
+ "@buerli.io/classcad": "0.10.0",
36
36
  "flat-promise": "^1.0.3"
37
37
  }
38
38
  }