brep-io-kernel 1.0.18 → 1.0.19

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.
@@ -34,6 +34,15 @@ export class PatternLinearFeature {
34
34
  static shortName = "PATLIN";
35
35
  static longName = "Pattern Linear";
36
36
  static inputParamsSchema = inputParamsSchema;
37
+ static showContexButton(selectedItems) {
38
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
39
+ const solids = items
40
+ .filter((it) => String(it?.type || '').toUpperCase() === 'SOLID')
41
+ .map((it) => it?.name)
42
+ .filter((name) => !!name);
43
+ if (!solids.length) return false;
44
+ return { params: { solids } };
45
+ }
37
46
 
38
47
  constructor() {
39
48
  this.inputParams = {};
@@ -49,6 +49,19 @@ export class PatternRadialFeature {
49
49
  static shortName = "PATRAD";
50
50
  static longName = "Pattern Radial";
51
51
  static inputParamsSchema = inputParamsSchema;
52
+ static showContexButton(selectedItems) {
53
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
54
+ const solids = items
55
+ .filter((it) => String(it?.type || '').toUpperCase() === 'SOLID')
56
+ .map((it) => it?.name)
57
+ .filter((name) => !!name);
58
+ if (!solids.length) return false;
59
+ const axis = items.find((it) => String(it?.type || '').toUpperCase() === 'EDGE');
60
+ const axisName = axis?.name || axis?.userData?.edgeName || null;
61
+ const params = { solids };
62
+ if (axisName) params.axisRef = axisName;
63
+ return { params };
64
+ }
52
65
 
53
66
  constructor() {
54
67
  this.inputParams = {};
@@ -46,6 +46,16 @@ export class PlaneFeature {
46
46
  static shortName = "P";
47
47
  static longName = "Plane";
48
48
  static inputParamsSchema = inputParamsSchema;
49
+ static showContexButton(selectedItems) {
50
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
51
+ const ref = items.find((it) => {
52
+ const type = String(it?.type || '').toUpperCase();
53
+ return type === 'FACE' || type === 'PLANE';
54
+ });
55
+ const name = ref?.name || ref?.userData?.faceName || null;
56
+ if (!name) return false;
57
+ return { field: 'datum', value: name };
58
+ }
49
59
 
50
60
  constructor() {
51
61
  this.inputParams = {};
@@ -47,6 +47,21 @@ export class RevolveFeature {
47
47
  static shortName = "R";
48
48
  static longName = "Revolve";
49
49
  static inputParamsSchema = inputParamsSchema;
50
+ static showContexButton(selectedItems) {
51
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
52
+ const profileObj = items.find((it) => {
53
+ const type = String(it?.type || '').toUpperCase();
54
+ return type === 'FACE' || type === 'SKETCH';
55
+ });
56
+ if (!profileObj) return false;
57
+ const profileName = profileObj?.name || profileObj?.userData?.faceName || null;
58
+ if (!profileName) return false;
59
+ const axisObj = items.find((it) => String(it?.type || '').toUpperCase() === 'EDGE');
60
+ const axisName = axisObj?.name || axisObj?.userData?.edgeName || null;
61
+ const params = { profile: profileName };
62
+ if (axisName) params.axis = axisName;
63
+ return { params };
64
+ }
50
65
 
51
66
  constructor() {
52
67
  this.inputParams = {};
@@ -82,6 +82,17 @@ export class SketchFeature {
82
82
  static shortName = "S";
83
83
  static longName = "Sketch";
84
84
  static inputParamsSchema = inputParamsSchema;
85
+ static showContexButton(selectedItems) {
86
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
87
+ const target = items.find((it) => {
88
+ const type = String(it?.type || '').toUpperCase();
89
+ return type === 'FACE' || type === 'PLANE';
90
+ });
91
+ if (!target) return false;
92
+ const name = target?.name || target?.userData?.faceName || null;
93
+ if (!name) return false;
94
+ return { field: 'sketchPlane', value: name };
95
+ }
85
96
 
86
97
  constructor() {
87
98
  this.inputParams = {};
@@ -48,6 +48,23 @@ export class SweepFeature {
48
48
  static shortName = "SW";
49
49
  static longName = "Sweep";
50
50
  static inputParamsSchema = inputParamsSchema;
51
+ static showContexButton(selectedItems) {
52
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
53
+ const profileObj = items.find((it) => {
54
+ const type = String(it?.type || '').toUpperCase();
55
+ return type === 'FACE' || type === 'SKETCH';
56
+ });
57
+ if (!profileObj) return false;
58
+ const profileName = profileObj?.name || profileObj?.userData?.faceName || null;
59
+ if (!profileName) return false;
60
+ const edges = items
61
+ .filter((it) => String(it?.type || '').toUpperCase() === 'EDGE')
62
+ .map((it) => it?.name || it?.userData?.edgeName)
63
+ .filter((name) => !!name);
64
+ const params = { profile: profileName };
65
+ if (edges.length) params.path = edges;
66
+ return { params };
67
+ }
51
68
 
52
69
  constructor() {
53
70
  this.inputParams = {};
@@ -57,6 +57,18 @@ export class TransformFeature {
57
57
  static shortName = "XFORM";
58
58
  static longName = "Transform";
59
59
  static inputParamsSchema = inputParamsSchema;
60
+ static showContexButton(selectedItems) {
61
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
62
+ const solids = items
63
+ .filter((it) => {
64
+ const type = String(it?.type || '').toUpperCase();
65
+ return type === 'SOLID';
66
+ })
67
+ .map((it) => it?.name)
68
+ .filter((name) => !!name);
69
+ if (!solids.length) return false;
70
+ return { params: { solids } };
71
+ }
60
72
 
61
73
  constructor() {
62
74
  this.inputParams = {};
@@ -332,6 +332,18 @@ export class TubeFeature {
332
332
  static shortName = 'TU';
333
333
  static longName = 'Tube';
334
334
  static inputParamsSchema = inputParamsSchema;
335
+ static showContexButton(selectedItems) {
336
+ const items = Array.isArray(selectedItems) ? selectedItems : [];
337
+ if (items.some((it) => String(it?.type || '').toUpperCase() !== 'EDGE')) {
338
+ return false;
339
+ }
340
+ const edges = items
341
+ .filter((it) => String(it?.type || '').toUpperCase() === 'EDGE')
342
+ .map((it) => it?.name || it?.userData?.edgeName)
343
+ .filter((name) => !!name);
344
+ if (!edges.length) return false;
345
+ return { params: { path: edges } };
346
+ }
335
347
 
336
348
  constructor() {
337
349
  this.inputParams = {};