@buerli.io/react-cad 0.13.1-beta.10 → 0.13.1-beta.12
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 +47 -50
- package/build/index.js +48 -51
- package/package.json +3 -3
package/build/index.cjs.js
CHANGED
|
@@ -1183,7 +1183,7 @@ const Mentions = ({
|
|
|
1183
1183
|
};
|
|
1184
1184
|
|
|
1185
1185
|
function isDegValue(expr) {
|
|
1186
|
-
return expr.length > 1 && expr
|
|
1186
|
+
return expr.length > 1 && expr.slice(expr.length - 3) === 'deg' && !isNaN(Number(expr.slice(0, expr.length - 3)));
|
|
1187
1187
|
}
|
|
1188
1188
|
function getDefNumValue(numOrExpr) {
|
|
1189
1189
|
return typeof numOrExpr === 'number' ? numOrExpr : isDegValue(numOrExpr) ? numOrExpr : 0;
|
|
@@ -1267,7 +1267,7 @@ const NumOrExpr = ({
|
|
|
1267
1267
|
}, /*#__PURE__*/React.createElement(Prefix, null, prefix)));
|
|
1268
1268
|
};
|
|
1269
1269
|
const baseReg$3 = /^-?(\d*(\.\d*)?)?$/;
|
|
1270
|
-
const angleReg$3 = /^-?(\d*(\.\d*)?)?g?$/;
|
|
1270
|
+
const angleReg$3 = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
1271
1271
|
const NumInput$1 = ({
|
|
1272
1272
|
state,
|
|
1273
1273
|
setState,
|
|
@@ -1566,7 +1566,7 @@ function acceptableRange(min, max) {
|
|
|
1566
1566
|
if (!isNaN(Number(numParam))) {
|
|
1567
1567
|
value = Number(numParam);
|
|
1568
1568
|
} else if (typeof numParam === 'string' && isDegValue(numParam)) {
|
|
1569
|
-
value = Number(numParam.slice(0, numParam.length -
|
|
1569
|
+
value = Number(numParam.slice(0, numParam.length - 3));
|
|
1570
1570
|
} else {
|
|
1571
1571
|
return [];
|
|
1572
1572
|
}
|
|
@@ -1663,7 +1663,7 @@ function createRealParam(member) {
|
|
|
1663
1663
|
// In the old models if member doesn't contain experssion, the value is stored in the member.expression as string
|
|
1664
1664
|
// For example 'limit2' member for an extrusion looks like this: {expression: "50", type: "real", value: 50, visible: 1}
|
|
1665
1665
|
// These expressions should be ignored.
|
|
1666
|
-
const expr = member.expression.replace(/ExpressionSet./g, '@expr.');
|
|
1666
|
+
const expr = member.expression.replace(/ExpressionSet./g, '@expr.').replace(/(?<=\b\d[\d.]*)g\b/g, 'deg');
|
|
1667
1667
|
const isExpr = expr.length > 0 && isNaN(Number(expr));
|
|
1668
1668
|
const value = isExpr ? expr : member.value;
|
|
1669
1669
|
return value;
|
|
@@ -1971,10 +1971,10 @@ const DimValue = ({
|
|
|
1971
1971
|
|
|
1972
1972
|
// const paramName = dimension.members.paramName.value
|
|
1973
1973
|
const expr = ((_master$members3 = master.members) == null ? void 0 : (_master$members3$memb = _master$members3[memberName]) == null ? void 0 : _master$members3$memb.expression.replace(/ /g, '').replace(/ExpressionSet./g, '@expr.')) || '';
|
|
1974
|
-
const degValue = expr.length > 0 && expr
|
|
1974
|
+
const degValue = expr.length > 0 && expr.slice(expr.length - 3) === 'deg' ? Number(expr.slice(0, expr.length - 3)) : NaN;
|
|
1975
1975
|
const isDeg = !isNaN(degValue);
|
|
1976
1976
|
const value = isDeg ? degValue : (_master$members4 = master.members) == null ? void 0 : (_master$members4$memb = _master$members4[memberName]) == null ? void 0 : _master$members4$memb.value;
|
|
1977
|
-
const valueStr = isDeg ? value.toFixed(2) + '
|
|
1977
|
+
const valueStr = isDeg ? value.toFixed(2) + 'deg' : value.toFixed(2);
|
|
1978
1978
|
return expr && !isDeg ? expr + ' (' + valueStr + ')' : valueStr;
|
|
1979
1979
|
}, [dimension, master, memberName, angle]);
|
|
1980
1980
|
const [editMode, setEditMode] = React.useState(false);
|
|
@@ -5900,7 +5900,7 @@ function parsePoint(param) {
|
|
|
5900
5900
|
return comps;
|
|
5901
5901
|
}
|
|
5902
5902
|
function getDisplayValue(valOrExpr) {
|
|
5903
|
-
return typeof valOrExpr === 'string' ? valOrExpr.replace(/ /g, '')
|
|
5903
|
+
return typeof valOrExpr === 'string' ? valOrExpr.replace(/ /g, '') : valOrExpr.toString();
|
|
5904
5904
|
}
|
|
5905
5905
|
const DisplayBase = styled.div`
|
|
5906
5906
|
display: flex;
|
|
@@ -6235,7 +6235,7 @@ const PointEditor = ({
|
|
|
6235
6235
|
};
|
|
6236
6236
|
|
|
6237
6237
|
function createPointParam(member) {
|
|
6238
|
-
const expr = member.expression.replace(/ExpressionSet./g, '@expr.');
|
|
6238
|
+
const expr = member.expression.replace(/ExpressionSet./g, '@expr.').replace(/(?<=\b\d[\d.]*)g\b/g, 'deg');
|
|
6239
6239
|
const isExpr = expr.length > 0;
|
|
6240
6240
|
const value = isExpr ? expr : member.value;
|
|
6241
6241
|
return value;
|
|
@@ -9536,7 +9536,7 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
9536
9536
|
} = tmpObjects[tmpDimensionId];
|
|
9537
9537
|
const sector = getArcSector(dimPos, dir0, dir1, center);
|
|
9538
9538
|
const previewValue = getArcPreviewValue(dir0, dir1, sector, reflex);
|
|
9539
|
-
const degValue = radiansToDegrees(previewValue) + '
|
|
9539
|
+
const degValue = radiansToDegrees(previewValue) + 'deg';
|
|
9540
9540
|
classcad.createApi(drawingId).v1.sketch.dimension({
|
|
9541
9541
|
id: sketchId,
|
|
9542
9542
|
name: 'Ang',
|
|
@@ -10754,7 +10754,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
10754
10754
|
id: sketchId,
|
|
10755
10755
|
startPos,
|
|
10756
10756
|
midPos: midInfo.mid,
|
|
10757
|
-
endPos
|
|
10757
|
+
endPos,
|
|
10758
|
+
genTangency: arcType === HandlersList.DRAWARCTANGENT
|
|
10758
10759
|
});
|
|
10759
10760
|
promise.then(() => {
|
|
10760
10761
|
// Remove the old temporary arc and its points once a permanent one is created in its place
|
|
@@ -14075,7 +14076,7 @@ const TmpAngularDim = props => {
|
|
|
14075
14076
|
previewValue: previewValue_
|
|
14076
14077
|
};
|
|
14077
14078
|
}, [dir0, dir1, center, dimPos, reflex]);
|
|
14078
|
-
const text = radiansToDegrees(previewValue).toFixed(2) + '
|
|
14079
|
+
const text = radiansToDegrees(previewValue).toFixed(2) + 'deg';
|
|
14079
14080
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
14080
14081
|
start: cornerP,
|
|
14081
14082
|
end: startFoot
|
|
@@ -15131,12 +15132,12 @@ function useShowRigidSet(drawingId, pluginId, selectorId) {
|
|
|
15131
15132
|
}
|
|
15132
15133
|
const convertDegToRadValue = angle => {
|
|
15133
15134
|
if (isDegValue(angle)) {
|
|
15134
|
-
return degreesToRadians(Number(angle.slice(0, angle.length -
|
|
15135
|
+
return degreesToRadians(Number(angle.slice(0, angle.length - 3)));
|
|
15135
15136
|
}
|
|
15136
15137
|
return angle === '' ? NaN : Number(angle);
|
|
15137
15138
|
};
|
|
15138
15139
|
const baseReg$2 = /^-?(\d*(\.\d*)?)?$/;
|
|
15139
|
-
const angleReg$2 = /^-?(\d*(\.\d*)?)?g?$/;
|
|
15140
|
+
const angleReg$2 = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
15140
15141
|
const Input$2 = _ref => {
|
|
15141
15142
|
let {
|
|
15142
15143
|
angle = false,
|
|
@@ -15284,7 +15285,7 @@ const CircPattern = () => {
|
|
|
15284
15285
|
const [rgSetSelId, setRgSetSelId] = React.useState('');
|
|
15285
15286
|
const [centerSelId, setCenterSelId] = React.useState('');
|
|
15286
15287
|
const [countD, setCountD] = React.useState('3');
|
|
15287
|
-
const [angleD, setAngleD] = React.useState('
|
|
15288
|
+
const [angleD, setAngleD] = React.useState('45deg');
|
|
15288
15289
|
useShowRigidSet(drawingId, pluginId, rgSetSelId);
|
|
15289
15290
|
const createPattern = React.useCallback(() => {
|
|
15290
15291
|
var _getDrawing$selection2, _getDrawing$selection3;
|
|
@@ -15326,7 +15327,7 @@ const CircPattern = () => {
|
|
|
15326
15327
|
contentWidth: 50
|
|
15327
15328
|
}, /*#__PURE__*/React.createElement(Input$2, {
|
|
15328
15329
|
value: angleD,
|
|
15329
|
-
defaultValue: '
|
|
15330
|
+
defaultValue: '45deg',
|
|
15330
15331
|
setValue: setAngleD,
|
|
15331
15332
|
angle: true
|
|
15332
15333
|
})), /*#__PURE__*/React.createElement(Wrapper, {
|
|
@@ -22932,17 +22933,15 @@ const FileUtils = {
|
|
|
22932
22933
|
const format = (type === 'step' ? 'stp' : type).toUpperCase();
|
|
22933
22934
|
const res = isRoot ? await classcad.createApi(drawingId).v1.common.save({
|
|
22934
22935
|
format,
|
|
22935
|
-
encoding: 'base64'
|
|
22936
|
-
compression: 'deflate'
|
|
22936
|
+
encoding: 'base64'
|
|
22937
22937
|
}).catch(console.warn) : await classcad.createApi(drawingId).v1.assembly.exportNode({
|
|
22938
22938
|
id: objectId,
|
|
22939
22939
|
format: format,
|
|
22940
|
-
encoding: 'base64'
|
|
22941
|
-
compression: 'deflate'
|
|
22940
|
+
encoding: 'base64'
|
|
22942
22941
|
}).catch(console.warn);
|
|
22943
22942
|
const content = res == null ? void 0 : (_res$result = res.result) == null ? void 0 : _res$result.content;
|
|
22944
22943
|
if (content) {
|
|
22945
|
-
const data =
|
|
22944
|
+
const data = atob(content);
|
|
22946
22945
|
const link = document.createElement('a');
|
|
22947
22946
|
link.href = window.URL.createObjectURL(new Blob([data], {
|
|
22948
22947
|
type: 'application/octet-stream'
|
|
@@ -22973,8 +22972,12 @@ const ModelTreeHeader = ({
|
|
|
22973
22972
|
const mode = useEditMode(drawingId);
|
|
22974
22973
|
const currProd = useCurrentProduct(drawingId);
|
|
22975
22974
|
const currInstance = useCurrentInstance(drawingId);
|
|
22976
|
-
const
|
|
22977
|
-
|
|
22975
|
+
const {
|
|
22976
|
+
isRoot,
|
|
22977
|
+
isAssembly,
|
|
22978
|
+
isAssemblyNode
|
|
22979
|
+
} = useObjectDetails(drawingId, (currInstance == null ? void 0 : currInstance.id) || NOCCID);
|
|
22980
|
+
const showBackBtn = React.useMemo(() => pStackNotEmpty || !isRoot && (isAssemblyNode || isAssembly), [isAssembly, isAssemblyNode, isRoot, pStackNotEmpty]);
|
|
22978
22981
|
const isFeatureActive = react.useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
|
|
22979
22982
|
const name = currProd ? currProd.name : currInstance ? currInstance.name : '';
|
|
22980
22983
|
const [rename, setRename] = React.useState(false);
|
|
@@ -23060,7 +23063,7 @@ const ModelTreeHeader = ({
|
|
|
23060
23063
|
display: 'flex',
|
|
23061
23064
|
alignItems: 'center'
|
|
23062
23065
|
}
|
|
23063
|
-
}, exportComponent, mode === exports.EditMode.Assembly &&
|
|
23066
|
+
}, exportComponent, mode === exports.EditMode.Assembly && isRoot && /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
23064
23067
|
title: "Convert to subassembly"
|
|
23065
23068
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
23066
23069
|
style: {
|
|
@@ -23069,7 +23072,7 @@ const ModelTreeHeader = ({
|
|
|
23069
23072
|
onClick: () => setShowNameChoice(true),
|
|
23070
23073
|
icon: /*#__PURE__*/React.createElement(icons.AppstoreAddOutlined, null),
|
|
23071
23074
|
size: "small"
|
|
23072
|
-
})), /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
23075
|
+
})), mode === exports.EditMode.Assembly && /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
23073
23076
|
title: "Product management"
|
|
23074
23077
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
23075
23078
|
style: {
|
|
@@ -23078,7 +23081,7 @@ const ModelTreeHeader = ({
|
|
|
23078
23081
|
onClick: () => enableProductManagement(true),
|
|
23079
23082
|
icon: /*#__PURE__*/React.createElement(icons.AppstoreOutlined, null),
|
|
23080
23083
|
size: "small"
|
|
23081
|
-
})))
|
|
23084
|
+
}))), showNameChoice && /*#__PURE__*/React.createElement(NameChoice, {
|
|
23082
23085
|
drawingId: drawingId,
|
|
23083
23086
|
hideWindow: () => setShowNameChoice(false)
|
|
23084
23087
|
}));
|
|
@@ -25923,13 +25926,13 @@ const formatValue$1 = (value, angle) => {
|
|
|
25923
25926
|
if (typeof value === 'number') {
|
|
25924
25927
|
return formatNumber$1(value);
|
|
25925
25928
|
} else if (angle && typeof value === 'string' && isDegValue(value)) {
|
|
25926
|
-
const float = Number(value.slice(0, value.length -
|
|
25927
|
-
return formatNumber$1(float) + '
|
|
25929
|
+
const float = Number(value.slice(0, value.length - 3));
|
|
25930
|
+
return formatNumber$1(float) + 'deg';
|
|
25928
25931
|
}
|
|
25929
25932
|
return '';
|
|
25930
25933
|
};
|
|
25931
25934
|
const baseReg$1 = /^-?(\d*(\.\d*)?)?$/;
|
|
25932
|
-
const angleReg$1 = /^-?(\d*(\.\d*)?)?g?$/;
|
|
25935
|
+
const angleReg$1 = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
25933
25936
|
const LimitInput = ({
|
|
25934
25937
|
value,
|
|
25935
25938
|
setValue,
|
|
@@ -26052,10 +26055,10 @@ const formatNumber = value => value.toFixed(3).replace(/\.?0+$/, '');
|
|
|
26052
26055
|
const formatValue = (value, angle) => {
|
|
26053
26056
|
if (typeof value === 'number') {
|
|
26054
26057
|
const formatted = formatNumber(value);
|
|
26055
|
-
return angle ? formatted + '
|
|
26058
|
+
return angle ? formatted + 'deg' : formatted;
|
|
26056
26059
|
} else if (isDegValue(value)) {
|
|
26057
|
-
const float = Number(value.slice(0, value.length -
|
|
26058
|
-
return formatNumber(float) + '
|
|
26060
|
+
const float = Number(value.slice(0, value.length - 3));
|
|
26061
|
+
return formatNumber(float) + 'deg';
|
|
26059
26062
|
}
|
|
26060
26063
|
return '';
|
|
26061
26064
|
};
|
|
@@ -26075,7 +26078,7 @@ function getNumericValue(value) {
|
|
|
26075
26078
|
if (typeof value === 'number') {
|
|
26076
26079
|
return value;
|
|
26077
26080
|
} else if (isDegValue(value)) {
|
|
26078
|
-
return Number(value.slice(0, value.length -
|
|
26081
|
+
return Number(value.slice(0, value.length - 3));
|
|
26079
26082
|
}
|
|
26080
26083
|
return 0;
|
|
26081
26084
|
}
|
|
@@ -26083,7 +26086,7 @@ function convertIfAngle(value, angle) {
|
|
|
26083
26086
|
return value !== undefined && angle ? radiansToDegrees(value) : value;
|
|
26084
26087
|
}
|
|
26085
26088
|
const baseReg = /^-?(\d*(\.\d*)?)?$/;
|
|
26086
|
-
const angleReg = /^-?(\d*(\.\d*)?)?g?$/;
|
|
26089
|
+
const angleReg = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
26087
26090
|
const LimitedValue = ({
|
|
26088
26091
|
drawingId,
|
|
26089
26092
|
objId,
|
|
@@ -27633,7 +27636,7 @@ function RootImpl$3({
|
|
|
27633
27636
|
});
|
|
27634
27637
|
}, [drawingId, objectId, entities, ratio, offset]);
|
|
27635
27638
|
const validate = React.useCallback(() => {
|
|
27636
|
-
if (ratio.userValue === 0 || ratio.userValue === '
|
|
27639
|
+
if (ratio.userValue === 0 || ratio.userValue === '0deg') {
|
|
27637
27640
|
return ["Ratio shouldn't equal 0!"];
|
|
27638
27641
|
}
|
|
27639
27642
|
return [];
|
|
@@ -27895,15 +27898,13 @@ function RootImpl$2({
|
|
|
27895
27898
|
};
|
|
27896
27899
|
reader.readAsArrayBuffer(file);
|
|
27897
27900
|
});
|
|
27898
|
-
|
|
27901
|
+
|
|
27899
27902
|
// TODO: Handle the format differently. It would probably be good to check the format beforehand, and avoid calling the API if it is wrong.
|
|
27900
27903
|
return classcad.createApi(drawingId).v1.part.updateImportFeature({
|
|
27901
27904
|
id: objectId,
|
|
27902
27905
|
name,
|
|
27903
|
-
data,
|
|
27904
|
-
format: type
|
|
27905
|
-
encoding: 'base64',
|
|
27906
|
-
compression: 'deflate'
|
|
27906
|
+
data: result,
|
|
27907
|
+
format: type
|
|
27907
27908
|
}).finally(() => isUpdating.current = false);
|
|
27908
27909
|
}, [drawingId, objectId, fileParam]);
|
|
27909
27910
|
const validate = React.useCallback(() => {
|
|
@@ -28464,12 +28465,9 @@ const ImportModel = ({
|
|
|
28464
28465
|
const type = pathBrowserify.extname(file.name).replace('.', '');
|
|
28465
28466
|
const format = (type === 'step' ? 'stp' : type).toUpperCase();
|
|
28466
28467
|
if (['OFB', 'STP'].includes(format)) {
|
|
28467
|
-
const data = typeof content !== 'string' ? classcad.compression.deflateToBase64(content) : content;
|
|
28468
28468
|
classcad.createApi(drawingId).v1.assembly.loadProduct({
|
|
28469
|
-
data,
|
|
28470
|
-
format: format
|
|
28471
|
-
encoding: 'base64',
|
|
28472
|
-
compression: 'deflate'
|
|
28469
|
+
data: content,
|
|
28470
|
+
format: format
|
|
28473
28471
|
}).catch(console.warn);
|
|
28474
28472
|
} else {
|
|
28475
28473
|
throw new Error('This type of file is not supported to import.');
|
|
@@ -28678,17 +28676,16 @@ const load = (file, singleDrawingApp) => {
|
|
|
28678
28676
|
const drawingId = await classcad.BuerliCadFacade.utils.connect(file.name).catch(console.warn);
|
|
28679
28677
|
if (drawingId) {
|
|
28680
28678
|
try {
|
|
28679
|
+
if (!result) {
|
|
28680
|
+
throw new Error('No data to load!');
|
|
28681
|
+
}
|
|
28681
28682
|
core.api.getState().api.setActiveDrawing(drawingId);
|
|
28682
28683
|
const type = pathBrowserify.extname(file.name).replace('.', '');
|
|
28683
28684
|
const format = (type === 'step' ? 'stp' : type).toUpperCase();
|
|
28684
|
-
const data = typeof result !== 'string' ? classcad.compression.deflateToBase64(result) : result;
|
|
28685
28685
|
if (['OFB', 'STP', 'IWP'].includes(format)) {
|
|
28686
28686
|
await classcad.createApi(drawingId).v1.common.load({
|
|
28687
|
-
data,
|
|
28688
|
-
format: format
|
|
28689
|
-
ident: file.name,
|
|
28690
|
-
encoding: 'base64',
|
|
28691
|
-
compression: 'deflate'
|
|
28687
|
+
data: result,
|
|
28688
|
+
format: format
|
|
28692
28689
|
}).catch(console.warn);
|
|
28693
28690
|
} else {
|
|
28694
28691
|
throw new Error('This type of file is not supported to load.');
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useDrawing, CameraHelper, useBuerli, usePlugin, usePluginExists, useFeaturePluginDef, GlobalTransform, BuerliGeometry } from '@buerli.io/react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useState, useCallback, useEffect, useRef, memo, useMemo, useContext, useReducer, forwardRef } from 'react';
|
|
4
|
-
import { ccUtils, ScgClassType, createApi as createApi$1, ReorientedType, FlipType, ScgGraphicType, BooleanOperationType, ExtrusionType as ExtrusionType$1, ChamferType, WorkAxisType, WorkPlaneType, WorkPointType, WorkCoordSystemType,
|
|
4
|
+
import { ccUtils, ScgClassType, createApi as createApi$1, ReorientedType, FlipType, ScgGraphicType, BooleanOperationType, ExtrusionType as ExtrusionType$1, ChamferType, WorkAxisType, WorkPlaneType, WorkPointType, WorkCoordSystemType, BuerliCadFacade } from '@buerli.io/classcad';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
6
|
import { Matrix4 } from 'three';
|
|
7
7
|
import { getDrawing, createGraphicItem, MemberType, MathUtils, api, showMessage, ExtrusionType, createInfo, getPlugin, BuerliScope, solidFilter, edgeFilter, meshFilter, loopFilter, planeFilter, EntityTypes, Measure, MeasureResultType, pointFilter, lineFilter, arcFilter, circleFilter, arcCircleFilter } from '@buerli.io/core';
|
|
@@ -1160,7 +1160,7 @@ const Mentions = ({
|
|
|
1160
1160
|
};
|
|
1161
1161
|
|
|
1162
1162
|
function isDegValue(expr) {
|
|
1163
|
-
return expr.length > 1 && expr
|
|
1163
|
+
return expr.length > 1 && expr.slice(expr.length - 3) === 'deg' && !isNaN(Number(expr.slice(0, expr.length - 3)));
|
|
1164
1164
|
}
|
|
1165
1165
|
function getDefNumValue(numOrExpr) {
|
|
1166
1166
|
return typeof numOrExpr === 'number' ? numOrExpr : isDegValue(numOrExpr) ? numOrExpr : 0;
|
|
@@ -1244,7 +1244,7 @@ const NumOrExpr = ({
|
|
|
1244
1244
|
}, /*#__PURE__*/React__default.createElement(Prefix, null, prefix)));
|
|
1245
1245
|
};
|
|
1246
1246
|
const baseReg$3 = /^-?(\d*(\.\d*)?)?$/;
|
|
1247
|
-
const angleReg$3 = /^-?(\d*(\.\d*)?)?g?$/;
|
|
1247
|
+
const angleReg$3 = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
1248
1248
|
const NumInput$1 = ({
|
|
1249
1249
|
state,
|
|
1250
1250
|
setState,
|
|
@@ -1543,7 +1543,7 @@ function acceptableRange(min, max) {
|
|
|
1543
1543
|
if (!isNaN(Number(numParam))) {
|
|
1544
1544
|
value = Number(numParam);
|
|
1545
1545
|
} else if (typeof numParam === 'string' && isDegValue(numParam)) {
|
|
1546
|
-
value = Number(numParam.slice(0, numParam.length -
|
|
1546
|
+
value = Number(numParam.slice(0, numParam.length - 3));
|
|
1547
1547
|
} else {
|
|
1548
1548
|
return [];
|
|
1549
1549
|
}
|
|
@@ -1640,7 +1640,7 @@ function createRealParam(member) {
|
|
|
1640
1640
|
// In the old models if member doesn't contain experssion, the value is stored in the member.expression as string
|
|
1641
1641
|
// For example 'limit2' member for an extrusion looks like this: {expression: "50", type: "real", value: 50, visible: 1}
|
|
1642
1642
|
// These expressions should be ignored.
|
|
1643
|
-
const expr = member.expression.replace(/ExpressionSet./g, '@expr.');
|
|
1643
|
+
const expr = member.expression.replace(/ExpressionSet./g, '@expr.').replace(/(?<=\b\d[\d.]*)g\b/g, 'deg');
|
|
1644
1644
|
const isExpr = expr.length > 0 && isNaN(Number(expr));
|
|
1645
1645
|
const value = isExpr ? expr : member.value;
|
|
1646
1646
|
return value;
|
|
@@ -1948,10 +1948,10 @@ const DimValue = ({
|
|
|
1948
1948
|
|
|
1949
1949
|
// const paramName = dimension.members.paramName.value
|
|
1950
1950
|
const expr = ((_master$members3 = master.members) == null ? void 0 : (_master$members3$memb = _master$members3[memberName]) == null ? void 0 : _master$members3$memb.expression.replace(/ /g, '').replace(/ExpressionSet./g, '@expr.')) || '';
|
|
1951
|
-
const degValue = expr.length > 0 && expr
|
|
1951
|
+
const degValue = expr.length > 0 && expr.slice(expr.length - 3) === 'deg' ? Number(expr.slice(0, expr.length - 3)) : NaN;
|
|
1952
1952
|
const isDeg = !isNaN(degValue);
|
|
1953
1953
|
const value = isDeg ? degValue : (_master$members4 = master.members) == null ? void 0 : (_master$members4$memb = _master$members4[memberName]) == null ? void 0 : _master$members4$memb.value;
|
|
1954
|
-
const valueStr = isDeg ? value.toFixed(2) + '
|
|
1954
|
+
const valueStr = isDeg ? value.toFixed(2) + 'deg' : value.toFixed(2);
|
|
1955
1955
|
return expr && !isDeg ? expr + ' (' + valueStr + ')' : valueStr;
|
|
1956
1956
|
}, [dimension, master, memberName, angle]);
|
|
1957
1957
|
const [editMode, setEditMode] = React__default.useState(false);
|
|
@@ -5877,7 +5877,7 @@ function parsePoint(param) {
|
|
|
5877
5877
|
return comps;
|
|
5878
5878
|
}
|
|
5879
5879
|
function getDisplayValue(valOrExpr) {
|
|
5880
|
-
return typeof valOrExpr === 'string' ? valOrExpr.replace(/ /g, '')
|
|
5880
|
+
return typeof valOrExpr === 'string' ? valOrExpr.replace(/ /g, '') : valOrExpr.toString();
|
|
5881
5881
|
}
|
|
5882
5882
|
const DisplayBase = styled.div`
|
|
5883
5883
|
display: flex;
|
|
@@ -6212,7 +6212,7 @@ const PointEditor = ({
|
|
|
6212
6212
|
};
|
|
6213
6213
|
|
|
6214
6214
|
function createPointParam(member) {
|
|
6215
|
-
const expr = member.expression.replace(/ExpressionSet./g, '@expr.');
|
|
6215
|
+
const expr = member.expression.replace(/ExpressionSet./g, '@expr.').replace(/(?<=\b\d[\d.]*)g\b/g, 'deg');
|
|
6216
6216
|
const isExpr = expr.length > 0;
|
|
6217
6217
|
const value = isExpr ? expr : member.value;
|
|
6218
6218
|
return value;
|
|
@@ -9513,7 +9513,7 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
9513
9513
|
} = tmpObjects[tmpDimensionId];
|
|
9514
9514
|
const sector = getArcSector(dimPos, dir0, dir1, center);
|
|
9515
9515
|
const previewValue = getArcPreviewValue(dir0, dir1, sector, reflex);
|
|
9516
|
-
const degValue = radiansToDegrees(previewValue) + '
|
|
9516
|
+
const degValue = radiansToDegrees(previewValue) + 'deg';
|
|
9517
9517
|
createApi$1(drawingId).v1.sketch.dimension({
|
|
9518
9518
|
id: sketchId,
|
|
9519
9519
|
name: 'Ang',
|
|
@@ -10731,7 +10731,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
10731
10731
|
id: sketchId,
|
|
10732
10732
|
startPos,
|
|
10733
10733
|
midPos: midInfo.mid,
|
|
10734
|
-
endPos
|
|
10734
|
+
endPos,
|
|
10735
|
+
genTangency: arcType === HandlersList.DRAWARCTANGENT
|
|
10735
10736
|
});
|
|
10736
10737
|
promise.then(() => {
|
|
10737
10738
|
// Remove the old temporary arc and its points once a permanent one is created in its place
|
|
@@ -14052,7 +14053,7 @@ const TmpAngularDim = props => {
|
|
|
14052
14053
|
previewValue: previewValue_
|
|
14053
14054
|
};
|
|
14054
14055
|
}, [dir0, dir1, center, dimPos, reflex]);
|
|
14055
|
-
const text = radiansToDegrees(previewValue).toFixed(2) + '
|
|
14056
|
+
const text = radiansToDegrees(previewValue).toFixed(2) + 'deg';
|
|
14056
14057
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Line$2, {
|
|
14057
14058
|
start: cornerP,
|
|
14058
14059
|
end: startFoot
|
|
@@ -15108,12 +15109,12 @@ function useShowRigidSet(drawingId, pluginId, selectorId) {
|
|
|
15108
15109
|
}
|
|
15109
15110
|
const convertDegToRadValue = angle => {
|
|
15110
15111
|
if (isDegValue(angle)) {
|
|
15111
|
-
return degreesToRadians(Number(angle.slice(0, angle.length -
|
|
15112
|
+
return degreesToRadians(Number(angle.slice(0, angle.length - 3)));
|
|
15112
15113
|
}
|
|
15113
15114
|
return angle === '' ? NaN : Number(angle);
|
|
15114
15115
|
};
|
|
15115
15116
|
const baseReg$2 = /^-?(\d*(\.\d*)?)?$/;
|
|
15116
|
-
const angleReg$2 = /^-?(\d*(\.\d*)?)?g?$/;
|
|
15117
|
+
const angleReg$2 = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
15117
15118
|
const Input$2 = _ref => {
|
|
15118
15119
|
let {
|
|
15119
15120
|
angle = false,
|
|
@@ -15261,7 +15262,7 @@ const CircPattern = () => {
|
|
|
15261
15262
|
const [rgSetSelId, setRgSetSelId] = React__default.useState('');
|
|
15262
15263
|
const [centerSelId, setCenterSelId] = React__default.useState('');
|
|
15263
15264
|
const [countD, setCountD] = React__default.useState('3');
|
|
15264
|
-
const [angleD, setAngleD] = React__default.useState('
|
|
15265
|
+
const [angleD, setAngleD] = React__default.useState('45deg');
|
|
15265
15266
|
useShowRigidSet(drawingId, pluginId, rgSetSelId);
|
|
15266
15267
|
const createPattern = React__default.useCallback(() => {
|
|
15267
15268
|
var _getDrawing$selection2, _getDrawing$selection3;
|
|
@@ -15303,7 +15304,7 @@ const CircPattern = () => {
|
|
|
15303
15304
|
contentWidth: 50
|
|
15304
15305
|
}, /*#__PURE__*/React__default.createElement(Input$2, {
|
|
15305
15306
|
value: angleD,
|
|
15306
|
-
defaultValue: '
|
|
15307
|
+
defaultValue: '45deg',
|
|
15307
15308
|
setValue: setAngleD,
|
|
15308
15309
|
angle: true
|
|
15309
15310
|
})), /*#__PURE__*/React__default.createElement(Wrapper, {
|
|
@@ -22909,17 +22910,15 @@ const FileUtils = {
|
|
|
22909
22910
|
const format = (type === 'step' ? 'stp' : type).toUpperCase();
|
|
22910
22911
|
const res = isRoot ? await createApi$1(drawingId).v1.common.save({
|
|
22911
22912
|
format,
|
|
22912
|
-
encoding: 'base64'
|
|
22913
|
-
compression: 'deflate'
|
|
22913
|
+
encoding: 'base64'
|
|
22914
22914
|
}).catch(console.warn) : await createApi$1(drawingId).v1.assembly.exportNode({
|
|
22915
22915
|
id: objectId,
|
|
22916
22916
|
format: format,
|
|
22917
|
-
encoding: 'base64'
|
|
22918
|
-
compression: 'deflate'
|
|
22917
|
+
encoding: 'base64'
|
|
22919
22918
|
}).catch(console.warn);
|
|
22920
22919
|
const content = res == null ? void 0 : (_res$result = res.result) == null ? void 0 : _res$result.content;
|
|
22921
22920
|
if (content) {
|
|
22922
|
-
const data =
|
|
22921
|
+
const data = atob(content);
|
|
22923
22922
|
const link = document.createElement('a');
|
|
22924
22923
|
link.href = window.URL.createObjectURL(new Blob([data], {
|
|
22925
22924
|
type: 'application/octet-stream'
|
|
@@ -22950,8 +22949,12 @@ const ModelTreeHeader = ({
|
|
|
22950
22949
|
const mode = useEditMode(drawingId);
|
|
22951
22950
|
const currProd = useCurrentProduct(drawingId);
|
|
22952
22951
|
const currInstance = useCurrentInstance(drawingId);
|
|
22953
|
-
const
|
|
22954
|
-
|
|
22952
|
+
const {
|
|
22953
|
+
isRoot,
|
|
22954
|
+
isAssembly,
|
|
22955
|
+
isAssemblyNode
|
|
22956
|
+
} = useObjectDetails(drawingId, (currInstance == null ? void 0 : currInstance.id) || NOCCID);
|
|
22957
|
+
const showBackBtn = React__default.useMemo(() => pStackNotEmpty || !isRoot && (isAssemblyNode || isAssembly), [isAssembly, isAssemblyNode, isRoot, pStackNotEmpty]);
|
|
22955
22958
|
const isFeatureActive = useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
|
|
22956
22959
|
const name = currProd ? currProd.name : currInstance ? currInstance.name : '';
|
|
22957
22960
|
const [rename, setRename] = React__default.useState(false);
|
|
@@ -23037,7 +23040,7 @@ const ModelTreeHeader = ({
|
|
|
23037
23040
|
display: 'flex',
|
|
23038
23041
|
alignItems: 'center'
|
|
23039
23042
|
}
|
|
23040
|
-
}, exportComponent, mode === EditMode.Assembly &&
|
|
23043
|
+
}, exportComponent, mode === EditMode.Assembly && isRoot && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
23041
23044
|
title: "Convert to subassembly"
|
|
23042
23045
|
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
23043
23046
|
style: {
|
|
@@ -23046,7 +23049,7 @@ const ModelTreeHeader = ({
|
|
|
23046
23049
|
onClick: () => setShowNameChoice(true),
|
|
23047
23050
|
icon: /*#__PURE__*/React__default.createElement(AppstoreAddOutlined, null),
|
|
23048
23051
|
size: "small"
|
|
23049
|
-
})), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
23052
|
+
})), mode === EditMode.Assembly && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
23050
23053
|
title: "Product management"
|
|
23051
23054
|
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
23052
23055
|
style: {
|
|
@@ -23055,7 +23058,7 @@ const ModelTreeHeader = ({
|
|
|
23055
23058
|
onClick: () => enableProductManagement(true),
|
|
23056
23059
|
icon: /*#__PURE__*/React__default.createElement(AppstoreOutlined, null),
|
|
23057
23060
|
size: "small"
|
|
23058
|
-
})))
|
|
23061
|
+
}))), showNameChoice && /*#__PURE__*/React__default.createElement(NameChoice, {
|
|
23059
23062
|
drawingId: drawingId,
|
|
23060
23063
|
hideWindow: () => setShowNameChoice(false)
|
|
23061
23064
|
}));
|
|
@@ -25900,13 +25903,13 @@ const formatValue$1 = (value, angle) => {
|
|
|
25900
25903
|
if (typeof value === 'number') {
|
|
25901
25904
|
return formatNumber$1(value);
|
|
25902
25905
|
} else if (angle && typeof value === 'string' && isDegValue(value)) {
|
|
25903
|
-
const float = Number(value.slice(0, value.length -
|
|
25904
|
-
return formatNumber$1(float) + '
|
|
25906
|
+
const float = Number(value.slice(0, value.length - 3));
|
|
25907
|
+
return formatNumber$1(float) + 'deg';
|
|
25905
25908
|
}
|
|
25906
25909
|
return '';
|
|
25907
25910
|
};
|
|
25908
25911
|
const baseReg$1 = /^-?(\d*(\.\d*)?)?$/;
|
|
25909
|
-
const angleReg$1 = /^-?(\d*(\.\d*)?)?g?$/;
|
|
25912
|
+
const angleReg$1 = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
25910
25913
|
const LimitInput = ({
|
|
25911
25914
|
value,
|
|
25912
25915
|
setValue,
|
|
@@ -26029,10 +26032,10 @@ const formatNumber = value => value.toFixed(3).replace(/\.?0+$/, '');
|
|
|
26029
26032
|
const formatValue = (value, angle) => {
|
|
26030
26033
|
if (typeof value === 'number') {
|
|
26031
26034
|
const formatted = formatNumber(value);
|
|
26032
|
-
return angle ? formatted + '
|
|
26035
|
+
return angle ? formatted + 'deg' : formatted;
|
|
26033
26036
|
} else if (isDegValue(value)) {
|
|
26034
|
-
const float = Number(value.slice(0, value.length -
|
|
26035
|
-
return formatNumber(float) + '
|
|
26037
|
+
const float = Number(value.slice(0, value.length - 3));
|
|
26038
|
+
return formatNumber(float) + 'deg';
|
|
26036
26039
|
}
|
|
26037
26040
|
return '';
|
|
26038
26041
|
};
|
|
@@ -26052,7 +26055,7 @@ function getNumericValue(value) {
|
|
|
26052
26055
|
if (typeof value === 'number') {
|
|
26053
26056
|
return value;
|
|
26054
26057
|
} else if (isDegValue(value)) {
|
|
26055
|
-
return Number(value.slice(0, value.length -
|
|
26058
|
+
return Number(value.slice(0, value.length - 3));
|
|
26056
26059
|
}
|
|
26057
26060
|
return 0;
|
|
26058
26061
|
}
|
|
@@ -26060,7 +26063,7 @@ function convertIfAngle(value, angle) {
|
|
|
26060
26063
|
return value !== undefined && angle ? radiansToDegrees(value) : value;
|
|
26061
26064
|
}
|
|
26062
26065
|
const baseReg = /^-?(\d*(\.\d*)?)?$/;
|
|
26063
|
-
const angleReg = /^-?(\d*(\.\d*)?)?g?$/;
|
|
26066
|
+
const angleReg = /^-?(\d*(\.\d*)?)?d?e?g?$/;
|
|
26064
26067
|
const LimitedValue = ({
|
|
26065
26068
|
drawingId,
|
|
26066
26069
|
objId,
|
|
@@ -27610,7 +27613,7 @@ function RootImpl$3({
|
|
|
27610
27613
|
});
|
|
27611
27614
|
}, [drawingId, objectId, entities, ratio, offset]);
|
|
27612
27615
|
const validate = React__default.useCallback(() => {
|
|
27613
|
-
if (ratio.userValue === 0 || ratio.userValue === '
|
|
27616
|
+
if (ratio.userValue === 0 || ratio.userValue === '0deg') {
|
|
27614
27617
|
return ["Ratio shouldn't equal 0!"];
|
|
27615
27618
|
}
|
|
27616
27619
|
return [];
|
|
@@ -27872,15 +27875,13 @@ function RootImpl$2({
|
|
|
27872
27875
|
};
|
|
27873
27876
|
reader.readAsArrayBuffer(file);
|
|
27874
27877
|
});
|
|
27875
|
-
|
|
27878
|
+
|
|
27876
27879
|
// TODO: Handle the format differently. It would probably be good to check the format beforehand, and avoid calling the API if it is wrong.
|
|
27877
27880
|
return createApi$1(drawingId).v1.part.updateImportFeature({
|
|
27878
27881
|
id: objectId,
|
|
27879
27882
|
name,
|
|
27880
|
-
data,
|
|
27881
|
-
format: type
|
|
27882
|
-
encoding: 'base64',
|
|
27883
|
-
compression: 'deflate'
|
|
27883
|
+
data: result,
|
|
27884
|
+
format: type
|
|
27884
27885
|
}).finally(() => isUpdating.current = false);
|
|
27885
27886
|
}, [drawingId, objectId, fileParam]);
|
|
27886
27887
|
const validate = React__default.useCallback(() => {
|
|
@@ -28441,12 +28442,9 @@ const ImportModel = ({
|
|
|
28441
28442
|
const type = extname(file.name).replace('.', '');
|
|
28442
28443
|
const format = (type === 'step' ? 'stp' : type).toUpperCase();
|
|
28443
28444
|
if (['OFB', 'STP'].includes(format)) {
|
|
28444
|
-
const data = typeof content !== 'string' ? compression.deflateToBase64(content) : content;
|
|
28445
28445
|
createApi$1(drawingId).v1.assembly.loadProduct({
|
|
28446
|
-
data,
|
|
28447
|
-
format: format
|
|
28448
|
-
encoding: 'base64',
|
|
28449
|
-
compression: 'deflate'
|
|
28446
|
+
data: content,
|
|
28447
|
+
format: format
|
|
28450
28448
|
}).catch(console.warn);
|
|
28451
28449
|
} else {
|
|
28452
28450
|
throw new Error('This type of file is not supported to import.');
|
|
@@ -28655,17 +28653,16 @@ const load = (file, singleDrawingApp) => {
|
|
|
28655
28653
|
const drawingId = await BuerliCadFacade.utils.connect(file.name).catch(console.warn);
|
|
28656
28654
|
if (drawingId) {
|
|
28657
28655
|
try {
|
|
28656
|
+
if (!result) {
|
|
28657
|
+
throw new Error('No data to load!');
|
|
28658
|
+
}
|
|
28658
28659
|
api.getState().api.setActiveDrawing(drawingId);
|
|
28659
28660
|
const type = extname(file.name).replace('.', '');
|
|
28660
28661
|
const format = (type === 'step' ? 'stp' : type).toUpperCase();
|
|
28661
|
-
const data = typeof result !== 'string' ? compression.deflateToBase64(result) : result;
|
|
28662
28662
|
if (['OFB', 'STP', 'IWP'].includes(format)) {
|
|
28663
28663
|
await createApi$1(drawingId).v1.common.load({
|
|
28664
|
-
data,
|
|
28665
|
-
format: format
|
|
28666
|
-
ident: file.name,
|
|
28667
|
-
encoding: 'base64',
|
|
28668
|
-
compression: 'deflate'
|
|
28664
|
+
data: result,
|
|
28665
|
+
format: format
|
|
28669
28666
|
}).catch(console.warn);
|
|
28670
28667
|
} else {
|
|
28671
28668
|
throw new Error('This type of file is not supported to load.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buerli.io/react-cad",
|
|
3
|
-
"version": "0.13.1-beta.
|
|
3
|
+
"version": "0.13.1-beta.12",
|
|
4
4
|
"description": "buerli CAD components",
|
|
5
5
|
"author": "AWV Informatik AG <info@awv-informatik.ch>",
|
|
6
6
|
"repository": {},
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"three": ">=0.153"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@buerli.io/classcad": "0.13.1-beta.
|
|
91
|
-
"@buerli.io/react": "0.13.1-beta.
|
|
90
|
+
"@buerli.io/classcad": "0.13.1-beta.12",
|
|
91
|
+
"@buerli.io/react": "0.13.1-beta.12",
|
|
92
92
|
"@dnd-kit/core": "^6.0.8",
|
|
93
93
|
"@dnd-kit/modifiers": "^6.0.1",
|
|
94
94
|
"@dnd-kit/sortable": "^7.0.2",
|