@itwin/editor-frontend 3.0.0-dev.151 → 3.0.0-dev.155
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/lib/cjs/SolidModelingTools.d.ts +128 -21
- package/lib/cjs/SolidModelingTools.d.ts.map +1 -1
- package/lib/cjs/SolidModelingTools.js +593 -63
- package/lib/cjs/SolidModelingTools.js.map +1 -1
- package/lib/esm/SolidModelingTools.d.ts +128 -21
- package/lib/esm/SolidModelingTools.d.ts.map +1 -1
- package/lib/esm/SolidModelingTools.js +594 -64
- package/lib/esm/SolidModelingTools.js.map +1 -1
- package/lib/public/locales/en/Editor.json +60 -9
- package/package.json +12 -12
|
@@ -14,6 +14,8 @@ const core_geometry_1 = require("@itwin/core-geometry");
|
|
|
14
14
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
15
15
|
const CreateElementTool_1 = require("./CreateElementTool");
|
|
16
16
|
const ElementGeometryTool_1 = require("./ElementGeometryTool");
|
|
17
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
18
|
+
const EditTool_1 = require("./EditTool");
|
|
17
19
|
/** @alpha Base class for tools that perform boolean operations on a set of elements. */
|
|
18
20
|
class BooleanOperationTool extends ElementGeometryTool_1.ElementGeometryCacheTool {
|
|
19
21
|
get allowSelectionSet() { return editor_common_1.BooleanMode.Subtract !== this.mode; }
|
|
@@ -126,12 +128,20 @@ SewSheetElementsTool.toolId = "SewSheets";
|
|
|
126
128
|
SewSheetElementsTool.iconSpec = "icon-move"; // TODO: Need better icon...
|
|
127
129
|
/** @alpha Perform thicken operation on surface geometry. */
|
|
128
130
|
class ThickenSheetElementsTool extends ElementGeometryTool_1.ElementGeometryCacheTool {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
}
|
|
131
|
+
get frontDistanceProperty() {
|
|
132
|
+
if (!this._frontDistanceProperty)
|
|
133
|
+
this._frontDistanceProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("thickenFront", EditTool_1.EditTools.translate("ThickenSheets.Label.FrontDistance")), 0.1, undefined);
|
|
134
|
+
return this._frontDistanceProperty;
|
|
135
|
+
}
|
|
136
|
+
get frontDistance() { return this.frontDistanceProperty.value; }
|
|
137
|
+
set frontDistance(value) { this.frontDistanceProperty.value = value; }
|
|
138
|
+
get backDistanceProperty() {
|
|
139
|
+
if (!this._backDistanceProperty)
|
|
140
|
+
this._backDistanceProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("thickenBack", EditTool_1.EditTools.translate("ThickenSheets.Label.BackDistance")), 0.0, undefined);
|
|
141
|
+
return this._backDistanceProperty;
|
|
142
|
+
}
|
|
143
|
+
get backDistance() { return this.backDistanceProperty.value; }
|
|
144
|
+
set backDistance(value) { this.backDistanceProperty.value = value; }
|
|
135
145
|
get geometryCacheFilter() {
|
|
136
146
|
return { parts: true, curves: false, surfaces: true, solids: false, other: false };
|
|
137
147
|
}
|
|
@@ -154,6 +164,32 @@ class ThickenSheetElementsTool extends ElementGeometryTool_1.ElementGeometryCach
|
|
|
154
164
|
if (result === null || result === void 0 ? void 0 : result.elementId)
|
|
155
165
|
await this.saveChanges();
|
|
156
166
|
}
|
|
167
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
168
|
+
if (updatedValue.propertyName === this.frontDistanceProperty.name) {
|
|
169
|
+
this.frontDistance = updatedValue.value.value;
|
|
170
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.frontDistanceProperty.item);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
else if (updatedValue.propertyName === this.backDistanceProperty.name) {
|
|
174
|
+
this.backDistance = updatedValue.value.value;
|
|
175
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.backDistanceProperty.item);
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
supplyToolSettingsProperties() {
|
|
181
|
+
var _a;
|
|
182
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.frontDistanceProperty.name, this.backDistanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
183
|
+
if (value.propertyName === this.frontDistanceProperty.name)
|
|
184
|
+
this.frontDistanceProperty.dialogItemValue = value.value;
|
|
185
|
+
else if (value.propertyName === this.backDistanceProperty.name)
|
|
186
|
+
this.backDistanceProperty.dialogItemValue = value.value;
|
|
187
|
+
});
|
|
188
|
+
const toolSettings = new Array();
|
|
189
|
+
toolSettings.push(this.frontDistanceProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
|
|
190
|
+
toolSettings.push(this.backDistanceProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
191
|
+
return toolSettings;
|
|
192
|
+
}
|
|
157
193
|
async onRestartTool() {
|
|
158
194
|
const tool = new ThickenSheetElementsTool();
|
|
159
195
|
if (!await tool.run())
|
|
@@ -165,13 +201,34 @@ ThickenSheetElementsTool.toolId = "ThickenSheets";
|
|
|
165
201
|
ThickenSheetElementsTool.iconSpec = "icon-move"; // TODO: Need better icon...
|
|
166
202
|
/** @alpha Perform cut operation on solid using region or path profile. */
|
|
167
203
|
class CutSolidElementsTool extends ElementGeometryTool_1.ElementGeometryCacheTool {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
204
|
+
get bothDirectionsProperty() {
|
|
205
|
+
if (!this._bothDirectionsProperty)
|
|
206
|
+
this._bothDirectionsProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildToggleDescription("cutBothDirections", EditTool_1.EditTools.translate("CutSolids.Label.BothDirections")), false);
|
|
207
|
+
return this._bothDirectionsProperty;
|
|
208
|
+
}
|
|
209
|
+
get bothDirections() { return this.bothDirectionsProperty.value; }
|
|
210
|
+
set bothDirections(value) { this.bothDirectionsProperty.value = value; }
|
|
211
|
+
get outsideProperty() {
|
|
212
|
+
if (!this._outsideProperty)
|
|
213
|
+
this._outsideProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildToggleDescription("cutOutside", EditTool_1.EditTools.translate("CutSolids.Label.Outside")), false);
|
|
214
|
+
return this._outsideProperty;
|
|
215
|
+
}
|
|
216
|
+
get outside() { return this.outsideProperty.value; }
|
|
217
|
+
set outside(value) { this.outsideProperty.value = value; }
|
|
218
|
+
get useDepthProperty() {
|
|
219
|
+
if (!this._useDepthProperty)
|
|
220
|
+
this._useDepthProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildLockPropertyDescription("useCutDepth"), false);
|
|
221
|
+
return this._useDepthProperty;
|
|
222
|
+
}
|
|
223
|
+
get useDepth() { return this.useDepthProperty.value; }
|
|
224
|
+
set useDepth(value) { this.useDepthProperty.value = value; }
|
|
225
|
+
get depthProperty() {
|
|
226
|
+
if (!this._depthProperty)
|
|
227
|
+
this._depthProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("cutDepth", EditTool_1.EditTools.translate("CutSolids.Label.Depth")), 0.1, undefined, !this.useDepth);
|
|
228
|
+
return this._depthProperty;
|
|
229
|
+
}
|
|
230
|
+
get depth() { return this.depthProperty.value; }
|
|
231
|
+
set depth(value) { this.depthProperty.value = value; }
|
|
175
232
|
get requiredElementCount() { return 2; }
|
|
176
233
|
get isProfilePhase() { return !this.agenda.isEmpty; }
|
|
177
234
|
get geometryCacheFilter() {
|
|
@@ -200,12 +257,12 @@ class CutSolidElementsTool extends ElementGeometryTool_1.ElementGeometryCacheToo
|
|
|
200
257
|
if (this.agenda.length < this.requiredElementCount)
|
|
201
258
|
return undefined;
|
|
202
259
|
const direction = (this.bothDirections ? editor_common_1.CutDirectionMode.Both : editor_common_1.CutDirectionMode.Auto);
|
|
203
|
-
const depth = (
|
|
260
|
+
const depth = (this.useDepth ? editor_common_1.CutDepthMode.Blind : editor_common_1.CutDepthMode.All);
|
|
204
261
|
try {
|
|
205
262
|
this._startedCmd = await this.startCommand();
|
|
206
263
|
const target = this.agenda.elements[0];
|
|
207
264
|
const profile = this.agenda.elements[1];
|
|
208
|
-
const params = { profile, direction, depth, distance: this.
|
|
265
|
+
const params = { profile, direction, depth, distance: this.depth, outside: this.outside ? true : undefined, closeOpen: editor_common_1.ProfileClosure.Auto, targetPoint: this.targetPoint, toolPoint: this.toolPoint };
|
|
209
266
|
const opts = { writeChanges: true };
|
|
210
267
|
return await ElementGeometryTool_1.ElementGeometryCacheTool.callCommand("cutSolid", target, params, opts);
|
|
211
268
|
}
|
|
@@ -225,6 +282,60 @@ class CutSolidElementsTool extends ElementGeometryTool_1.ElementGeometryCacheToo
|
|
|
225
282
|
this.targetPoint = hit.hitPoint;
|
|
226
283
|
return super.buildLocateAgenda(hit);
|
|
227
284
|
}
|
|
285
|
+
syncDepthState() {
|
|
286
|
+
this.depthProperty.displayValue = this.depthProperty.description.format(this.depth);
|
|
287
|
+
this.depthProperty.isDisabled = !this.useDepth;
|
|
288
|
+
this.syncToolSettingsProperties([this.depthProperty.syncItem]);
|
|
289
|
+
}
|
|
290
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
291
|
+
if (updatedValue.propertyName === this.bothDirectionsProperty.name) {
|
|
292
|
+
this.bothDirections = updatedValue.value.value;
|
|
293
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.bothDirectionsProperty.item);
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
else if (updatedValue.propertyName === this.outsideProperty.name) {
|
|
297
|
+
this.outside = updatedValue.value.value;
|
|
298
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.outsideProperty.item);
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
else if (updatedValue.propertyName === this.useDepthProperty.name) {
|
|
302
|
+
this.useDepth = updatedValue.value.value;
|
|
303
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.useDepthProperty.item);
|
|
304
|
+
this.syncDepthState();
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
else if (updatedValue.propertyName === this.depthProperty.name) {
|
|
308
|
+
if (!updatedValue.value.value) {
|
|
309
|
+
this.syncDepthState(); // force UI to redisplay last valid value
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
this.depth = updatedValue.value.value;
|
|
313
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.depthProperty.item);
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
supplyToolSettingsProperties() {
|
|
319
|
+
var _a;
|
|
320
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.bothDirectionsProperty.name, this.outsideProperty.name, this.useDepthProperty.name, this.depthProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
321
|
+
if (value.propertyName === this.bothDirectionsProperty.name)
|
|
322
|
+
this.bothDirectionsProperty.dialogItemValue = value.value;
|
|
323
|
+
else if (value.propertyName === this.outsideProperty.name)
|
|
324
|
+
this.outsideProperty.dialogItemValue = value.value;
|
|
325
|
+
else if (value.propertyName === this.useDepthProperty.name)
|
|
326
|
+
this.useDepthProperty.dialogItemValue = value.value;
|
|
327
|
+
else if (value.propertyName === this.depthProperty.name)
|
|
328
|
+
this.depthProperty.dialogItemValue = value.value;
|
|
329
|
+
});
|
|
330
|
+
const toolSettings = new Array();
|
|
331
|
+
toolSettings.push(this.bothDirectionsProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
|
|
332
|
+
toolSettings.push(this.outsideProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
333
|
+
// ensure controls are enabled/disabled based on current lock property state
|
|
334
|
+
this.depthProperty.isDisabled = !this.useDepth;
|
|
335
|
+
const useDepthLock = this.useDepthProperty.toDialogItem({ rowPriority: 3, columnIndex: 0 });
|
|
336
|
+
toolSettings.push(this.depthProperty.toDialogItem({ rowPriority: 3, columnIndex: 1 }, useDepthLock));
|
|
337
|
+
return toolSettings;
|
|
338
|
+
}
|
|
228
339
|
async onRestartTool() {
|
|
229
340
|
const tool = new CutSolidElementsTool();
|
|
230
341
|
if (!await tool.run())
|
|
@@ -367,13 +478,27 @@ class FaceLocationData {
|
|
|
367
478
|
exports.FaceLocationData = FaceLocationData;
|
|
368
479
|
/** @alpha Identify faces of solids and surfaces to offset. */
|
|
369
480
|
class OffsetFacesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
481
|
+
get addSmoothProperty() {
|
|
482
|
+
if (!this._addSmoothProperty)
|
|
483
|
+
this._addSmoothProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildToggleDescription("offsetSmooth", EditTool_1.EditTools.translate("OffsetFaces.Label.AddSmooth")), false);
|
|
484
|
+
return this._addSmoothProperty;
|
|
485
|
+
}
|
|
486
|
+
get addSmooth() { return this.addSmoothProperty.value; }
|
|
487
|
+
set addSmooth(value) { this.addSmoothProperty.value = value; }
|
|
488
|
+
get useDistanceProperty() {
|
|
489
|
+
if (!this._useDistanceProperty)
|
|
490
|
+
this._useDistanceProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildLockPropertyDescription("useOffsetDistance"), false);
|
|
491
|
+
return this._useDistanceProperty;
|
|
492
|
+
}
|
|
493
|
+
get useDistance() { return this.useDistanceProperty.value; }
|
|
494
|
+
set useDistance(value) { this.useDistanceProperty.value = value; }
|
|
495
|
+
get distanceProperty() {
|
|
496
|
+
if (!this._distanceProperty)
|
|
497
|
+
this._distanceProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("offsetDistance", EditTool_1.EditTools.translate("OffsetFaces.Label.Distance")), 0.1, undefined, !this.useDistance);
|
|
498
|
+
return this._distanceProperty;
|
|
499
|
+
}
|
|
500
|
+
get distance() { return this.distanceProperty.value; }
|
|
501
|
+
set distance(value) { this.distanceProperty.value = value; }
|
|
377
502
|
get wantDynamics() { return true; }
|
|
378
503
|
get wantAccuSnap() { return this.isDynamicsStarted; }
|
|
379
504
|
get geometryCacheFilter() {
|
|
@@ -417,7 +542,7 @@ class OffsetFacesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
|
417
542
|
if (undefined === projPt)
|
|
418
543
|
return undefined;
|
|
419
544
|
const offsetDir = core_geometry_1.Vector3d.createStartEnd(faceData.point, projPt);
|
|
420
|
-
if (this.
|
|
545
|
+
if (this.useDistance && undefined === offsetDir.scaleToLength(this.distance, offsetDir))
|
|
421
546
|
return undefined;
|
|
422
547
|
let offset = offsetDir.magnitude();
|
|
423
548
|
if (offset < core_geometry_1.Geometry.smallMetricDistance)
|
|
@@ -428,7 +553,7 @@ class OffsetFacesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
|
428
553
|
this._startedCmd = await this.startCommand();
|
|
429
554
|
const id = this.agenda.elements[0];
|
|
430
555
|
const faces = this.getAcceptedSubEntities();
|
|
431
|
-
if (this.
|
|
556
|
+
if (this.addSmooth) {
|
|
432
557
|
const allSmoothFaces = [];
|
|
433
558
|
for (const face of faces) {
|
|
434
559
|
const smoothFaces = await this.getSmoothFaces(id, face);
|
|
@@ -469,6 +594,52 @@ class OffsetFacesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
|
469
594
|
hints.setXAxis2(faceData.normal);
|
|
470
595
|
hints.sendHints(false);
|
|
471
596
|
}
|
|
597
|
+
syncDistanceState() {
|
|
598
|
+
this.distanceProperty.displayValue = this.distanceProperty.description.format(this.distance);
|
|
599
|
+
this.distanceProperty.isDisabled = !this.useDistance;
|
|
600
|
+
this.syncToolSettingsProperties([this.distanceProperty.syncItem]);
|
|
601
|
+
}
|
|
602
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
603
|
+
if (updatedValue.propertyName === this.addSmoothProperty.name) {
|
|
604
|
+
this.addSmooth = updatedValue.value.value;
|
|
605
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
else if (updatedValue.propertyName === this.useDistanceProperty.name) {
|
|
609
|
+
this.useDistance = updatedValue.value.value;
|
|
610
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.useDistanceProperty.item);
|
|
611
|
+
this.syncDistanceState();
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
else if (updatedValue.propertyName === this.distanceProperty.name) {
|
|
615
|
+
if (!updatedValue.value.value) {
|
|
616
|
+
this.syncDistanceState(); // force UI to redisplay last valid value
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
this.distance = updatedValue.value.value;
|
|
620
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceProperty.item);
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
supplyToolSettingsProperties() {
|
|
626
|
+
var _a;
|
|
627
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.addSmoothProperty.name, this.useDistanceProperty.name, this.distanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
628
|
+
if (value.propertyName === this.addSmoothProperty.name)
|
|
629
|
+
this.addSmoothProperty.dialogItemValue = value.value;
|
|
630
|
+
else if (value.propertyName === this.useDistanceProperty.name)
|
|
631
|
+
this.useDistanceProperty.dialogItemValue = value.value;
|
|
632
|
+
else if (value.propertyName === this.distanceProperty.name)
|
|
633
|
+
this.distanceProperty.dialogItemValue = value.value;
|
|
634
|
+
});
|
|
635
|
+
const toolSettings = new Array();
|
|
636
|
+
// ensure controls are enabled/disabled based on current lock property state
|
|
637
|
+
this.distanceProperty.isDisabled = !this.useDistance;
|
|
638
|
+
const useDistanceLock = this.useDistanceProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 });
|
|
639
|
+
toolSettings.push(this.distanceProperty.toDialogItem({ rowPriority: 1, columnIndex: 1 }, useDistanceLock));
|
|
640
|
+
toolSettings.push(this.addSmoothProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
641
|
+
return toolSettings;
|
|
642
|
+
}
|
|
472
643
|
async onRestartTool() {
|
|
473
644
|
const tool = new OffsetFacesTool();
|
|
474
645
|
if (!await tool.run())
|
|
@@ -480,12 +651,20 @@ OffsetFacesTool.toolId = "OffsetFaces";
|
|
|
480
651
|
OffsetFacesTool.iconSpec = "icon-move"; // TODO: Need better icon...
|
|
481
652
|
/** @alpha Identify faces to offset to hollow solids. */
|
|
482
653
|
class HollowFacesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
this.
|
|
487
|
-
|
|
488
|
-
}
|
|
654
|
+
get shellThicknessProperty() {
|
|
655
|
+
if (!this._shellThicknessProperty)
|
|
656
|
+
this._shellThicknessProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("hollowShellThickness", EditTool_1.EditTools.translate("HollowFaces.Label.ShellThickness")), 0.1, undefined);
|
|
657
|
+
return this._shellThicknessProperty;
|
|
658
|
+
}
|
|
659
|
+
get shellThickness() { return this.shellThicknessProperty.value; }
|
|
660
|
+
set shellThickness(value) { this.shellThicknessProperty.value = value; }
|
|
661
|
+
get faceThicknessProperty() {
|
|
662
|
+
if (!this._faceThicknessProperty)
|
|
663
|
+
this._faceThicknessProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("hollowFaceThickness", EditTool_1.EditTools.translate("HollowFaces.Label.FaceThickness")), 0.0, undefined);
|
|
664
|
+
return this._faceThicknessProperty;
|
|
665
|
+
}
|
|
666
|
+
get faceThickness() { return this.faceThicknessProperty.value; }
|
|
667
|
+
set faceThickness(value) { this.faceThicknessProperty.value = value; }
|
|
489
668
|
get geometryCacheFilter() {
|
|
490
669
|
return { parts: true, curves: false, surfaces: false, solids: true, other: false };
|
|
491
670
|
}
|
|
@@ -507,6 +686,32 @@ class HollowFacesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
|
507
686
|
return undefined;
|
|
508
687
|
}
|
|
509
688
|
}
|
|
689
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
690
|
+
if (updatedValue.propertyName === this.shellThicknessProperty.name) {
|
|
691
|
+
this.shellThickness = updatedValue.value.value;
|
|
692
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.shellThicknessProperty.item);
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
else if (updatedValue.propertyName === this.faceThicknessProperty.name) {
|
|
696
|
+
this.faceThickness = updatedValue.value.value;
|
|
697
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.faceThicknessProperty.item);
|
|
698
|
+
return true;
|
|
699
|
+
}
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
supplyToolSettingsProperties() {
|
|
703
|
+
var _a;
|
|
704
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.shellThicknessProperty.name, this.faceThicknessProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
705
|
+
if (value.propertyName === this.shellThicknessProperty.name)
|
|
706
|
+
this.shellThicknessProperty.dialogItemValue = value.value;
|
|
707
|
+
else if (value.propertyName === this.faceThicknessProperty.name)
|
|
708
|
+
this.faceThicknessProperty.dialogItemValue = value.value;
|
|
709
|
+
});
|
|
710
|
+
const toolSettings = new Array();
|
|
711
|
+
toolSettings.push(this.shellThicknessProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
|
|
712
|
+
toolSettings.push(this.faceThicknessProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
713
|
+
return toolSettings;
|
|
714
|
+
}
|
|
510
715
|
async onRestartTool() {
|
|
511
716
|
const tool = new HollowFacesTool();
|
|
512
717
|
if (!await tool.run())
|
|
@@ -597,12 +802,31 @@ var ImprintSolidMethod;
|
|
|
597
802
|
class ImprintSolidElementsTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
598
803
|
constructor() {
|
|
599
804
|
super(...arguments);
|
|
600
|
-
// TODO: Tool settings for method, propagate for edges, offset distance...
|
|
601
|
-
this.method = ImprintSolidMethod.Points;
|
|
602
805
|
this.points = [];
|
|
603
|
-
this.extend = true;
|
|
604
|
-
this.distance = 0.1;
|
|
605
806
|
}
|
|
807
|
+
static methodMessage(str) { return EditTool_1.EditTools.translate(`ImprintSolids.Method.${str}`); }
|
|
808
|
+
get methodProperty() {
|
|
809
|
+
if (!this._methodProperty)
|
|
810
|
+
this._methodProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildEnumPicklistEditorDescription("imprintMethod", EditTool_1.EditTools.translate("ImprintSolids.Label.Method"), ImprintSolidElementsTool.getMethodChoices()), ImprintSolidMethod.Element);
|
|
811
|
+
return this._methodProperty;
|
|
812
|
+
}
|
|
813
|
+
get method() { return this.methodProperty.value; }
|
|
814
|
+
set method(method) { this.methodProperty.value = method; }
|
|
815
|
+
get distanceProperty() {
|
|
816
|
+
if (!this._distanceProperty)
|
|
817
|
+
this._distanceProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("imprintDistance", EditTool_1.EditTools.translate("ImprintSolids.Label.Distance")), 0.1, undefined);
|
|
818
|
+
return this._distanceProperty;
|
|
819
|
+
}
|
|
820
|
+
get distance() { return this.distanceProperty.value; }
|
|
821
|
+
set distance(value) { this.distanceProperty.value = value; }
|
|
822
|
+
get extendProperty() {
|
|
823
|
+
if (!this._extendProperty)
|
|
824
|
+
this._extendProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildToggleDescription("imprintExtend", EditTool_1.EditTools.translate("ImprintSolids.Label.Extend")), false);
|
|
825
|
+
return this._extendProperty;
|
|
826
|
+
}
|
|
827
|
+
get extend() { return this.extendProperty.value; }
|
|
828
|
+
set extend(value) { this.extendProperty.value = value; }
|
|
829
|
+
get requiredSubEntityCount() { return ImprintSolidMethod.Element === this.method ? 0 : 1; }
|
|
606
830
|
get requiredElementCount() { return ImprintSolidMethod.Element === this.method ? 2 : 1; }
|
|
607
831
|
get allowSubEntityControlSelect() { return ImprintSolidMethod.Edges === this.method; }
|
|
608
832
|
get inhibitSubEntityDisplay() { return ImprintSolidMethod.Points === this.method ? false : super.inhibitSubEntityDisplay; }
|
|
@@ -725,6 +949,50 @@ class ImprintSolidElementsTool extends ElementGeometryTool_1.LocateSubEntityTool
|
|
|
725
949
|
hints.setNormal(faceData.normal);
|
|
726
950
|
hints.sendHints(false);
|
|
727
951
|
}
|
|
952
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
953
|
+
if (updatedValue.propertyName === this.methodProperty.name) {
|
|
954
|
+
this.method = updatedValue.value.value;
|
|
955
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.methodProperty.item);
|
|
956
|
+
await this.onReinitialize();
|
|
957
|
+
return true;
|
|
958
|
+
}
|
|
959
|
+
else if (updatedValue.propertyName === this.extendProperty.name) {
|
|
960
|
+
this.extend = updatedValue.value.value;
|
|
961
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.extendProperty.item);
|
|
962
|
+
return true;
|
|
963
|
+
}
|
|
964
|
+
else if (updatedValue.propertyName === this.distanceProperty.name) {
|
|
965
|
+
this.distance = updatedValue.value.value;
|
|
966
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceProperty.item);
|
|
967
|
+
return true;
|
|
968
|
+
}
|
|
969
|
+
return false;
|
|
970
|
+
}
|
|
971
|
+
supplyToolSettingsProperties() {
|
|
972
|
+
var _a;
|
|
973
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.methodProperty.name, this.extendProperty.name, this.distanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
974
|
+
if (value.propertyName === this.methodProperty.name)
|
|
975
|
+
this.methodProperty.dialogItemValue = value.value;
|
|
976
|
+
else if (value.propertyName === this.extendProperty.name)
|
|
977
|
+
this.extendProperty.dialogItemValue = value.value;
|
|
978
|
+
else if (value.propertyName === this.distanceProperty.name)
|
|
979
|
+
this.distanceProperty.dialogItemValue = value.value;
|
|
980
|
+
});
|
|
981
|
+
const toolSettings = new Array();
|
|
982
|
+
toolSettings.push(this.methodProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
|
|
983
|
+
switch (this.method) {
|
|
984
|
+
case ImprintSolidMethod.Element:
|
|
985
|
+
toolSettings.push(this.extendProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
986
|
+
break;
|
|
987
|
+
case ImprintSolidMethod.Edges:
|
|
988
|
+
toolSettings.push(this.distanceProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
989
|
+
break;
|
|
990
|
+
case ImprintSolidMethod.Points:
|
|
991
|
+
toolSettings.push(this.extendProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
return toolSettings;
|
|
995
|
+
}
|
|
728
996
|
async onRestartTool() {
|
|
729
997
|
const tool = new ImprintSolidElementsTool();
|
|
730
998
|
if (!await tool.run())
|
|
@@ -734,13 +1002,22 @@ class ImprintSolidElementsTool extends ElementGeometryTool_1.LocateSubEntityTool
|
|
|
734
1002
|
exports.ImprintSolidElementsTool = ImprintSolidElementsTool;
|
|
735
1003
|
ImprintSolidElementsTool.toolId = "ImprintSolids";
|
|
736
1004
|
ImprintSolidElementsTool.iconSpec = "icon-move"; // TODO: Need better icon...
|
|
1005
|
+
ImprintSolidElementsTool.getMethodChoices = () => {
|
|
1006
|
+
return [
|
|
1007
|
+
{ label: ImprintSolidElementsTool.methodMessage("Element"), value: ImprintSolidMethod.Element },
|
|
1008
|
+
{ label: ImprintSolidElementsTool.methodMessage("Edges"), value: ImprintSolidMethod.Edges },
|
|
1009
|
+
{ label: ImprintSolidElementsTool.methodMessage("Points"), value: ImprintSolidMethod.Points },
|
|
1010
|
+
];
|
|
1011
|
+
};
|
|
737
1012
|
/** @alpha Base class for tools to identify edges of solids and surfaces and apply blends. */
|
|
738
1013
|
class BlendEdgesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
this.
|
|
1014
|
+
get addSmoothProperty() {
|
|
1015
|
+
if (!this._addSmoothProperty)
|
|
1016
|
+
this._addSmoothProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildToggleDescription("blendSmooth", EditTool_1.EditTools.translate("RoundEdges.Label.AddSmooth")), false);
|
|
1017
|
+
return this._addSmoothProperty;
|
|
743
1018
|
}
|
|
1019
|
+
get addSmooth() { return this.addSmoothProperty.value; }
|
|
1020
|
+
set addSmooth(value) { this.addSmoothProperty.value = value; }
|
|
744
1021
|
wantSubEntityType(type) { return editor_common_1.SubEntityType.Edge === type; }
|
|
745
1022
|
getSubEntityFilter() {
|
|
746
1023
|
return { laminarEdges: true, smoothEdges: true };
|
|
@@ -791,16 +1068,26 @@ class BlendEdgesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
|
791
1068
|
const primaryEdge = (undefined !== edgeData.toolData ? edgeData.toolData : edgeData.props);
|
|
792
1069
|
this._acceptedSubEntities = this._acceptedSubEntities.filter((entry) => !isTangentEdge(entry));
|
|
793
1070
|
}
|
|
1071
|
+
async syncTangentEdges() {
|
|
1072
|
+
const id = this.getCurrentElement();
|
|
1073
|
+
if (undefined === id)
|
|
1074
|
+
return;
|
|
1075
|
+
if (this.addSmooth)
|
|
1076
|
+
await this.addTangentEdges(id);
|
|
1077
|
+
else
|
|
1078
|
+
await this.removeTangentEdges(id);
|
|
1079
|
+
core_frontend_1.IModelApp.viewManager.invalidateDecorationsAllViews();
|
|
1080
|
+
}
|
|
794
1081
|
async addSubEntity(id, props) {
|
|
795
1082
|
await super.addSubEntity(id, props);
|
|
796
|
-
if (!this.
|
|
1083
|
+
if (!this.addSmooth)
|
|
797
1084
|
return;
|
|
798
1085
|
const chordTolerance = (this.targetView ? (0, CreateElementTool_1.computeChordToleranceFromPoint)(this.targetView, core_geometry_1.Point3d.fromJSON(props.point)) : undefined);
|
|
799
1086
|
return this.addTangentEdges(id, props.subEntity, chordTolerance);
|
|
800
1087
|
}
|
|
801
1088
|
async removeSubEntity(id, props) {
|
|
802
1089
|
var _a;
|
|
803
|
-
if (!this.
|
|
1090
|
+
if (!this.addSmooth)
|
|
804
1091
|
return super.removeSubEntity(id, props);
|
|
805
1092
|
const edge = (undefined !== props) ? props.subEntity : (_a = this.getAcceptedSubEntityData()) === null || _a === void 0 ? void 0 : _a.props;
|
|
806
1093
|
if (undefined === edge)
|
|
@@ -817,17 +1104,19 @@ class BlendEdgesTool extends ElementGeometryTool_1.LocateSubEntityTool {
|
|
|
817
1104
|
exports.BlendEdgesTool = BlendEdgesTool;
|
|
818
1105
|
/** @alpha Identify edges of solids and surfaces to apply a rolling ball blend to. */
|
|
819
1106
|
class RoundEdgesTool extends BlendEdgesTool {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
this.
|
|
1107
|
+
get radiusProperty() {
|
|
1108
|
+
if (!this._radiusProperty)
|
|
1109
|
+
this._radiusProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("roundRadius", EditTool_1.EditTools.translate("RoundEdges.Label.Radius")), 0.1, undefined);
|
|
1110
|
+
return this._radiusProperty;
|
|
824
1111
|
}
|
|
1112
|
+
get radius() { return this.radiusProperty.value; }
|
|
1113
|
+
set radius(value) { this.radiusProperty.value = value; }
|
|
825
1114
|
async applyAgendaOperation(ev, isAccept) {
|
|
826
1115
|
if (undefined === ev.viewport || this.agenda.isEmpty || !this.haveAcceptedSubEntities)
|
|
827
1116
|
return undefined;
|
|
828
1117
|
try {
|
|
829
1118
|
this._startedCmd = await this.startCommand();
|
|
830
|
-
const params = { edges: this.getAcceptedSubEntities(), radii: this.radius, propagateSmooth: this.
|
|
1119
|
+
const params = { edges: this.getAcceptedSubEntities(), radii: this.radius, propagateSmooth: this.addSmooth };
|
|
831
1120
|
const opts = {
|
|
832
1121
|
wantGraphic: isAccept ? undefined : true,
|
|
833
1122
|
chordTolerance: (0, CreateElementTool_1.computeChordToleranceFromPoint)(ev.viewport, ev.point),
|
|
@@ -840,6 +1129,33 @@ class RoundEdgesTool extends BlendEdgesTool {
|
|
|
840
1129
|
return undefined;
|
|
841
1130
|
}
|
|
842
1131
|
}
|
|
1132
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
1133
|
+
if (updatedValue.propertyName === this.radiusProperty.name) {
|
|
1134
|
+
this.radius = updatedValue.value.value;
|
|
1135
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.radiusProperty.item);
|
|
1136
|
+
return true;
|
|
1137
|
+
}
|
|
1138
|
+
else if (updatedValue.propertyName === this.addSmoothProperty.name) {
|
|
1139
|
+
this.addSmooth = updatedValue.value.value;
|
|
1140
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
|
|
1141
|
+
await this.syncTangentEdges();
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
supplyToolSettingsProperties() {
|
|
1147
|
+
var _a;
|
|
1148
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.radiusProperty.name, this.addSmoothProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
1149
|
+
if (value.propertyName === this.radiusProperty.name)
|
|
1150
|
+
this.radiusProperty.dialogItemValue = value.value;
|
|
1151
|
+
else if (value.propertyName === this.addSmoothProperty.name)
|
|
1152
|
+
this.addSmoothProperty.dialogItemValue = value.value;
|
|
1153
|
+
});
|
|
1154
|
+
const toolSettings = new Array();
|
|
1155
|
+
toolSettings.push(this.radiusProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
|
|
1156
|
+
toolSettings.push(this.addSmoothProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
1157
|
+
return toolSettings;
|
|
1158
|
+
}
|
|
843
1159
|
async onRestartTool() {
|
|
844
1160
|
const tool = new RoundEdgesTool();
|
|
845
1161
|
if (!await tool.run())
|
|
@@ -851,18 +1167,69 @@ RoundEdgesTool.toolId = "RoundEdges";
|
|
|
851
1167
|
RoundEdgesTool.iconSpec = "icon-move"; // TODO: Need better icon...
|
|
852
1168
|
/** @alpha Identify edges of solids and surfaces to apply a rolling ball blend to. */
|
|
853
1169
|
class ChamferEdgesTool extends BlendEdgesTool {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
this.
|
|
859
|
-
}
|
|
1170
|
+
static methodMessage(str) { return EditTool_1.EditTools.translate(`ChamferEdges.Method.${str}`); }
|
|
1171
|
+
get methodProperty() {
|
|
1172
|
+
if (!this._methodProperty)
|
|
1173
|
+
this._methodProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildEnumPicklistEditorDescription("chamferMethod", EditTool_1.EditTools.translate("ChamferEdges.Label.Method"), ChamferEdgesTool.getMethodChoices()), editor_common_1.ChamferMode.Length);
|
|
1174
|
+
return this._methodProperty;
|
|
1175
|
+
}
|
|
1176
|
+
get method() { return this.methodProperty.value; }
|
|
1177
|
+
set method(method) { this.methodProperty.value = method; }
|
|
1178
|
+
get lengthProperty() {
|
|
1179
|
+
if (!this._lengthProperty)
|
|
1180
|
+
this._lengthProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("chamferLength", EditTool_1.EditTools.translate("ChamferEdges.Label.Length")), 0.1, undefined);
|
|
1181
|
+
return this._lengthProperty;
|
|
1182
|
+
}
|
|
1183
|
+
get length() { return this.lengthProperty.value; }
|
|
1184
|
+
set length(value) { this.lengthProperty.value = value; }
|
|
1185
|
+
get distanceLeftProperty() {
|
|
1186
|
+
if (!this._distanceLeftProperty)
|
|
1187
|
+
this._distanceLeftProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("chamferLeftDist", EditTool_1.EditTools.translate("ChamferEdges.Label.LeftDistance")), 0.1, undefined);
|
|
1188
|
+
return this._distanceLeftProperty;
|
|
1189
|
+
}
|
|
1190
|
+
get distanceLeft() { return this.distanceLeftProperty.value; }
|
|
1191
|
+
set distanceLeft(value) { this.distanceLeftProperty.value = value; }
|
|
1192
|
+
get distanceRightProperty() {
|
|
1193
|
+
if (!this._distanceRightProperty)
|
|
1194
|
+
this._distanceRightProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("chamferRightDist", EditTool_1.EditTools.translate("ChamferEdges.Label.RightDistance")), 0.1, undefined);
|
|
1195
|
+
return this._distanceRightProperty;
|
|
1196
|
+
}
|
|
1197
|
+
get distanceRight() { return this.distanceRightProperty.value; }
|
|
1198
|
+
set distanceRight(value) { this.distanceRightProperty.value = value; }
|
|
1199
|
+
get angleProperty() {
|
|
1200
|
+
if (!this._angleProperty)
|
|
1201
|
+
this._angleProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.AngleDescription("chamferAngle", EditTool_1.EditTools.translate("ChamferEdges.Label.Angle")), core_geometry_1.Angle.piOver4Radians, undefined, false);
|
|
1202
|
+
return this._angleProperty;
|
|
1203
|
+
}
|
|
1204
|
+
get angle() { return this.angleProperty.value; }
|
|
1205
|
+
set angle(value) { this.angleProperty.value = value; }
|
|
860
1206
|
async applyAgendaOperation(ev, isAccept) {
|
|
861
1207
|
if (undefined === ev.viewport || this.agenda.isEmpty || !this.haveAcceptedSubEntities)
|
|
862
1208
|
return undefined;
|
|
863
1209
|
try {
|
|
864
1210
|
this._startedCmd = await this.startCommand();
|
|
865
|
-
|
|
1211
|
+
let values1;
|
|
1212
|
+
let values2;
|
|
1213
|
+
switch (this.method) {
|
|
1214
|
+
case editor_common_1.ChamferMode.Length:
|
|
1215
|
+
values1 = this.length;
|
|
1216
|
+
break;
|
|
1217
|
+
case editor_common_1.ChamferMode.Distances:
|
|
1218
|
+
values1 = this.distanceLeft;
|
|
1219
|
+
values2 = this.distanceRight;
|
|
1220
|
+
break;
|
|
1221
|
+
case editor_common_1.ChamferMode.DistanceAngle:
|
|
1222
|
+
values1 = this.distanceLeft;
|
|
1223
|
+
values2 = this.angle;
|
|
1224
|
+
break;
|
|
1225
|
+
case editor_common_1.ChamferMode.AngleDistance:
|
|
1226
|
+
values1 = this.angle;
|
|
1227
|
+
values2 = this.distanceRight;
|
|
1228
|
+
break;
|
|
1229
|
+
default:
|
|
1230
|
+
return undefined;
|
|
1231
|
+
}
|
|
1232
|
+
const params = { edges: this.getAcceptedSubEntities(), mode: this.method, values1, values2, propagateSmooth: this.addSmooth };
|
|
866
1233
|
const opts = {
|
|
867
1234
|
wantGraphic: isAccept ? undefined : true,
|
|
868
1235
|
chordTolerance: (0, CreateElementTool_1.computeChordToleranceFromPoint)(ev.viewport, ev.point),
|
|
@@ -875,6 +1242,78 @@ class ChamferEdgesTool extends BlendEdgesTool {
|
|
|
875
1242
|
return undefined;
|
|
876
1243
|
}
|
|
877
1244
|
}
|
|
1245
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
1246
|
+
if (updatedValue.propertyName === this.methodProperty.name) {
|
|
1247
|
+
this.method = updatedValue.value.value;
|
|
1248
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.methodProperty.item);
|
|
1249
|
+
await this.onReinitialize();
|
|
1250
|
+
return true;
|
|
1251
|
+
}
|
|
1252
|
+
else if (updatedValue.propertyName === this.addSmoothProperty.name) {
|
|
1253
|
+
this.addSmooth = updatedValue.value.value;
|
|
1254
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
|
|
1255
|
+
return true;
|
|
1256
|
+
}
|
|
1257
|
+
else if (updatedValue.propertyName === this.lengthProperty.name) {
|
|
1258
|
+
this.length = updatedValue.value.value;
|
|
1259
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.lengthProperty.item);
|
|
1260
|
+
return true;
|
|
1261
|
+
}
|
|
1262
|
+
else if (updatedValue.propertyName === this.distanceLeftProperty.name) {
|
|
1263
|
+
this.distanceLeft = updatedValue.value.value;
|
|
1264
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceLeftProperty.item);
|
|
1265
|
+
return true;
|
|
1266
|
+
}
|
|
1267
|
+
else if (updatedValue.propertyName === this.distanceRightProperty.name) {
|
|
1268
|
+
this.distanceRight = updatedValue.value.value;
|
|
1269
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceRightProperty.item);
|
|
1270
|
+
return true;
|
|
1271
|
+
}
|
|
1272
|
+
else if (updatedValue.propertyName === this.angleProperty.name) {
|
|
1273
|
+
this.angle = updatedValue.value.value;
|
|
1274
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.angleProperty.item);
|
|
1275
|
+
return true;
|
|
1276
|
+
}
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
supplyToolSettingsProperties() {
|
|
1280
|
+
var _a;
|
|
1281
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.methodProperty.name, this.addSmoothProperty.name, this.lengthProperty.name, this.distanceLeftProperty.name, this.distanceRightProperty.name, this.angleProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
1282
|
+
if (value.propertyName === this.methodProperty.name)
|
|
1283
|
+
this.methodProperty.dialogItemValue = value.value;
|
|
1284
|
+
else if (value.propertyName === this.addSmoothProperty.name)
|
|
1285
|
+
this.addSmoothProperty.dialogItemValue = value.value;
|
|
1286
|
+
else if (value.propertyName === this.lengthProperty.name)
|
|
1287
|
+
this.lengthProperty.dialogItemValue = value.value;
|
|
1288
|
+
else if (value.propertyName === this.distanceLeftProperty.name)
|
|
1289
|
+
this.distanceLeftProperty.dialogItemValue = value.value;
|
|
1290
|
+
else if (value.propertyName === this.distanceRightProperty.name)
|
|
1291
|
+
this.distanceRightProperty.dialogItemValue = value.value;
|
|
1292
|
+
else if (value.propertyName === this.angleProperty.name)
|
|
1293
|
+
this.angleProperty.dialogItemValue = value.value;
|
|
1294
|
+
});
|
|
1295
|
+
const toolSettings = new Array();
|
|
1296
|
+
toolSettings.push(this.methodProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
|
|
1297
|
+
toolSettings.push(this.addSmoothProperty.toDialogItem({ rowPriority: editor_common_1.ChamferMode.Length === this.method ? 3 : 4, columnIndex: 0 }));
|
|
1298
|
+
switch (this.method) {
|
|
1299
|
+
case editor_common_1.ChamferMode.Length:
|
|
1300
|
+
toolSettings.push(this.lengthProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
1301
|
+
break;
|
|
1302
|
+
case editor_common_1.ChamferMode.Distances:
|
|
1303
|
+
toolSettings.push(this.distanceLeftProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
1304
|
+
toolSettings.push(this.distanceRightProperty.toDialogItem({ rowPriority: 3, columnIndex: 0 }));
|
|
1305
|
+
break;
|
|
1306
|
+
case editor_common_1.ChamferMode.DistanceAngle:
|
|
1307
|
+
toolSettings.push(this.distanceLeftProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
1308
|
+
toolSettings.push(this.angleProperty.toDialogItem({ rowPriority: 3, columnIndex: 0 }));
|
|
1309
|
+
break;
|
|
1310
|
+
case editor_common_1.ChamferMode.AngleDistance:
|
|
1311
|
+
toolSettings.push(this.distanceRightProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
1312
|
+
toolSettings.push(this.angleProperty.toDialogItem({ rowPriority: 3, columnIndex: 0 }));
|
|
1313
|
+
break;
|
|
1314
|
+
}
|
|
1315
|
+
return toolSettings;
|
|
1316
|
+
}
|
|
878
1317
|
async onRestartTool() {
|
|
879
1318
|
const tool = new ChamferEdgesTool();
|
|
880
1319
|
if (!await tool.run())
|
|
@@ -884,6 +1323,14 @@ class ChamferEdgesTool extends BlendEdgesTool {
|
|
|
884
1323
|
exports.ChamferEdgesTool = ChamferEdgesTool;
|
|
885
1324
|
ChamferEdgesTool.toolId = "ChamferEdges";
|
|
886
1325
|
ChamferEdgesTool.iconSpec = "icon-move"; // TODO: Need better icon...
|
|
1326
|
+
ChamferEdgesTool.getMethodChoices = () => {
|
|
1327
|
+
return [
|
|
1328
|
+
{ label: ChamferEdgesTool.methodMessage("Length"), value: editor_common_1.ChamferMode.Length },
|
|
1329
|
+
{ label: ChamferEdgesTool.methodMessage("Distances"), value: editor_common_1.ChamferMode.Distances },
|
|
1330
|
+
{ label: ChamferEdgesTool.methodMessage("DistanceAngle"), value: editor_common_1.ChamferMode.DistanceAngle },
|
|
1331
|
+
{ label: ChamferEdgesTool.methodMessage("AngleDistance"), value: editor_common_1.ChamferMode.AngleDistance },
|
|
1332
|
+
];
|
|
1333
|
+
};
|
|
887
1334
|
/** @alpha */
|
|
888
1335
|
class ProfileLocationData {
|
|
889
1336
|
constructor(point, orientation) {
|
|
@@ -951,16 +1398,30 @@ class LocateFaceOrProfileTool extends ElementGeometryTool_1.LocateSubEntityTool
|
|
|
951
1398
|
exports.LocateFaceOrProfileTool = LocateFaceOrProfileTool;
|
|
952
1399
|
/** @alpha Identify faces of solids and surfaces to translate. */
|
|
953
1400
|
class SweepFacesTool extends LocateFaceOrProfileTool {
|
|
954
|
-
constructor() {
|
|
955
|
-
super(...arguments);
|
|
956
|
-
// TODO: Tool settings for sweep distance...
|
|
957
|
-
this.useDistance = false;
|
|
958
|
-
this.distance = 0.1;
|
|
959
|
-
this.addSmoothFaces = false;
|
|
960
|
-
}
|
|
961
1401
|
get wantDynamics() { return true; }
|
|
962
1402
|
get wantAccuSnap() { return true; }
|
|
963
1403
|
get wantSubEntitySnap() { return true; }
|
|
1404
|
+
get addSmoothProperty() {
|
|
1405
|
+
if (!this._addSmoothProperty)
|
|
1406
|
+
this._addSmoothProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildToggleDescription("sweepSmooth", EditTool_1.EditTools.translate("SweepFaces.Label.AddSmooth")), false);
|
|
1407
|
+
return this._addSmoothProperty;
|
|
1408
|
+
}
|
|
1409
|
+
get addSmooth() { return this.addSmoothProperty.value; }
|
|
1410
|
+
set addSmooth(value) { this.addSmoothProperty.value = value; }
|
|
1411
|
+
get useDistanceProperty() {
|
|
1412
|
+
if (!this._useDistanceProperty)
|
|
1413
|
+
this._useDistanceProperty = new appui_abstract_1.DialogProperty(appui_abstract_1.PropertyDescriptionHelper.buildLockPropertyDescription("useOffsetDistance"), false);
|
|
1414
|
+
return this._useDistanceProperty;
|
|
1415
|
+
}
|
|
1416
|
+
get useDistance() { return this.useDistanceProperty.value; }
|
|
1417
|
+
set useDistance(value) { this.useDistanceProperty.value = value; }
|
|
1418
|
+
get distanceProperty() {
|
|
1419
|
+
if (!this._distanceProperty)
|
|
1420
|
+
this._distanceProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.LengthDescription("sweepDistance", EditTool_1.EditTools.translate("SweepFaces.Label.Distance")), 0.1, undefined, !this.useDistance);
|
|
1421
|
+
return this._distanceProperty;
|
|
1422
|
+
}
|
|
1423
|
+
get distance() { return this.distanceProperty.value; }
|
|
1424
|
+
set distance(value) { this.distanceProperty.value = value; }
|
|
964
1425
|
async getSmoothFaces(id, face) {
|
|
965
1426
|
try {
|
|
966
1427
|
// NOTE: For sweep/translation, it makes sense to limit smooth to immediately adjacent...
|
|
@@ -996,7 +1457,7 @@ class SweepFacesTool extends LocateFaceOrProfileTool {
|
|
|
996
1457
|
if (editor_common_1.SubEntityType.Edge === subEntities[0].type || editor_common_1.BRepEntityType.Solid !== this.getBRepEntityTypeForSubEntity(id, subEntities[0])) {
|
|
997
1458
|
return await ElementGeometryTool_1.ElementGeometryCacheTool.callCommand("sweepFaces", id, params, opts);
|
|
998
1459
|
}
|
|
999
|
-
if (this.
|
|
1460
|
+
if (this.addSmooth) {
|
|
1000
1461
|
const allSmoothFaces = [];
|
|
1001
1462
|
for (const face of subEntities) {
|
|
1002
1463
|
const smoothFaces = await this.getSmoothFaces(id, face);
|
|
@@ -1031,6 +1492,52 @@ class SweepFacesTool extends LocateFaceOrProfileTool {
|
|
|
1031
1492
|
hints.setXAxis2(profileData.orientation instanceof core_geometry_1.Matrix3d ? profileData.orientation.getColumn(2) : profileData.orientation);
|
|
1032
1493
|
hints.sendHints(false);
|
|
1033
1494
|
}
|
|
1495
|
+
syncDistanceState() {
|
|
1496
|
+
this.distanceProperty.displayValue = this.distanceProperty.description.format(this.distance);
|
|
1497
|
+
this.distanceProperty.isDisabled = !this.useDistance;
|
|
1498
|
+
this.syncToolSettingsProperties([this.distanceProperty.syncItem]);
|
|
1499
|
+
}
|
|
1500
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
1501
|
+
if (updatedValue.propertyName === this.addSmoothProperty.name) {
|
|
1502
|
+
this.addSmooth = updatedValue.value.value;
|
|
1503
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.addSmoothProperty.item);
|
|
1504
|
+
return true;
|
|
1505
|
+
}
|
|
1506
|
+
else if (updatedValue.propertyName === this.useDistanceProperty.name) {
|
|
1507
|
+
this.useDistance = updatedValue.value.value;
|
|
1508
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.useDistanceProperty.item);
|
|
1509
|
+
this.syncDistanceState();
|
|
1510
|
+
return true;
|
|
1511
|
+
}
|
|
1512
|
+
else if (updatedValue.propertyName === this.distanceProperty.name) {
|
|
1513
|
+
if (!updatedValue.value.value) {
|
|
1514
|
+
this.syncDistanceState(); // force UI to redisplay last valid value
|
|
1515
|
+
return false;
|
|
1516
|
+
}
|
|
1517
|
+
this.distance = updatedValue.value.value;
|
|
1518
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.distanceProperty.item);
|
|
1519
|
+
return true;
|
|
1520
|
+
}
|
|
1521
|
+
return false;
|
|
1522
|
+
}
|
|
1523
|
+
supplyToolSettingsProperties() {
|
|
1524
|
+
var _a;
|
|
1525
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.addSmoothProperty.name, this.useDistanceProperty.name, this.distanceProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
1526
|
+
if (value.propertyName === this.addSmoothProperty.name)
|
|
1527
|
+
this.addSmoothProperty.dialogItemValue = value.value;
|
|
1528
|
+
else if (value.propertyName === this.useDistanceProperty.name)
|
|
1529
|
+
this.useDistanceProperty.dialogItemValue = value.value;
|
|
1530
|
+
else if (value.propertyName === this.distanceProperty.name)
|
|
1531
|
+
this.distanceProperty.dialogItemValue = value.value;
|
|
1532
|
+
});
|
|
1533
|
+
const toolSettings = new Array();
|
|
1534
|
+
// ensure controls are enabled/disabled based on current lock property state
|
|
1535
|
+
this.distanceProperty.isDisabled = !this.useDistance;
|
|
1536
|
+
const useDistanceLock = this.useDistanceProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 });
|
|
1537
|
+
toolSettings.push(this.distanceProperty.toDialogItem({ rowPriority: 1, columnIndex: 1 }, useDistanceLock));
|
|
1538
|
+
toolSettings.push(this.addSmoothProperty.toDialogItem({ rowPriority: 2, columnIndex: 0 }));
|
|
1539
|
+
return toolSettings;
|
|
1540
|
+
}
|
|
1034
1541
|
async onRestartTool() {
|
|
1035
1542
|
const tool = new SweepFacesTool();
|
|
1036
1543
|
if (!await tool.run())
|
|
@@ -1044,10 +1551,15 @@ SweepFacesTool.iconSpec = "icon-move"; // TODO: Need better icon...
|
|
|
1044
1551
|
class SpinFacesTool extends LocateFaceOrProfileTool {
|
|
1045
1552
|
constructor() {
|
|
1046
1553
|
super(...arguments);
|
|
1047
|
-
// TODO: Tool settings for sweep angle...
|
|
1048
|
-
this.sweep = core_geometry_1.Angle.piOver2Radians;
|
|
1049
1554
|
this.points = [];
|
|
1050
1555
|
}
|
|
1556
|
+
get angleProperty() {
|
|
1557
|
+
if (!this._angleProperty)
|
|
1558
|
+
this._angleProperty = new appui_abstract_1.DialogProperty(new core_frontend_1.AngleDescription("spinAngle", EditTool_1.EditTools.translate("SpinFaces.Label.Angle")), core_geometry_1.Angle.piOver2Radians, undefined, false);
|
|
1559
|
+
return this._angleProperty;
|
|
1560
|
+
}
|
|
1561
|
+
get angle() { return this.angleProperty.value; }
|
|
1562
|
+
set angle(value) { this.angleProperty.value = value; }
|
|
1051
1563
|
get wantDynamics() { return true; }
|
|
1052
1564
|
get wantAccuSnap() { return true; }
|
|
1053
1565
|
get wantSubEntitySnap() { return true; }
|
|
@@ -1058,7 +1570,7 @@ class SpinFacesTool extends LocateFaceOrProfileTool {
|
|
|
1058
1570
|
if (direction.magnitude() < core_geometry_1.Geometry.smallMetricDistance)
|
|
1059
1571
|
return undefined;
|
|
1060
1572
|
const origin = this.points[0];
|
|
1061
|
-
const angle = core_geometry_1.Angle.createRadians(this.
|
|
1573
|
+
const angle = core_geometry_1.Angle.createRadians(this.angle);
|
|
1062
1574
|
try {
|
|
1063
1575
|
this._startedCmd = await this.startCommand();
|
|
1064
1576
|
const id = this.agenda.elements[0];
|
|
@@ -1121,6 +1633,24 @@ class SpinFacesTool extends LocateFaceOrProfileTool {
|
|
|
1121
1633
|
hints.setNormal(profileData.orientation);
|
|
1122
1634
|
hints.sendHints(false);
|
|
1123
1635
|
}
|
|
1636
|
+
async applyToolSettingPropertyChange(updatedValue) {
|
|
1637
|
+
if (updatedValue.propertyName === this.angleProperty.name) {
|
|
1638
|
+
this.angle = updatedValue.value.value;
|
|
1639
|
+
core_frontend_1.IModelApp.toolAdmin.toolSettingsState.saveToolSettingProperty(this.toolId, this.angleProperty.item);
|
|
1640
|
+
return true;
|
|
1641
|
+
}
|
|
1642
|
+
return false;
|
|
1643
|
+
}
|
|
1644
|
+
supplyToolSettingsProperties() {
|
|
1645
|
+
var _a;
|
|
1646
|
+
(_a = core_frontend_1.IModelApp.toolAdmin.toolSettingsState.getInitialToolSettingValues(this.toolId, [this.angleProperty.name])) === null || _a === void 0 ? void 0 : _a.forEach((value) => {
|
|
1647
|
+
if (value.propertyName === this.angleProperty.name)
|
|
1648
|
+
this.angleProperty.dialogItemValue = value.value;
|
|
1649
|
+
});
|
|
1650
|
+
const toolSettings = new Array();
|
|
1651
|
+
toolSettings.push(this.angleProperty.toDialogItem({ rowPriority: 1, columnIndex: 0 }));
|
|
1652
|
+
return toolSettings;
|
|
1653
|
+
}
|
|
1124
1654
|
async onRestartTool() {
|
|
1125
1655
|
const tool = new SpinFacesTool();
|
|
1126
1656
|
if (!await tool.run())
|