@buerli.io/react-cad 0.8.0 → 0.9.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.
@@ -1,3 +1,3 @@
1
1
  import { DrawingID, ObjectID } from '@buerli.io/core';
2
- export declare function useFeaturesIds(drawingId: DrawingID, curNodeId: ObjectID): ObjectID[];
3
- export declare function getFeaturesIds(drawingId: DrawingID, curNodeId: ObjectID): ObjectID[];
2
+ export declare function useFeaturesIds(drawingId: DrawingID, curInstanceId: ObjectID): ObjectID[];
3
+ export declare function getFeaturesIds(drawingId: DrawingID, curInstanceId: ObjectID): ObjectID[];
@@ -5,7 +5,7 @@ import './ModelTreeHeader.css';
5
5
  * The model tree header.
6
6
  *
7
7
  * Responsibility:
8
- * - Show name of current node
8
+ * - Show name of current instance
9
9
  * - Show back button
10
10
  * - Show assembly node menu
11
11
  * - Provide convert to template functionality
@@ -1,4 +1,4 @@
1
- export { useCurrentNode } from './useCurrentNode';
1
+ export { useCurrentInstance } from './useCurrentInstance';
2
2
  export { useCurrentProduct } from './useCurrentProduct';
3
3
  export { EditMode, useEditMode } from './useEditMode';
4
4
  export { useHasPending } from './useHasPending';
@@ -0,0 +1,2 @@
1
+ import { DrawingID } from '@buerli.io/core';
2
+ export declare const useCurrentInstance: (drawingId: DrawingID) => import("@buerli.io/core").IStructureObject | undefined;
@@ -6,7 +6,7 @@ declare type ObjectDetails = {
6
6
  isAssemblyNode?: boolean;
7
7
  isRoot?: boolean;
8
8
  isCurrProd?: boolean;
9
- isCurrNode?: boolean;
9
+ isCurrInstance?: boolean;
10
10
  };
11
11
  export declare const useObjectDetails: (drawingId: DrawingID, objectId: ObjectID) => ObjectDetails;
12
12
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DrawingID } from '@buerli.io/core';
3
3
  /**
4
- * Validator for CSysDisplay component. Checks drawing and currentNode existance.
4
+ * Validator for CSysDisplay component. Checks drawing and currentInstance existance.
5
5
  *
6
6
  * @param drawingId
7
7
  * @returns
@@ -23,7 +23,7 @@ declare type Warning = {
23
23
  export declare type Warnings = Record<string, Warning | null>;
24
24
  export declare function useDrawingVerifier(drawingId: DrawingID, warnings: Warnings): void;
25
25
  export declare function useCurProductVerifier(drawingId: DrawingID, warnings: Warnings): void;
26
- export declare function useCurNodeVerifier(drawingId: DrawingID, warnings: Warnings): void;
26
+ export declare function useCurInstanceVerifier(drawingId: DrawingID, warnings: Warnings): void;
27
27
  export declare function useRootVerifier(drawingId: DrawingID, warnings: Warnings): void;
28
28
  export declare function useRootOrProdVerifier(drawingId: DrawingID, warnings: Warnings): void;
29
29
  export declare function usePluginObjVerifier(drawingId: DrawingID, pluginId: PluginID, warnings: Warnings): void;
@@ -1145,16 +1145,16 @@ const appApi = (set, get) => ({
1145
1145
  }
1146
1146
  set(state => {
1147
1147
  let res = [];
1148
- const curNode = core.api.getState().drawing.refs[drawingId].structure.currentNode;
1148
+ const curInstance = core.api.getState().drawing.refs[drawingId].structure.currentInstance;
1149
1149
  res = state.assemblyTree.prodStack;
1150
- curNode && res.push(curNode);
1150
+ curInstance && res.push(curInstance);
1151
1151
  return _objectSpread$r(_objectSpread$r({}, state), {}, {
1152
1152
  assemblyTree: {
1153
1153
  prodStack: [...res]
1154
1154
  }
1155
1155
  });
1156
1156
  });
1157
- classcad.ccAPI.assemblyBuilder.setCurrentNode(drawingId, objId).catch(console.warn);
1157
+ classcad.ccAPI.assemblyBuilder.setCurrentInstance(drawingId, objId).catch(console.warn);
1158
1158
  },
1159
1159
  goBack: drawingId => {
1160
1160
  const prodStack = get().assemblyTree.prodStack;
@@ -1171,7 +1171,7 @@ const appApi = (set, get) => ({
1171
1171
  }
1172
1172
  });
1173
1173
  });
1174
- classcad.ccAPI.assemblyBuilder.setCurrentNode(drawingId, prevProd).catch(console.warn);
1174
+ classcad.ccAPI.assemblyBuilder.setCurrentInstance(drawingId, prevProd).catch(console.warn);
1175
1175
  },
1176
1176
  clearProdStack: () => {
1177
1177
  set(state => _objectSpread$r(_objectSpread$r({}, state), {}, {
@@ -1975,21 +1975,21 @@ function useCurProductVerifier(drawingId, warnings) {
1975
1975
  warnings['currentProduct'] = null;
1976
1976
  }
1977
1977
  }
1978
- function useCurNodeVerifier(drawingId, warnings) {
1979
- const currNodeId = useDrawingCCId(drawingId, d => {
1978
+ function useCurInstanceVerifier(drawingId, warnings) {
1979
+ const currInstanceId = useDrawingCCId(drawingId, d => {
1980
1980
  var _d$structure3;
1981
- return d == null ? void 0 : (_d$structure3 = d.structure) == null ? void 0 : _d$structure3.currentNode;
1981
+ return d == null ? void 0 : (_d$structure3 = d.structure) == null ? void 0 : _d$structure3.currentInstance;
1982
1982
  });
1983
- const currNodeExists = react.useDrawing(drawingId, d => {
1983
+ const currInstanceExists = react.useDrawing(drawingId, d => {
1984
1984
  var _d$structure4;
1985
- return Boolean(d == null ? void 0 : (_d$structure4 = d.structure) == null ? void 0 : _d$structure4.tree[currNodeId]);
1985
+ return Boolean(d == null ? void 0 : (_d$structure4 = d.structure) == null ? void 0 : _d$structure4.tree[currInstanceId]);
1986
1986
  });
1987
- if (!currNodeExists) {
1988
- warnings['currentNode'] = {
1989
- caption: 'CurrentNode is not defined or corresponding object does not exist in the tree.'
1987
+ if (!currInstanceExists) {
1988
+ warnings['currentInstance'] = {
1989
+ caption: 'currentInstance is not defined or corresponding object does not exist in the tree.'
1990
1990
  };
1991
1991
  } else {
1992
- warnings['currentNode'] = null;
1992
+ warnings['currentInstance'] = null;
1993
1993
  }
1994
1994
  }
1995
1995
  function useRootVerifier(drawingId, warnings) {
@@ -7541,7 +7541,8 @@ const MergedWrapper = ({
7541
7541
  React.createElement(drei.Merged, {
7542
7542
  meshes: [cylMesh, sphereMesh, arcMesh],
7543
7543
  limit: limit,
7544
- raycast: null
7544
+ raycast: null,
7545
+ frustumCulled: false
7545
7546
  }, (Cylinder, Sphere, Arc) => /*#__PURE__*/React.createElement(InstancedGeometry, {
7546
7547
  cylinder: Cylinder,
7547
7548
  sphere: Sphere,
@@ -12294,10 +12295,10 @@ const useOverrideGeometryColor = (name, priority, values, solidIds) => {
12294
12295
  }, [addOverride, removeOverride, name, priority, values, solidIds]);
12295
12296
  };
12296
12297
 
