@manycore/custom-sdk 1.0.0-latest.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,449 @@
1
+ import { IExportModelData } from '@manycore/custom-miniapp-sdk';
2
+ import { Number3 } from '@manycore/custom-miniapp-sdk';
3
+
4
+ export declare class Application {
5
+ constructor();
6
+ /**
7
+ * 启动当前应用
8
+ */
9
+ start(): Promise<void>;
10
+ /**
11
+ * 初始化语言类型
12
+ * @param lang
13
+ * @param resource
14
+ */
15
+ initLange(lang?: string, resource?: {}): void;
16
+ stop(): void;
17
+ getService<T extends BaseService>(serv: {
18
+ new (): T;
19
+ }): T;
20
+ }
21
+
22
+ declare class BaseService {
23
+ }
24
+
25
+ /**
26
+ * 配件附加参数数据类型
27
+ */
28
+ export declare enum EFittingParametersType {
29
+ /**
30
+ * 字符串
31
+ */
32
+ string = "string",
33
+ double = "double",
34
+ long = "long",
35
+ int = "int",
36
+ float2 = "float2",
37
+ float3 = "float3"
38
+ }
39
+
40
+ /**
41
+ * 孔槽配件类型
42
+ */
43
+ export declare enum EFittingType {
44
+ /**
45
+ * 槽
46
+ */
47
+ GROOVE = 1,
48
+ /**
49
+ * 孔
50
+ */
51
+ HOLE = 2,
52
+ /**
53
+ * 五金
54
+ */
55
+ HARDWARE = 3,
56
+ /**
57
+ * 交接面信息
58
+ */
59
+ INTERSECTED = 4
60
+ }
61
+
62
+ /**
63
+ * 交接面、交接体数据类型
64
+ */
65
+ export declare enum EIntersectedType {
66
+ /**
67
+ * 交接体
68
+ */
69
+ SHELL = "1",
70
+ /**
71
+ * 交界面
72
+ */
73
+ FACE = "2"
74
+ }
75
+
76
+ export declare enum ELanguage {
77
+ ZH_CN = "zh_CN",
78
+ EN_US = "en_US",
79
+ DE_DE = "de_DE",
80
+ FR_FR = "fr_FR",
81
+ JA_JP = "ja_JP",
82
+ ZH_TW = "zh_TW",
83
+ RU_RU = "ru_RU",
84
+ KO_KR = "ko_KR",
85
+ ES_ES = "es_ES",
86
+ AR_EG = "ar_EG",
87
+ EN_CN = "en_CN",
88
+ VI = "vi"
89
+ }
90
+
91
+ export declare enum ESelectedType {
92
+ /**
93
+ * 未选中模型
94
+ */
95
+ NULL = 0,
96
+ /**
97
+ * 模型或商品
98
+ */
99
+ MODEL = 1,
100
+ /**
101
+ * 五金信息
102
+ */
103
+ CASBIN = 2
104
+ }
105
+
106
+ export declare class FittingDesignService extends BaseService {
107
+ /**
108
+ * 设置孔槽方案自动保存
109
+ *
110
+ * @param autoSave 默认开启自动保存
111
+ */
112
+ toggleAutoSave(autoSave?: boolean): void;
113
+ /**
114
+ * 是否开启了自动保存功能
115
+ */
116
+ isAutoSave(): boolean;
117
+ /**
118
+ *
119
+ * 槽方案数据
120
+ *
121
+ * @param modelid 模型ID,如果为空时,则表示传递的为查询当前模型的数据
122
+ * @param casbin 是否为五金,当modelid为五金的id时,需要为true
123
+ */
124
+ getConnectedFittingDesign(modelid?: string, casbin?: boolean): Promise<IFittingDesignData | null>;
125
+ /**
126
+ * 往当前方案中,新增孔/槽数据
127
+ *
128
+ * 会自动merge数据,但同一块板上,会进行覆盖
129
+ *
130
+ * @param design
131
+ * @param option { timeout, save} 调用超时,save 是否立即保存至后端,默认为true
132
+ */
133
+ appendFittingDesign(design: Partial<IFittingDesignData>, option?: {
134
+ timeout?: number;
135
+ save?: boolean;
136
+ }): Promise<void>;
137
+ /**
138
+ * 保存孔/槽数据至方案
139
+ * 如果design不传,即表示将分步保存数据保存至后端
140
+ *
141
+ * @param design
142
+ * @param option
143
+ */
144
+ saveDesign(design?: IFittingDesignData, option?: {
145
+ timeout?: number;
146
+ }): Promise<void>;
147
+ /**
148
+ * 清空当前孔槽方案
149
+ *
150
+ * @param timeout
151
+ */
152
+ clearDesign(timeout?: number): Promise<void>;
153
+ }
154
+
155
+ /**
156
+ * 孔槽数据基础示意
157
+ */
158
+ export declare interface IBaseFittingData {
159
+ /**
160
+ * 孔槽的id
161
+ */
162
+ id: string;
163
+ /**
164
+ * 类型
165
+ */
166
+ fittingType: EFittingType;
167
+ /**
168
+ * 附加通用参数
169
+ */
170
+ params?: EFittingParametersType[];
171
+ }
172
+
173
+ /**
174
+ * 附加通用参数存储
175
+ */
176
+ export declare interface IBaseFittingParameters {
177
+ key: string;
178
+ value: string;
179
+ type: string;
180
+ }
181
+
182
+ /**
183
+ * 孔/槽的基础数据结构
184
+ */
185
+ export declare interface IBaseHoleGrooveData extends IBaseFittingData {
186
+ /**
187
+ * 孔/槽的深度
188
+ */
189
+ depth: number;
190
+ /**
191
+ * 所处的板面
192
+ */
193
+ plankFaceId: number;
194
+ /**
195
+ * 起点
196
+ */
197
+ start: Number3;
198
+ /**
199
+ * 终点
200
+ */
201
+ end: Number3;
202
+ }
203
+
204
+ export declare interface IBaseIntersected {
205
+ /**
206
+ * 板面
207
+ */
208
+ plankFaceId: number;
209
+ /**
210
+ * 所有点的信息
211
+ */
212
+ points: Number3[];
213
+ /**
214
+ * 关联的模型ID
215
+ */
216
+ linkedModelId: string;
217
+ /**
218
+ * 关联的父级模型ID
219
+ */
220
+ linkedParentModelId: string;
221
+ /**
222
+ * 交接类型
223
+ */
224
+ '@type': EIntersectedType;
225
+ /**
226
+ * 交接体的shell数据
227
+ */
228
+ shell?: string;
229
+ }
230
+
231
+ /**
232
+ * 孔/槽方案的数据结构
233
+ */
234
+ export declare interface IFittingDesignData {
235
+ /**
236
+ * 所属模型的id
237
+ */
238
+ id?: string;
239
+ /**
240
+ * 所有的孔的数据
241
+ */
242
+ holes: IFittingHoleCollect;
243
+ /**
244
+ * 槽的数据
245
+ */
246
+ grooves: IFittingGrooveCollect;
247
+ /**
248
+ * 五金数据
249
+ */
250
+ hardwares: IFittingHardwareCollect;
251
+ }
252
+
253
+ /**
254
+ * 方案中的所有槽的数据
255
+ */
256
+ export declare type IFittingGrooveCollect = Record<string, IGrooveData[]>;
257
+
258
+ /**
259
+ * 五金数据
260
+ */
261
+ export declare type IFittingHardwareCollect = Record<string, IHardwareData[]>;
262
+
263
+ /**
264
+ * 方案中,所有孔的数据
265
+ */
266
+ export declare type IFittingHoleCollect = Record<string, IHoleData[]>;
267
+
268
+ export declare interface IGrooveData extends IBaseHoleGrooveData {
269
+ width: number;
270
+ }
271
+
272
+ /**
273
+ * 五金相关的信息
274
+ */
275
+ export declare interface IHardwareData extends IBaseFittingData {
276
+ /**
277
+ * 建模原点在板件坐标系下的坐标
278
+ */
279
+ position: Number3;
280
+ /**
281
+ * 相对建模坐标系中夹角,不传默认没有任何基于板件坐标的旋转,会将五金以建模原点放在 position 上,五金建模方向和板件建模方向一致进行摆放。
282
+ */
283
+ rotate: Number3;
284
+ /**
285
+ * 相对建模坐标系中缩放,不传默认五金和上传大小完全一致
286
+ */
287
+ scale: Number3;
288
+ /**
289
+ * 商品ID
290
+ */
291
+ brandGoodId: string;
292
+ /**
293
+ * 关联孔槽ID
294
+ */
295
+ linkedIds: string[];
296
+ }
297
+
298
+ export declare interface IHoleData extends IBaseHoleGrooveData {
299
+ /**
300
+ * 孔直径
301
+ */
302
+ diameter: number;
303
+ }
304
+
305
+ export declare interface IIntersectedGroup {
306
+ /**
307
+ * 交接面ID
308
+ */
309
+ id: string;
310
+ /**
311
+ * 交接面信息
312
+ */
313
+ intersecteds: IBaseIntersected[];
314
+ }
315
+
316
+ /**
317
+ * 交接面信息
318
+ */
319
+ export declare interface IIntersectedResult {
320
+ intersectedGroups: IIntersectedGroup[];
321
+ }
322
+
323
+ export declare class IntersectedService extends BaseService {
324
+ /**
325
+ * 是否显示交接面信息
326
+ *
327
+ * @param flag
328
+ */
329
+ toggleModelViewIntersected(flag: boolean): void;
330
+ /**
331
+ * 切换展示的交接面、交接体坐标
332
+ *
333
+ * @param option
334
+ */
335
+ toggleModelViewedIntersected(option?: IToggleIntersectedViewOption): void;
336
+ }
337
+
338
+ export declare interface IPoint3d {
339
+ x: number;
340
+ y: number;
341
+ z: number;
342
+ }
343
+
344
+ export declare interface ISelected {
345
+ data: IExportModelData[] | IHardwareData[];
346
+ type: ESelectedType;
347
+ }
348
+
349
+ /**
350
+ * 处理场景当中
351
+ */
352
+ export declare interface ISettingColor {
353
+ /**
354
+ * 交接面展示时,使用的颜色表示
355
+ */
356
+ intersectedColor: number;
357
+ /**
358
+ * 交接体展示时,使用的颜色
359
+ */
360
+ intersectedBodyColor: number;
361
+ /**
362
+ * 孔展示
363
+ */
364
+ holeColor: number;
365
+ /**
366
+ * 槽展示颜色
367
+ */
368
+ grooveColor: number;
369
+ }
370
+
371
+ export declare interface IToggleIntersectedViewOption {
372
+ /**
373
+ * 是否展示
374
+ * 默认为false
375
+ */
376
+ references?: boolean;
377
+ plankFaceIds?: number[];
378
+ }
379
+
380
+ export declare class ModelService extends BaseService {
381
+ /**
382
+ * 获取当前整个模型数据信息
383
+ *
384
+ * @param timeout
385
+ */
386
+ getParamData(timeout?: number): Promise<any>;
387
+ /**
388
+ * 获取交接面信息
389
+ *
390
+ * @param timeout
391
+ */
392
+ getParamIntersected(timeout?: number): Promise<IIntersectedResult>;
393
+ }
394
+
395
+ export declare class ModelViewerSelectionService extends BaseService {
396
+ constructor();
397
+ /**
398
+ * 获取当前选中模型
399
+ */
400
+ getSelected(): ISelected;
401
+ /**
402
+ * 设置当前选中内容
403
+ */
404
+ select(selected: any[]): void;
405
+ /**
406
+ * 取消选中所有内容
407
+ */
408
+ unSelect(): void;
409
+ private onSelectedChanged;
410
+ on(fn: (param: ISelected) => any): void;
411
+ off(fn?: (param: ISelected) => any): void;
412
+ once(fn: (param: ISelected) => any): void;
413
+ __onDestroy(): void;
414
+ }
415
+
416
+ /**
417
+ * 模型展示的服务
418
+ */
419
+ export declare class ModelViewerService extends BaseService {
420
+ /**
421
+ * 查看当前选中的模型
422
+ */
423
+ viewSelected(): Promise<void>;
424
+ /**
425
+ * 通过模型的ID来显示某个模型
426
+ * @param id 模型ID
427
+ */
428
+ viewModelById(id: string | string[]): Promise<void>;
429
+ /**
430
+ * 重置视角
431
+ */
432
+ resetPerspective(): void;
433
+ /**
434
+ * 模型渲染是都显示边框
435
+ * @param flag
436
+ */
437
+ toggleModelBorder(flag: boolean): void;
438
+ /**
439
+ * 模型渲染是否半透明
440
+ * @param flag
441
+ */
442
+ toggleModelTransparent(flag: boolean): void;
443
+ /**
444
+ * 配置场景展示界面
445
+ */
446
+ setting(settings: Partial<ISettingColor>): void;
447
+ }
448
+
449
+ export { }