@buerli.io/react-cad 0.0.23-beta.4 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs.js +208 -180
- package/build/index.js +209 -181
- package/build/plugins/Sketch/types.d.ts +0 -1
- package/build/utils/defaultValues.d.ts +3 -0
- package/build/utils/drawing/index.d.ts +3 -0
- package/build/utils/drawing/useDrawingArr.d.ts +2 -0
- package/build/utils/drawing/useDrawingCCId.d.ts +2 -0
- package/build/utils/drawing/useDrawingStr.d.ts +2 -0
- package/package.json +3 -3
package/build/index.cjs.js
CHANGED
|
@@ -1667,6 +1667,25 @@ class ErrorBoundary extends React.Component {
|
|
|
1667
1667
|
|
|
1668
1668
|
}
|
|
1669
1669
|
|
|
1670
|
+
const EMPTYARRAY = [];
|
|
1671
|
+
const NOCCID = Number.MIN_SAFE_INTEGER;
|
|
1672
|
+
const EMPTYSTR = '';
|
|
1673
|
+
|
|
1674
|
+
function useDrawingArr(drawingId, selector) {
|
|
1675
|
+
const res = react.useDrawing(drawingId, selector);
|
|
1676
|
+
return res || EMPTYARRAY;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
function useDrawingCCId(drawingId, selector) {
|
|
1680
|
+
const res = react.useDrawing(drawingId, selector);
|
|
1681
|
+
return res || NOCCID;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
function useDrawingStr(drawingId, selector) {
|
|
1685
|
+
const res = react.useDrawing(drawingId, selector);
|
|
1686
|
+
return res || EMPTYSTR;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1670
1689
|
/**
|
|
1671
1690
|
* !!! Important !!!
|
|
1672
1691
|
*
|
|
@@ -1702,11 +1721,11 @@ function useDrawingVerifier(drawingId, warnings) {
|
|
|
1702
1721
|
}
|
|
1703
1722
|
}
|
|
1704
1723
|
function useCurProductVerifier(drawingId, warnings) {
|
|
1705
|
-
const currProdId =
|
|
1724
|
+
const currProdId = useDrawingCCId(drawingId, d => {
|
|
1706
1725
|
var _d$structure;
|
|
1707
1726
|
|
|
1708
1727
|
return d == null ? void 0 : (_d$structure = d.structure) == null ? void 0 : _d$structure.currentProduct;
|
|
1709
|
-
})
|
|
1728
|
+
});
|
|
1710
1729
|
const currProdExists = react.useDrawing(drawingId, d => {
|
|
1711
1730
|
var _d$structure2, _d$structure2$tree$cu;
|
|
1712
1731
|
|
|
@@ -1722,11 +1741,11 @@ function useCurProductVerifier(drawingId, warnings) {
|
|
|
1722
1741
|
}
|
|
1723
1742
|
}
|
|
1724
1743
|
function useCurNodeVerifier(drawingId, warnings) {
|
|
1725
|
-
const currNodeId =
|
|
1744
|
+
const currNodeId = useDrawingCCId(drawingId, d => {
|
|
1726
1745
|
var _d$structure3;
|
|
1727
1746
|
|
|
1728
1747
|
return d == null ? void 0 : (_d$structure3 = d.structure) == null ? void 0 : _d$structure3.currentNode;
|
|
1729
|
-
})
|
|
1748
|
+
});
|
|
1730
1749
|
const currNodeExists = react.useDrawing(drawingId, d => {
|
|
1731
1750
|
var _d$structure4;
|
|
1732
1751
|
|
|
@@ -1742,11 +1761,11 @@ function useCurNodeVerifier(drawingId, warnings) {
|
|
|
1742
1761
|
}
|
|
1743
1762
|
}
|
|
1744
1763
|
function useRootVerifier(drawingId, warnings) {
|
|
1745
|
-
const rootId =
|
|
1764
|
+
const rootId = useDrawingCCId(drawingId, d => {
|
|
1746
1765
|
var _d$structure5;
|
|
1747
1766
|
|
|
1748
1767
|
return d == null ? void 0 : (_d$structure5 = d.structure) == null ? void 0 : _d$structure5.root;
|
|
1749
|
-
})
|
|
1768
|
+
});
|
|
1750
1769
|
const rootExists = react.useDrawing(drawingId, d => {
|
|
1751
1770
|
var _d$structure6;
|
|
1752
1771
|
|
|
@@ -1762,21 +1781,21 @@ function useRootVerifier(drawingId, warnings) {
|
|
|
1762
1781
|
}
|
|
1763
1782
|
}
|
|
1764
1783
|
function useRootOrProdVerifier(drawingId, warnings) {
|
|
1765
|
-
const rootId =
|
|
1784
|
+
const rootId = useDrawingCCId(drawingId, d => {
|
|
1766
1785
|
var _d$structure7;
|
|
1767
1786
|
|
|
1768
1787
|
return d == null ? void 0 : (_d$structure7 = d.structure) == null ? void 0 : _d$structure7.root;
|
|
1769
|
-
})
|
|
1788
|
+
});
|
|
1770
1789
|
const rootExists = react.useDrawing(drawingId, d => {
|
|
1771
1790
|
var _d$structure8;
|
|
1772
1791
|
|
|
1773
1792
|
return Boolean(d == null ? void 0 : (_d$structure8 = d.structure) == null ? void 0 : _d$structure8.tree[rootId]);
|
|
1774
1793
|
});
|
|
1775
|
-
const currProdId =
|
|
1794
|
+
const currProdId = useDrawingCCId(drawingId, d => {
|
|
1776
1795
|
var _d$structure9;
|
|
1777
1796
|
|
|
1778
1797
|
return d == null ? void 0 : (_d$structure9 = d.structure) == null ? void 0 : _d$structure9.currentProduct;
|
|
1779
|
-
})
|
|
1798
|
+
});
|
|
1780
1799
|
const currProdExists = react.useDrawing(drawingId, d => {
|
|
1781
1800
|
var _d$structure10, _d$structure10$tree$c;
|
|
1782
1801
|
|
|
@@ -1792,11 +1811,11 @@ function useRootOrProdVerifier(drawingId, warnings) {
|
|
|
1792
1811
|
}
|
|
1793
1812
|
}
|
|
1794
1813
|
function usePluginObjVerifier(drawingId, pluginId, warnings) {
|
|
1795
|
-
const objectId = react.usePlugin(drawingId, pluginId, p => p == null ? void 0 : p.objectId);
|
|
1814
|
+
const objectId = react.usePlugin(drawingId, pluginId, p => p == null ? void 0 : p.objectId) || NOCCID;
|
|
1796
1815
|
const objectExists = react.useDrawing(drawingId, d => {
|
|
1797
1816
|
var _d$structure11;
|
|
1798
1817
|
|
|
1799
|
-
return Boolean(d == null ? void 0 : (_d$structure11 = d.structure) == null ? void 0 : _d$structure11.tree[objectId
|
|
1818
|
+
return Boolean(d == null ? void 0 : (_d$structure11 = d.structure) == null ? void 0 : _d$structure11.tree[objectId]);
|
|
1800
1819
|
});
|
|
1801
1820
|
|
|
1802
1821
|
if (!objectExists) {
|
|
@@ -1809,7 +1828,7 @@ function usePluginObjVerifier(drawingId, pluginId, warnings) {
|
|
|
1809
1828
|
}
|
|
1810
1829
|
function usePartAndAssemblyContVerifier(drawingId, warnings) {
|
|
1811
1830
|
// <<< Code below is a copypaste from `useAllObjects` hook. Check comment in the beginnig of the file.
|
|
1812
|
-
const root =
|
|
1831
|
+
const root = useDrawingCCId(drawingId, d => {
|
|
1813
1832
|
var _d$structure12;
|
|
1814
1833
|
|
|
1815
1834
|
return d == null ? void 0 : (_d$structure12 = d.structure) == null ? void 0 : _d$structure12.root;
|
|
@@ -1817,7 +1836,7 @@ function usePartAndAssemblyContVerifier(drawingId, warnings) {
|
|
|
1817
1836
|
const rootExists = react.useDrawing(drawingId, d => {
|
|
1818
1837
|
var _d$structure13;
|
|
1819
1838
|
|
|
1820
|
-
return Boolean(d == null ? void 0 : (_d$structure13 = d.structure) == null ? void 0 : _d$structure13.tree[root
|
|
1839
|
+
return Boolean(d == null ? void 0 : (_d$structure13 = d.structure) == null ? void 0 : _d$structure13.tree[root]);
|
|
1821
1840
|
});
|
|
1822
1841
|
const allObjId = React.useMemo(() => {
|
|
1823
1842
|
const drawing = core.getDrawing(drawingId);
|
|
@@ -1850,7 +1869,7 @@ function usePartAndAssemblyContVerifier(drawingId, warnings) {
|
|
|
1850
1869
|
var _getDrawing, _getDrawing$structure, _getDrawing$structure2;
|
|
1851
1870
|
|
|
1852
1871
|
return ((_getDrawing = core.getDrawing(drawingId)) == null ? void 0 : (_getDrawing$structure = _getDrawing.structure) == null ? void 0 : (_getDrawing$structure2 = _getDrawing$structure.tree[id]) == null ? void 0 : _getDrawing$structure2.class) === classcad.CCClasses.CCPartContainer;
|
|
1853
|
-
}) ||
|
|
1872
|
+
}) || NOCCID;
|
|
1854
1873
|
const partContExists = react.useDrawing(drawingId, d => {
|
|
1855
1874
|
var _d$structure15;
|
|
1856
1875
|
|
|
@@ -1860,7 +1879,7 @@ function usePartAndAssemblyContVerifier(drawingId, warnings) {
|
|
|
1860
1879
|
var _getDrawing$structure3, _getDrawing$structure4;
|
|
1861
1880
|
|
|
1862
1881
|
return ((_getDrawing$structure3 = core.getDrawing(drawingId).structure) == null ? void 0 : (_getDrawing$structure4 = _getDrawing$structure3.tree[id]) == null ? void 0 : _getDrawing$structure4.class) === classcad.CCClasses.CCAssemblyContainer;
|
|
1863
|
-
}) ||
|
|
1882
|
+
}) || NOCCID;
|
|
1864
1883
|
const asmContExists = react.useDrawing(drawingId, d => {
|
|
1865
1884
|
var _d$structure16;
|
|
1866
1885
|
|
|
@@ -1876,16 +1895,16 @@ function usePartAndAssemblyContVerifier(drawingId, warnings) {
|
|
|
1876
1895
|
}
|
|
1877
1896
|
}
|
|
1878
1897
|
function useExprSetVerifier(drawingId, warnings) {
|
|
1879
|
-
const productId =
|
|
1898
|
+
const productId = useDrawingCCId(drawingId, d => {
|
|
1880
1899
|
var _d$structure17;
|
|
1881
1900
|
|
|
1882
1901
|
return d == null ? void 0 : (_d$structure17 = d.structure) == null ? void 0 : _d$structure17.currentProduct;
|
|
1883
|
-
})
|
|
1884
|
-
const exprSetId =
|
|
1902
|
+
});
|
|
1903
|
+
const exprSetId = useDrawingCCId(drawingId, d => {
|
|
1885
1904
|
var _d$structure18, _d$structure18$tree$p;
|
|
1886
1905
|
|
|
1887
1906
|
return d == null ? void 0 : (_d$structure18 = d.structure) == null ? void 0 : (_d$structure18$tree$p = _d$structure18.tree[productId]) == null ? void 0 : _d$structure18$tree$p.expressionSet;
|
|
1888
|
-
})
|
|
1907
|
+
});
|
|
1889
1908
|
const exprSetExists = react.useDrawing(drawingId, d => {
|
|
1890
1909
|
var _d$structure19;
|
|
1891
1910
|
|
|
@@ -2112,7 +2131,7 @@ function _objectSpread$j(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
2112
2131
|
const MateScope = 'HLConstraintScope';
|
|
2113
2132
|
const createMateItem = (matePath, csys, flip, reoriented) => {
|
|
2114
2133
|
return {
|
|
2115
|
-
id: `Mate|${matePath.toString()}|${csys.id}`,
|
|
2134
|
+
id: `Mate|${matePath.toString()}|${csys.id}|(${flip},${reoriented})`,
|
|
2116
2135
|
scope: MateScope,
|
|
2117
2136
|
data: {
|
|
2118
2137
|
matePath,
|
|
@@ -2906,24 +2925,15 @@ const MateEditor = ({
|
|
|
2906
2925
|
defaults
|
|
2907
2926
|
} = param;
|
|
2908
2927
|
const [matePath, csysId, flipState, reorientedState] = userValue;
|
|
2928
|
+
const isSelected = matePath !== undefined && csysId !== undefined;
|
|
2909
2929
|
const [selectorId, setSelectorId] = React.useState();
|
|
2910
|
-
const
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
const
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
const reorientedState_ = selectedItem == null ? void 0 : selectedItem.data.reoriented;
|
|
2918
|
-
|
|
2919
|
-
if (matePath_ && csysId_) {
|
|
2920
|
-
setUserValue([matePath_, csysId_, flipState_, reorientedState_]);
|
|
2921
|
-
|
|
2922
|
-
if (selectorId !== undefined) {
|
|
2923
|
-
selectorsOrder ? selectorsOrder.switchToNext(selectorId) : core.getDrawing(drawingId).api.selection.activateSelector(null);
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
}, [setUserValue, selectedItem, drawingId, selectorsOrder, selectorId]); // Update the selected item with changed flip / reoriented value(s)
|
|
2930
|
+
const setMateParam = React.useCallback(selItem => {
|
|
2931
|
+
const matePath_ = selItem == null ? void 0 : selItem.data.matePath;
|
|
2932
|
+
const csysId_ = selItem == null ? void 0 : selItem.data.csys.id;
|
|
2933
|
+
const flipState_ = (selItem == null ? void 0 : selItem.data.flip) !== undefined ? selItem == null ? void 0 : selItem.data.flip : classcad.FlipType.FLIP_Z;
|
|
2934
|
+
const reorientedState_ = (selItem == null ? void 0 : selItem.data.reoriented) !== undefined ? selItem == null ? void 0 : selItem.data.reoriented : classcad.ReorientedType.REORIENTED_0;
|
|
2935
|
+
setUserValue([matePath_, csysId_, flipState_, reorientedState_]);
|
|
2936
|
+
}, [setUserValue]); // Update the selected item with changed flip / reoriented value(s)
|
|
2927
2937
|
// TODO: Don't store flip / reoriented states inside the selector state at all?
|
|
2928
2938
|
|
|
2929
2939
|
const setOrientation = React.useCallback(({
|
|
@@ -2936,11 +2946,9 @@ const MateEditor = ({
|
|
|
2936
2946
|
const flip_ = flip !== undefined ? flip : selMate.data.flip;
|
|
2937
2947
|
const reoriented_ = reoriented !== undefined ? reoriented : selMate.data.reoriented;
|
|
2938
2948
|
const newItem = createMateItem(selMate.data.matePath, selMate.data.csys, flip_, reoriented_);
|
|
2939
|
-
|
|
2940
|
-
const selectionActions = core.getDrawing(drawingId).api.selection;
|
|
2941
|
-
selectionActions.setItems(selectorId, [newItem]);
|
|
2949
|
+
setMateParam(newItem);
|
|
2942
2950
|
}
|
|
2943
|
-
}, [drawingId, selectorId]);
|
|
2951
|
+
}, [drawingId, setMateParam, selectorId]);
|
|
2944
2952
|
const setFlip = React.useCallback(value => {
|
|
2945
2953
|
setOrientation({
|
|
2946
2954
|
flip: value
|
|
@@ -2970,15 +2978,25 @@ const MateEditor = ({
|
|
|
2970
2978
|
React.useEffect(() => {
|
|
2971
2979
|
setValidateF(validatorWrapper, 1);
|
|
2972
2980
|
return () => setValidateF(null, 1);
|
|
2973
|
-
}, [validatorWrapper, setValidateF]);
|
|
2974
|
-
|
|
2981
|
+
}, [validatorWrapper, setValidateF]); // Function which will be called when user clicks on the mate csys
|
|
2982
|
+
|
|
2983
|
+
const customSetter = React.useCallback((selId, items) => {
|
|
2984
|
+
//Change reference in the param
|
|
2985
|
+
setMateParam(items[0]); // If items len === 0 selector should not be switched
|
|
2986
|
+
|
|
2987
|
+
if (items.length !== 0) {
|
|
2988
|
+
selectorsOrder ? selectorsOrder.switchToNext(selId) : core.getDrawing(drawingId).api.selection.activateSelector(null);
|
|
2989
|
+
}
|
|
2990
|
+
}, // TODO: there is dependency array, but customSelect will be used in Selection once on selector creating.
|
|
2991
|
+
[drawingId, selectorsOrder, setMateParam]);
|
|
2992
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MateRestorer, {
|
|
2975
2993
|
drawingId: drawingId,
|
|
2976
2994
|
matePath: matePath,
|
|
2977
2995
|
csysId: csysId,
|
|
2978
2996
|
flip: flipState,
|
|
2979
2997
|
reoriented: reorientedState,
|
|
2980
2998
|
selectorId: selectorId,
|
|
2981
|
-
|
|
2999
|
+
setMateParam: setMateParam
|
|
2982
3000
|
}), /*#__PURE__*/React.createElement(Wrapper, {
|
|
2983
3001
|
caption: caption,
|
|
2984
3002
|
highlighted: param.isChanged()
|
|
@@ -2986,13 +3004,17 @@ const MateEditor = ({
|
|
|
2986
3004
|
drawingId: drawingId,
|
|
2987
3005
|
filter: mateFilter,
|
|
2988
3006
|
onCreated: setSelectorId,
|
|
2989
|
-
maxLen: 1
|
|
3007
|
+
maxLen: 1,
|
|
3008
|
+
customSelect: customSetter,
|
|
3009
|
+
customUnSelect: customSetter
|
|
2990
3010
|
}), /*#__PURE__*/React.createElement(MateFlip, {
|
|
2991
3011
|
flipState: flipState,
|
|
2992
|
-
setFlipState: setFlip
|
|
3012
|
+
setFlipState: setFlip,
|
|
3013
|
+
disabled: !isSelected
|
|
2993
3014
|
}), /*#__PURE__*/React.createElement(MateReorient, {
|
|
2994
3015
|
reorientedState: reorientedState,
|
|
2995
|
-
setReorientedState: setReoriented
|
|
3016
|
+
setReorientedState: setReoriented,
|
|
3017
|
+
disabled: !isSelected
|
|
2996
3018
|
}))));
|
|
2997
3019
|
};
|
|
2998
3020
|
|
|
@@ -3003,7 +3025,7 @@ const MateRestorer = ({
|
|
|
3003
3025
|
flip,
|
|
3004
3026
|
reoriented,
|
|
3005
3027
|
selectorId,
|
|
3006
|
-
|
|
3028
|
+
setMateParam
|
|
3007
3029
|
}) => {
|
|
3008
3030
|
const selItems = React.useMemo(() => {
|
|
3009
3031
|
if (!matePath || !csysId) {
|
|
@@ -3016,10 +3038,14 @@ const MateRestorer = ({
|
|
|
3016
3038
|
}, [drawingId, matePath, csysId, flip, reoriented]);
|
|
3017
3039
|
React.useEffect(() => {
|
|
3018
3040
|
if (!selectorId) return;
|
|
3019
|
-
const
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3041
|
+
const selector = core.getDrawing(drawingId).selection.refs[selectorId];
|
|
3042
|
+
const selApi = core.getDrawing(drawingId).api.selection;
|
|
3043
|
+
|
|
3044
|
+
if (!selApi.areItemsSelected(selItems, selectorId) || selItems.length !== selector.items.length) {
|
|
3045
|
+
setMateParam(selItems[0]);
|
|
3046
|
+
selApi.setItems(selectorId, selItems);
|
|
3047
|
+
}
|
|
3048
|
+
}, [drawingId, selItems, setMateParam, selectorId]);
|
|
3023
3049
|
return null;
|
|
3024
3050
|
};
|
|
3025
3051
|
|
|
@@ -3064,7 +3090,8 @@ const flipStates = {
|
|
|
3064
3090
|
|
|
3065
3091
|
const MateFlip = ({
|
|
3066
3092
|
flipState,
|
|
3067
|
-
setFlipState
|
|
3093
|
+
setFlipState,
|
|
3094
|
+
disabled = false
|
|
3068
3095
|
}) => {
|
|
3069
3096
|
const {
|
|
3070
3097
|
Group,
|
|
@@ -3083,7 +3110,8 @@ const MateFlip = ({
|
|
|
3083
3110
|
value: flipState,
|
|
3084
3111
|
onChange: onChange,
|
|
3085
3112
|
showArrow: false,
|
|
3086
|
-
bordered: false
|
|
3113
|
+
bordered: false,
|
|
3114
|
+
disabled: disabled
|
|
3087
3115
|
}, flipTypes.map(flip => /*#__PURE__*/React.createElement(Select.Option, {
|
|
3088
3116
|
key: flip,
|
|
3089
3117
|
value: flip,
|
|
@@ -3106,7 +3134,8 @@ const reorientedTypes = [classcad.ReorientedType.REORIENTED_0, classcad.Reorient
|
|
|
3106
3134
|
|
|
3107
3135
|
const MateReorient = ({
|
|
3108
3136
|
reorientedState,
|
|
3109
|
-
setReorientedState
|
|
3137
|
+
setReorientedState,
|
|
3138
|
+
disabled = false
|
|
3110
3139
|
}) => {
|
|
3111
3140
|
const {
|
|
3112
3141
|
Group,
|
|
@@ -3125,7 +3154,8 @@ const MateReorient = ({
|
|
|
3125
3154
|
value: reorientedState,
|
|
3126
3155
|
onChange: onChange,
|
|
3127
3156
|
showArrow: false,
|
|
3128
|
-
bordered: false
|
|
3157
|
+
bordered: false,
|
|
3158
|
+
disabled: disabled
|
|
3129
3159
|
}, reorientedTypes.map(reoriented => /*#__PURE__*/React.createElement(Select.Option, {
|
|
3130
3160
|
key: reoriented,
|
|
3131
3161
|
value: reoriented,
|
|
@@ -5641,7 +5671,6 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
5641
5671
|
description: description$g
|
|
5642
5672
|
});
|
|
5643
5673
|
|
|
5644
|
-
const UNDEFINEDID = -1;
|
|
5645
5674
|
// TODO use it as key in object
|
|
5646
5675
|
// TODO: move to view/handlers ?
|
|
5647
5676
|
let HandlersList;
|
|
@@ -5841,7 +5870,7 @@ const initialState = {
|
|
|
5841
5870
|
handlers: {},
|
|
5842
5871
|
tmpObjects: {},
|
|
5843
5872
|
selected: [],
|
|
5844
|
-
hovered:
|
|
5873
|
+
hovered: NOCCID,
|
|
5845
5874
|
highlighted: [],
|
|
5846
5875
|
scale: 1,
|
|
5847
5876
|
step: 1,
|
|
@@ -6114,7 +6143,7 @@ const unhover = (drawingId, pluginId, hoveredId) => {
|
|
|
6114
6143
|
const highlighted = state_.highlighted;
|
|
6115
6144
|
const highlightedConstraints = highlighted.filter(id => is2DConstraint(tree[id]));
|
|
6116
6145
|
return {
|
|
6117
|
-
hovered: state_.hovered === hoveredId ?
|
|
6146
|
+
hovered: state_.hovered === hoveredId ? NOCCID : state_.hovered,
|
|
6118
6147
|
highlighted: highlightedConstraints
|
|
6119
6148
|
};
|
|
6120
6149
|
});
|
|
@@ -6226,7 +6255,7 @@ const snapToGrid = mousePosition => {
|
|
|
6226
6255
|
|
|
6227
6256
|
const snapPoint = point => {
|
|
6228
6257
|
let snapResult = {
|
|
6229
|
-
objId:
|
|
6258
|
+
objId: NOCCID,
|
|
6230
6259
|
distance: snapDistance,
|
|
6231
6260
|
point: new THREE__namespace.Vector3()
|
|
6232
6261
|
};
|
|
@@ -6246,7 +6275,7 @@ const snapPoint = point => {
|
|
|
6246
6275
|
}
|
|
6247
6276
|
});
|
|
6248
6277
|
|
|
6249
|
-
if (snapResult.objId !==
|
|
6278
|
+
if (snapResult.objId !== NOCCID) {
|
|
6250
6279
|
return snapResult.point;
|
|
6251
6280
|
} else {
|
|
6252
6281
|
return snapToGrid(point);
|
|
@@ -6373,7 +6402,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
6373
6402
|
let isRectSelectionActive = false;
|
|
6374
6403
|
let rectClickPoint = new THREE__namespace.Vector3();
|
|
6375
6404
|
let rectSelected = [];
|
|
6376
|
-
let pressedId =
|
|
6405
|
+
let pressedId = NOCCID;
|
|
6377
6406
|
let moveFrom = new THREE__namespace.Vector3();
|
|
6378
6407
|
let promise = null;
|
|
6379
6408
|
let defferedDiff = null;
|
|
@@ -6426,7 +6455,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
6426
6455
|
};
|
|
6427
6456
|
|
|
6428
6457
|
const deleteHandler = () => {
|
|
6429
|
-
if (pressedId !==
|
|
6458
|
+
if (pressedId !== NOCCID) {
|
|
6430
6459
|
return;
|
|
6431
6460
|
}
|
|
6432
6461
|
|
|
@@ -6461,7 +6490,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
6461
6490
|
|
|
6462
6491
|
isRectSelectionActive = true;
|
|
6463
6492
|
rectClickPoint = e.point.project(e.camera);
|
|
6464
|
-
pressedId =
|
|
6493
|
+
pressedId = NOCCID;
|
|
6465
6494
|
camControls.enabled = false;
|
|
6466
6495
|
e.target.setPointerCapture(e.pointerId);
|
|
6467
6496
|
e.stopPropagation();
|
|
@@ -6470,13 +6499,13 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
6470
6499
|
min: rectClickPoint.clone(),
|
|
6471
6500
|
max: rectClickPoint.clone()
|
|
6472
6501
|
},
|
|
6473
|
-
hovered:
|
|
6502
|
+
hovered: NOCCID
|
|
6474
6503
|
});
|
|
6475
6504
|
return;
|
|
6476
6505
|
}
|
|
6477
6506
|
|
|
6478
6507
|
if (pressedObj.class === classcad.CCClasses.CCSketch) {
|
|
6479
|
-
pressedId =
|
|
6508
|
+
pressedId = NOCCID;
|
|
6480
6509
|
return;
|
|
6481
6510
|
}
|
|
6482
6511
|
|
|
@@ -6518,7 +6547,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
6518
6547
|
}
|
|
6519
6548
|
|
|
6520
6549
|
if (isMoved === false) {
|
|
6521
|
-
if (pressedId ===
|
|
6550
|
+
if (pressedId === NOCCID) {
|
|
6522
6551
|
clearSelection();
|
|
6523
6552
|
return;
|
|
6524
6553
|
}
|
|
@@ -6528,7 +6557,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
6528
6557
|
|
|
6529
6558
|
clearIgnoreList();
|
|
6530
6559
|
clearDraggedPoints();
|
|
6531
|
-
pressedId =
|
|
6560
|
+
pressedId = NOCCID;
|
|
6532
6561
|
e.target.releasePointerCapture(e.pointerId);
|
|
6533
6562
|
e.stopPropagation();
|
|
6534
6563
|
};
|
|
@@ -6596,7 +6625,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
6596
6625
|
return;
|
|
6597
6626
|
}
|
|
6598
6627
|
|
|
6599
|
-
if (pressedId ===
|
|
6628
|
+
if (pressedId === NOCCID) return;
|
|
6600
6629
|
const pressedObj = core.getDrawing(drawingId).structure.tree[pressedId];
|
|
6601
6630
|
if (is2DConstraint(pressedObj)) return;
|
|
6602
6631
|
const intersectionPosition = getPointOnPlane(e.unprojectedPoint, e.camera, getGlobalToLocalMatrix(drawingId, sketchId));
|
|
@@ -6736,7 +6765,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6736
6765
|
const sketchId = core.getPlugin(drawingId, pluginId).objectId; // Local state:
|
|
6737
6766
|
|
|
6738
6767
|
let firstPointIsSet = false;
|
|
6739
|
-
let lastAddedEndPointId =
|
|
6768
|
+
let lastAddedEndPointId = NOCCID;
|
|
6740
6769
|
let isMoved = false;
|
|
6741
6770
|
let promise = null;
|
|
6742
6771
|
const tmpStartPId = guid();
|
|
@@ -6760,7 +6789,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6760
6789
|
|
|
6761
6790
|
const destructor = () => {
|
|
6762
6791
|
firstPointIsSet = false;
|
|
6763
|
-
lastAddedEndPointId =
|
|
6792
|
+
lastAddedEndPointId = NOCCID;
|
|
6764
6793
|
set({
|
|
6765
6794
|
tmpObjects: {},
|
|
6766
6795
|
mousePos: undefined
|
|
@@ -6777,7 +6806,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6777
6806
|
return true;
|
|
6778
6807
|
} else {
|
|
6779
6808
|
firstPointIsSet = false;
|
|
6780
|
-
lastAddedEndPointId =
|
|
6809
|
+
lastAddedEndPointId = NOCCID;
|
|
6781
6810
|
set(state => ({
|
|
6782
6811
|
tmpObjects: {
|
|
6783
6812
|
[tmpEndPId]: state.tmpObjects[tmpEndPId]
|
|
@@ -6825,7 +6854,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6825
6854
|
const startPos = tmpObjects[tmpStartPId].position.clone();
|
|
6826
6855
|
const endPos = tmpObjects[tmpEndPId].position.clone();
|
|
6827
6856
|
|
|
6828
|
-
if (lastAddedEndPointId ===
|
|
6857
|
+
if (lastAddedEndPointId === NOCCID) {
|
|
6829
6858
|
promise = classcad.ccAPI.sketcher.addGeometry(drawingId, sketchId, 'Line', [startPos, endPos], {
|
|
6830
6859
|
fixation: true,
|
|
6831
6860
|
incidence: true,
|
|
@@ -7273,7 +7302,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7273
7302
|
const sketch = core.getDrawing(drawingId).structure.tree[sketchId]; // Local state:
|
|
7274
7303
|
|
|
7275
7304
|
let additionIndex = 0;
|
|
7276
|
-
let lastAddedEndPointId =
|
|
7305
|
+
let lastAddedEndPointId = NOCCID;
|
|
7277
7306
|
let isMoved = false;
|
|
7278
7307
|
let tangent = new THREE__namespace.Vector3();
|
|
7279
7308
|
let lastMousePos = new THREE__namespace.Vector3();
|
|
@@ -7300,7 +7329,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7300
7329
|
|
|
7301
7330
|
const destructor = () => {
|
|
7302
7331
|
additionIndex = 0;
|
|
7303
|
-
lastAddedEndPointId =
|
|
7332
|
+
lastAddedEndPointId = NOCCID;
|
|
7304
7333
|
set({
|
|
7305
7334
|
tmpObjects: {},
|
|
7306
7335
|
mousePos: undefined
|
|
@@ -7317,7 +7346,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7317
7346
|
return true;
|
|
7318
7347
|
} else if (additionIndex === 1 || additionIndex === 2 && arcType === HandlersList.DRAWARCTANGENT) {
|
|
7319
7348
|
additionIndex = 0;
|
|
7320
|
-
lastAddedEndPointId =
|
|
7349
|
+
lastAddedEndPointId = NOCCID;
|
|
7321
7350
|
set(state => {
|
|
7322
7351
|
const tmpStartP = _objectSpread$b(_objectSpread$b({}, state.tmpObjects[tmpStartPId]), {}, {
|
|
7323
7352
|
position: lastMousePos.clone()
|
|
@@ -7521,7 +7550,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7521
7550
|
radius: 1
|
|
7522
7551
|
}); // calculateMidPoint(startPos, endPos, centerPos, clockwise)
|
|
7523
7552
|
|
|
7524
|
-
if (lastAddedEndPointId ===
|
|
7553
|
+
if (lastAddedEndPointId === NOCCID) {
|
|
7525
7554
|
promise = classcad.ccAPI.sketcher.addGeometry(drawingId, sketchId, 'Arc', [startPos, midInfo.mid, endPos], {
|
|
7526
7555
|
fixation: true,
|
|
7527
7556
|
incidence: true,
|
|
@@ -8509,7 +8538,7 @@ function Trim(drawingId, pluginId) {
|
|
|
8509
8538
|
|
|
8510
8539
|
const onPointerOut = e => {
|
|
8511
8540
|
set({
|
|
8512
|
-
hovered:
|
|
8541
|
+
hovered: NOCCID,
|
|
8513
8542
|
highlighted: []
|
|
8514
8543
|
});
|
|
8515
8544
|
e.stopPropagation();
|
|
@@ -8750,7 +8779,7 @@ const getOriginByPoint = (drawingId, pointId, objectIds) => {
|
|
|
8750
8779
|
|
|
8751
8780
|
const getDefaultOriginId = (drawingId, objectIds) => {
|
|
8752
8781
|
const tree = core.getDrawing(drawingId).structure.tree;
|
|
8753
|
-
let originId =
|
|
8782
|
+
let originId = NOCCID;
|
|
8754
8783
|
let currentMinPos = new THREE__namespace.Vector3(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, 0.0);
|
|
8755
8784
|
objectIds.forEach(objId => {
|
|
8756
8785
|
const object = tree[objId];
|
|
@@ -8916,7 +8945,7 @@ const CircPattern = () => {
|
|
|
8916
8945
|
}
|
|
8917
8946
|
|
|
8918
8947
|
const tree = core.getDrawing(drawingId).structure.tree;
|
|
8919
|
-
const selectedOrigin = originId !==
|
|
8948
|
+
const selectedOrigin = originId !== NOCCID ? tree[originId] : undefined;
|
|
8920
8949
|
const rotationOriginPoint = selectedOrigin ? convertToVector(selectedOrigin.members.pos) : new THREE__namespace.Vector3(0.0, 0.0, 0.0);
|
|
8921
8950
|
const angleStep = degreesToRadians(angle);
|
|
8922
8951
|
classcad.ccAPI.sketcher.copyCircularPattern(drawingId, sketchId, rigidSetId, rotationOriginPoint, angleStep, numSteps - 1).then(() => {
|
|
@@ -10807,14 +10836,14 @@ core.api.subscribe(drawingIds => {
|
|
|
10807
10836
|
}, state => state.drawing.ids); //#endregion buerli store subscription
|
|
10808
10837
|
|
|
10809
10838
|
const useCurrentProduct = drawingId => {
|
|
10810
|
-
const currProdId =
|
|
10811
|
-
const currProd = react.useDrawing(drawingId, d => d.structure.tree[currProdId
|
|
10839
|
+
const currProdId = useDrawingCCId(drawingId, d => d.structure.currentProduct);
|
|
10840
|
+
const currProd = react.useDrawing(drawingId, d => d.structure.tree[currProdId]);
|
|
10812
10841
|
return currProd;
|
|
10813
10842
|
};
|
|
10814
10843
|
|
|
10815
10844
|
const useCurrentNode = drawingId => {
|
|
10816
|
-
const currNodeId =
|
|
10817
|
-
const currNode = react.useDrawing(drawingId, d => d.structure.tree[currNodeId
|
|
10845
|
+
const currNodeId = useDrawingCCId(drawingId, d => d.structure.currentNode);
|
|
10846
|
+
const currNode = react.useDrawing(drawingId, d => d.structure.tree[currNodeId]);
|
|
10818
10847
|
return currNode;
|
|
10819
10848
|
};
|
|
10820
10849
|
|
|
@@ -10827,17 +10856,17 @@ let EditMode;
|
|
|
10827
10856
|
})(EditMode || (EditMode = {}));
|
|
10828
10857
|
|
|
10829
10858
|
const useEditMode = drawingId => {
|
|
10830
|
-
const rootId =
|
|
10831
|
-
const currProdId =
|
|
10859
|
+
const rootId = useDrawingCCId(drawingId, d => d.structure.root);
|
|
10860
|
+
const currProdId = useDrawingCCId(drawingId, d => d.structure.currentProduct);
|
|
10832
10861
|
const rootClass = react.useDrawing(drawingId, d => {
|
|
10833
|
-
var _d$structure$tree;
|
|
10862
|
+
var _d$structure$tree$roo;
|
|
10834
10863
|
|
|
10835
|
-
return (_d$structure$tree = d.structure.tree[rootId
|
|
10864
|
+
return (_d$structure$tree$roo = d.structure.tree[rootId]) == null ? void 0 : _d$structure$tree$roo.class;
|
|
10836
10865
|
});
|
|
10837
10866
|
const currProdClass = react.useDrawing(drawingId, d => {
|
|
10838
|
-
var _d$structure$
|
|
10867
|
+
var _d$structure$tree$cur;
|
|
10839
10868
|
|
|
10840
|
-
return (_d$structure$
|
|
10869
|
+
return (_d$structure$tree$cur = d.structure.tree[currProdId]) == null ? void 0 : _d$structure$tree$cur.class;
|
|
10841
10870
|
});
|
|
10842
10871
|
return React.useMemo(() => {
|
|
10843
10872
|
const isPartRoot = Boolean(rootClass === classcad.CCClasses.CCPart);
|
|
@@ -10850,8 +10879,8 @@ const useEditMode = drawingId => {
|
|
|
10850
10879
|
|
|
10851
10880
|
const useObjectDetails = (drawingId, objectId) => {
|
|
10852
10881
|
const rootId = react.useDrawing(drawingId, d => d.structure.root);
|
|
10853
|
-
const currProdId =
|
|
10854
|
-
const currNodeId =
|
|
10882
|
+
const currProdId = useDrawingCCId(drawingId, d => d.structure.currentProduct);
|
|
10883
|
+
const currNodeId = useDrawingCCId(drawingId, d => d.structure.currentNode);
|
|
10855
10884
|
return React.useMemo(() => {
|
|
10856
10885
|
const drawing = core.getDrawing(drawingId);
|
|
10857
10886
|
|
|
@@ -10859,7 +10888,7 @@ const useObjectDetails = (drawingId, objectId) => {
|
|
|
10859
10888
|
const {
|
|
10860
10889
|
tree
|
|
10861
10890
|
} = drawing.structure;
|
|
10862
|
-
const obj = tree[objectId
|
|
10891
|
+
const obj = tree[objectId];
|
|
10863
10892
|
|
|
10864
10893
|
if (obj) {
|
|
10865
10894
|
const clazz = obj.class;
|
|
@@ -10900,12 +10929,12 @@ const useOperationSequence = (drawingId, partId) => {
|
|
|
10900
10929
|
} = drawing.structure;
|
|
10901
10930
|
|
|
10902
10931
|
if (children) {
|
|
10903
|
-
const opSeqId = children == null ? void 0 : children.find(id => {
|
|
10932
|
+
const opSeqId = (children == null ? void 0 : children.find(id => {
|
|
10904
10933
|
var _tree$id;
|
|
10905
10934
|
|
|
10906
10935
|
return ((_tree$id = tree[id]) == null ? void 0 : _tree$id.class) === classcad.CCClasses.CCOperationSequence;
|
|
10907
|
-
});
|
|
10908
|
-
const opSeq = tree[opSeqId
|
|
10936
|
+
})) || NOCCID;
|
|
10937
|
+
const opSeq = tree[opSeqId];
|
|
10909
10938
|
|
|
10910
10939
|
if (opSeq) {
|
|
10911
10940
|
return opSeq.id;
|
|
@@ -10918,11 +10947,11 @@ const useOperationSequence = (drawingId, partId) => {
|
|
|
10918
10947
|
};
|
|
10919
10948
|
|
|
10920
10949
|
const useRollbackBar = (drawingId, partId) => {
|
|
10921
|
-
const opSeqId = useOperationSequence(drawingId, partId);
|
|
10950
|
+
const opSeqId = useOperationSequence(drawingId, partId) || NOCCID;
|
|
10922
10951
|
const opSeqChildren = react.useDrawing(drawingId, d => {
|
|
10923
|
-
var _d$structure$tree;
|
|
10952
|
+
var _d$structure$tree$opS;
|
|
10924
10953
|
|
|
10925
|
-
return (_d$structure$tree = d.structure.tree[opSeqId
|
|
10954
|
+
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS.children;
|
|
10926
10955
|
});
|
|
10927
10956
|
return React.useMemo(() => {
|
|
10928
10957
|
const drawing = core.getDrawing(drawingId);
|
|
@@ -10931,18 +10960,18 @@ const useRollbackBar = (drawingId, partId) => {
|
|
|
10931
10960
|
const {
|
|
10932
10961
|
tree
|
|
10933
10962
|
} = drawing.structure;
|
|
10934
|
-
const opSeq = tree[opSeqId
|
|
10963
|
+
const opSeq = tree[opSeqId];
|
|
10935
10964
|
|
|
10936
10965
|
if (opSeq && opSeqChildren) {
|
|
10937
|
-
const rollbackBarId = opSeqChildren == null ? void 0 : opSeqChildren.find(id => {
|
|
10966
|
+
const rollbackBarId = (opSeqChildren == null ? void 0 : opSeqChildren.find(id => {
|
|
10938
10967
|
var _tree$id;
|
|
10939
10968
|
|
|
10940
10969
|
return ((_tree$id = tree[id]) == null ? void 0 : _tree$id.class) === classcad.CCClasses.CCRollbackBar;
|
|
10941
|
-
});
|
|
10942
|
-
const rollbackBarIndex = (opSeqChildren == null ? void 0 : opSeqChildren.indexOf(rollbackBarId
|
|
10970
|
+
})) || NOCCID;
|
|
10971
|
+
const rollbackBarIndex = (opSeqChildren == null ? void 0 : opSeqChildren.indexOf(rollbackBarId)) || -1;
|
|
10943
10972
|
return {
|
|
10944
10973
|
operationSequence: opSeq,
|
|
10945
|
-
rollbackBar: tree[rollbackBarId
|
|
10974
|
+
rollbackBar: tree[rollbackBarId],
|
|
10946
10975
|
rollbackBarIndex: rollbackBarIndex
|
|
10947
10976
|
};
|
|
10948
10977
|
}
|
|
@@ -11177,8 +11206,8 @@ const ObjTitle = ({
|
|
|
11177
11206
|
drawingId,
|
|
11178
11207
|
pluginId
|
|
11179
11208
|
} = React.useContext(RootContext);
|
|
11180
|
-
const name =
|
|
11181
|
-
const objClass =
|
|
11209
|
+
const name = useDrawingStr(drawingId, d => d.structure.tree[objId].name);
|
|
11210
|
+
const objClass = useDrawingStr(drawingId, d => d.structure.tree[objId].class);
|
|
11182
11211
|
const isHovered = useSketchState(drawingId, pluginId, s => s.hovered === objId);
|
|
11183
11212
|
const isSelected = useSketchState(drawingId, pluginId, s => s.selected.indexOf(objId) !== -1);
|
|
11184
11213
|
const color = isSelected ? '#ffa500' : isHovered ? '#28d79f' : undefined; // TODO: Rename resources so that they have more generic names, i.e. 'CC_Point' instead of 'drawPoint', etc
|
|
@@ -11258,7 +11287,7 @@ const SketchObj = ({
|
|
|
11258
11287
|
const {
|
|
11259
11288
|
drawingId
|
|
11260
11289
|
} = React.useContext(RootContext);
|
|
11261
|
-
const children =
|
|
11290
|
+
const children = useDrawingArr(drawingId, d => d.structure.tree[objId].children);
|
|
11262
11291
|
const [collapsed, setCollapsed] = React.useState(true);
|
|
11263
11292
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FlexRow, null, /*#__PURE__*/React.createElement(Indents, {
|
|
11264
11293
|
level: level
|
|
@@ -11337,8 +11366,8 @@ const PlaneSelectionMode = ({
|
|
|
11337
11366
|
} = react.useBuerli(buerli => buerli.options.elements);
|
|
11338
11367
|
const sketchId = react.usePlugin(drawingId, pluginId, plugin => plugin.objectId);
|
|
11339
11368
|
const curProduct = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
11340
|
-
const opSeqId = useOperationSequence(drawingId, curProduct) ||
|
|
11341
|
-
const opSeqChildren =
|
|
11369
|
+
const opSeqId = useOperationSequence(drawingId, curProduct) || NOCCID;
|
|
11370
|
+
const opSeqChildren = useDrawingArr(drawingId, d => d.structure.tree[opSeqId].children); // Makes base planes visible when just created, and turns them off after initialization (i.e. selecting a plane)
|
|
11342
11371
|
|
|
11343
11372
|
React.useEffect(() => {
|
|
11344
11373
|
if (opSeqChildren.length < 7) {
|
|
@@ -11527,7 +11556,7 @@ const RootImpl$f = ({
|
|
|
11527
11556
|
plugin.set({
|
|
11528
11557
|
tmpObjects: {},
|
|
11529
11558
|
selected: [],
|
|
11530
|
-
hovered:
|
|
11559
|
+
hovered: NOCCID,
|
|
11531
11560
|
highlighted: []
|
|
11532
11561
|
});
|
|
11533
11562
|
}
|
|
@@ -11611,8 +11640,8 @@ function useRefsReset(type, refs) {
|
|
|
11611
11640
|
}
|
|
11612
11641
|
|
|
11613
11642
|
const useAllObjects = drawingId => {
|
|
11614
|
-
const root =
|
|
11615
|
-
const rootExists = react.useDrawing(drawingId, d => Boolean(d.structure.tree[root
|
|
11643
|
+
const root = useDrawingCCId(drawingId, d => d.structure.root);
|
|
11644
|
+
const rootExists = react.useDrawing(drawingId, d => Boolean(d.structure.tree[root]));
|
|
11616
11645
|
return React.useMemo(() => {
|
|
11617
11646
|
const drawing = core.getDrawing(drawingId);
|
|
11618
11647
|
|
|
@@ -12579,8 +12608,8 @@ function RootImpl$b({
|
|
|
12579
12608
|
|
|
12580
12609
|
// We do not expect that the 'currentProduct' can change while a plugin is open,
|
|
12581
12610
|
// so we don't have to listen for changes to 'currentProduct' and access it statically.
|
|
12582
|
-
const geomSetId = (_structure$tree = structure.tree[structure.currentProduct]) == null ? void 0 : _structure$tree.geometrySet;
|
|
12583
|
-
const geomSet = structure.tree[geomSetId
|
|
12611
|
+
const geomSetId = ((_structure$tree = structure.tree[structure.currentProduct]) == null ? void 0 : _structure$tree.geometrySet) || NOCCID;
|
|
12612
|
+
const geomSet = structure.tree[geomSetId];
|
|
12584
12613
|
|
|
12585
12614
|
if (geomSet && geomSet.children && geomSet.children.length > 0) {
|
|
12586
12615
|
const geomObjects = geomSet.children.map(childId => structure.tree[childId]);
|
|
@@ -13767,30 +13796,30 @@ function useFeaturesIds(drawingId, curNodeId) {
|
|
|
13767
13796
|
|
|
13768
13797
|
return curNodeId;
|
|
13769
13798
|
});
|
|
13770
|
-
const opSeqId = useOperationSequence(drawingId, prodId);
|
|
13771
|
-
const opSeqChildren =
|
|
13772
|
-
var _d$structure$tree;
|
|
13799
|
+
const opSeqId = useOperationSequence(drawingId, prodId) || NOCCID;
|
|
13800
|
+
const opSeqChildren = useDrawingArr(drawingId, d => {
|
|
13801
|
+
var _d$structure$tree$opS;
|
|
13773
13802
|
|
|
13774
|
-
return (_d$structure$tree = d.structure.tree[opSeqId
|
|
13803
|
+
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS.children;
|
|
13775
13804
|
});
|
|
13776
13805
|
const tree = core.getDrawing(drawingId).structure.tree;
|
|
13777
|
-
const featureIds =
|
|
13806
|
+
const featureIds = opSeqChildren.map(refId => tree[refId].members.refObj.value);
|
|
13778
13807
|
return featureIds;
|
|
13779
13808
|
}
|
|
13780
13809
|
function getFeaturesIds(drawingId, curNodeId) {
|
|
13781
|
-
var _tree$prodId, _tree;
|
|
13810
|
+
var _tree$prodId, _tree$opSeqId;
|
|
13782
13811
|
|
|
13783
13812
|
const tree = core.getDrawing(drawingId).structure.tree;
|
|
13784
13813
|
const curClass = tree[curNodeId].class;
|
|
13785
13814
|
const prodId = curClass === classcad.CCClasses.CCProductReference || curClass === classcad.CCClasses.CCProductReferenceET ? tree[curNodeId].members.productId.value : curNodeId;
|
|
13786
|
-
const prodChildren = (_tree$prodId = tree[prodId]) == null ? void 0 : _tree$prodId.children;
|
|
13787
|
-
const opSeqId = prodChildren
|
|
13815
|
+
const prodChildren = ((_tree$prodId = tree[prodId]) == null ? void 0 : _tree$prodId.children) || [];
|
|
13816
|
+
const opSeqId = prodChildren.find(id => {
|
|
13788
13817
|
var _tree$id;
|
|
13789
13818
|
|
|
13790
13819
|
return ((_tree$id = tree[id]) == null ? void 0 : _tree$id.class) === classcad.CCClasses.CCOperationSequence;
|
|
13791
|
-
});
|
|
13792
|
-
const opSeqChildren = (_tree = tree[opSeqId
|
|
13793
|
-
const featureIds =
|
|
13820
|
+
}) || NOCCID;
|
|
13821
|
+
const opSeqChildren = ((_tree$opSeqId = tree[opSeqId]) == null ? void 0 : _tree$opSeqId.children) || [];
|
|
13822
|
+
const featureIds = opSeqChildren.map(refId => tree[refId].members.refObj.value);
|
|
13794
13823
|
return featureIds;
|
|
13795
13824
|
}
|
|
13796
13825
|
|
|
@@ -16217,20 +16246,20 @@ const Parts = ({
|
|
|
16217
16246
|
pluginId
|
|
16218
16247
|
}) => {
|
|
16219
16248
|
const allObjId = useAllObjects(drawingId);
|
|
16220
|
-
const allObjsChilds =
|
|
16249
|
+
const allObjsChilds = useDrawingArr(drawingId, d => {
|
|
16221
16250
|
var _d$structure$tree$all;
|
|
16222
16251
|
|
|
16223
|
-
return (
|
|
16252
|
+
return (_d$structure$tree$all = d.structure.tree[allObjId]) == null ? void 0 : _d$structure$tree$all.children;
|
|
16224
16253
|
});
|
|
16225
16254
|
const partContId = allObjsChilds.find(id => {
|
|
16226
16255
|
var _getDrawing$structure;
|
|
16227
16256
|
|
|
16228
16257
|
return ((_getDrawing$structure = core.getDrawing(drawingId).structure.tree[id]) == null ? void 0 : _getDrawing$structure.class) === classcad.CCClasses.CCPartContainer;
|
|
16229
16258
|
});
|
|
16230
|
-
const partsIds =
|
|
16259
|
+
const partsIds = useDrawingArr(drawingId, d => {
|
|
16231
16260
|
var _d$structure$tree$par;
|
|
16232
16261
|
|
|
16233
|
-
return (
|
|
16262
|
+
return (_d$structure$tree$par = d.structure.tree[partContId]) == null ? void 0 : _d$structure$tree$par.children;
|
|
16234
16263
|
});
|
|
16235
16264
|
const [createMode, setCreateMode] = React.useState(false);
|
|
16236
16265
|
const data = useTableData(partsIds, 'part', createMode);
|
|
@@ -16265,20 +16294,20 @@ const Assemblies = ({
|
|
|
16265
16294
|
pluginId
|
|
16266
16295
|
}) => {
|
|
16267
16296
|
const allObjId = useAllObjects(drawingId);
|
|
16268
|
-
const allObjsChilds =
|
|
16297
|
+
const allObjsChilds = useDrawingArr(drawingId, d => {
|
|
16269
16298
|
var _d$structure$tree$all2;
|
|
16270
16299
|
|
|
16271
|
-
return (
|
|
16300
|
+
return (_d$structure$tree$all2 = d.structure.tree[allObjId]) == null ? void 0 : _d$structure$tree$all2.children;
|
|
16272
16301
|
});
|
|
16273
16302
|
const assemblyContId = allObjsChilds.find(id => {
|
|
16274
16303
|
var _getDrawing$structure2;
|
|
16275
16304
|
|
|
16276
16305
|
return ((_getDrawing$structure2 = core.getDrawing(drawingId).structure.tree[id]) == null ? void 0 : _getDrawing$structure2.class) === classcad.CCClasses.CCAssemblyContainer;
|
|
16277
16306
|
});
|
|
16278
|
-
const assembliesIds =
|
|
16307
|
+
const assembliesIds = useDrawingArr(drawingId, d => {
|
|
16279
16308
|
var _d$structure$tree$ass;
|
|
16280
16309
|
|
|
16281
|
-
return (
|
|
16310
|
+
return (_d$structure$tree$ass = d.structure.tree[assemblyContId]) == null ? void 0 : _d$structure$tree$ass.children;
|
|
16282
16311
|
});
|
|
16283
16312
|
const [createMode, setCreateMode] = React.useState(false);
|
|
16284
16313
|
const data = useTableData(assembliesIds, 'asm', createMode);
|
|
@@ -17815,14 +17844,14 @@ const FPluginWindow = ({
|
|
|
17815
17844
|
const FeaturePlugin = ({
|
|
17816
17845
|
drawingId
|
|
17817
17846
|
}) => {
|
|
17818
|
-
const activeFeature = react.useDrawing(drawingId, d => d.plugin.active.feature); // Feature plugins are lazy loaded, so it's possible that recently activated feature plugins hasn't been created yet
|
|
17847
|
+
const activeFeature = react.useDrawing(drawingId, d => d.plugin.active.feature) || NOCCID; // Feature plugins are lazy loaded, so it's possible that recently activated feature plugins hasn't been created yet
|
|
17819
17848
|
|
|
17820
|
-
const isCreated = react.usePluginExists(drawingId, activeFeature
|
|
17821
|
-
const name =
|
|
17822
|
-
if (!activeFeature || !isCreated) return
|
|
17849
|
+
const isCreated = react.usePluginExists(drawingId, activeFeature);
|
|
17850
|
+
const name = useDrawingStr(drawingId, d => {
|
|
17851
|
+
if (!activeFeature || !isCreated) return undefined;
|
|
17823
17852
|
const objId = d.plugin.refs[activeFeature].objectId;
|
|
17824
17853
|
const plugin = d.structure.tree[objId];
|
|
17825
|
-
return
|
|
17854
|
+
return plugin == null ? void 0 : plugin.name;
|
|
17826
17855
|
});
|
|
17827
17856
|
const pluginAPI = core.getDrawing(drawingId).api.plugin;
|
|
17828
17857
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DraggableModalProvider, null, activeFeature && isCreated && /*#__PURE__*/React.createElement(DraggableModal, {
|
|
@@ -17924,35 +17953,35 @@ function useMenuItems$2(drawingId, featureId, isActive, setEditName) {
|
|
|
17924
17953
|
|
|
17925
17954
|
function useIsCustom(drawingId, featureRefId) {
|
|
17926
17955
|
const curProduct = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
17927
|
-
const opSeqId = useOperationSequence(drawingId, curProduct);
|
|
17928
|
-
const opSeqChildren =
|
|
17929
|
-
var _d$structure$tree;
|
|
17956
|
+
const opSeqId = useOperationSequence(drawingId, curProduct) || NOCCID;
|
|
17957
|
+
const opSeqChildren = useDrawingArr(drawingId, d => {
|
|
17958
|
+
var _d$structure$tree$opS;
|
|
17930
17959
|
|
|
17931
|
-
return (_d$structure$tree = d.structure.tree[opSeqId
|
|
17932
|
-
})
|
|
17960
|
+
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS.children;
|
|
17961
|
+
}); // First 7 elements in operationSequence are features created by default (origin, x,y,z axes and planes) => they're not custom
|
|
17933
17962
|
|
|
17934
17963
|
return opSeqChildren.indexOf(featureRefId) > 6;
|
|
17935
17964
|
}
|
|
17936
17965
|
|
|
17937
17966
|
function usePrecheckErrorId(drawingId, featureId) {
|
|
17938
17967
|
const curProduct = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
17939
|
-
const opSeqId = useOperationSequence(drawingId, curProduct) ||
|
|
17940
|
-
const opSeqChildren =
|
|
17941
|
-
var _d$structure$tree$
|
|
17968
|
+
const opSeqId = useOperationSequence(drawingId, curProduct) || NOCCID;
|
|
17969
|
+
const opSeqChildren = useDrawingArr(drawingId, d => {
|
|
17970
|
+
var _d$structure$tree$opS2;
|
|
17942
17971
|
|
|
17943
|
-
return (_d$structure$tree$
|
|
17944
|
-
})
|
|
17972
|
+
return (_d$structure$tree$opS2 = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS2.children;
|
|
17973
|
+
});
|
|
17945
17974
|
const refId = opSeqChildren.find(chId => {
|
|
17946
17975
|
var _ref_$members;
|
|
17947
17976
|
|
|
17948
17977
|
const ref_ = core.getDrawing(drawingId).structure.tree[chId];
|
|
17949
17978
|
return featureId === (ref_ == null ? void 0 : (_ref_$members = ref_.members) == null ? void 0 : _ref_$members.refObj.value);
|
|
17950
|
-
});
|
|
17951
|
-
const refChildren =
|
|
17952
|
-
var _d$structure$
|
|
17979
|
+
}) || NOCCID;
|
|
17980
|
+
const refChildren = useDrawingArr(drawingId, d => {
|
|
17981
|
+
var _d$structure$tree$ref;
|
|
17953
17982
|
|
|
17954
|
-
return (_d$structure$
|
|
17955
|
-
})
|
|
17983
|
+
return (_d$structure$tree$ref = d.structure.tree[refId]) == null ? void 0 : _d$structure$tree$ref.children;
|
|
17984
|
+
});
|
|
17956
17985
|
const errorId = refChildren.find(chId => {
|
|
17957
17986
|
var _getDrawing$structure;
|
|
17958
17987
|
|
|
@@ -18117,21 +18146,21 @@ const Item$1 = ({
|
|
|
18117
18146
|
featureRefId
|
|
18118
18147
|
}) => {
|
|
18119
18148
|
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
18120
|
-
const opSeqId = useOperationSequence(drawingId, curPartId);
|
|
18149
|
+
const opSeqId = useOperationSequence(drawingId, curPartId) || NOCCID;
|
|
18121
18150
|
const idx = react.useDrawing(drawingId, d => {
|
|
18122
|
-
var _d$structure$tree, _d$structure$tree$
|
|
18151
|
+
var _d$structure$tree$opS, _d$structure$tree$opS2;
|
|
18123
18152
|
|
|
18124
|
-
return (_d$structure$tree = d.structure.tree[opSeqId
|
|
18153
|
+
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : (_d$structure$tree$opS2 = _d$structure$tree$opS.children) == null ? void 0 : _d$structure$tree$opS2.indexOf(featureRefId);
|
|
18125
18154
|
}) || -1;
|
|
18126
18155
|
const featureId = react.useDrawing(drawingId, d => {
|
|
18127
18156
|
var _d$structure$tree$fea, _d$structure$tree$fea2;
|
|
18128
18157
|
|
|
18129
18158
|
return (_d$structure$tree$fea = d.structure.tree[featureRefId]) == null ? void 0 : (_d$structure$tree$fea2 = _d$structure$tree$fea.members) == null ? void 0 : _d$structure$tree$fea2.refObj.value;
|
|
18130
18159
|
});
|
|
18131
|
-
const objClass =
|
|
18160
|
+
const objClass = useDrawingStr(drawingId, d => {
|
|
18132
18161
|
var _d$structure$tree$fea3;
|
|
18133
18162
|
|
|
18134
|
-
return (
|
|
18163
|
+
return (_d$structure$tree$fea3 = d.structure.tree[featureId]) == null ? void 0 : _d$structure$tree$fea3.class;
|
|
18135
18164
|
});
|
|
18136
18165
|
const isFeatureActive = react.useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
|
|
18137
18166
|
const isRollbackBar = objClass === classcad.CCClasses.CCRollbackBar;
|
|
@@ -18149,12 +18178,12 @@ const List$2 = ({
|
|
|
18149
18178
|
drawingId
|
|
18150
18179
|
}) => {
|
|
18151
18180
|
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
18152
|
-
const opSeqId = useOperationSequence(drawingId, curPartId);
|
|
18153
|
-
const featureRefIds =
|
|
18154
|
-
var _d$structure$
|
|
18181
|
+
const opSeqId = useOperationSequence(drawingId, curPartId) || NOCCID;
|
|
18182
|
+
const featureRefIds = useDrawingArr(drawingId, d => {
|
|
18183
|
+
var _d$structure$tree$opS3;
|
|
18155
18184
|
|
|
18156
|
-
return (_d$structure$
|
|
18157
|
-
})
|
|
18185
|
+
return (_d$structure$tree$opS3 = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS3.children;
|
|
18186
|
+
});
|
|
18158
18187
|
return /*#__PURE__*/React.createElement(SortableCont, {
|
|
18159
18188
|
helperClass: "row-dragging",
|
|
18160
18189
|
lockAxis: "y",
|
|
@@ -18289,7 +18318,7 @@ const ProdReferenceNode = ({
|
|
|
18289
18318
|
level,
|
|
18290
18319
|
onClick
|
|
18291
18320
|
}) => {
|
|
18292
|
-
const children =
|
|
18321
|
+
const children = useDrawingArr(drawingId, d => d.structure.tree[refId].children);
|
|
18293
18322
|
const [collapsed, setCollapsed] = React.useState(true);
|
|
18294
18323
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FlexRow, null, /*#__PURE__*/React.createElement(Indents, {
|
|
18295
18324
|
level: level
|
|
@@ -18373,7 +18402,7 @@ const AssemblyTreeHeader = ({
|
|
|
18373
18402
|
const mode = useEditMode(drawingId);
|
|
18374
18403
|
const currProd = useCurrentProduct(drawingId);
|
|
18375
18404
|
const currNode = useCurrentNode(drawingId);
|
|
18376
|
-
const objDetails = useObjectDetails(drawingId, (currNode == null ? void 0 : currNode.id) ||
|
|
18405
|
+
const objDetails = useObjectDetails(drawingId, (currNode == null ? void 0 : currNode.id) || NOCCID);
|
|
18377
18406
|
const showBackBtn = React.useMemo(() => pStackNotEmpty || !objDetails.isRoot && (objDetails.isAssemblyNode || objDetails.isAssembly), [objDetails.isAssembly, objDetails.isAssemblyNode, objDetails.isRoot, pStackNotEmpty]);
|
|
18378
18407
|
const isFeatureActive = react.useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
|
|
18379
18408
|
const name = currProd ? currProd.name : currNode ? currNode.name : '';
|
|
@@ -18421,7 +18450,7 @@ const AssemblyTreeHeader = ({
|
|
|
18421
18450
|
}));
|
|
18422
18451
|
const nameComponent = rename ? /*#__PURE__*/React.createElement(NameEdit, {
|
|
18423
18452
|
drawingId: drawingId,
|
|
18424
|
-
objId: (currProd == null ? void 0 : currProd.id) ||
|
|
18453
|
+
objId: (currProd == null ? void 0 : currProd.id) || NOCCID,
|
|
18425
18454
|
setEditName: setRename,
|
|
18426
18455
|
name: name
|
|
18427
18456
|
}) : /*#__PURE__*/React.createElement(EntityName, {
|
|
@@ -18506,10 +18535,10 @@ const AssemblyTreeImpl = ({
|
|
|
18506
18535
|
const api = useCADStore(s => s.api);
|
|
18507
18536
|
const mode = useEditMode(drawingId);
|
|
18508
18537
|
const currNode = useCurrentNode(drawingId);
|
|
18509
|
-
const children =
|
|
18538
|
+
const children = useDrawingArr(drawingId, d => {
|
|
18510
18539
|
var _d$structure$tree;
|
|
18511
18540
|
|
|
18512
|
-
return (
|
|
18541
|
+
return (_d$structure$tree = d.structure.tree[(currNode == null ? void 0 : currNode.id) || NOCCID]) == null ? void 0 : _d$structure$tree.children;
|
|
18513
18542
|
});
|
|
18514
18543
|
return /*#__PURE__*/React.createElement("div", {
|
|
18515
18544
|
style: {
|
|
@@ -18526,13 +18555,13 @@ const AssemblyTreeImpl = ({
|
|
|
18526
18555
|
}
|
|
18527
18556
|
}, mode === EditMode.Part && /*#__PURE__*/React.createElement(FeatureList, {
|
|
18528
18557
|
drawingId: drawingId
|
|
18529
|
-
}), mode === EditMode.Assembly &&
|
|
18558
|
+
}), mode === EditMode.Assembly && children.map(childId => /*#__PURE__*/React.createElement(AssemblyNode, {
|
|
18530
18559
|
drawingId: drawingId,
|
|
18531
18560
|
nodeId: childId,
|
|
18532
18561
|
key: childId,
|
|
18533
18562
|
level: 0,
|
|
18534
18563
|
onClick: refId => api.assemblyTree.startProdEditing(drawingId, refId)
|
|
18535
|
-
}))))
|
|
18564
|
+
}))));
|
|
18536
18565
|
};
|
|
18537
18566
|
|
|
18538
18567
|
const AssemblyTree = ({
|
|
@@ -18568,12 +18597,11 @@ const Constraints = ({
|
|
|
18568
18597
|
drawingId
|
|
18569
18598
|
}) => {
|
|
18570
18599
|
const curProdId = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
18571
|
-
const prodChildren =
|
|
18600
|
+
const prodChildren = useDrawingArr(drawingId, d => {
|
|
18572
18601
|
var _d$structure$tree$cur;
|
|
18573
18602
|
|
|
18574
|
-
return (
|
|
18575
|
-
});
|
|
18576
|
-
|
|
18603
|
+
return (_d$structure$tree$cur = d.structure.tree[curProdId]) == null ? void 0 : _d$structure$tree$cur.children;
|
|
18604
|
+
});
|
|
18577
18605
|
const constrSetId = React.useMemo(() => {
|
|
18578
18606
|
const tree = core.getDrawing(drawingId).structure.tree;
|
|
18579
18607
|
return prodChildren.find(childId => tree[childId].class === classcad.CCClasses.CCConstraintSet) || null;
|
|
@@ -18701,11 +18729,11 @@ const ColorPicker = ({
|
|
|
18701
18729
|
|
|
18702
18730
|
return (_d$geometry$cache$sol3 = d.geometry.cache[solidId]) == null ? void 0 : (_d$geometry$cache$sol4 = _d$geometry$cache$sol3.meshes[0]) == null ? void 0 : _d$geometry$cache$sol4.opacity;
|
|
18703
18731
|
}) || 1;
|
|
18704
|
-
const solidOwner =
|
|
18732
|
+
const solidOwner = useDrawingCCId(drawingId, d => {
|
|
18705
18733
|
var _d$graphic$containers;
|
|
18706
18734
|
|
|
18707
18735
|
return (_d$graphic$containers = d.graphic.containers[solidId]) == null ? void 0 : _d$graphic$containers.owner;
|
|
18708
|
-
})
|
|
18736
|
+
}); // Color which is set by colorPicker
|
|
18709
18737
|
|
|
18710
18738
|
const [userColor, setUColor] = React.useState({
|
|
18711
18739
|
r,
|
|
@@ -18855,11 +18883,11 @@ const Solid = ({
|
|
|
18855
18883
|
drawingId,
|
|
18856
18884
|
solidId
|
|
18857
18885
|
}) => {
|
|
18858
|
-
const solidOwner =
|
|
18886
|
+
const solidOwner = useDrawingCCId(drawingId, d => {
|
|
18859
18887
|
var _d$graphic$containers;
|
|
18860
18888
|
|
|
18861
18889
|
return (_d$graphic$containers = d.graphic.containers[solidId]) == null ? void 0 : _d$graphic$containers.owner;
|
|
18862
|
-
})
|
|
18890
|
+
});
|
|
18863
18891
|
const ccSolid = react.useDrawing(drawingId, d => d.structure.tree[solidOwner]);
|
|
18864
18892
|
const [rename, setRename] = React.useState(false);
|
|
18865
18893
|
const [isMenuHovered, setIsMenuHovered] = React.useState(false);
|
|
@@ -18900,7 +18928,7 @@ const Solids = ({
|
|
|
18900
18928
|
drawingId
|
|
18901
18929
|
}) => {
|
|
18902
18930
|
const curProdId = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
18903
|
-
const solidsIds =
|
|
18931
|
+
const solidsIds = useDrawingArr(drawingId, d => d.structure.tree[curProdId].solids);
|
|
18904
18932
|
return /*#__PURE__*/React.createElement("div", {
|
|
18905
18933
|
style: {
|
|
18906
18934
|
display: 'flex',
|