12297
- const useCurrentNode = drawingId => {
12298
- const currNodeId = useDrawingCCId(drawingId, d => d.structure.currentNode);
12299
- const currNode = react.useDrawing(drawingId, d => d.structure.tree[currNodeId]);
12300
- return currNode;
12298
+ const useCurrentInstance = drawingId => {
12299
+ const currInstanceId = useDrawingCCId(drawingId, d => d.structure.currentInstance);
12300
+ const currInstance = react.useDrawing(drawingId, d => d.structure.tree[currInstanceId]);
12301
+ return currInstance;
12301
12302
  };
12302
12303
 
12303
12304
  const useCurrentProduct = drawingId => {
@@ -12435,7 +12436,7 @@ function useMenuItems$4(drawingId, featureId, isActive, setEditName) {
12435
12436
  const useObjectDetails = (drawingId, objectId) => {
12436
12437
  const rootId = react.useDrawing(drawingId, d => d.structure.root);
12437
12438
  const currProdId = useDrawingCCId(drawingId, d => d.structure.currentProduct);
12438
- const currNodeId = useDrawingCCId(drawingId, d => d.structure.currentNode);
12439
+ const currInstanceId = useDrawingCCId(drawingId, d => d.structure.currentInstance);
12439
12440
  return React.useMemo(() => {
12440
12441
  const drawing = core.getDrawing(drawingId);
12441
12442
  if (drawing) {
@@ -12450,20 +12451,20 @@ const useObjectDetails = (drawingId, objectId) => {
12450
12451
  const isAssembyNode = classcad.ccUtils.base.isA(objClass, classcad.CCClasses.IProductReference) || classcad.ccUtils.base.isA(objClass, classcad.CCClasses.CCAssemblyRoot);
12451
12452
  const isRoot = objectId === rootId;
12452
12453
  const isCurrProd = objectId === currProdId;
12453
- const isCurrNode = objectId === currNodeId;
12454
+ const isCurrInstance = objectId === currInstanceId;
12454
12455
  return {
12455
12456
  isPart,
12456
12457
  isAssembly,
12457
12458
  isAssembyNode,
12458
12459
  isRoot,
12459
12460
  isCurrProd,
12460
- isCurrNode,
12461
+ isCurrInstance,
12461
12462
  obj
12462
12463
  };
12463
12464
  }
12464
12465
  }
12465
12466
  return {};
12466
- }, [currNodeId, currProdId, drawingId, objectId, rootId]);
12467
+ }, [currInstanceId, currProdId, drawingId, objectId, rootId]);
12467
12468
  };
12468
12469
 
12469
12470
  const useRollbackBar = (drawingId, partId) => {
@@ -12949,6 +12950,9 @@ const HandlerIcon = styled(RadioButtonImpl)`
12949
12950
  -webkit-box-shadow: none !important;
12950
12951
  box-shadow: none !important;
12951
12952
  }
12953
+ ::before {
12954
+ display: none !important;
12955
+ }
12952
12956
  `;
12953
12957
  const HandlerRadioGroup = styled(RadioGroupImpl)`
12954
12958
  ${props => props.width && styled.css`
@@ -12959,6 +12963,15 @@ const HandlerRadioGroup = styled(RadioGroupImpl)`
12959
12963
  padding: 0px ${props => props.sidepadding || 1 - props.iconmargin}px;
12960
12964
  .ant-radio-button-wrapper {
12961
12965
  margin: ${props => props.iconmargin}px !important;
12966
+ &:hover {
12967
+ border-color: rgb(30, 144, 255);
12968
+ }
12969
+ }
12970
+ .ant-radio-button-wrapper-checked {
12971
+ border: 3px solid;
12972
+ padding: 0px !important;
12973
+ margin: ${props => props.iconmargin}px !important;
12974
+ transition: border-color 0s;
12962
12975
  }
12963
12976
  `;
12964
12977
  const HButton = _ref => {
@@ -16792,7 +16805,7 @@ const Root$9 = ({
16792
16805
  };
16793
16806
 
16794
16807
  const getMatePath = (drawingId, prRefId) => {
16795
- var _tree$currentNode$mem, _tree$currentNode$mem2;
16808
+ var _tree$currentInstance, _tree$currentInstance2;
16796
16809
  const drawing = core.getDrawing(drawingId);
16797
16810
  if (!drawing) {
16798
16811
  return [];
@@ -16809,8 +16822,8 @@ const getMatePath = (drawingId, prRefId) => {
16809
16822
  var _tree$id$members, _tree$id$members$prod;
16810
16823
  return ((_tree$id$members = tree[id].members) == null ? void 0 : (_tree$id$members$prod = _tree$id$members.productRef) == null ? void 0 : _tree$id$members$prod.value) || id;
16811
16824
  });
16812
- const currentNode = drawing.structure.currentNode;
16813
- const currentProduct = currentNode && (((_tree$currentNode$mem = tree[currentNode].members) == null ? void 0 : (_tree$currentNode$mem2 = _tree$currentNode$mem.productRef) == null ? void 0 : _tree$currentNode$mem2.value) || currentNode);
16825
+ const currentInstance = drawing.structure.currentInstance;
16826
+ const currentProduct = currentInstance && (((_tree$currentInstance = tree[currentInstance].members) == null ? void 0 : (_tree$currentInstance2 = _tree$currentInstance.productRef) == null ? void 0 : _tree$currentInstance2.value) || currentInstance);
16814
16827
  const pathLength = currentProduct && path.indexOf(currentProduct);
16815
16828
  if (pathLength && pathLength !== -1) {
16816
16829
  path.splice(pathLength);
@@ -16819,7 +16832,7 @@ const getMatePath = (drawingId, prRefId) => {
16819
16832
  };
16820
16833
 
16821
16834
  /**
16822
- * Validator for CSysDisplay component. Checks drawing and currentNode existance.
16835
+ * Validator for CSysDisplay component. Checks drawing and currentInstance existance.
16823
16836
  *
16824
16837
  * @param drawingId
16825
16838
  * @returns
@@ -16830,24 +16843,24 @@ const CSysDisplayValidator = ({
16830
16843
  }) => {
16831
16844
  const warnings = {};
16832
16845
  useDrawingVerifier(drawingId, warnings);
16833
- useCurNodeVerifier(drawingId, warnings);
16846
+ useCurInstanceVerifier(drawingId, warnings);
16834
16847
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
16835
16848
  warnings: warnings
16836
16849
  }, children);
16837
16850
  };
16838
16851
 
16839
- function useFeaturesIds(drawingId, curNodeId) {
16852
+ function useFeaturesIds(drawingId, curInstanceId) {
16840
16853
  const curClass = react.useDrawing(drawingId, d => {
16841
16854
  var _d$structure$tree$cur;
16842
- return (_d$structure$tree$cur = d.structure.tree[curNodeId]) == null ? void 0 : _d$structure$tree$cur.class;
16855
+ return (_d$structure$tree$cur = d.structure.tree[curInstanceId]) == null ? void 0 : _d$structure$tree$cur.class;
16843
16856
  }) || '';
16844
16857
  const prodId = useDrawingCCId(drawingId, d => {
16845
16858
  if (classcad.ccUtils.base.isA(curClass, classcad.CCClasses.IProductReference)) {
16846
- var _node$members;
16847
- const node = d.structure.tree[curNodeId];
16848
- return (_node$members = node.members) == null ? void 0 : _node$members.productId.value;
16859
+ var _instance$members;
16860
+ const instance = d.structure.tree[curInstanceId];
16861
+ return (_instance$members = instance.members) == null ? void 0 : _instance$members.productId.value;
16849
16862
  }
16850
- return curNodeId;
16863
+ return curInstanceId;
16851
16864
  });
16852
16865
  const opSeqId = useOperationSequence(drawingId, prodId) || NOCCID;
16853
16866
  const opSeqChildren = useDrawingArr(drawingId, d => {
@@ -16861,11 +16874,11 @@ function useFeaturesIds(drawingId, curNodeId) {
16861
16874
  });
16862
16875
  return featureIds;
16863
16876
  }
16864
- function getFeaturesIds(drawingId, curNodeId) {
16865
- var _tree$curNodeId$membe, _tree$prodId, _tree$opSeqId;
16877
+ function getFeaturesIds(drawingId, curInstanceId) {
16878
+ var _tree$curInstanceId$m, _tree$prodId, _tree$opSeqId;
16866
16879
  const tree = core.getDrawing(drawingId).structure.tree;
16867
- const curClass = tree[curNodeId].class;
16868
- const prodId = classcad.ccUtils.base.isA(curClass, classcad.CCClasses.IProductReference) ? ((_tree$curNodeId$membe = tree[curNodeId].members) == null ? void 0 : _tree$curNodeId$membe.productId.value) || NOCCID : curNodeId;
16880
+ const curClass = tree[curInstanceId].class;
16881
+ const prodId = classcad.ccUtils.base.isA(curClass, classcad.CCClasses.IProductReference) ? ((_tree$curInstanceId$m = tree[curInstanceId].members) == null ? void 0 : _tree$curInstanceId$m.productId.value) || NOCCID : curInstanceId;
16869
16882
  const prodChildren = ((_tree$prodId = tree[prodId]) == null ? void 0 : _tree$prodId.children) || [];
16870
16883
  const opSeqId = prodChildren.find(id => {
16871
16884
  var _tree$id;
@@ -16988,14 +17001,14 @@ const CSysWrapper = ({
16988
17001
  isSelected,
16989
17002
  isActive
16990
17003
  } = userData;
16991
- const currentNode = react.useDrawing(drawingId, drawing => drawing.structure.currentNode);
17004
+ const currentInstance = react.useDrawing(drawingId, drawing => drawing.structure.currentInstance);
16992
17005
  const matrix = useCsysMatrix(drawingId, csysId, flip, reoriented);
16993
17006
  const activeColor = getHighlightedColor(false, false, false, true);
16994
17007
  const onPointerMove_ = React.useCallback(() => onPointerMove && onPointerMove(csysId, matePath), [onPointerMove, matePath, csysId]);
16995
17008
  const onPointerOut_ = React.useCallback(() => onPointerOut && onPointerOut(csysId, matePath), [onPointerOut, matePath, csysId]);
16996
17009
  return /*#__PURE__*/React.createElement(react.GlobalTransform, {
16997
17010
  drawingId: drawingId,
16998
- objectId: currentNode
17011
+ objectId: currentInstance
16999
17012
  }, /*#__PURE__*/React.createElement(MatePathTransform, {
17000
17013
  drawingId: drawingId,
17001
17014
  matePath: matePath
@@ -17037,9 +17050,9 @@ const getActiveReference = (drawingId, matePath, activeRefs) => {
17037
17050
  return undefined;
17038
17051
  }
17039
17052
  const root = drawing.structure.root;
17040
- const currentNode = drawing.structure.currentNode;
17053
+ const currentInstance = drawing.structure.currentInstance;
17041
17054
  const tree = drawing.structure.tree;
17042
- const pathET = currentNode === root ? [...matePath] : [...matePath, currentNode];
17055
+ const pathET = currentInstance === root ? [...matePath] : [...matePath, currentInstance];
17043
17056
  pathET.reverse();
17044
17057
  pathET.forEach((id, idx) => {
17045
17058
  if (idx === 0) {
@@ -17080,8 +17093,8 @@ const CSysDisplayImpl = ({
17080
17093
  }) => {
17081
17094
  // If we are in part mode, the products array contains the id of the CC_Part and no product references!
17082
17095
  // TODO: Split the products array into `products` and `productRefs` in the drawing state.
17083
- const currentNode = useDrawingCCId(drawingId, drawing => drawing.structure.currentNode);
17084
- const rigidSets = useDrawingArr(drawingId, drawing => drawing.structure.tree[currentNode].children);
17096
+ const currentInstance = useDrawingCCId(drawingId, drawing => drawing.structure.currentInstance);
17097
+ const rigidSets = useDrawingArr(drawingId, drawing => drawing.structure.tree[currentInstance].children);
17085
17098
  const productIds = react.useDrawing(drawingId, drawing => drawing.structure.products);
17086
17099
  const selectors = react.useDrawing(drawingId, drawing => drawing.selection.refs);
17087
17100
  const activeSelector = react.useDrawing(drawingId, drawing => drawing.selection.active && drawing.selection.refs[drawing.selection.active]);
@@ -17093,11 +17106,11 @@ const CSysDisplayImpl = ({
17093
17106
  const prevHoveredIdRef = React.useRef(undefined);
17094
17107
  const displayTimers = React.useRef({});
17095
17108
  const activeProducts = React.useMemo(() => {
17096
- if (!currentNode || !productIds) {
17109
+ if (!currentInstance || !productIds) {
17097
17110
  return [];
17098
17111
  }
17099
- return productIds.filter(id => getAncestors(drawingId, id).indexOf(currentNode) !== -1);
17100
- }, [drawingId, currentNode, productIds]);
17112
+ return productIds.filter(id => getAncestors(drawingId, id).indexOf(currentInstance) !== -1);
17113
+ }, [drawingId, currentInstance, productIds]);
17101
17114
  React.useEffect(() => {
17102
17115
  if (prevHoveredIdRef.current !== undefined) {
17103
17116
  const prevHoveredId = prevHoveredIdRef.current;
@@ -19111,10 +19124,10 @@ function useMenuItems$2(drawingId, pluginId, prodId, setEditName) {
19111
19124
  caption: 'add',
19112
19125
  icon: /*#__PURE__*/React.createElement(icons.PlusSquareOutlined, null),
19113
19126
  callback: () => {
19114
- const curNodeId = core.getDrawing(drawingId).structure.currentNode;
19115
- classcad.ccAPI.assemblyBuilder.addNodes(drawingId, [{
19116
- referenceId: prodId,
19117
- ownerId: curNodeId,
19127
+ const curInstanceId = core.getDrawing(drawingId).structure.currentInstance;
19128
+ classcad.ccAPI.assemblyBuilder.addInstances(drawingId, [{
19129
+ productId: prodId,
19130
+ ownerId: curInstanceId,
19118
19131
  transformation: [{
19119
19132
  x: 0,
19120
19133
  y: 0,
@@ -19579,22 +19592,22 @@ const ViewImpl = ({
19579
19592
  drawingId,
19580
19593
  pluginId
19581
19594
  }) => {
19582
- const currNodeId = react.useDrawing(drawingId, d => d.structure.currentNode);
19595
+ const currInstanceId = react.useDrawing(drawingId, d => d.structure.currentInstance);
19583
19596
  const prodId = react.usePlugin(drawingId, pluginId, p => p.state.product);
19584
19597
  const [pos, setPos] = React.useState(new THREE__namespace.Vector3());
19585
19598
  const onClick = React.useCallback(e => {
19586
19599
  if (e.delta > 1) return;
19587
19600
  const run = async () => {
19588
19601
  const drawing = core.getDrawing(drawingId);
19589
- if (drawing && prodId && currNodeId && pos) {
19602
+ if (drawing && prodId && currInstanceId && pos) {
19590
19603
  const pos1 = {
19591
19604
  x: pos.x,
19592
19605
  y: pos.y,
19593
19606
  z: pos.z
19594
19607
  };
19595
- classcad.ccAPI.assemblyBuilder.addNodes(drawingId, [{
19596
- referenceId: prodId,
19597
- ownerId: currNodeId,
19608
+ classcad.ccAPI.assemblyBuilder.addInstances(drawingId, [{
19609
+ productId: prodId,
19610
+ ownerId: currInstanceId,
19598
19611
  transformation: [pos1, {
19599
19612
  x: 1,
19600
19613
  y: 0,
@@ -19608,7 +19621,7 @@ const ViewImpl = ({
19608
19621
  }
19609
19622
  };
19610
19623
  run();
19611
- }, [drawingId, prodId, currNodeId, pos]);
19624
+ }, [drawingId, prodId, currInstanceId, pos]);
19612
19625
  const onPointerMove = React.useCallback(e => {
19613
19626
  setPos(() => e.point.clone());
19614
19627
  }, []);
@@ -19911,11 +19924,20 @@ const PluginGeometryBounds = ({
19911
19924
  }
19912
19925
  case classcad.CCClasses.CCSketch:
19913
19926
  {
19914
- var _obj$members3;
19915
- const sketchBB = (_obj$members3 = obj.members) == null ? void 0 : _obj$members3.boundingBox;
19916
- const [min, max] = sketchBB.members.map(memb => convertToVector(memb));
19917
- bb_.expandByPoint(min);
19918
- bb_.expandByPoint(max);
19927
+ // consider sketch bb only if sketch geometry exists
19928
+ if (obj.children && obj.children.length > 0) {
19929
+ var _obj$members3;
19930
+ const sketchBB = (_obj$members3 = obj.members) == null ? void 0 : _obj$members3.boundingBox;
19931
+ const [min, max] = sketchBB.members.map(memb => convertToVector(memb));
19932
+ // apply sketch's transformation
19933
+ if (obj.coordinateSystem) {
19934
+ const matrix4 = core.MathUtils.convertToMatrix4(obj.coordinateSystem);
19935
+ min.applyMatrix4(matrix4);
19936
+ max.applyMatrix4(matrix4);
19937
+ }
19938
+ bb_.expandByPoint(min);
19939
+ bb_.expandByPoint(max);
19940
+ }
19919
19941
  break;
19920
19942
  }
19921
19943
  }
@@ -19995,11 +20017,11 @@ const SelectedMateObj = ({
19995
20017
  reoriented,
19996
20018
  opacity
19997
20019
  }) => {
19998
- const currentNode = react.useDrawing(drawingId, drawing => drawing.structure.currentNode);
20020
+ const currentInstance = react.useDrawing(drawingId, drawing => drawing.structure.currentInstance);
19999
20021
  const matrix = useCsysMatrix(drawingId, csysId, flip, reoriented);
20000
20022
  return /*#__PURE__*/React.createElement(react.GlobalTransform, {
20001
20023
  drawingId: drawingId,
20002
- objectId: currentNode
20024
+ objectId: currentInstance
20003
20025
  }, /*#__PURE__*/React.createElement(MatePathTransform, {
20004
20026
  drawingId: drawingId,
20005
20027
  matePath: matePath
@@ -20875,27 +20897,27 @@ const Outline = /*#__PURE__*/React.forwardRef(function Outline(_ref, forwardRef)
20875
20897
  });
20876
20898
 
20877
20899
  const useVisibleSolids = drawingId => {
20878
- const curNodeId = react.useDrawing(drawingId, d => d.structure.currentNode);
20900
+ const curInstanceId = react.useDrawing(drawingId, d => d.structure.currentInstance);
20879
20901
  const curProdId = react.useDrawing(drawingId, d => d.structure.currentProduct);
20880
20902
  const solidsIds = useDrawingArr(drawingId, d => {
20881
20903
  var _d$structure$tree$cur;
20882
20904
  return (_d$structure$tree$cur = d.structure.tree[curProdId]) == null ? void 0 : _d$structure$tree$cur.solids;
20883
20905
  });
20884
20906
 
20885
- // This useDrawing is used ONLY for reactiveness, since we don't want to react to all the tree changes, and reacting to current node's children changes should be enough
20907
+ // This useDrawing is used ONLY for reactiveness, since we don't want to react to all the tree changes, and reacting to current instance's children changes should be enough
20886
20908
  react.useDrawing(drawingId, d => {
20887
20909
  var _d$structure$tree$cur2;
20888
- return (_d$structure$tree$cur2 = d.structure.tree[curNodeId]) == null ? void 0 : _d$structure$tree$cur2.children;
20910
+ return (_d$structure$tree$cur2 = d.structure.tree[curInstanceId]) == null ? void 0 : _d$structure$tree$cur2.children;
20889
20911
  });
20890
20912
  const tree = core.getDrawing(drawingId).structure.tree;
20891
- const descendants = curNodeId ? getDescendants(tree, curNodeId) : [];
20913
+ const descendants = curInstanceId ? getDescendants(tree, curInstanceId) : [];
20892
20914
  const partDescendants = descendants.filter((id, i) => {
20893
- var _node$members, _node$members$product;
20894
- const node = tree[id];
20895
- if (node && !classcad.ccUtils.base.isA(node.class, classcad.CCClasses.IProductReference)) {
20915
+ var _instance$members, _instance$members$pro;
20916
+ const instance = tree[id];
20917
+ if (instance && !classcad.ccUtils.base.isA(instance.class, classcad.CCClasses.IProductReference)) {
20896
20918
  return false;
20897
20919
  }
20898
- const product = tree[(_node$members = node.members) == null ? void 0 : (_node$members$product = _node$members.productId) == null ? void 0 : _node$members$product.value];
20920
+ const product = tree[(_instance$members = instance.members) == null ? void 0 : (_instance$members$pro = _instance$members.productId) == null ? void 0 : _instance$members$pro.value];
20899
20921
  if (product && !classcad.ccUtils.base.isA(product.class, classcad.CCClasses.CCPart)) {
20900
20922
  return false;
20901
20923
  }
@@ -20906,9 +20928,9 @@ const useVisibleSolids = drawingId => {
20906
20928
  });
20907
20929
  let solids = [];
20908
20930
  partDescendants.forEach(id => {
20909
- var _node$members2, _node$members2$produc;
20910
- const node = tree[id];
20911
- const product = tree[(_node$members2 = node.members) == null ? void 0 : (_node$members2$produc = _node$members2.productId) == null ? void 0 : _node$members2$produc.value];
20931
+ var _instance$members2, _instance$members2$pr;
20932
+ const instance = tree[id];
20933
+ const product = tree[(_instance$members2 = instance.members) == null ? void 0 : (_instance$members2$pr = _instance$members2.productId) == null ? void 0 : _instance$members2$pr.value];
20912
20934
  const solids_ = product == null ? void 0 : product.solids;
20913
20935
  solids_ && solids.push(...solids_);
20914
20936
  });
@@ -20943,9 +20965,9 @@ const getMateRefIds = (drawingId, constrId) => {
20943
20965
  if (pRefIds.length === 0) {
20944
20966
  return;
20945
20967
  }
20946
- const curNodeId = drawing.structure.currentNode;
20947
- const curNode = tree[curNodeId];
20948
- const curRefIds = (curNode == null ? void 0 : curNode.instances) || (curNode == null ? void 0 : curNode.children) || [];
20968
+ const curInstanceId = drawing.structure.currentInstance;
20969
+ const curInstance = tree[curInstanceId];
20970
+ const curRefIds = (curInstance == null ? void 0 : curInstance.instances) || (curInstance == null ? void 0 : curInstance.children) || [];
20949
20971
  const mateRefIds = [];
20950
20972
  curRefIds.forEach(id => {
20951
20973
  var _tree$id$members, _tree$id$members$prod;
@@ -21092,10 +21114,10 @@ const Constraint = ({
21092
21114
  }, [drawingId, constraintId]);
21093
21115
  const onMouseEnter = React.useCallback(() => {
21094
21116
  const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
21095
- const curNodeId = core.getDrawing(drawingId).structure.currentNode;
21117
+ const curInstanceId = core.getDrawing(drawingId).structure.currentInstance;
21096
21118
  setHovered(core.createInfo({
21097
21119
  objectId: constraintId,
21098
- prodRefId: curNodeId
21120
+ prodRefId: curInstanceId
21099
21121
  }));
21100
21122
  }, [drawingId, constraintId]);
21101
21123
  const onMouseLeave = React.useCallback(() => {
@@ -22808,7 +22830,7 @@ const fileTypes = ['ofb', 'stp', 'stl'];
22808
22830
  * The model tree header.
22809
22831
  *
22810
22832
  * Responsibility:
22811
- * - Show name of current node
22833
+ * - Show name of current instance
22812
22834
  * - Show back button
22813
22835
  * - Show assembly node menu
22814
22836
  * - Provide convert to template functionality
@@ -22821,11 +22843,11 @@ const ModelTreeHeader = ({
22821
22843
  const pStackNotEmpty = useCADStore(s => s.assemblyTree.prodStack.length) !== 0;
22822
22844
  const mode = useEditMode(drawingId);
22823
22845
  const currProd = useCurrentProduct(drawingId);
22824
- const currNode = useCurrentNode(drawingId);
22825
- const objDetails = useObjectDetails(drawingId, (currNode == null ? void 0 : currNode.id) || NOCCID);
22846
+ const currInstance = useCurrentInstance(drawingId);
22847
+ const objDetails = useObjectDetails(drawingId, (currInstance == null ? void 0 : currInstance.id) || NOCCID);
22826
22848
  const showBackBtn = React.useMemo(() => pStackNotEmpty || !objDetails.isRoot && (objDetails.isAssemblyNode || objDetails.isAssembly), [objDetails.isAssembly, objDetails.isAssemblyNode, objDetails.isRoot, pStackNotEmpty]);
22827
22849
  const isFeatureActive = react.useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
22828
- const name = currProd ? currProd.name : currNode ? currNode.name : '';
22850
+ const name = currProd ? currProd.name : currInstance ? currInstance.name : '';
22829
22851
  const [rename, setRename] = React.useState(false);
22830
22852
  const [showNameChoice, setShowNameChoice] = React.useState(false);
22831
22853
  const enableProductManagement = React.useCallback(enabled => {
@@ -22836,7 +22858,7 @@ const ModelTreeHeader = ({
22836
22858
  drawing.api.plugin.setActiveGlobal(plugId, enabled);
22837
22859
  }
22838
22860
  }, [drawingId]);
22839
- const toExportId = (currNode == null ? void 0 : currNode.id) || (currProd == null ? void 0 : currProd.id);
22861
+ const toExportId = (currInstance == null ? void 0 : currInstance.id) || (currProd == null ? void 0 : currProd.id);
22840
22862
  const exportNode = React.useCallback((type = 'ofb') => toExportId && FileUtils.exportNode(drawingId, toExportId, type), [drawingId, toExportId]);
22841
22863
 
22842
22864
  // Disable the ProductManagement plugin on unmount
@@ -22962,10 +22984,10 @@ const ModelTreeImpl = ({
22962
22984
  drawingId
22963
22985
  }) => {
22964
22986
  const mode = useEditMode(drawingId);
22965
- const currNode = useCurrentNode(drawingId);
22987
+ const currInstance = useCurrentInstance(drawingId);
22966
22988
  const children = useDrawingArr(drawingId, d => {
22967
22989
  var _d$structure$tree;
22968
- return (_d$structure$tree = d.structure.tree[(currNode == null ? void 0 : currNode.id) || NOCCID]) == null ? void 0 : _d$structure$tree.children;
22990
+ return (_d$structure$tree = d.structure.tree[(currInstance == null ? void 0 : currInstance.id) || NOCCID]) == null ? void 0 : _d$structure$tree.children;
22969
22991
  });
22970
22992
  return /*#__PURE__*/React.createElement("div", {
22971
22993
  style: {
@@ -23374,7 +23396,7 @@ const Solid = ({
23374
23396
  const onClick = React.useCallback(e => {
23375
23397
  var _drawing$structure$tr;
23376
23398
  const drawing = core.getDrawing(drawingId);
23377
- const curNodeId = drawing.structure.currentNode;
23399
+ const curInstanceId = drawing.structure.currentInstance;
23378
23400
  const curProdId = drawing.structure.currentProduct;
23379
23401
  const selId = drawing.selection.active;
23380
23402
  if (selId) {
@@ -23405,21 +23427,21 @@ const Solid = ({
23405
23427
  objectId,
23406
23428
  graphicId: solidId,
23407
23429
  containerId: solidId,
23408
- prodRefId: isPart ? curProdId : curNodeId
23430
+ prodRefId: isPart ? curProdId : curInstanceId
23409
23431
  }), multi);
23410
23432
  }, [drawingId, solidId]);
23411
23433
  const onMouseEnter = React.useCallback(() => {
23412
23434
  var _getDrawing$structure;
23413
23435
  const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
23414
23436
  const objectId = core.getDrawing(drawingId).geometry.cache[solidId].container.ownerId;
23415
- const curNodeId = core.getDrawing(drawingId).structure.currentNode;
23437
+ const curInstanceId = core.getDrawing(drawingId).structure.currentInstance;
23416
23438
  const curProdId = core.getDrawing(drawingId).structure.currentProduct;
23417
23439
  const isPart = classcad.ccUtils.base.isA(((_getDrawing$structure = core.getDrawing(drawingId).structure.tree[curProdId]) == null ? void 0 : _getDrawing$structure.class) || '', classcad.CCClasses.CCPart);
23418
23440
  setHovered(core.createInfo({
23419
23441
  objectId,
23420
23442
  graphicId: solidId,
23421
23443
  containerId: solidId,
23422
- prodRefId: isPart ? curProdId : curNodeId
23444
+ prodRefId: isPart ? curProdId : curInstanceId
23423
23445
  }));
23424
23446
  }, [drawingId, solidId]);
23425
23447
  const onMouseLeave = React.useCallback(() => {
@@ -23662,20 +23684,20 @@ const PartModeCmds = (drawingId, rootId) => {
23662
23684
  icon: /*#__PURE__*/React.createElement(Icon, {
23663
23685
  url: img$I
23664
23686
  }),
23665
- callback: wrapper(() => featureApi.createExtrusion(drawingId, rootId))
23687
+ callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCExtrusion, 'Extrusion'))
23666
23688
  }, {
23667
23689
  label: 'Revolve',
23668
23690
  icon: /*#__PURE__*/React.createElement(Icon, {
23669
23691
  url: img$H
23670
23692
  }),
23671
- callback: wrapper(() => featureApi.createRevolve(drawingId, rootId))
23693
+ callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCRevolve, 'Revolve'))
23672
23694
  }],
23673
23695
  Boolean: {
23674
23696
  label: 'Boolean',
23675
23697
  icon: /*#__PURE__*/React.createElement(Icon, {
23676
23698
  url: img$m
23677
23699
  }),
23678
- callback: wrapper(() => featureApi.createBooleanOperation(drawingId, rootId))
23700
+ callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCUnion, 'Union'))
23679
23701
  },
23680
23702
  Slice: [{
23681
23703
  label: 'Slice',
package/build/index.js CHANGED
@@ -1122,16 +1122,16 @@ const appApi = (set, get) => ({
1122
1122
  }
1123
1123
  set(state => {
1124
1124
  let res = [];
1125
- const curNode = api.getState().drawing.refs[drawingId].structure.currentNode;
1125
+ const curInstance = api.getState().drawing.refs[drawingId].structure.currentInstance;
1126
1126
  res = state.assemblyTree.prodStack;
1127
- curNode && res.push(curNode);
1127
+ curInstance && res.push(curInstance);
1128
1128
  return _objectSpread$r(_objectSpread$r({}, state), {}, {
1129
1129
  assemblyTree: {
1130
1130
  prodStack: [...res]
1131
1131
  }
1132
1132
  });
1133
1133
  });
1134
- ccAPI.assemblyBuilder.setCurrentNode(drawingId, objId).catch(console.warn);
1134
+ ccAPI.assemblyBuilder.setCurrentInstance(drawingId, objId).catch(console.warn);
1135
1135
  },
1136
1136
  goBack: drawingId => {
1137
1137
  const prodStack = get().assemblyTree.prodStack;
@@ -1148,7 +1148,7 @@ const appApi = (set, get) => ({
1148
1148
  }
1149
1149
  });
1150
1150
  });
1151
- ccAPI.assemblyBuilder.setCurrentNode(drawingId, prevProd).catch(console.warn);
1151
+ ccAPI.assemblyBuilder.setCurrentInstance(drawingId, prevProd).catch(console.warn);
1152
1152
  },
1153
1153
  clearProdStack: () => {
1154
1154
  set(state => _objectSpread$r(_objectSpread$r({}, state), {}, {
@@ -1952,21 +1952,21 @@ function useCurProductVerifier(drawingId, warnings) {
1952
1952
  warnings['currentProduct'] = null;
1953
1953
  }
1954
1954
  }
1955
- function useCurNodeVerifier(drawingId, warnings) {
1956
- const currNodeId = useDrawingCCId(drawingId, d => {
1955
+ function useCurInstanceVerifier(drawingId, warnings) {
1956
+ const currInstanceId = useDrawingCCId(drawingId, d => {
1957
1957
  var _d$structure3;
1958
- return d == null ? void 0 : (_d$structure3 = d.structure) == null ? void 0 : _d$structure3.currentNode;
1958
+ return d == null ? void 0 : (_d$structure3 = d.structure) == null ? void 0 : _d$structure3.currentInstance;
1959
1959
  });
1960
- const currNodeExists = useDrawing(drawingId, d => {
1960
+ const currInstanceExists = useDrawing(drawingId, d => {
1961
1961
  var _d$structure4;
1962
- return Boolean(d == null ? void 0 : (_d$structure4 = d.structure) == null ? void 0 : _d$structure4.tree[currNodeId]);
1962
+ return Boolean(d == null ? void 0 : (_d$structure4 = d.structure) == null ? void 0 : _d$structure4.tree[currInstanceId]);
1963
1963
  });
1964
- if (!currNodeExists) {
1965
- warnings['currentNode'] = {
1966
- caption: 'CurrentNode is not defined or corresponding object does not exist in the tree.'
1964
+ if (!currInstanceExists) {
1965
+ warnings['currentInstance'] = {
1966
+ caption: 'currentInstance is not defined or corresponding object does not exist in the tree.'
1967
1967
  };
1968
1968
  } else {
1969
- warnings['currentNode'] = null;
1969
+ warnings['currentInstance'] = null;
1970
1970
  }
1971
1971
  }
1972
1972
  function useRootVerifier(drawingId, warnings) {
@@ -7518,7 +7518,8 @@ const MergedWrapper = ({
7518
7518
  React__default.createElement(Merged, {
7519
7519
  meshes: [cylMesh, sphereMesh, arcMesh],
7520
7520
  limit: limit,
7521
- raycast: null
7521
+ raycast: null,
7522
+ frustumCulled: false
7522
7523
  }, (Cylinder, Sphere, Arc) => /*#__PURE__*/React__default.createElement(InstancedGeometry, {
7523
7524
  cylinder: Cylinder,
7524
7525
  sphere: Sphere,
@@ -12271,10 +12272,10 @@ const useOverrideGeometryColor = (name, priority, values, solidIds) => {
12271
12272
  }, [addOverride, removeOverride, name, priority, values, solidIds]);
12272
12273
  };
12273
12274
 
12274
- const useCurrentNode = drawingId => {
12275
- const currNodeId = useDrawingCCId(drawingId, d => d.structure.currentNode);
12276
- const currNode = useDrawing(drawingId, d => d.structure.tree[currNodeId]);
12277
- return currNode;
12275
+ const useCurrentInstance = drawingId => {
12276
+ const currInstanceId = useDrawingCCId(drawingId, d => d.structure.currentInstance);
12277
+ const currInstance = useDrawing(drawingId, d => d.structure.tree[currInstanceId]);
12278
+ return currInstance;
12278
12279
  };
12279
12280
 
12280
12281
  const useCurrentProduct = drawingId => {
@@ -12412,7 +12413,7 @@ function useMenuItems$4(drawingId, featureId, isActive, setEditName) {
12412
12413
  const useObjectDetails = (drawingId, objectId) => {
12413
12414
  const rootId = useDrawing(drawingId, d => d.structure.root);
12414
12415
  const currProdId = useDrawingCCId(drawingId, d => d.structure.currentProduct);
12415
- const currNodeId = useDrawingCCId(drawingId, d => d.structure.currentNode);
12416
+ const currInstanceId = useDrawingCCId(drawingId, d => d.structure.currentInstance);
12416
12417
  return React__default.useMemo(() => {
12417
12418
  const drawing = getDrawing(drawingId);
12418
12419
  if (drawing) {
@@ -12427,20 +12428,20 @@ const useObjectDetails = (drawingId, objectId) => {
12427
12428
  const isAssembyNode = ccUtils.base.isA(objClass, CCClasses.IProductReference) || ccUtils.base.isA(objClass, CCClasses.CCAssemblyRoot);
12428
12429
  const isRoot = objectId === rootId;
12429
12430
  const isCurrProd = objectId === currProdId;
12430
- const isCurrNode = objectId === currNodeId;
12431
+ const isCurrInstance = objectId === currInstanceId;
12431
12432
  return {
12432
12433
  isPart,
12433
12434
  isAssembly,
12434
12435
  isAssembyNode,
12435
12436
  isRoot,
12436
12437
  isCurrProd,
12437
- isCurrNode,
12438
+ isCurrInstance,
12438
12439
  obj
12439
12440
  };
12440
12441
  }
12441
12442
  }
12442
12443
  return {};
12443
- }, [currNodeId, currProdId, drawingId, objectId, rootId]);
12444
+ }, [currInstanceId, currProdId, drawingId, objectId, rootId]);
12444
12445
  };
12445
12446
 
12446
12447
  const useRollbackBar = (drawingId, partId) => {
@@ -12926,6 +12927,9 @@ const HandlerIcon = styled(RadioButtonImpl)`
12926
12927
  -webkit-box-shadow: none !important;
12927
12928
  box-shadow: none !important;
12928
12929
  }
12930
+ ::before {
12931
+ display: none !important;
12932
+ }
12929
12933
  `;
12930
12934
  const HandlerRadioGroup = styled(RadioGroupImpl)`
12931
12935
  ${props => props.width && css`
@@ -12936,6 +12940,15 @@ const HandlerRadioGroup = styled(RadioGroupImpl)`
12936
12940
  padding: 0px ${props => props.sidepadding || 1 - props.iconmargin}px;
12937
12941
  .ant-radio-button-wrapper {
12938
12942
  margin: ${props => props.iconmargin}px !important;
12943
+ &:hover {
12944
+ border-color: rgb(30, 144, 255);
12945
+ }
12946
+ }
12947
+ .ant-radio-button-wrapper-checked {
12948
+ border: 3px solid;
12949
+ padding: 0px !important;
12950
+ margin: ${props => props.iconmargin}px !important;
12951
+ transition: border-color 0s;
12939
12952
  }
12940
12953
  `;
12941
12954
  const HButton = _ref => {
@@ -16769,7 +16782,7 @@ const Root$9 = ({
16769
16782
  };
16770
16783
 
16771
16784
  const getMatePath = (drawingId, prRefId) => {
16772
- var _tree$currentNode$mem, _tree$currentNode$mem2;
16785
+ var _tree$currentInstance, _tree$currentInstance2;
16773
16786
  const drawing = getDrawing(drawingId);
16774
16787
  if (!drawing) {
16775
16788
  return [];
@@ -16786,8 +16799,8 @@ const getMatePath = (drawingId, prRefId) => {
16786
16799
  var _tree$id$members, _tree$id$members$prod;
16787
16800
  return ((_tree$id$members = tree[id].members) == null ? void 0 : (_tree$id$members$prod = _tree$id$members.productRef) == null ? void 0 : _tree$id$members$prod.value) || id;
16788
16801
  });
16789
- const currentNode = drawing.structure.currentNode;
16790
- const currentProduct = currentNode && (((_tree$currentNode$mem = tree[currentNode].members) == null ? void 0 : (_tree$currentNode$mem2 = _tree$currentNode$mem.productRef) == null ? void 0 : _tree$currentNode$mem2.value) || currentNode);
16802
+ const currentInstance = drawing.structure.currentInstance;
16803
+ const currentProduct = currentInstance && (((_tree$currentInstance = tree[currentInstance].members) == null ? void 0 : (_tree$currentInstance2 = _tree$currentInstance.productRef) == null ? void 0 : _tree$currentInstance2.value) || currentInstance);
16791
16804
  const pathLength = currentProduct && path.indexOf(currentProduct);
16792
16805
  if (pathLength && pathLength !== -1) {
16793
16806
  path.splice(pathLength);
@@ -16796,7 +16809,7 @@ const getMatePath = (drawingId, prRefId) => {
16796
16809
  };
16797
16810
 
16798
16811
  /**
16799
- * Validator for CSysDisplay component. Checks drawing and currentNode existance.
16812
+ * Validator for CSysDisplay component. Checks drawing and currentInstance existance.
16800
16813
  *
16801
16814
  * @param drawingId
16802
16815
  * @returns
@@ -16807,24 +16820,24 @@ const CSysDisplayValidator = ({
16807
16820
  }) => {
16808
16821
  const warnings = {};
16809
16822
  useDrawingVerifier(drawingId, warnings);
16810
- useCurNodeVerifier(drawingId, warnings);
16823
+ useCurInstanceVerifier(drawingId, warnings);
16811
16824
  return /*#__PURE__*/React__default.createElement(ErrorBoundary, {
16812
16825
  warnings: warnings
16813
16826
  }, children);
16814
16827
  };
16815
16828
 
16816
- function useFeaturesIds(drawingId, curNodeId) {
16829
+ function useFeaturesIds(drawingId, curInstanceId) {
16817
16830
  const curClass = useDrawing(drawingId, d => {
16818
16831
  var _d$structure$tree$cur;
16819
- return (_d$structure$tree$cur = d.structure.tree[curNodeId]) == null ? void 0 : _d$structure$tree$cur.class;
16832
+ return (_d$structure$tree$cur = d.structure.tree[curInstanceId]) == null ? void 0 : _d$structure$tree$cur.class;
16820
16833
  }) || '';
16821
16834
  const prodId = useDrawingCCId(drawingId, d => {
16822
16835
  if (ccUtils.base.isA(curClass, CCClasses.IProductReference)) {
16823
- var _node$members;
16824
- const node = d.structure.tree[curNodeId];
16825
- return (_node$members = node.members) == null ? void 0 : _node$members.productId.value;
16836
+ var _instance$members;
16837
+ const instance = d.structure.tree[curInstanceId];
16838
+ return (_instance$members = instance.members) == null ? void 0 : _instance$members.productId.value;
16826
16839
  }
16827
- return curNodeId;
16840
+ return curInstanceId;
16828
16841
  });
16829
16842
  const opSeqId = useOperationSequence(drawingId, prodId) || NOCCID;
16830
16843
  const opSeqChildren = useDrawingArr(drawingId, d => {
@@ -16838,11 +16851,11 @@ function useFeaturesIds(drawingId, curNodeId) {
16838
16851
  });
16839
16852
  return featureIds;
16840
16853
  }
16841
- function getFeaturesIds(drawingId, curNodeId) {
16842
- var _tree$curNodeId$membe, _tree$prodId, _tree$opSeqId;
16854
+ function getFeaturesIds(drawingId, curInstanceId) {
16855
+ var _tree$curInstanceId$m, _tree$prodId, _tree$opSeqId;
16843
16856
  const tree = getDrawing(drawingId).structure.tree;
16844
- const curClass = tree[curNodeId].class;
16845
- const prodId = ccUtils.base.isA(curClass, CCClasses.IProductReference) ? ((_tree$curNodeId$membe = tree[curNodeId].members) == null ? void 0 : _tree$curNodeId$membe.productId.value) || NOCCID : curNodeId;
16857
+ const curClass = tree[curInstanceId].class;
16858
+ const prodId = ccUtils.base.isA(curClass, CCClasses.IProductReference) ? ((_tree$curInstanceId$m = tree[curInstanceId].members) == null ? void 0 : _tree$curInstanceId$m.productId.value) || NOCCID : curInstanceId;
16846
16859
  const prodChildren = ((_tree$prodId = tree[prodId]) == null ? void 0 : _tree$prodId.children) || [];
16847
16860
  const opSeqId = prodChildren.find(id => {
16848
16861
  var _tree$id;
@@ -16965,14 +16978,14 @@ const CSysWrapper = ({
16965
16978
  isSelected,
16966
16979
  isActive
16967
16980
  } = userData;
16968
- const currentNode = useDrawing(drawingId, drawing => drawing.structure.currentNode);
16981
+ const currentInstance = useDrawing(drawingId, drawing => drawing.structure.currentInstance);
16969
16982
  const matrix = useCsysMatrix(drawingId, csysId, flip, reoriented);
16970
16983
  const activeColor = getHighlightedColor(false, false, false, true);
16971
16984
  const onPointerMove_ = React__default.useCallback(() => onPointerMove && onPointerMove(csysId, matePath), [onPointerMove, matePath, csysId]);
16972
16985
  const onPointerOut_ = React__default.useCallback(() => onPointerOut && onPointerOut(csysId, matePath), [onPointerOut, matePath, csysId]);
16973
16986
  return /*#__PURE__*/React__default.createElement(GlobalTransform, {
16974
16987
  drawingId: drawingId,
16975
- objectId: currentNode
16988
+ objectId: currentInstance
16976
16989
  }, /*#__PURE__*/React__default.createElement(MatePathTransform, {
16977
16990
  drawingId: drawingId,
16978
16991
  matePath: matePath
@@ -17014,9 +17027,9 @@ const getActiveReference = (drawingId, matePath, activeRefs) => {
17014
17027
  return undefined;
17015
17028
  }
17016
17029
  const root = drawing.structure.root;
17017
- const currentNode = drawing.structure.currentNode;
17030
+ const currentInstance = drawing.structure.currentInstance;
17018
17031
  const tree = drawing.structure.tree;
17019
- const pathET = currentNode === root ? [...matePath] : [...matePath, currentNode];
17032
+ const pathET = currentInstance === root ? [...matePath] : [...matePath, currentInstance];
17020
17033
  pathET.reverse();
17021
17034
  pathET.forEach((id, idx) => {
17022
17035
  if (idx === 0) {
@@ -17057,8 +17070,8 @@ const CSysDisplayImpl = ({
17057
17070
  }) => {
17058
17071
  // If we are in part mode, the products array contains the id of the CC_Part and no product references!
17059
17072
  // TODO: Split the products array into `products` and `productRefs` in the drawing state.
17060
- const currentNode = useDrawingCCId(drawingId, drawing => drawing.structure.currentNode);
17061
- const rigidSets = useDrawingArr(drawingId, drawing => drawing.structure.tree[currentNode].children);
17073
+ const currentInstance = useDrawingCCId(drawingId, drawing => drawing.structure.currentInstance);
17074
+ const rigidSets = useDrawingArr(drawingId, drawing => drawing.structure.tree[currentInstance].children);
17062
17075
  const productIds = useDrawing(drawingId, drawing => drawing.structure.products);
17063
17076
  const selectors = useDrawing(drawingId, drawing => drawing.selection.refs);
17064
17077
  const activeSelector = useDrawing(drawingId, drawing => drawing.selection.active && drawing.selection.refs[drawing.selection.active]);
@@ -17070,11 +17083,11 @@ const CSysDisplayImpl = ({
17070
17083
  const prevHoveredIdRef = React__default.useRef(undefined);
17071
17084
  const displayTimers = React__default.useRef({});
17072
17085
  const activeProducts = React__default.useMemo(() => {
17073
- if (!currentNode || !productIds) {
17086
+ if (!currentInstance || !productIds) {
17074
17087
  return [];
17075
17088
  }
17076
- return productIds.filter(id => getAncestors(drawingId, id).indexOf(currentNode) !== -1);
17077
- }, [drawingId, currentNode, productIds]);
17089
+ return productIds.filter(id => getAncestors(drawingId, id).indexOf(currentInstance) !== -1);
17090
+ }, [drawingId, currentInstance, productIds]);
17078
17091
  React__default.useEffect(() => {
17079
17092
  if (prevHoveredIdRef.current !== undefined) {
17080
17093
  const prevHoveredId = prevHoveredIdRef.current;
@@ -19088,10 +19101,10 @@ function useMenuItems$2(drawingId, pluginId, prodId, setEditName) {
19088
19101
  caption: 'add',
19089
19102
  icon: /*#__PURE__*/React__default.createElement(PlusSquareOutlined, null),
19090
19103
  callback: () => {
19091
- const curNodeId = getDrawing(drawingId).structure.currentNode;
19092
- ccAPI.assemblyBuilder.addNodes(drawingId, [{
19093
- referenceId: prodId,
19094
- ownerId: curNodeId,
19104
+ const curInstanceId = getDrawing(drawingId).structure.currentInstance;
19105
+ ccAPI.assemblyBuilder.addInstances(drawingId, [{
19106
+ productId: prodId,
19107
+ ownerId: curInstanceId,
19095
19108
  transformation: [{
19096
19109
  x: 0,
19097
19110
  y: 0,
@@ -19556,22 +19569,22 @@ const ViewImpl = ({
19556
19569
  drawingId,
19557
19570
  pluginId
19558
19571
  }) => {
19559
- const currNodeId = useDrawing(drawingId, d => d.structure.currentNode);
19572
+ const currInstanceId = useDrawing(drawingId, d => d.structure.currentInstance);
19560
19573
  const prodId = usePlugin(drawingId, pluginId, p => p.state.product);
19561
19574
  const [pos, setPos] = React__default.useState(new THREE.Vector3());
19562
19575
  const onClick = React__default.useCallback(e => {
19563
19576
  if (e.delta > 1) return;
19564
19577
  const run = async () => {
19565
19578
  const drawing = getDrawing(drawingId);
19566
- if (drawing && prodId && currNodeId && pos) {
19579
+ if (drawing && prodId && currInstanceId && pos) {
19567
19580
  const pos1 = {
19568
19581
  x: pos.x,
19569
19582
  y: pos.y,
19570
19583
  z: pos.z
19571
19584
  };
19572
- ccAPI.assemblyBuilder.addNodes(drawingId, [{
19573
- referenceId: prodId,
19574
- ownerId: currNodeId,
19585
+ ccAPI.assemblyBuilder.addInstances(drawingId, [{
19586
+ productId: prodId,
19587
+ ownerId: currInstanceId,
19575
19588
  transformation: [pos1, {
19576
19589
  x: 1,
19577
19590
  y: 0,
@@ -19585,7 +19598,7 @@ const ViewImpl = ({
19585
19598
  }
19586
19599
  };
19587
19600
  run();
19588
- }, [drawingId, prodId, currNodeId, pos]);
19601
+ }, [drawingId, prodId, currInstanceId, pos]);
19589
19602
  const onPointerMove = React__default.useCallback(e => {
19590
19603
  setPos(() => e.point.clone());
19591
19604
  }, []);
@@ -19888,11 +19901,20 @@ const PluginGeometryBounds = ({
19888
19901
  }
19889
19902
  case CCClasses.CCSketch:
19890
19903
  {
19891
- var _obj$members3;
19892
- const sketchBB = (_obj$members3 = obj.members) == null ? void 0 : _obj$members3.boundingBox;
19893
- const [min, max] = sketchBB.members.map(memb => convertToVector(memb));
19894
- bb_.expandByPoint(min);
19895
- bb_.expandByPoint(max);
19904
+ // consider sketch bb only if sketch geometry exists
19905
+ if (obj.children && obj.children.length > 0) {
19906
+ var _obj$members3;
19907
+ const sketchBB = (_obj$members3 = obj.members) == null ? void 0 : _obj$members3.boundingBox;
19908
+ const [min, max] = sketchBB.members.map(memb => convertToVector(memb));
19909
+ // apply sketch's transformation
19910
+ if (obj.coordinateSystem) {
19911
+ const matrix4 = MathUtils.convertToMatrix4(obj.coordinateSystem);
19912
+ min.applyMatrix4(matrix4);
19913
+ max.applyMatrix4(matrix4);
19914
+ }
19915
+ bb_.expandByPoint(min);
19916
+ bb_.expandByPoint(max);
19917
+ }
19896
19918
  break;
19897
19919
  }
19898
19920
  }
@@ -19972,11 +19994,11 @@ const SelectedMateObj = ({
19972
19994
  reoriented,
19973
19995
  opacity
19974
19996
  }) => {
19975
- const currentNode = useDrawing(drawingId, drawing => drawing.structure.currentNode);
19997
+ const currentInstance = useDrawing(drawingId, drawing => drawing.structure.currentInstance);
19976
19998
  const matrix = useCsysMatrix(drawingId, csysId, flip, reoriented);
19977
19999
  return /*#__PURE__*/React__default.createElement(GlobalTransform, {
19978
20000
  drawingId: drawingId,
19979
- objectId: currentNode
20001
+ objectId: currentInstance
19980
20002
  }, /*#__PURE__*/React__default.createElement(MatePathTransform, {
19981
20003
  drawingId: drawingId,
19982
20004
  matePath: matePath
@@ -20852,27 +20874,27 @@ const Outline = /*#__PURE__*/React__default.forwardRef(function Outline(_ref, fo
20852
20874
  });
20853
20875
 
20854
20876
  const useVisibleSolids = drawingId => {
20855
- const curNodeId = useDrawing(drawingId, d => d.structure.currentNode);
20877
+ const curInstanceId = useDrawing(drawingId, d => d.structure.currentInstance);
20856
20878
  const curProdId = useDrawing(drawingId, d => d.structure.currentProduct);
20857
20879
  const solidsIds = useDrawingArr(drawingId, d => {
20858
20880
  var _d$structure$tree$cur;
20859
20881
  return (_d$structure$tree$cur = d.structure.tree[curProdId]) == null ? void 0 : _d$structure$tree$cur.solids;
20860
20882
  });
20861
20883
 
20862
- // This useDrawing is used ONLY for reactiveness, since we don't want to react to all the tree changes, and reacting to current node's children changes should be enough
20884
+ // This useDrawing is used ONLY for reactiveness, since we don't want to react to all the tree changes, and reacting to current instance's children changes should be enough
20863
20885
  useDrawing(drawingId, d => {
20864
20886
  var _d$structure$tree$cur2;
20865
- return (_d$structure$tree$cur2 = d.structure.tree[curNodeId]) == null ? void 0 : _d$structure$tree$cur2.children;
20887
+ return (_d$structure$tree$cur2 = d.structure.tree[curInstanceId]) == null ? void 0 : _d$structure$tree$cur2.children;
20866
20888
  });
20867
20889
  const tree = getDrawing(drawingId).structure.tree;
20868
- const descendants = curNodeId ? getDescendants(tree, curNodeId) : [];
20890
+ const descendants = curInstanceId ? getDescendants(tree, curInstanceId) : [];
20869
20891
  const partDescendants = descendants.filter((id, i) => {
20870
- var _node$members, _node$members$product;
20871
- const node = tree[id];
20872
- if (node && !ccUtils.base.isA(node.class, CCClasses.IProductReference)) {
20892
+ var _instance$members, _instance$members$pro;
20893
+ const instance = tree[id];
20894
+ if (instance && !ccUtils.base.isA(instance.class, CCClasses.IProductReference)) {
20873
20895
  return false;
20874
20896
  }
20875
- const product = tree[(_node$members = node.members) == null ? void 0 : (_node$members$product = _node$members.productId) == null ? void 0 : _node$members$product.value];
20897
+ const product = tree[(_instance$members = instance.members) == null ? void 0 : (_instance$members$pro = _instance$members.productId) == null ? void 0 : _instance$members$pro.value];
20876
20898
  if (product && !ccUtils.base.isA(product.class, CCClasses.CCPart)) {
20877
20899
  return false;
20878
20900
  }
@@ -20883,9 +20905,9 @@ const useVisibleSolids = drawingId => {
20883
20905
  });
20884
20906
  let solids = [];
20885
20907
  partDescendants.forEach(id => {
20886
- var _node$members2, _node$members2$produc;
20887
- const node = tree[id];
20888
- const product = tree[(_node$members2 = node.members) == null ? void 0 : (_node$members2$produc = _node$members2.productId) == null ? void 0 : _node$members2$produc.value];
20908
+ var _instance$members2, _instance$members2$pr;
20909
+ const instance = tree[id];
20910
+ const product = tree[(_instance$members2 = instance.members) == null ? void 0 : (_instance$members2$pr = _instance$members2.productId) == null ? void 0 : _instance$members2$pr.value];
20889
20911
  const solids_ = product == null ? void 0 : product.solids;
20890
20912
  solids_ && solids.push(...solids_);
20891
20913
  });
@@ -20920,9 +20942,9 @@ const getMateRefIds = (drawingId, constrId) => {
20920
20942
  if (pRefIds.length === 0) {
20921
20943
  return;
20922
20944
  }
20923
- const curNodeId = drawing.structure.currentNode;
20924
- const curNode = tree[curNodeId];
20925
- const curRefIds = (curNode == null ? void 0 : curNode.instances) || (curNode == null ? void 0 : curNode.children) || [];
20945
+ const curInstanceId = drawing.structure.currentInstance;
20946
+ const curInstance = tree[curInstanceId];
20947
+ const curRefIds = (curInstance == null ? void 0 : curInstance.instances) || (curInstance == null ? void 0 : curInstance.children) || [];
20926
20948
  const mateRefIds = [];
20927
20949
  curRefIds.forEach(id => {
20928
20950
  var _tree$id$members, _tree$id$members$prod;
@@ -21069,10 +21091,10 @@ const Constraint = ({
21069
21091
  }, [drawingId, constraintId]);
21070
21092
  const onMouseEnter = React__default.useCallback(() => {
21071
21093
  const setHovered = getDrawing(drawingId).api.interaction.setHovered;
21072
- const curNodeId = getDrawing(drawingId).structure.currentNode;
21094
+ const curInstanceId = getDrawing(drawingId).structure.currentInstance;
21073
21095
  setHovered(createInfo({
21074
21096
  objectId: constraintId,
21075
- prodRefId: curNodeId
21097
+ prodRefId: curInstanceId
21076
21098
  }));
21077
21099
  }, [drawingId, constraintId]);
21078
21100
  const onMouseLeave = React__default.useCallback(() => {
@@ -22785,7 +22807,7 @@ const fileTypes = ['ofb', 'stp', 'stl'];
22785
22807
  * The model tree header.
22786
22808
  *
22787
22809
  * Responsibility:
22788
- * - Show name of current node
22810
+ * - Show name of current instance
22789
22811
  * - Show back button
22790
22812
  * - Show assembly node menu
22791
22813
  * - Provide convert to template functionality
@@ -22798,11 +22820,11 @@ const ModelTreeHeader = ({
22798
22820
  const pStackNotEmpty = useCADStore(s => s.assemblyTree.prodStack.length) !== 0;
22799
22821
  const mode = useEditMode(drawingId);
22800
22822
  const currProd = useCurrentProduct(drawingId);
22801
- const currNode = useCurrentNode(drawingId);
22802
- const objDetails = useObjectDetails(drawingId, (currNode == null ? void 0 : currNode.id) || NOCCID);
22823
+ const currInstance = useCurrentInstance(drawingId);
22824
+ const objDetails = useObjectDetails(drawingId, (currInstance == null ? void 0 : currInstance.id) || NOCCID);
22803
22825
  const showBackBtn = React__default.useMemo(() => pStackNotEmpty || !objDetails.isRoot && (objDetails.isAssemblyNode || objDetails.isAssembly), [objDetails.isAssembly, objDetails.isAssemblyNode, objDetails.isRoot, pStackNotEmpty]);
22804
22826
  const isFeatureActive = useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
22805
- const name = currProd ? currProd.name : currNode ? currNode.name : '';
22827
+ const name = currProd ? currProd.name : currInstance ? currInstance.name : '';
22806
22828
  const [rename, setRename] = React__default.useState(false);
22807
22829
  const [showNameChoice, setShowNameChoice] = React__default.useState(false);
22808
22830
  const enableProductManagement = React__default.useCallback(enabled => {
@@ -22813,7 +22835,7 @@ const ModelTreeHeader = ({
22813
22835
  drawing.api.plugin.setActiveGlobal(plugId, enabled);
22814
22836
  }
22815
22837
  }, [drawingId]);
22816
- const toExportId = (currNode == null ? void 0 : currNode.id) || (currProd == null ? void 0 : currProd.id);
22838
+ const toExportId = (currInstance == null ? void 0 : currInstance.id) || (currProd == null ? void 0 : currProd.id);
22817
22839
  const exportNode = React__default.useCallback((type = 'ofb') => toExportId && FileUtils.exportNode(drawingId, toExportId, type), [drawingId, toExportId]);
22818
22840
 
22819
22841
  // Disable the ProductManagement plugin on unmount
@@ -22939,10 +22961,10 @@ const ModelTreeImpl = ({
22939
22961
  drawingId
22940
22962
  }) => {
22941
22963
  const mode = useEditMode(drawingId);
22942
- const currNode = useCurrentNode(drawingId);
22964
+ const currInstance = useCurrentInstance(drawingId);
22943
22965
  const children = useDrawingArr(drawingId, d => {
22944
22966
  var _d$structure$tree;
22945
- return (_d$structure$tree = d.structure.tree[(currNode == null ? void 0 : currNode.id) || NOCCID]) == null ? void 0 : _d$structure$tree.children;
22967
+ return (_d$structure$tree = d.structure.tree[(currInstance == null ? void 0 : currInstance.id) || NOCCID]) == null ? void 0 : _d$structure$tree.children;
22946
22968
  });
22947
22969
  return /*#__PURE__*/React__default.createElement("div", {
22948
22970
  style: {
@@ -23351,7 +23373,7 @@ const Solid = ({
23351
23373
  const onClick = React__default.useCallback(e => {
23352
23374
  var _drawing$structure$tr;
23353
23375
  const drawing = getDrawing(drawingId);
23354
- const curNodeId = drawing.structure.currentNode;
23376
+ const curInstanceId = drawing.structure.currentInstance;
23355
23377
  const curProdId = drawing.structure.currentProduct;
23356
23378
  const selId = drawing.selection.active;
23357
23379
  if (selId) {
@@ -23382,21 +23404,21 @@ const Solid = ({
23382
23404
  objectId,
23383
23405
  graphicId: solidId,
23384
23406
  containerId: solidId,
23385
- prodRefId: isPart ? curProdId : curNodeId
23407
+ prodRefId: isPart ? curProdId : curInstanceId
23386
23408
  }), multi);
23387
23409
  }, [drawingId, solidId]);
23388
23410
  const onMouseEnter = React__default.useCallback(() => {
23389
23411
  var _getDrawing$structure;
23390
23412
  const setHovered = getDrawing(drawingId).api.interaction.setHovered;
23391
23413
  const objectId = getDrawing(drawingId).geometry.cache[solidId].container.ownerId;
23392
- const curNodeId = getDrawing(drawingId).structure.currentNode;
23414
+ const curInstanceId = getDrawing(drawingId).structure.currentInstance;
23393
23415
  const curProdId = getDrawing(drawingId).structure.currentProduct;
23394
23416
  const isPart = ccUtils.base.isA(((_getDrawing$structure = getDrawing(drawingId).structure.tree[curProdId]) == null ? void 0 : _getDrawing$structure.class) || '', CCClasses.CCPart);
23395
23417
  setHovered(createInfo({
23396
23418
  objectId,
23397
23419
  graphicId: solidId,
23398
23420
  containerId: solidId,
23399
- prodRefId: isPart ? curProdId : curNodeId
23421
+ prodRefId: isPart ? curProdId : curInstanceId
23400
23422
  }));
23401
23423
  }, [drawingId, solidId]);
23402
23424
  const onMouseLeave = React__default.useCallback(() => {
@@ -23639,20 +23661,20 @@ const PartModeCmds = (drawingId, rootId) => {
23639
23661
  icon: /*#__PURE__*/React__default.createElement(Icon, {
23640
23662
  url: img$I
23641
23663
  }),
23642
- callback: wrapper(() => featureApi.createExtrusion(drawingId, rootId))
23664
+ callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCExtrusion, 'Extrusion'))
23643
23665
  }, {
23644
23666
  label: 'Revolve',
23645
23667
  icon: /*#__PURE__*/React__default.createElement(Icon, {
23646
23668
  url: img$H
23647
23669
  }),
23648
- callback: wrapper(() => featureApi.createRevolve(drawingId, rootId))
23670
+ callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCRevolve, 'Revolve'))
23649
23671
  }],
23650
23672
  Boolean: {
23651
23673
  label: 'Boolean',
23652
23674
  icon: /*#__PURE__*/React__default.createElement(Icon, {
23653
23675
  url: img$m
23654
23676
  }),
23655
- callback: wrapper(() => featureApi.createBooleanOperation(drawingId, rootId))
23677
+ callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCUnion, 'Union'))
23656
23678
  },
23657
23679
  Slice: [{
23658
23680
  label: 'Slice',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/react-cad",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "buerli CAD components",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "repository": {},
@@ -91,8 +91,8 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "@ant-design/compatible": "^1.0.8",
94
- "@buerli.io/classcad": "0.8.0",
95
- "@buerli.io/react": "0.8.0",
94
+ "@buerli.io/classcad": "0.9.0",
95
+ "@buerli.io/react": "0.9.0",
96
96
  "@react-three/postprocessing": "2.14.9",
97
97
  "antd": "^4.23.4",
98
98
  "path-browserify": "^1.0.1",
@@ -1,2 +0,0 @@
1
- import { DrawingID } from '@buerli.io/core';
2
- export declare const useCurrentNode: (drawingId: DrawingID) => import("@buerli.io/core").IStructureObject | undefined;