@kudashi/kds-api 2.13.1 → 2.13.3

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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/api.d.ts +1224 -18
  3. package/package.json +1 -1
package/api.d.ts CHANGED
@@ -257,72 +257,132 @@ declare global {
257
257
  }
258
258
 
259
259
  /**
260
+ * KApplication 是使用酷大师前端 Plugin API 的起点。
261
+ *
262
+ * 从这里我们可以获取很多其他有用的 API 接口。例如:
263
+ * 1. 代表当前打开的酷大师方案的 KDesign 接口,从这里我们可以调用酷大师的各种建模命令,如拉伸、扫掠、布尔等,对方案数据进行修改;
264
+ * 2. 代表酷大师视图窗口的 KView 接口,从这里我们可以获取酷大师的画布和相机对象,并在画布中绘制各种临时图形元素;
265
+ * 3. 代表酷大师选择集的 KSelection 接口,从这里我们可以获取酷大师画布中的各种被选择的对象,如造型面、造型边、参考线、成组等
266
+ * ... ...
267
+ *
268
+ * KApplication 还可以激活一个插件自定义工具对象 (KTool),它可以响应各种鼠标、键盘事件,实现和酷大师内置建模工具类似的交互效果;
269
+ * KApplication 还可以注册、注销酷大师应用的事件观察者,供插件响应酷大师发出的各种事件
270
+ *
271
+ * 请阅读下面的方法注释,以获取更详细的信息
272
+ *
273
+ *
260
274
  * The KApplication interface serves as the "entry point" for most other APIs. From here we can get the active design,
261
275
  * which represents the user's design data; we can get the active view, which represents the application's graphics view.
262
- * We can also activate a custom tool, which is the tool that plugin provides to interact with the design daa...
276
+ * We can also activate a custom tool, which is the tool that plugin provides to interact with the design data...
263
277
  * please check the comments below for more information.
264
278
  */
265
279
  interface KApplication {
266
280
  /**
281
+ *
282
+ * 获取酷大师信息提示接口
283
+ *
267
284
  * Get the toast operation handle.
268
285
  * @returns The toast operation handle.
269
286
  */
270
287
  getToast(): KToast;
288
+
271
289
  /**
290
+ *
291
+ * 获取酷大师选择集。用户在视图窗口中用鼠标选中的造型面、造型边、参考线、成组等,都可以从此选择集中得到
292
+ *
272
293
  * Get the selection operation handle.
273
294
  * @returns The selection operation handle.
274
295
  */
275
296
  getSelection(): KSelection;
297
+
276
298
  /**
299
+ * 获取当前打开的酷大师方案。从 KDesign 接口我们可以调用酷大师各种建模命令,如拉伸、扫掠、布尔等,对方案数据进行修改
300
+ *
277
301
  * Get the active design.
278
302
  * @returns The active design.
279
303
  */
280
304
  getActiveDesign(): KDesign;
305
+
281
306
  /**
307
+ *
308
+ * 获取酷大师视图窗口。从 KView 接口我们可以获取酷大师的画布和相机对象,并在画布中绘制各种临时图形元素
309
+ *
282
310
  * Get the active view.
283
311
  * @returns The active view.
284
312
  */
285
313
  getActiveView(): KView;
314
+
286
315
  /**
316
+ *
317
+ * 获取插件 UI 面板。插件如果提供了 UI html,就是在这个 UI 面板里打开的。我们可以调整此 UI 面板的大小,发送和响应插件自定义消息
318
+ *
287
319
  * Get the KPluginUI object for operating the plugin UIs.
288
320
  * @returns The KPluginUI object for operating the plugin UIs.
289
321
  */
290
322
  getPluginUI(): KPluginUI;
323
+
291
324
  /**
325
+ *
326
+ * 获取酷大师应用的 UI 面板,即顶部工具栏、左侧栏、右侧属性面板等组成的酷大师 UI 面板
327
+ *
292
328
  * Get the KApplicationUI object for operating the application UI.
293
329
  * @returns The KApplicationUI object for operating the application UI.
294
330
  */
295
331
  getApplicationUI(): KApplicationUI;
332
+
296
333
  /**
334
+ *
335
+ * 获取客户端临时存储对象。通过该对象,插件可在客户端进行临时数据存取
336
+ *
297
337
  * Get the KClientStorage object for allowing you to store data on the user's local machine.
298
338
  * @returns The KClientStorage object.
299
339
  */
300
340
  getClientStorage(): KClientStorage;
341
+
301
342
  /**
343
+ *
344
+ * 获取自定义工具 KTool 的帮助接口,此接口提供了一组帮助自定义工具实现更复杂交互效果的方法,例如激活选择功能,激活框选功能,设置选择过滤器等
345
+ *
302
346
  * Get the utility helper for plugin tools.
303
347
  * @returns The KToolHelper object.
304
348
  */
305
349
  getToolHelper(): KToolHelper;
350
+
306
351
  /**
352
+ *
353
+ * 获取选择帮助器,此接口提供了按屏幕 2d 点选,按屏幕 2d 矩形框选等进行选择的方法
354
+ *
307
355
  * Get the KPickHelper object for allowing you to pick entities.
308
356
  * @returns The KPickHelper object.
309
357
  */
310
358
  getPickHelper(): KPickHelper;
359
+
311
360
  /**
361
+ *
362
+ * 激活插件自定义工具。插件自定义工具能响应各种鼠标、键盘事件,从而实现和酷大师内置建模工具类似的交互效果
363
+ *
312
364
  * Activate the custom tool.
313
365
  * @param tool The custom tool.
314
366
  * @param clearSelection If the clearSelection flag is set to true, when the tool is activated, the selection will be cleared. The default value is false.
315
367
  * @returns Return true if successful, otherwise return false.
316
368
  */
317
369
  activateCustomTool(tool: KTool, clearSelection?: boolean): boolean;
370
+
318
371
  /**
372
+ *
373
+ * 反激活插件自定义工具
374
+ *
319
375
  * Daactivate the custom tool.
320
376
  * @param tool The custom tool.
321
377
  * @param clearSelection If the clearSelection flag is set to true, when the tool is deactivated, the selection will be cleared. The default value is false.
322
378
  * @returns Return true if successful, otherwise return false.
323
379
  */
324
380
  deactivateCustomTool(tool: KTool, clearSelection?: boolean): boolean;
381
+
325
382
  /**
383
+ *
384
+ * @deprecated:延时若干毫秒后执行一个函数 (本方法将被移除。建议直接使用 JS 内置的 setTimeout 方法)
385
+ *
326
386
  * The method is used to call a function after the specified number of milliseconds.
327
387
  * @param callback The called function.
328
388
  * @param time The specified number of milliseconds.
@@ -330,13 +390,21 @@ declare global {
330
390
  * @returns
331
391
  */
332
392
  setTimeout(callback: (...args: any[]) => void, time: number, ...args: any[]): void;
393
+
333
394
  /**
395
+ *
396
+ * 添加酷大师应用观察者。目前观察者主要用于响应插件关闭的消息,这样插件本身可以完成一些业务逻辑,比如保存插件本身的业务数据
397
+ *
334
398
  * The method is used to add an plugin observer to the application object.
335
399
  * @param observer The observer to add.
336
400
  * @returns Return true if successful, else return false.
337
401
  */
338
402
  addObserver(observer: KApplicationObserver): boolean;
403
+
339
404
  /**
405
+ *
406
+ * 移除酷大师应用观察者
407
+ *
340
408
  * The method is used to remove the plugin observer from the application object.
341
409
  * @param observer The observer to remove.
342
410
  * @returns Return true if successful, else return false.
@@ -344,6 +412,9 @@ declare global {
344
412
  removeObserver(observer: KApplicationObserver): boolean;
345
413
 
346
414
  /**
415
+ *
416
+ * @deprecated 获取酷大师测试帮助器。目前此接口仅用于酷大师 UI 自动化测试,不建议插件开发者使用
417
+ *
347
418
  * Get the utility helper that is only used for testing.
348
419
  * @returns The KTestHelper object
349
420
  */
@@ -351,6 +422,12 @@ declare global {
351
422
  }
352
423
 
353
424
  /**
425
+ * 应用观察者用于响应酷大师发出的各种事件
426
+ *
427
+ * 目前酷大师只会发出一种事件,就是插件 UI 面板被关闭的事件。
428
+ *
429
+ * 插件可以实现此接口,并调用 KApplication.addPluginObserver 方法将观察者注册到酷大师,用于响应酷大师事件
430
+ *
354
431
  * This observer interface is implemented to react to plugin events.
355
432
  * To create a new observer, you must define a new class that implements all the methods of the KPluginObserver class.
356
433
  * Once you have defined a observer class, you can add it to the application object by the KApplication.addPluginObserver method.
@@ -358,6 +435,9 @@ declare global {
358
435
  */
359
436
  interface KApplicationObserver {
360
437
  /**
438
+ *
439
+ * 酷大师关闭插件 UI 面板时,会调用观察者的这个方法
440
+ *
361
441
  * The method is called whenever the plugin is closed.
362
442
  * @return
363
443
  */
@@ -365,15 +445,27 @@ declare global {
365
445
  }
366
446
 
367
447
  /**
448
+ *
449
+ * 本接口代表酷大师的 UI 面板,如工具栏、菜单栏、属性栏等。
450
+ *
451
+ * 目前只提供了激活、抑制所有 UI 面板元素的方法
452
+ *
368
453
  * The KApplicationUI contains a number of methods for manipulating the application UI, such as tool bar, menu bar, resource panel, etc.
369
454
  */
370
455
  interface KApplicationUI {
371
456
  /**
457
+ *
458
+ * 激活所有 UI 面板元素
459
+ *
372
460
  * Enable tool bar, menu bar, resource panel, etc.
373
461
  * @return
374
462
  */
375
463
  enableAll(): void;
464
+
376
465
  /**
466
+ *
467
+ * 抑制所有 UI 面板元素
468
+ *
377
469
  * Disable tool bar, menu bar, resource panel, etc.
378
470
  * @return
379
471
  */
@@ -381,24 +473,38 @@ declare global {
381
473
  }
382
474
 
383
475
  /**
476
+ *
477
+ * 参考线段对象。即用户在酷大师界面中,用“参考线段”命令画出的各种参考线段、参考圆弧等
478
+ *
384
479
  * The KAuxiliaryBoundedCurve class represents the auxiliary bounded curve.
385
480
  * NOTE: Now only the auxiliary line segment and the auxiliary arc are supported.
386
481
  */
387
482
  interface KAuxiliaryBoundedCurve extends KAuxiliaryCurve {
388
483
  /**
484
+ *
485
+ * 获取参考线段的几何外形曲线,如直线段、圆弧等
486
+ *
389
487
  * Get the geometric bounded curve corresponding to the bounded curve.
390
488
  * NOTE: Now only the line segment and the arc are supported.
391
489
  * @returns Return the geometric bounded curve if successful, otherwise return null.
392
490
  */
393
491
  getBoundedCurve(): KBoundedCurve3d | null;
492
+
394
493
  /**
494
+ *
495
+ * 获取参考线段的起始顶点
496
+ *
395
497
  * Get the auxiliary vertex at the start of the auxiliary bounded curve.
396
498
  * NOTE: Even if the auxiliary bounded curve is not connected to other auxiliary bounded curves at the start,
397
499
  * we can still get the auxiliary vertex.
398
500
  * @returns The auxiliary vertex at the start of the auxiliary bounded curve.
399
501
  */
400
502
  getStartVertex(): KAuxiliaryVertex;
503
+
401
504
  /**
505
+ *
506
+ * 获取参考线段的终止顶点
507
+ *
402
508
  * Get the auxiliary vertex at the end of the auxiliary bounded curve.
403
509
  * NOTE: Even if the auxiliary bounded curve is not connected to other auxiliary bounded curves at the end,
404
510
  * we can still get the auxiliary vertex.
@@ -408,10 +514,16 @@ declare global {
408
514
  }
409
515
 
410
516
  /**
517
+ *
518
+ * 参考线基类,其派生类有参考直线和参考线段
519
+ *
411
520
  * The base class for all auxiliary curves, such as KAuxiliaryLine and KAuxiliaryBoundedCurve.
412
521
  */
413
522
  interface KAuxiliaryCurve extends KEntity {
414
523
  /**
524
+ *
525
+ * 获取参考线的唯一标识符
526
+ *
415
527
  * Get a unique key assigned to an auxiliary curve.
416
528
  * @returns The unique key.
417
529
  */
@@ -419,10 +531,15 @@ declare global {
419
531
  }
420
532
 
421
533
  /**
534
+ * 参考线。虽然在画布中只有有限的长度,但它实际上代表了一条无限长的直线
535
+ *
422
536
  * The KAuxiliaryLine class represents the auxiliary line. It is infinite in length.
423
537
  */
424
538
  interface KAuxiliaryLine extends KAuxiliaryCurve {
425
539
  /**
540
+ *
541
+ * 获取参考线对象的几何直线表达
542
+ *
426
543
  * Get the geometric 3D line corresponding to the auxiliary line.
427
544
  * @returns The geometric 3D line.
428
545
  */
@@ -430,6 +547,10 @@ declare global {
430
547
  }
431
548
 
432
549
  /**
550
+ *
551
+ * 参考线顶点
552
+ * 参考线顶点是参考线段的端点。如果两个参考线段是相连的,那么它们共享一个参考线顶点。移动此参考线顶点,会导致相邻的参考线段形状发生改变
553
+ *
433
554
  * The KAuxiliaryVertex class represents the auxiliary vertex.
434
555
  * The auxiliary vertex is the connection point between auxiliary bounded curves.
435
556
  * Through the auxiliary vertex you can get all auxiliary bounded curves connected through this vertex.
@@ -437,16 +558,27 @@ declare global {
437
558
  */
438
559
  interface KAuxiliaryVertex extends KEntity{
439
560
  /**
561
+ *
562
+ * 获取唯一标识符
563
+ *
440
564
  * Get a unique key assigned to an auxiliary vertex.
441
565
  * @returns The unique key.
442
566
  */
443
567
  getKey(): string;
568
+
444
569
  /**
570
+ *
571
+ * 获取参考线顶点的几何点表达
572
+ *
445
573
  * Get the geometric 3D point corresponding to the auxiliary vertex.
446
574
  * @returns The geometric 3D point.
447
575
  */
448
576
  getPoint(): KPoint3d;
577
+
449
578
  /**
579
+ *
580
+ * 获取相邻的参考线段
581
+ *
450
582
  * Get all auxiliary bounded curves connected through this vertex.
451
583
  * @returns An array of bounded curves connected through this vertex.
452
584
  */
@@ -454,49 +586,87 @@ declare global {
454
586
  }
455
587
 
456
588
  /**
589
+ *
590
+ * 相机模式
591
+ *
457
592
  * The KCameraMode class represents the camera modes.
458
593
  */
459
594
  enum KCameraMode {
460
595
  /**
596
+ *
597
+ * 2D正交模式。选中一个造型面,即可从选择菜单上进入“2D正交模式”
598
+ *
461
599
  * For2DView mode.
462
600
  * Using orthographic view for 2d view.
463
601
  */
464
602
  For2DView = 0,
603
+
465
604
  /**
605
+ *
606
+ * 透视模式
607
+ *
466
608
  * Perspective view mode.
467
609
  */
468
610
  Perspective = 1,
611
+
469
612
  /**
613
+ *
614
+ * 正交模式
615
+ *
470
616
  * Orthographic view mode.
471
617
  */
472
618
  Orthographic = 2,
473
619
  }
620
+
474
621
  /**
622
+ *
623
+ * 酷大师相机
624
+ * 可以将酷大师画布中显示的内容,想象成从一个虚拟的照相机中看到的内容。可阅读任何计算机图形学课程资料,获取关于相机的基础知识。
625
+ *
475
626
  * The KCamera class contains methods for getting the camera information.
476
627
  * The camera in KuDaShi is the “point of view” from which you look at the model.
477
628
  */
478
629
  interface KCamera {
479
630
  /**
631
+ *
632
+ * 获取相机缩放比例
633
+ *
480
634
  * Get the camera's zoom factor.
481
635
  * @returns The camera's zoom factor.
482
636
  */
483
637
  getZoomFactor(): number;
638
+
484
639
  /**
640
+ *
641
+ * 获取相机模式
642
+ *
485
643
  * Get the camera's mode.
486
644
  * @returns The camera's mode.
487
645
  */
488
646
  getMode(): KCameraMode;
647
+
489
648
  /**
649
+ *
650
+ * 获取相机位置
651
+ *
490
652
  * Get the camera's position.
491
653
  * @returns The camera's position.
492
654
  */
493
655
  getPosition(): KPoint3d;
656
+
494
657
  /**
658
+ *
659
+ * 获取相机的观察点
660
+ *
495
661
  * Get the camera's target, which is the camera is pointing at.
496
662
  * @returns The camera's target.
497
663
  */
498
664
  getTarget(): KPoint3d;
665
+
499
666
  /**
667
+ *
668
+ * 获取相机向上方向
669
+ *
500
670
  * Get the camera's up direction.
501
671
  * @returns The camera's up direction.
502
672
  */
@@ -505,6 +675,9 @@ declare global {
505
675
 
506
676
 
507
677
  /**
678
+ *
679
+ * 布尔类型
680
+ *
508
681
  * The KBooleanType class represents the boolean types.
509
682
  */
510
683
  enum KBooleanType {
@@ -523,34 +696,62 @@ declare global {
523
696
  }
524
697
 
525
698
  /**
699
+ *
700
+ * KDesign 代表酷大师方案数据。从这里我们可以调用酷大师的各种建模命令,如拉伸、扫掠、布尔等,对方案数据进行修改
701
+ *
526
702
  * The KDesign class is the interface to a KuDaShi model, and from here you can use the model-level methods
527
703
  * to start getting information and making changes.
528
704
  * NOTE: The entity you are operating must be in active definition, or an Error will be shrew.
529
705
  */
530
706
  interface KDesign {
531
707
  /**
708
+ *
709
+ * 获取方案 id
710
+ *
711
+ * 如果此方案是从酷大师网站的“开始建模”按钮打开的,那它还没有一个方案id。调用此方法会导致此方案保存,并生成一个id
712
+ *
532
713
  * Get the design id.
533
714
  * NOTE: If the design has not design id, it will trigger the design to save and generate an id.
534
715
  * @returns The design id.
535
716
  */
536
717
  getDesignId(): HostPromise<string | undefined>;
718
+
537
719
  /**
720
+ *
721
+ * 保存方案
722
+ *
538
723
  * Save the design.
539
724
  * NOTE: If the design is not saved, it will trigger the design to save.
540
725
  * @returns True if successful, or false.
541
726
  */
542
727
  save(): HostPromise<boolean>;
728
+
543
729
  /**
730
+ *
731
+ * 获取方案顶层的成组
732
+ *
544
733
  * Get the top group definition.
545
734
  * @returns The top group definition.
546
735
  */
547
736
  getTopGroupDefinition(): KGroupDefinition;
737
+
548
738
  /**
739
+ *
740
+ * 获取当前的活跃成组,即正在编辑的成组
741
+ *
549
742
  * Get the active group definition.
550
743
  * @returns The active group definition.
551
744
  */
552
745
  getActiveGroupDefinition(): KGroupDefinition;
746
+
553
747
  /**
748
+ *
749
+ * 向当前活跃成组中添加造型边
750
+ * 传入的一组几何点,代表依次相连的一组造型边。这些造型边中如果有封闭的部分,那封闭的区域将自动形成造型面。这些造型面将和场景中原有的面互相分割
751
+ * 注意:
752
+ * 1. 传入的所有几何点都必须在一个平面上,否则本方法不起作用,会返回 null
753
+ * 2. 如果传入的几何点里,最后一个点和第一个点不重合,则会自动在最后一个点和第一个点之间加上一条边
754
+ *
554
755
  * The method is used to add a set of connected edges to the active group definition by the input points.
555
756
  * The area surrounded by edges will automatically generate faces, and at the same time, the generated faces will merged with other intersecting faces.
556
757
  * NOTE: 1.All the input Points should be on one surface (e.g., a plane), or null will be returned.
@@ -559,7 +760,20 @@ declare global {
559
760
  * @returns Return an object that contains added edges if successful, otherwise return null.
560
761
  */
561
762
  addEdges(points: KPoint3d[]): { addedEdges: KEdge[] } | null;
763
+
562
764
  /**
765
+ *
766
+ * 向当前活跃的成组中添加一组造型面
767
+ * 添加的造型面,将和现有的造型面互相分割
768
+ *
769
+ * 输入的参数是一个点的二维数组。二维数组的每一个元素代表一个面,它自己本身又是一个数组,代表一个面的外轮廓.
770
+ *
771
+ * 对组成一个面的点的数组而言,其要求和 addEdges 类似:
772
+ * 1. 传入的所有几何点都必须在一个平面上,否则不会生成一个面,整个方法也会返回null
773
+ * 2. 如果传入的几何点里,最后一个点和第一个点不重合,则会自动在最后一个点和第一个点之间加上一条边
774
+ *
775
+ * 通常,这个方法用来向酷大师中添加一组网格面
776
+ *
563
777
  * The method is used to add a set of faces to the active group definition by the input points.
564
778
  * The generated faces will merged with other intersecting faces.
565
779
  * The input parameter is two-dimensional points array. We can make one-dimensional points array to represent a face, and then we
@@ -570,35 +784,59 @@ declare global {
570
784
  * @returns Return an object that contains added edges if successful, otherwise return null.
571
785
  */
572
786
  addFaces(points: KPoint3d[][]): { addedEdges: KEdge[] } | null;
787
+
573
788
  /**
789
+ * 向当前成组中加入一条圆弧线段
790
+ * 如果圆弧线段和现有的某些边围成了一个封闭的面,则会创建出一个新的面。这个新的面会和已有的面互相分割
791
+ * numSegments 表示这条圆弧线段将由多少段直线段来表达
792
+ *
574
793
  * The method is used to add an arc curve segment to the active group definition.
575
794
  * The area surrounded by edges will automatically generate faces, and at the same time, the generated faces will merged with other intersecting faces.
576
795
  * @param arc The input arc.
577
- * @param numSegments How many segments to draw.
796
+ * @param numSegments the number of line segments the arc is represented by
578
797
  * @returns Return an object that contains added edges which define the arc if successful, otherwise return null.
579
798
  */
580
799
  addArc(arc: KArc3d, numSegments?: number): { addedEdges: KEdge[] } | null;
800
+
581
801
  /**
802
+ * 向当前成组中加入一个整圆围成的面,这个新的面会和已有的面互相分割
803
+ * numSegments 表示这个圆将由多少段直线段来表达
804
+ *
582
805
  * The method is used to add a circle curve segment to the active group definition.
583
806
  * The area surrounded by edges will automatically generate faces, and at the same time, the generated faces will merged with other intersecting faces.
584
807
  * @param circle The input circle.
585
- * @param numSegments How many segments to draw.
808
+ * @param numSegments the number of line segments the circle is represented by
586
809
  * @returns Return an object that contains added edges which define the circle if successful, otherwise return null.
587
810
  */
588
811
  addCircle(circle: KCircle3d, numSegments?: number): { addedEdges: KEdge[] } | null;
812
+
589
813
  /**
814
+ *
815
+ * 向当前成组中添加一条参考直线
816
+ *
590
817
  * The method is used to create an auxiliary Line to the active group definition by the input 3D line.
591
818
  * @param line The input 3D line.
592
819
  * @returns Return an object that contains added auxiliary Line if successful, otherwise return null.
593
820
  */
594
821
  addAuxiliaryLine(line: KLine3d): { addedAuxiliaryLine: KAuxiliaryLine } | null;
822
+
595
823
  /**
824
+ *
825
+ * 向当前成组中添加一条参考线段。
826
+ * 如果参考线段是圆弧,则 numSegments 表示这条圆弧线段将由多少段直线段来表达
827
+ *
596
828
  * The method is used to create an auxiliary bounded curve to the active group definition by the input 3D bounded curve.
597
829
  * @param line The input 3D bounded curve.
598
830
  * @returns Return an object that contains added bounded auxiliary curve if successful, otherwise return null.
599
831
  */
600
832
  addAuxiliaryBoundedCurve(boundedCurve: KBoundedCurve3d, numSegments?: number): { addedCurve: KAuxiliaryBoundedCurve } | null;
833
+
601
834
  /**
835
+ *
836
+ * 对一个单独的面,在其两条边,edge1 和 edge2 之间,加一个圆弧的倒角
837
+ * distance 表示倒角圆弧的半径
838
+ * approxCount 表示这条倒角的圆弧将由多少段直线段来表达
839
+ *
602
840
  * The method is used to create a round corner by the input edges and round distance to the active group definition.
603
841
  * @param edge1 The first edge.
604
842
  * @param edge2 The second edge.
@@ -607,45 +845,74 @@ declare global {
607
845
  * @returns Return an object that contains added edges which define the round corner if successful, otherwise return null.
608
846
  */
609
847
  addRoundCorner(edge1: KEdge, edge2: KEdge, distance: number, approxCount?: number): { addedEdges: KEdge[] } | null;
848
+
610
849
  /**
850
+ *
851
+ * 从当前成组中删除一条边
852
+ *
611
853
  * The method is used to remove an edge from the active group definition.
612
854
  * @param edge The edge to remove.
613
855
  * @returns Return an object that contains success flag.
614
856
  */
615
857
  removeEdge(edge: KEdge): { isSuccess: boolean };
858
+
616
859
  /**
860
+ *
861
+ * 从当前成组中删除一组边
862
+ * 如果某条边属于一个连续边,则整条连续边都会被删除
863
+ *
617
864
  * The method is used to remove a list of edges from the active group definition.
618
865
  * If an edge is in continuous edge group, the whole continuouse edge group will be removed.
619
866
  * @param edges The edges to remove.
620
867
  * @returns Return an object that contains success flag.
621
868
  */
622
869
  removeEdges(edges: KEdge[]): { isSuccess: boolean };
870
+
623
871
  /**
624
- * The method is used to merge one collection of faces with another collection of faces.
872
+ *
873
+ * 对两组面做布尔并操作
874
+ *
875
+ * The method is used to merge (boolean union) one collection of faces with another collection of faces.
625
876
  * @param subjects The subject faces to merge with the tool faces.
626
877
  * @param tools The tool faces
627
878
  * @returns Return an object which contains the modified shells if successful, otherwise return null.
628
879
  */
629
880
  mergeFaces(subjects: KFace[], tools: KFace[]): { modifiedShells: KShell[] } | null;
881
+
630
882
  /**
883
+ *
884
+ * 删除一组面
885
+ *
631
886
  * The method is used to remove faces from the active group definition.
632
887
  * @param faces The faces to remove.
633
888
  * @returns Return an object that contains success flag.
634
889
  */
635
890
  removeFaces(faces: KFace[]): { isSuccess: boolean };
891
+
636
892
  /**
893
+ *
894
+ * 删除参考线
895
+ *
637
896
  * The method is used to remove auxiliary curve from the active group definition.
638
897
  * @param auxiliaryCurve The auxiliary curve to remove.
639
898
  * @returns Return an object that contains success flag.
640
899
  */
641
900
  removeAuxiliaryCurve(auxiliaryCurve: KAuxiliaryCurve): { isSuccess: boolean };
901
+
642
902
  /**
903
+ *
904
+ * 删除成组实例
905
+ *
643
906
  * The method is used to remove group instance from the active group definition.
644
907
  * @param groupInstance The group instance to remove.
645
908
  * @returns Return an object that contains success flag.
646
909
  */
647
910
  removeGroupInstance(groupInstance: KGroupInstance): { isSuccess: boolean };
911
+
648
912
  /**
913
+ *
914
+ * 使用一组点,打断一条边
915
+ *
649
916
  * The method is used to split an edge into two or more distinct edges by the input points.
650
917
  * NOTE: the input points must be points that are on the edge.
651
918
  * @param edge The group instance to split.
@@ -653,7 +920,11 @@ declare global {
653
920
  * @returns Return an object that contains added edges if successful, otherwise return null.
654
921
  */
655
922
  splitEdge(edge: KEdge, points: KPoint3d[]): { addedEdges: KEdge[] } | null;
923
+
656
924
  /**
925
+ *
926
+ * 设置一组边的软化信息,true为软化边,false为非软化边
927
+ *
657
928
  * Set the edges to be soft. If you want to set the edge one by one, you can use the setIsSoft method in KEdge.
658
929
  * A soft edge will cause the connected faces to be treated as a surface.
659
930
  * This means that if you select one face it will also
@@ -663,14 +934,23 @@ declare global {
663
934
  * @return Return true if successful, otherwise return false.
664
935
  */
665
936
  setEdgesSoft(edges: KEdge[], isSoft: boolean): { isSuccess: boolean };
937
+
666
938
  /**
939
+ *
940
+ * @deprecated 酷大师内置的建模命令造出的软化边默认为不可见。请只在代码调试等特殊情况下使用这个 API
941
+ * 设置一组软化边的可见性,true为可见,false为不可见。
942
+ *
667
943
  * Set the soft edges visibility.
668
944
  * @param softEdges The edges to set.
669
945
  * @param isVisible The visible value.
670
946
  * @return Return true if successful, otherwise return false.
671
947
  */
672
948
  setSoftEdgesVisible(softEdges: KEdge[], isVisible: boolean): { isSuccess: boolean };
949
+
673
950
  /**
951
+ *
952
+ * 设置一组顶点的软化信息,true为软化顶点,false为非软化顶点
953
+ *
674
954
  * Set the vertex to be soft. If you want to set the vertex one by one, you can use the setIsSoft method in KVertex.
675
955
  * A soft vertex will cause the connected edges to be treated as a curve.
676
956
  * This means that if you select one edge it will also
@@ -680,21 +960,34 @@ declare global {
680
960
  * @return Return true if it is a soft vertex, otherwise return false.
681
961
  */
682
962
  setVerticesSoft(vertices: KVertex[], isSoft: boolean): { isSuccess: boolean };
963
+
683
964
  /**
965
+ *
966
+ * 移动参考线顶点
967
+ *
684
968
  * The method is used to move the auxiliary vertex to the target position.
685
969
  * @param auxiliaryVertex The auxiliary vertex to move.
686
970
  * @param targetPosition The target position.
687
971
  * @returns Return an object that contains moved auxiliary bounded curves if successful, otherwise return null.
688
972
  */
689
973
  moveAuxiliaryVertex(auxiliaryVertex: KAuxiliaryVertex, targetPosition: KPoint3d): { movedCurves: KAuxiliaryBoundedCurve[] } | null;
974
+
690
975
  /**
976
+ *
977
+ * 移动参考圆弧的中点 (用起点、中点、终点三点定义圆弧)
978
+ *
691
979
  * The method is used to move the auxiliary middle point to the target position.
692
980
  * @param auxiliaryCurve The auxiliary bounded curve to move.
693
981
  * @param targetPosition The target position.
694
982
  * @returns Return an object that contains success flag.
695
983
  */
696
984
  moveAuxiliaryMiddlePoint(auxiliaryCurve: KAuxiliaryBoundedCurve, targetPosition: KPoint3d): { isSuccess: boolean };
985
+
697
986
  /**
987
+ *
988
+ * @deprecated 此 API 已过时,请使用transformVertices
989
+ * 移动一组顶点
990
+ *
698
991
  * The method is used to move the vertices.
699
992
  * @param vertices An array of vertices to move.
700
993
  * @param moveVectors An array of vectors to apply.
@@ -704,14 +997,24 @@ declare global {
704
997
  * @returns Return an object that contains modified shells if successful, otherwise return null.
705
998
  */
706
999
  moveVertices(vertices: KVertex[], moveVectors: KVector3d[], propagateContinuousEdge?: boolean): { modifiedShells: KShell[] } | null;
1000
+
707
1001
  /**
1002
+ *
1003
+ * @deprecated 此 API 已过时,请使用transformVertices
1004
+ * 移动一条边
1005
+ *
708
1006
  * The method is used to move the edge.
709
1007
  * @param edge The edge to move.
710
1008
  * @param moveVector The move vector.
711
1009
  * @returns Return an object that contains modified shells if successful, otherwise return null.
712
1010
  */
713
1011
  moveEdge(edge: KEdge, moveVector: KVector3d): { modifiedShells: KShell[] } | null;
1012
+
714
1013
  /**
1014
+ *
1015
+ * @deprecated 此 API 已过时,请使用transformVertices
1016
+ * 移动一个面
1017
+ *
715
1018
  * The method is used to move the face.
716
1019
  * @param face The face to move.
717
1020
  * @param moveVector The move vector.
@@ -719,7 +1022,13 @@ declare global {
719
1022
  * @returns Return an object that contains modified shells if successful, otherwise return null.
720
1023
  */
721
1024
  moveFace(face: KFace, moveVector: KVector3d, loftFlag?: boolean): { modifiedShells: KShell[] } | null;
1025
+
722
1026
  /**
1027
+ *
1028
+ * 拉伸命令:推/拉一个面,以创建或修改一个 3D 造型
1029
+ * 如果 copy 为 true,则会保持原始 face 不变,而在推/拉的终止位置新生成一个 face
1030
+ * (相当于在酷大师里手工执行推/拉命令时,按住ctrl键)
1031
+ *
723
1032
  * The method is used to perform a push/pull on a face.
724
1033
  * @param face The face to push/pull.
725
1034
  * @param distance The distance to push/pull the face.
@@ -727,7 +1036,11 @@ declare global {
727
1036
  * @returns Return an object that contains success flag.
728
1037
  */
729
1038
  pullPushFace(face: KFace, distance: number, copy: boolean): { isSuccess: boolean };
1039
+
730
1040
  /**
1041
+ *
1042
+ * 扫掠命令:将一个不带洞的平面轮廓(contour),沿一条路径(path),扫掠生成一个 3d 造型(addedShells)
1043
+ *
731
1044
  * The method is used to create a shape by making the face follow along an array of edges.
732
1045
  * NOTE: The method will remove the face that the contour belongs to.
733
1046
  * @param contour The face's contour.
@@ -735,7 +1048,12 @@ declare global {
735
1048
  * @returns Return an object that contains success flag and added shells.
736
1049
  */
737
1050
  sweepFollowEdges(contour: KLoop, path: KEdge[]): { isSuccess: boolean, addedShells: KShell[] };
1051
+
738
1052
  /**
1053
+ *
1054
+ * 扫掠命令:将一个不带洞的平面轮廓(contour),沿一条路径(path),扫掠生成一个 3d 造型(addedShells)
1055
+ * 同上,只不过路径可以是一组参考线段
1056
+ *
739
1057
  * The method is used to create a shape by making the face follow along an array of auxiliary bounded curves.
740
1058
  * NOTE: The method will remove the face that the contour belongs to.
741
1059
  * @param contour The face's contour.
@@ -743,7 +1061,13 @@ declare global {
743
1061
  * @returns Return an object that contains success flag and added shells.
744
1062
  */
745
1063
  sweepFollowCurves(contour: KLoop, path: KAuxiliaryBoundedCurve[]): { isSuccess: boolean, addedShells: KShell[] };
1064
+
746
1065
  /**
1066
+ *
1067
+ * 将两个成组实例做布尔运算 (交、并、差),生成一个新的成组实例
1068
+ * 输入的两个成组实例 (subject & tool) 必须是实体。即:所有的面围合起来形成一个封闭的实体 (真实世界中能存在的物体)
1069
+ * 从拓扑结构上说,一个实体,里面的每一条造型边,有且仅有两个相邻面
1070
+ *
747
1071
  * The method is used to make boolean operation of the two group instances.
748
1072
  * @param subject The subject instance.
749
1073
  * @param tool The tool instance.
@@ -751,7 +1075,12 @@ declare global {
751
1075
  * @returns Return an object that contains new instances if successful, otherwise return null.
752
1076
  */
753
1077
  boolean(subject: KGroupInstance, tool: KGroupInstance, type: KBooleanType, coplanarFacesUnion?: boolean): { newInstances: KGroupInstance[] } | null;
1078
+
754
1079
  /**
1080
+ *
1081
+ * 将造型面的轮廓进行偏移
1082
+ * halfEdge 是进行偏移的基准边,moveVector是偏移的方向,两者共同决定面的轮廓是放大偏移还是缩小偏移
1083
+ *
755
1084
  * The method is used to offset the contour of the face.
756
1085
  * NOTE: The moveVector must be perpendicular to the normal of the face and the halfEdge, or null will be returned.
757
1086
  * @param face The face to offset.
@@ -760,34 +1089,56 @@ declare global {
760
1089
  * @returns Return an object that contains added edges if successful, otherwise return null.
761
1090
  */
762
1091
  offset(face: KFace, halfEdge: KHalfEdge, moveVector: KVector3d): { addedEdges: KEdge[] } | null;
1092
+
763
1093
  /**
1094
+ *
1095
+ * 将当前活跃成组里面的所有东西(造型面、成组实例、参考线等)一起旋转/移动/缩放
1096
+ *
764
1097
  * The method is used to transform the active group definition.
765
1098
  * @param matrix The transformation matrix.
766
1099
  * @returns Return an object that contains success flag.
767
1100
  */
768
1101
  transformActiveGroupDefinition(matrix: KMatrix4): { isSuccess: boolean };
1102
+
769
1103
  /**
1104
+ *
1105
+ * 移动/旋转/缩放 一组造型壳体 (shells)
1106
+ *
770
1107
  * The method is used to transform the shells.
771
1108
  * @param shells The shells to transform.
772
1109
  * @param matrix The transformation matrix.
773
1110
  * @returns Return an object that contains success flag.
774
1111
  */
775
1112
  transformShells(shells: KShell[], matrix: KMatrix4): { isSuccess: boolean };
1113
+
776
1114
  /**
1115
+ *
1116
+ * 移动/旋转/缩放 某一个成组实例
1117
+ *
777
1118
  * The method is used to transform the group instances.
778
1119
  * @param groupInstances The group instances to transform.
779
1120
  * @param matrix The transformation matrix.
780
1121
  * @returns Return an object that contains success flag.
781
1122
  */
782
1123
  transformGroupInstances(groupInstances: KGroupInstance[], matrix: KMatrix4): { isSuccess: boolean };
1124
+
783
1125
  /**
1126
+ *
1127
+ * 移动/旋转/缩放 一组参考线
1128
+ *
784
1129
  * The method is used to transform the auxiliary Curves.
785
1130
  * @param auxiliaryCurves The auxiliary Curves to transform.
786
1131
  * @param matrix The transformation matrix.
787
1132
  * @returns Return an object that contains success flag.
788
1133
  */
789
1134
  transformAuxiliaryCurves(auxiliaryCurves: KAuxiliaryCurve[], matrix: KMatrix4): { isSuccess: boolean };
1135
+
790
1136
  /**
1137
+ *
1138
+ * 拷贝一组造型面
1139
+ * 如果 beCopyToInstance 为 true,则会将拷贝出的造型面加到一个新的成组内,不会与当前成组中现有的造型面发生相交、分割
1140
+ * 如果 beCopyToInstance 为 false,则会将拷贝出的造型面加到当前活跃成组内,它们会与当前成组中现有的造型面发生相交、分割
1141
+ *
791
1142
  * The method is used to copy the faces.
792
1143
  * @param faces The faces to copy.
793
1144
  * @param matrix The transformation matrix. The default value is an identity matrix.
@@ -798,27 +1149,44 @@ declare global {
798
1149
  copyFaces(faces: KFace[], matrix?: KMatrix4, beCopyToInstance?: boolean): { addedShells: KShell[], addedInstance?: KGroupInstance } | null;
799
1150
 
800
1151
  /**
1152
+ *
1153
+ * 拷贝生成一组新的成组实例
1154
+ *
801
1155
  * The method is used to copy the group instances.
802
1156
  * @param groupInstances The group instances to copy.
803
1157
  * @param matrix The transformation matrix. The default value is an identity matrix.
804
1158
  * @returns Return an object that contains added group instances if successful, otherwise return null.
805
1159
  */
806
1160
  copyGroupInstances(groupInstances: KGroupInstance[], matrix?: KMatrix4): { addedInstances: KGroupInstance[] } | null;
1161
+
807
1162
  /**
1163
+ *
1164
+ * 拷贝一组成组实例,每一个成组实例,都按照matricesForEachInstance中的一个matrices 数组指定的位姿,拷贝多次
1165
+ * 目前酷大师官方的“外景设计”插件,用这个 API 来实现“随机种树”功能
1166
+ *
808
1167
  * The method is used to copy each group multile times with different matrices.
809
1168
  * @param groupInstances The group instances to copy.
810
1169
  * @param matricesForEachInstance The transformation matrices for each group instance.
811
1170
  * @returns Return an object that contains added group instances if successful, otherwise return null.
812
1171
  */
813
1172
  bulkCopyGroupInstances(groupInstances: KGroupInstance[], matricesForEachInstance: KMatrix4[][]): { addedInstances: KGroupInstance[] } | null;
1173
+
814
1174
  /**
1175
+ *
1176
+ * 拷贝一组参考线
1177
+ *
815
1178
  * The method is used to copy the auxiliary curves.
816
1179
  * @param auxiliaryCurves The auxiliary curves to copy.
817
1180
  * @param matrix The transformation matrix. The default value is an identity matrix.
818
1181
  * @returns Return an object that contains added auxiliary curves if successful, otherwise return null.
819
1182
  */
820
1183
  copyAuxiliaryCurves(auxiliaryCurves: KAuxiliaryCurve[], matrix?: KMatrix4): { addedCurves: KAuxiliaryCurve[] } | null;
1184
+
821
1185
  /**
1186
+ *
1187
+ * 将一组造型面/成组实例/参考线成组。这将生成一个新的成组定义 (KGroupDefinition)和一个新的成组实例 (KGroupInstance)
1188
+ * 新生成的成组实例就是 addedInstance
1189
+ *
822
1190
  * The method is used to make the faces, group instances, auxiliary curves to a group.
823
1191
  * @param faces The faces to make to the group.
824
1192
  * @param groupInstances The group instances to make to the group.
@@ -826,33 +1194,57 @@ declare global {
826
1194
  * @returns Return an object that contains the added instance if successful, otherwise return null.
827
1195
  */
828
1196
  makeGroup(faces: KFace[], groupInstances: KGroupInstance[], auxiliaryCurves: KAuxiliaryCurve[]): { addedInstance: KGroupInstance } | null;
1197
+
829
1198
  /**
1199
+ *
1200
+ * 将一个成组实例解组
1201
+ *
830
1202
  * The method is used to break the group into individual entities, such as shells, group instances, auxiliary curves.
831
1203
  * @param groupInstance The group instance to break.
832
1204
  * @returns Return an object that contains shells, group instances, auxiliary curves if successful, otherwise return null.
833
1205
  */
834
1206
  breakGroup(groupInstance: KGroupInstance): { shells: KShell[], groupInstances: KGroupInstance[], auxiliaryCurves: KAuxiliaryCurve[] } | null;
1207
+
835
1208
  /**
1209
+ *
1210
+ * 开启一个 undo/redo 的会话
1211
+ * 在一个 startOperation 和一个 commitOperation 之间的所有建模操作,都会被放到一个 undo/redo 步骤中
1212
+ *
836
1213
  * The method is used to notify KuDaShi that a new operation (which can be undone) is starting.
837
1214
  * NOTE: If already in operation, an error will be threw.
838
1215
  * @returns
839
1216
  */
840
1217
  startOperation(): void;
1218
+
841
1219
  /**
1220
+ *
1221
+ * 提交一个 undo/redo 的会话
1222
+ * 在一个 startOperation 和一个 commitOperation 之间的所有建模操作,都会被放到一个 undo/redo 步骤中
1223
+ *
842
1224
  * The method is used to commit an operation for undo.
843
1225
  * It is normally called at the end of a method to commit the operation that the method performs.
844
1226
  * NOTE: If not in operation, an error will be threw.
845
1227
  * @returns
846
1228
  */
847
1229
  commitOperation(): void;
1230
+
848
1231
  /**
1232
+ *
1233
+ * 提前终止一个 undo/redo 的会话
1234
+ * 在一个 startOperation 和一个 abortOperation 之间的所有建模操作,都会被 undo 掉,并不会被放到一个 undo/redo 步骤中
1235
+ *
849
1236
  * The method is used to abort the current operation started with the startOperation method.
850
1237
  * It is normally called from inside of a rescue clause to cancel an operation if something goes wrong.
851
1238
  * NOTE: If not in operation, an error will be threw.
852
1239
  * @returns
853
1240
  */
854
1241
  abortOperation(): void;
1242
+
855
1243
  /**
1244
+ *
1245
+ * 用一组 toolFaces 去分割一组 sourceFaces
1246
+ * toolFaces 和 sourceFaces 都必须在当前活跃的成组中
1247
+ *
856
1248
  * The method is used to split the source faces by the tool faces.
857
1249
  * NOTE: source faces and tool faces must be both in the active group definition.
858
1250
  * @param sourceFaces The faces to be split.
@@ -860,7 +1252,12 @@ declare global {
860
1252
  * @returns Return an object that contains the changed shells if successful, otherwise return null.
861
1253
  */
862
1254
  faceSplitByFace(sourceFaces: KFace[], toolFaces: KFace[]): { modifiedShells: KShell[] } | null;
1255
+
863
1256
  /**
1257
+ *
1258
+ * 用一个 tool 成组实例里包含的造型面,去分割 sourceFaces
1259
+ * tool 成组实例和 sourceFaces 都必须在当前活跃的成组中
1260
+ *
864
1261
  * The method is used to split the source faces by group instance.
865
1262
  * NOTE: the source faces and the group instance must be both in the active group definition.
866
1263
  * @param sourceFaces The faces to be split.
@@ -868,18 +1265,33 @@ declare global {
868
1265
  * @returns Return an object that contains the changed shells if successful, otherwise return null.
869
1266
  */
870
1267
  faceSplitByGroup(sourceFaces: KFace[], tool: KGroupInstance): { modifiedShells: KShell[] } | null;
1268
+
871
1269
  /**
1270
+ *
1271
+ * 从一个网格数据,生成一个造型壳体 (shell)
1272
+ * 目前这个 API 被用于酷大师官方插件“外景设计”中的“地形生成”功能
1273
+ *
872
1274
  * The method is used to create a continuous shell from a mesh
873
1275
  * @param mesh The input mesh.
874
1276
  * @returns Return an object that contains new shell information if successful, otherwise return null.
875
1277
  */
876
1278
  createShellFromMesh(mesh: KMesh): { newShell: KShell } | null;
1279
+
877
1280
  /**
1281
+ *
1282
+ * 创建一个空的成组实例
1283
+ *
878
1284
  * The method is used to create empty group instance.
879
1285
  * @returns Return an object that contains added instance if successful, otherwise return null.
880
1286
  */
881
1287
  createEmptyGroupInstance(): { addedInstance: KGroupInstance } | null;
1288
+
882
1289
  /**
1290
+ *
1291
+ * 激活一个成组实例。
1292
+ * 激活后的成组实例的组定义(KGroupDefinition),即成为当前的活跃成组 (KDesign.getActiveGroupDefinition 的返回值)
1293
+ * 这相当于酷大师用户界面上的“进入组编辑”功能
1294
+ *
883
1295
  * The method is used to activate the group instance.
884
1296
  * When we activate the input group instance, the groupDefinition got by the KDesign.getActiveGroupDefinition method is the group definition
885
1297
  * for this input group instance, so anything we do is to edit it.
@@ -888,12 +1300,22 @@ declare global {
888
1300
  * @returns Return an object that contains success flag.
889
1301
  */
890
1302
  activateGroupInstance(groupInstance: KGroupInstance): HostPromise<{ isSuccess: boolean }>;
1303
+
891
1304
  /**
1305
+ *
1306
+ * 反激活一个成组实例
1307
+ * 这相当于酷大师用户界面上的“退出组编辑”功能
1308
+ *
892
1309
  * The method is used to deactivate the final group instance in the activated instance path.
893
1310
  * @returns Return an object that contains success flag.
894
1311
  */
895
1312
  deactivateGroupInstance(): { isSuccess: boolean };
1313
+
896
1314
  /**
1315
+ *
1316
+ * 为一个插件外部模型生成一个成组实例
1317
+ * resourceId 是外部模型唯一标识符。可阅读《酷大师插件开发教程》中的《酷大师插件官方定义消息》部分
1318
+ *
897
1319
  * The method is used to create the group instance from external resources.
898
1320
  * The type of the group definition for this group instance is Xref.
899
1321
  * @param resourceId The resource id, the resource is used to create group instances.
@@ -902,17 +1324,32 @@ declare global {
902
1324
  * @returns Return an object that contains new instances if successful, otherwise return null.
903
1325
  */
904
1326
  createInstanceFromExternalResources(resourceId: string, box: KBoundingBox3d, pluginId?: string): HostPromise<{ newInstance: KGroupInstance } | null>;
1327
+
905
1328
  /**
1329
+ *
1330
+ * 获取当前处于组编辑状态的成组实例的路径 (从顶层成组一直到当前激活成组实例的路径,路径中的每一个元素都是一个KGroupInstance)
1331
+ *
906
1332
  * The method is used to get the path of the editing group instance.
907
1333
  * @returns Return the path of the editing group instance, return empty path if the root group definition is editing.
908
1334
  */
909
1335
  getEditPath(): KGroupInstance[];
1336
+
910
1337
  /**
1338
+ *
1339
+ * @deprecated 此 API 仅供酷大师内部开发团队使用
1340
+ * 加载一个材质,材质id为酷大师内部材质库的材质id
1341
+ *
911
1342
  * Load and cache the material if it is first time used.
912
1343
  * @param materialId The id of the material.
913
1344
  */
914
1345
  loadMaterial(materialId: string): HostPromise<{ isSuccess: boolean }>;
1346
+
915
1347
  /**
1348
+ *
1349
+ * @deprecated 此 API 仅供酷大师内部开发团队使用
1350
+ * 给一组面赋材质
1351
+ * 可通过originVertexs 和 vertexUVs 来指定材质铺贴的uv
1352
+ *
916
1353
  * The method is used to assign material for a group of faces.
917
1354
  * @param faces the faces to be assigned material
918
1355
  * @param materialId material id
@@ -924,6 +1361,10 @@ declare global {
924
1361
  assignMaterialForFaces(faces: KFace[], materialId: string, bgId?: string, originVertexs?: KVertex[], vertUVs?: KPoint2d[]): boolean;
925
1362
 
926
1363
  /**
1364
+ *
1365
+ * @deprecated 此 API 仅供酷大师内部开发团队使用
1366
+ * 给一个成组实例赋材质
1367
+ *
927
1368
  * The method is used to assign material for group instance.
928
1369
  * @param groupInstance the group instance to be assigned material
929
1370
  * @param materialId material id
@@ -933,6 +1374,10 @@ declare global {
933
1374
  assignMaterialForGroupInstance(groupInstance: KGroupInstance, materialId: string, bgId?: string): boolean;
934
1375
 
935
1376
  /**
1377
+ *
1378
+ * 对一组造型边做 3D 倒角
1379
+ * stripCount是倒角圆弧轮廓的分段数
1380
+ * smoothTransit 为true时,在三边交汇处会做圆滑过渡
936
1381
  *
937
1382
  * @param edges the edges to be fillet
938
1383
  * @param radiuses radiuses for each edges
@@ -941,7 +1386,10 @@ declare global {
941
1386
  * @returns Return an object that contains a map of the input edges and the resulted corner faces, otherwise return null.
942
1387
  */
943
1388
  fillet(edges: KEdge[], radiuses: number[], stripeCount: number, smoothTransit?: boolean): { edgeFacesMap: Map<KEdge, KFace[]> } | null
1389
+
944
1390
  /**
1391
+ *
1392
+ * 平移/旋转/缩放 一组造型顶点。与这些造型顶点相连的造型边/造型面也会一起移动
945
1393
  *
946
1394
  * @param vertices vertices to be transformed
947
1395
  * @param matrix transform matrix
@@ -953,6 +1401,8 @@ declare global {
953
1401
 
954
1402
 
955
1403
  /**
1404
+ * @deprecated 本接口即将下线
1405
+ *
956
1406
  * The KContinuousEdgeGroup class is used by KuDaShi to unite a series of KEdge objects into one continuous edge group, which represents a conceptual curve.
957
1407
  * Since KuDaShi is a surface modeler, all circles, arcs, and arbitrary curves are really just edges that are bound together in sequence.
958
1408
  */
@@ -969,47 +1419,74 @@ declare global {
969
1419
  }
970
1420
 
971
1421
  /**
1422
+ * 酷大师图形实体:造型边
1423
+ * 它对应于一个Brep数据结构的边(Edge)
1424
+ *
972
1425
  * The KEdge class represents the BRep edge.
973
- * Since KuDaShi is a surface modeler, all circles, arcs, and arbitrary curves are really just edges that are bound together in sequence.
974
- * So you can think of all circles, arcs, and arbitrary curves as conceptual curve.
975
- * If one edge are united into one conceptual curve, it is a soft edge.
1426
+ *
976
1427
  */
977
1428
  interface KEdge extends KTopoEdge, KEntity {
978
1429
  /**
1430
+ *
1431
+ * 获取图形实体类型
1432
+ *
979
1433
  * Get the entity's type.
980
1434
  * @returns The entity's type which is KTopoType
981
1435
  */
982
1436
  getType(): KTopoType;
1437
+
983
1438
  /**
1439
+ *
1440
+ * 获取所从属的壳体
1441
+ *
984
1442
  * Retrieve the shell that the edge belongs to.
985
1443
  * @returns The shell if successful, otherwise null.
986
1444
  */
987
1445
  getShell(): KShell | null;
1446
+
988
1447
  /**
1448
+ *
1449
+ * 获取对应的半边
1450
+ *
989
1451
  * Retrieve all the involved half edges of this edge.
990
1452
  * @return The array of half edges.
991
1453
  */
992
1454
  getHalfEdges(): KHalfEdge[];
1455
+
993
1456
  /**
1457
+ *
1458
+ * 获取起始顶点
1459
+ *
994
1460
  * Retrieve edge's start vertex.
995
1461
  * @return The start vertex if successful, otherwise null.
996
1462
  */
997
1463
  getVertexA(): KVertex | null;
1464
+
998
1465
  /**
1466
+ *
1467
+ * 获取终止顶点
1468
+ *
999
1469
  * Retrieve edge's end vertex.
1000
1470
  * @return The end vertex if successful, otherwise null.
1001
1471
  */
1002
1472
  getVertexB(): KVertex | null;
1473
+
1003
1474
  /**
1004
- * Set the edge to be soft.
1005
- * A soft edge will cause the connected faces to be treated as a surface.
1006
- * This means that if you select one face it will also
1007
- * select all faces connected with soft edges. A soft edge will also appear hidden.
1475
+ *
1476
+ * 设置为这条边是否为软化边
1477
+ * 软化边默认在酷大师画布中不显示
1478
+ * 当在酷大师中选择一个造型面时,会将从这个面开始,所有通过软化边相连的面一起选中
1479
+ *
1480
+ * Set the edge to be soft. A soft edge is invisible in viewport by default
1481
+ * When selelcting a face, all faces that connected with soft edges will be selected together
1482
+ *
1008
1483
  * @param isSoft The soft value.
1009
1484
  * @return Return true if successful, otherwise return false.
1010
1485
  */
1011
1486
  setIsSoft(isSoft: boolean): boolean;
1487
+
1012
1488
  /**
1489
+ * @deprecated 本方法即将下线,请不要使用
1013
1490
  * Retrieve the continuous edge group which the edge belongs to.
1014
1491
  * @return The continuous edge group if successful, otherwise null.
1015
1492
  */
@@ -1018,6 +1495,9 @@ declare global {
1018
1495
 
1019
1496
 
1020
1497
  /**
1498
+ *
1499
+ * 酷大师应用图形实体类型
1500
+ *
1021
1501
  * The KEntityType class represents entity types.
1022
1502
  */
1023
1503
  enum KAppEntityType {
@@ -1039,15 +1519,25 @@ declare global {
1039
1519
  AuxiliaryVertex = 'auxiliaryVertex',
1040
1520
  }
1041
1521
 
1522
+ /**
1523
+ * 酷大师图形实体类型
1524
+ */
1042
1525
  type KEntityType = KTopoType | KAppEntityType;
1043
1526
  // https://github.com/microsoft/TypeScript/issues/17592
1044
1527
  const KEntityType = {...KTopoType, ...KAppEntityType};
1045
1528
 
1046
1529
  /**
1530
+ * 酷大师图形实体的基类
1531
+ * 造型面、造型边、造型顶点、参考线、参考线段、参考线顶点、成组实例等统称酷大师图元。
1532
+ * 可阅读《酷大师基本概念》第二节,“酷大师图形实体”,获取更多信息
1533
+ *
1047
1534
  * The KEntity class is the base class for all KuDaShi entities. Entities are basically anything that can be contained in a model.
1048
1535
  */
1049
1536
  interface KEntity {
1050
1537
  /**
1538
+ *
1539
+ * 获取图形实体类型
1540
+ *
1051
1541
  * Get the entity's type.
1052
1542
  * @returns The entity's type.
1053
1543
  */
@@ -1056,6 +1546,7 @@ declare global {
1056
1546
 
1057
1547
 
1058
1548
  /**
1549
+ * @deprecated 本接口即将下线,请不要使用
1059
1550
  * The KContinuousFaceGroup class is used by KuDaShi to unite a series of KFace objects into one continuous face group, which represents a conceptual surface.
1060
1551
  * Since KuDaShi is a surface modeler, all surfaces are really just faces that are bound together in sequence.
1061
1552
  */
@@ -1066,49 +1557,79 @@ declare global {
1066
1557
  readonly faces: KFace[];
1067
1558
  }
1068
1559
  /**
1560
+ *
1561
+ * 酷大师图形实体:造型面
1562
+ * 它对应于一个Brep数据结构的面 (Face)
1563
+ *
1069
1564
  * The KFace class represents the BRep face.
1070
- * Since KuDaShi is a surface modeler, all surfaces are really just faces that are bound together in sequence.
1071
- * So you can think of all surfaces as conceptual surfaces.
1072
1565
  */
1073
1566
  interface KFace extends KEntity, KTopoFace {
1074
1567
  /**
1568
+ *
1569
+ * 获取图形实体类型
1570
+ *
1075
1571
  * Get the entity's type.
1076
1572
  * @returns The entity's type.
1077
1573
  */
1078
1574
  getType(): KTopoType;
1079
1575
 
1080
1576
  /**
1577
+ *
1578
+ * 获取所从属的壳体
1579
+ *
1081
1580
  * Get the shell that the face belongs to.
1082
1581
  * @returns The shell if successful, otherwise null.
1083
1582
  */
1084
1583
  getShell(): KShell | null;
1584
+
1085
1585
  /**
1586
+ *
1587
+ * 获取所有包含的边
1588
+ *
1086
1589
  * Retrieve all the involved edges of this face.
1087
1590
  * @return The array of edges.
1088
1591
  */
1089
1592
  getEdges(): KEdge[];
1593
+
1090
1594
  /**
1595
+ *
1596
+ * 获取所有包含的顶点
1597
+ *
1091
1598
  * Retrieve all the involved vertices of this face.
1092
1599
  * @return The array of vertices.
1093
1600
  */
1094
1601
  getVertices(): KVertex[];
1602
+
1095
1603
  /**
1604
+ *
1605
+ * 获取所有包含的半边
1606
+ *
1096
1607
  * Retrieve all the involved half edges of this face.
1097
1608
  * @return The array of half edges.
1098
1609
  */
1099
1610
  getHalfEdges(): KHalfEdge[];
1611
+
1100
1612
  /**
1613
+ *
1614
+ * 获取所含的外环
1615
+ *
1101
1616
  * Retrieve face's outer loop.
1102
1617
  * @return The outer loop if successful, otherwise null.
1103
1618
  */
1104
1619
  getOuterLoop(): KLoop | null;
1620
+
1105
1621
  /**
1622
+ *
1623
+ * 获取所含的内环
1624
+ *
1106
1625
  * Retrieve face's inner loops.
1107
1626
  * @return The inner loops.
1108
1627
  */
1109
1628
  getInnerLoops(): KLoop[];
1110
1629
 
1111
1630
  /**
1631
+ * @deprecated 该接口即将下线
1632
+ *
1112
1633
  * Retrieve the continuous face which the face belongs to.
1113
1634
  * @return The continuous face if successful, otherwise null.
1114
1635
  */
@@ -1117,15 +1638,25 @@ declare global {
1117
1638
 
1118
1639
 
1119
1640
  /**
1641
+ *
1642
+ * 组定义的类型
1643
+ *
1120
1644
  * The KGroupDefinitionType class represents group definition types.
1121
1645
  */
1122
1646
  enum KGroupDefinitionType {
1123
1647
  /**
1648
+ *
1649
+ * 原生成组
1650
+ *
1124
1651
  * Native Type.
1125
1652
  * It means the definition is constructed in KuDaShi, you can edit the definition in KuDaShi.
1126
1653
  */
1127
1654
  Native = 'native',
1655
+
1128
1656
  /**
1657
+ *
1658
+ * 外部模型
1659
+ *
1129
1660
  * Xref Type.
1130
1661
  * It means the definition is constructed by other applications or services, such as smart 3d text, etc.
1131
1662
  * You can not change the xref definition.
@@ -1134,9 +1665,20 @@ declare global {
1134
1665
  }
1135
1666
 
1136
1667
  /**
1668
+ *
1669
+ * 组定义
1670
+ *
1671
+ * 组定义用来定义一个成组里面的内容。一个成组里面可包括一组酷大师图形实体,如造型面、参考线、参考线段、子级的成组实例等
1672
+ * 例如,我们可以画一个茶杯,把它做成一个成组(组定义)。然后为它创建6个实例,围绕在一张桌子的周围
1673
+ * 注意,在酷大师图形界面里使用“成组”的命令,会创建一个成组的组定义,并同时创建一个成组的组实例。我们在画布中看到的对象,其实是组实例。
1674
+ * 在酷大师图形界面里编辑一个“成组”,实际上是在编辑它的组定义。对组定义的修改,会应用到它所有的组实例上。因此,所有的组实例的外观在组定义修改后,都会变化。
1675
+ * 酷大师的组定义可以有两种类型,原生成组和外部模型
1676
+ * 在酷大师里用“成组”命令创建的,或用KDesign.makeGroup这个API创建的成组都属于原生成组。我们可以在酷大师里编辑原生成组的组定义内容(即进行“组编辑”)
1677
+ * 外部模型是由外部的应用(体现为一个酷大师插件)插入到酷大师方案中的,例如酷大师官方插件中的“智能模型”。外部模型的组定义只能由创建它的外部应用,即酷大师插件来编辑。
1678
+ *
1137
1679
  * The KGroupDefinition class is used to define the contents for a KuDaShi group instance.
1138
1680
  * The group definition is a collection of entities that can be instanced and reused multiple times throughout a KuDaShi model.
1139
- * For example, you could draw a tea-cup once, turn it into a group instance, and then use 6 instances of it to surround a tea table.
1681
+ * For example, you could draw a tea-cup once, turn it into a group definition, and then use 6 instances of it to surround a tea table.
1140
1682
  * Editing to the original “definition” will then propagate across all of its instances.
1141
1683
  * The KGroupDefinition class contains sub group instances, shells and auxiliary curves, etc. The group definition has two types, native and xref.
1142
1684
  * The native type means the definition is constructed in KuDaShi, you can edit the definition in KuDaShi.
@@ -1146,16 +1688,27 @@ declare global {
1146
1688
  */
1147
1689
  interface KGroupDefinition {
1148
1690
  /**
1691
+ *
1692
+ * 获取成组的类型
1693
+ *
1149
1694
  * Get the group definition's type.
1150
1695
  * @returns The group definition's type.
1151
1696
  */
1152
1697
  getType(): KGroupDefinitionType;
1698
+
1153
1699
  /**
1700
+ *
1701
+ * 获取成组的唯一标识符
1702
+ *
1154
1703
  * Get a unique key assigned to a group definition.
1155
1704
  * @returns The unique key.
1156
1705
  */
1157
1706
  getKey(): string;
1707
+
1158
1708
  /**
1709
+ *
1710
+ * 通过酷大师图形实体的唯一标识符,查找一个酷大师图形实体
1711
+ *
1159
1712
  * The method is used to find and return the entity by its unique key.
1160
1713
  * NOTE: 1.Only supports to find by face, group instance and auxiliary curve's keys.
1161
1714
  * 2. Can only find the entity in the current definition, not recursive.
@@ -1163,7 +1716,14 @@ declare global {
1163
1716
  * @returns The found entity if successful, otherwise null.
1164
1717
  */
1165
1718
  findEntity(key: string): KEntity | null;
1719
+
1166
1720
  /**
1721
+ *
1722
+ * 使用酷大师图形实体的唯一标识符,来匹配一个酷大师图形实体
1723
+ * 这个 API 和上面的 findEntity 的不同点在于,这里用来查找的key,可以是一个老的 key,不一定是现有的图形实体的 key
1724
+ * 例如,在一个矩形的造型面上添加了一条边,将其分割成两个面。那么,用一个老的造型面的key,就可以匹配到两个新的造型面
1725
+ * 目前,这种匹配功能只支持造型面和造型边。且只支持当前组定义所直接包含的造型面和造型边的匹配,不包含其子级成组实例里面引用的造型面和造型边
1726
+ *
1167
1727
  * Find the surviviors of the old entity after model modification.
1168
1728
  * Note: 1. only support face and edge for now.
1169
1729
  * 2. only can find the entities in the current definition, not recursive.
@@ -1171,32 +1731,58 @@ declare global {
1171
1731
  * @returns The survivor entities of the old entity. If the old entity was not modified, then itself will be returned.
1172
1732
  */
1173
1733
  matchEntities(key: string): KEntity[];
1734
+
1174
1735
  /**
1736
+ *
1737
+ * 获取子级的成组实例
1738
+ *
1175
1739
  * Get all the sub group instances in this group definition.
1176
1740
  * @returns An array of sub group instances in this group definition.
1177
1741
  */
1178
1742
  getSubGroupInstances(): KGroupInstance[];
1743
+
1179
1744
  /**
1745
+ *
1746
+ * 获取组定义里直接包含的造型壳体
1747
+ *
1180
1748
  * Get all the shells in this group definition.
1181
1749
  * @returns An array of shells in this group definition.
1182
1750
  */
1183
1751
  getShells(): KShell[];
1752
+
1184
1753
  /**
1754
+ *
1755
+ * 获取参考线
1756
+ *
1185
1757
  * Get all the auxiliary curves in this group definition.
1186
1758
  * @returns An array of auxiliary curves in this group definition.
1187
1759
  */
1188
1760
  getAuxiliaryCurves(): KAuxiliaryCurve[];
1761
+
1189
1762
  /**
1763
+ *
1764
+ * 获取酷大师方案中,所有应用本成组定义的成组实例
1765
+ *
1190
1766
  * Get all the instances of this group definition.
1191
1767
  * @returns An array of instances of this group definition.
1192
1768
  */
1193
1769
  getAllReferenceGroupInstances(): KGroupInstance[];
1770
+
1194
1771
  /**
1772
+ *
1773
+ * 检查本成组定义是否处于快速模式
1774
+ * 快速模式是成组的一种特殊显示模式。在这种模式下,我们不会在酷大师画布中加载成组的Brep数据,而只会加载它的三角网格数据。
1775
+ * 这样可以大大减轻内存的压力,从而使酷大师打开更大的方案
1776
+ *
1195
1777
  * Check whether the group definition is in express mode.
1196
1778
  * @returns A flag to indicate whether the group definition is in express mode.
1197
1779
  */
1198
1780
  isInExpressMode(): boolean;
1781
+
1199
1782
  /**
1783
+ *
1784
+ * 获取本成组定义的外包围盒
1785
+ *
1200
1786
  * Get the bounding box of this group definition.
1201
1787
  * @returns The bounding box.
1202
1788
  */
@@ -1204,27 +1790,48 @@ declare global {
1204
1790
  }
1205
1791
 
1206
1792
  /**
1793
+ *
1794
+ * 组实例
1795
+ *
1796
+ * 组实例用来表达一个成组的实例。可以把“组定义”看成面向对象编程中的“类”,而“组实例”看成面向对象编程中的“对象”
1797
+ * 组实例会包含一个对组定义的应用,然后包含一个齐次变换矩阵,用来表达它在酷大师 3D 场景中的位姿
1798
+ *
1207
1799
  * The KGroupInstance class is used to represent group instances of a group definition.
1208
1800
  * Therefore, the KGroupInstance class contains a reference to a corresponding KGroupDefinition object
1209
1801
  * and a Transformation object (which contains the location of the group instance in the Drawing Window).
1210
1802
  */
1211
1803
  interface KGroupInstance extends KEntity {
1212
1804
  /**
1805
+ *
1806
+ * 获取唯一标识符
1807
+ *
1213
1808
  * Get a unique key assigned to a group instance.
1214
1809
  * @returns The unique key.
1215
1810
  */
1216
1811
  getKey(): string;
1812
+
1217
1813
  /**
1814
+ *
1815
+ * 获取组定义
1816
+ *
1218
1817
  * Get the group definition for this group instance.
1219
1818
  * @returns The group definition if successful, else false.
1220
1819
  */
1221
1820
  getGroupDefinition(): KGroupDefinition | null;
1821
+
1222
1822
  /**
1823
+ *
1824
+ * 获取齐次变换矩阵。此矩阵用于表达组实例在酷大师 3D 场景中的位姿
1825
+ *
1223
1826
  * Get the transformation matrix of this group instance.
1224
1827
  * @returns The transformation matrix.
1225
1828
  */
1226
1829
  getTransform(): KMatrix4;
1830
+
1227
1831
  /**
1832
+ *
1833
+ * 获取组实例的外包围盒
1834
+ *
1228
1835
  * Get the bounding box of this group instance.
1229
1836
  * @returns The bounding box.
1230
1837
  */
@@ -1232,51 +1839,90 @@ declare global {
1232
1839
  }
1233
1840
 
1234
1841
  /**
1842
+ *
1843
+ * 半边
1844
+ *
1845
+ * 半边不是一个可以独立存在的酷大师图形实体。它对应于一个Brep数据结构的半边(HalfEdge)。它从属于酷大师图形实体中的面和边
1846
+ *
1235
1847
  * The KHalfEdge class represents the BRep half edge.
1236
1848
  */
1237
1849
  interface KHalfEdge extends KEntity, KTopoHalfEdge {
1238
1850
  /**
1851
+ *
1852
+ * 获取图形实体类型
1853
+ *
1239
1854
  * Get the entity's type.
1240
1855
  * @returns The entity's type.
1241
1856
  */
1242
1857
  getType(): KTopoType;
1243
1858
 
1244
1859
  /**
1860
+ *
1861
+ * 获取所从属的造型边
1862
+ *
1245
1863
  * Get the edge that the half edge belongs to.
1246
1864
  * @returns The edge if successful, otherwise null.
1247
1865
  */
1248
1866
  getEdge(): KEdge | null;
1867
+
1249
1868
  /**
1869
+ *
1870
+ * 获取所从属的环
1871
+ *
1250
1872
  * Get the loop that the half edge belongs to.
1251
1873
  * @returns The loop if successful, otherwise null.
1252
1874
  */
1253
1875
  getLoop(): KLoop | null;
1876
+
1254
1877
  /**
1878
+ *
1879
+ * 获取所从属的壳体
1880
+ *
1255
1881
  * Get the shell that the half edge belongs to.
1256
1882
  * @returns The shell if successful, otherwise null.
1257
1883
  */
1258
1884
  getShell(): KShell | null;
1885
+
1259
1886
  /**
1887
+ *
1888
+ * 获取环中的下一个半边
1889
+ *
1260
1890
  * Get this half edge's next half edge in the loop.
1261
1891
  * @return The next half edge if successful, otherwise null.
1262
1892
  */
1263
1893
  getNext(): KHalfEdge | null;
1894
+
1264
1895
  /**
1896
+ *
1897
+ * 获取环中的上一个半边
1898
+ *
1265
1899
  * Get this half edge's previous half edge in the loop.
1266
1900
  * @return The previous half edge if successful, otherwise null.
1267
1901
  */
1268
1902
  getPrev(): KHalfEdge | null;
1903
+
1269
1904
  /**
1905
+ *
1906
+ * 获取半边的起点
1907
+ *
1270
1908
  * Get this half edge's start vertex.
1271
1909
  * @return The start vertex if successful, otherwise null.
1272
1910
  */
1273
1911
  getVertexA(): KVertex | null;
1912
+
1274
1913
  /**
1914
+ *
1915
+ * 获取半边的终点
1916
+ *
1275
1917
  * Get this half edge's end vertex.
1276
1918
  * @return The end vertex if successful, otherwise null.
1277
1919
  */
1278
1920
  getVertexB(): KVertex | null;
1921
+
1279
1922
  /**
1923
+ *
1924
+ * 获取半边的方向是否和边的方向相反。如果相反,返回 true;否则返回 false
1925
+ *
1280
1926
  * Check whether the half edge is reversed to its edge.
1281
1927
  * @return true if reversed, false if the orientations are same.
1282
1928
  */
@@ -1284,36 +1930,62 @@ declare global {
1284
1930
  }
1285
1931
 
1286
1932
  /**
1933
+ *
1934
+ * 酷大师键盘事件
1935
+ *
1287
1936
  * The KKeyBoardEvent class describes a user interaction with the keyboard.
1288
1937
  * It is similar to the KeyBoardEvent class in Web APIs.
1289
1938
  */
1290
1939
  interface KKeyBoardEvent {
1291
1940
  /**
1941
+ *
1942
+ * 获取按键的名称
1943
+ *
1292
1944
  * Get the value of the key pressed by the user.
1293
1945
  * @returns
1294
1946
  */
1295
1947
  getKey(): string;
1948
+
1296
1949
  /**
1950
+ *
1951
+ * 获取按键的编码
1952
+ *
1297
1953
  * Get a physical key on the keyboard.
1298
1954
  * @returns
1299
1955
  */
1300
1956
  getCode(): string;
1957
+
1301
1958
  /**
1959
+ *
1960
+ * 判断是否是 ctrl 键
1961
+ *
1302
1962
  * Get a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred.
1303
1963
  * @returns True if the control key was pressed, else false.
1304
1964
  */
1305
1965
  ctrlKey(): boolean;
1966
+
1306
1967
  /**
1968
+ *
1969
+ * 判断是否是 alt 键
1970
+ *
1307
1971
  * Get a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred.
1308
1972
  * @returns True if the alt key was pressed, else false.
1309
1973
  */
1310
1974
  altKey(): boolean;
1975
+
1311
1976
  /**
1977
+ *
1978
+ * 判断是否是复合按键
1979
+ *
1312
1980
  * Get a Boolean value indicating if the event is fired within a composition session.
1313
1981
  * @returns True if within a composition session, else false.
1314
1982
  */
1315
1983
  isComposing(): boolean;
1984
+
1316
1985
  /**
1986
+ *
1987
+ * 判断是否是 shift 键
1988
+ *
1317
1989
  * Get a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred.
1318
1990
  * @returns True if the shift key was pressed, else false.
1319
1991
  */
@@ -1321,26 +1993,53 @@ declare global {
1321
1993
  }
1322
1994
 
1323
1995
  /**
1996
+ *
1997
+ * 环
1998
+ *
1999
+ * 环不是一个可以独立存在的酷大师图形实体。它对应于一个Brep数据结构的环(Loop)。它从属于酷大师图形实体中的面
2000
+ *
1324
2001
  * The KLoop class represents the BRep loop.
1325
2002
  */
1326
2003
  interface KLoop extends KEntity, KTopoLoop {
1327
2004
  /**
2005
+ *
2006
+ * 获取图形实体类型
2007
+ *
1328
2008
  * Get the entity's type.
1329
2009
  * @returns The entity's type.
1330
2010
  */
1331
2011
  getType(): KTopoType;
2012
+
1332
2013
  /**
2014
+ *
2015
+ * 获取所从属的面
2016
+ *
1333
2017
  * Get the face that the loop belongs to.
1334
2018
  * @returns The face if successful, otherwise null.
1335
2019
  */
1336
2020
  getFace(): KFace | null;
2021
+
1337
2022
  /**
2023
+ *
2024
+ * 获取所包含的半边
2025
+ *
1338
2026
  * Get all the involved half edges of this loop.
1339
2027
  * @return The array of half edges.
1340
2028
  */
1341
2029
  getHalfEdges(): KHalfEdge[];
1342
2030
  }
1343
2031
 
2032
+ /**
2033
+ *
2034
+ * 网格面
2035
+ *
2036
+ * 定义了一个网格面数据结构
2037
+ * vertices 数组里面的每一个元素代表一个网格面的顶点。这个元素自身是一个数组,包含三个数字,分别代表顶点的 X, Y, Z 坐标
2038
+ * tirangleIndices 数组里面的每一个元素代表一个三角形。这个元素自身是一个数组,包含三个数字,分别代表组成三角形的顶点在vertices数组里的下标
2039
+ * softEdges 数组里面的每一个元素代表一条边。这个元素自身是一个数组,包含两个数字,分别代表组成这个边的顶点在vertices数组里的下标。
2040
+ * 所有在 softEdges 数组里面的边,都会被设置为软化边
2041
+ *
2042
+ */
1344
2043
  interface KMesh {
1345
2044
  vertices: number[][];
1346
2045
  triangleIndices: number[][];
@@ -1348,16 +2047,26 @@ declare global {
1348
2047
  }
1349
2048
 
1350
2049
  /**
2050
+ *
2051
+ * 酷大师鼠标事件
2052
+ *
1351
2053
  * The KMouseEvent class describes a user interaction with the mouse.
1352
2054
  * It is similar to the MouseEvent class in Web APIs.
1353
2055
  */
1354
2056
  interface KMouseEvent {
1355
2057
  /**
2058
+ *
2059
+ * 获取 client 窗口中的 X 坐标
2060
+ *
1356
2061
  * Get the horizontal position of the mouse event on the client window of user's screen.
1357
2062
  * @returns
1358
2063
  */
1359
2064
  clientX(): number;
2065
+
1360
2066
  /**
2067
+ *
2068
+ * 获取 client 窗口中的 Y 坐标
2069
+ *
1361
2070
  * Get the vertical position of the mouse event on the client window of the user's screen.
1362
2071
  * @returns
1363
2072
  */
@@ -1366,54 +2075,92 @@ declare global {
1366
2075
 
1367
2076
 
1368
2077
  /**
2078
+ *
2079
+ * 框选类型
2080
+ *
1369
2081
  * The KPickType class represents pick types.
1370
2082
  */
1371
2083
  enum KPickType {
1372
2084
  /**
2085
+ *
2086
+ * 包含选中。框选时,所有被包含在框里面的图形实体才会被选中
2087
+ *
1373
2088
  * Pick Inside Type.
1374
2089
  */
1375
2090
  PickInside = 'pick_inside',
2091
+
1376
2092
  /**
2093
+ *
2094
+ * 交叉选中。框选时,所有被选择框交叉到的图形实体就会被选中
2095
+ *
1377
2096
  * Pick Crossing Type.
1378
2097
  */
1379
2098
  PickCrossing = 'pick_crossing'
1380
2099
  }
2100
+
1381
2101
  /**
2102
+ *
2103
+ * 选择设置
2104
+ *
1382
2105
  * The KPickSetting class represents the pick settings.
1383
2106
  */
1384
2107
  interface KPickSetting {
1385
2108
  /**
2109
+ *
2110
+ * 选择操作类型(仅用于框选)
2111
+ *
1386
2112
  * The pick type. Default is PickCrossing.
1387
2113
  * NOTE: It is only used when picking by rectangle.
1388
2114
  */
1389
2115
  pickType?: KPickType;
2116
+
1390
2117
  /**
2118
+ *
2119
+ * 可被选择的图形实体类型。默认情况下,所有图形实体都会被选中
2120
+ *
1391
2121
  * The pickable entity type. Default is that all types are pickable.
1392
2122
  */
1393
2123
  pickableEntityType?: KEntityType[];
1394
2124
  }
1395
2125
 
1396
2126
  /**
2127
+ *
2128
+ * 点选结果
2129
+ *
1397
2130
  * The KPointPickResult class represents the point pick result.
1398
2131
  */
1399
2132
  interface KPointPickResult {
1400
2133
  /**
2134
+ *
2135
+ * 获取选中的图形实体的数量
2136
+ *
1401
2137
  * Get the size of all the picked entities.
1402
2138
  * @return The size of all the picked entities.
1403
2139
  */
1404
2140
  getSize(): number;
2141
+
1405
2142
  /**
2143
+ * 获取选中的所有图形实体
2144
+ *
1406
2145
  * Get all the picked entities.
1407
2146
  * NOTE: The picked entities are arranged from near to far.
1408
2147
  * @return All the picked entities.
1409
2148
  */
1410
2149
  getAllPicked(): KEntity[];
2150
+
1411
2151
  /**
2152
+ *
2153
+ * 获取在被选中的图形实体中,排在最前面的那一个实体(第 0 号元素)
2154
+ *
1412
2155
  * Get the front picked entity.
1413
2156
  * @return The front picked entity.
1414
2157
  */
1415
2158
  getFrontPicked(): KEntity | null;
2159
+
1416
2160
  /**
2161
+ *
2162
+ * 获取在被选中的图形实体中,排在最前面的那一个实体的被选中的 3D 点
2163
+ *
1417
2164
  * Get the front picked point.
1418
2165
  * @return The front picked point.
1419
2166
  */
@@ -1421,15 +2168,25 @@ declare global {
1421
2168
  }
1422
2169
 
1423
2170
  /**
2171
+ *
2172
+ * 框选结果
2173
+ *
1424
2174
  * The KRectPickResult class represents the rect pick result.
1425
2175
  */
1426
2176
  interface KRectPickResult {
1427
2177
  /**
2178
+ *
2179
+ * 获取选中的图形实体的数量
2180
+ *
1428
2181
  * Get the size of all the picked entities.
1429
2182
  * @return The size of all the picked entities.
1430
2183
  */
1431
2184
  getSize(): number;
2185
+
1432
2186
  /**
2187
+ *
2188
+ * 获取选中的所有图形实体
2189
+ *
1433
2190
  * Get all the picked entities.
1434
2191
  * @return All the picked entities.
1435
2192
  */
@@ -1437,10 +2194,16 @@ declare global {
1437
2194
  }
1438
2195
 
1439
2196
  /**
2197
+ *
2198
+ * 选择帮助器
2199
+ *
1440
2200
  * The KPickHelper class is used to pick entities.
1441
2201
  */
1442
2202
  interface KPickHelper {
1443
2203
  /**
2204
+ *
2205
+ * 点选。 使用一个 client 窗口的 x,y 坐标来做选择
2206
+ *
1444
2207
  * The method is used to pick by point.
1445
2208
  * @param x X screen coordinate for the pick.
1446
2209
  * @param y Y screen coordinate for the pick.
@@ -1448,7 +2211,11 @@ declare global {
1448
2211
  * @return The result of point pick.
1449
2212
  */
1450
2213
  pickByPoint(x: number, y: number, pickSetting?: KPickSetting): KPointPickResult;
2214
+
1451
2215
  /**
2216
+ *
2217
+ * 框选。 使用一个 client 窗口的 2d 矩形来做选择
2218
+ *
1452
2219
  * The method is used to pick by rectangle.
1453
2220
  * @param startPoint First screen coordinate point.
1454
2221
  * @param endPoint Second screen coordinate point.
@@ -1460,6 +2227,16 @@ declare global {
1460
2227
 
1461
2228
 
1462
2229
  /**
2230
+ *
2231
+ * 酷大师选择集
2232
+ *
2233
+ * 代表在当前酷大师画布中选中的一组图形实体
2234
+ *
2235
+ * 注意:
2236
+ * 1.酷大师选择集中的图形实体的顺序是不固定的,因此,不要依赖于选择集中的图形实体的顺序去写业务逻辑
2237
+ * 2.酷大师选择集中只会包含酷大师图形实体类型,如KEntityType.Edge, KEntityType.Face等
2238
+ *
2239
+ *
1463
2240
  * The KSelection represents a set of the currently selected entities.
1464
2241
  * Use the app.selection method to get a selection object.
1465
2242
  * NOTE: 1.The order of entities in the set is in no particular order and should not be assumed to be
@@ -1470,12 +2247,18 @@ declare global {
1470
2247
  */
1471
2248
  interface KSelection {
1472
2249
  /**
2250
+ * 获取选择集中所有的图形实体
2251
+ *
1473
2252
  * Get all the entities in the selection.
1474
2253
  * NOTE: Only the entities of supported types are returned.
1475
2254
  * @return All the entities in the selection.
1476
2255
  */
1477
2256
  getAllEntities(): KEntity[];
2257
+
1478
2258
  /**
2259
+ *
2260
+ * 在选择集中添加图形实体
2261
+ *
1479
2262
  * Add entities to the selection.
1480
2263
  * NOTE: If the entity belongs to one conceptual curve or surface,
1481
2264
  * all the edges or faces that make up the conceptual curve or surface will be added to the selection automatically.
@@ -1483,7 +2266,11 @@ declare global {
1483
2266
  * @returns Return true if successful, else return false.
1484
2267
  */
1485
2268
  add(entities: KEntity[]): boolean;
2269
+
1486
2270
  /**
2271
+ *
2272
+ * 从选择集中移除图形实体
2273
+ *
1487
2274
  * Remove entities from the selection.
1488
2275
  * NOTE: If the entity belongs to one conceptual curve or surface,
1489
2276
  * all the edges or faces that make up the conceptual curve or surface will be removed from the selection automatically.
@@ -1491,18 +2278,30 @@ declare global {
1491
2278
  * @returns Return true if successful, else return false.
1492
2279
  */
1493
2280
  remove(entities: KEntity[]): boolean;
2281
+
1494
2282
  /**
2283
+ *
2284
+ * 清空选择集
2285
+ *
1495
2286
  * Clear the selection.
1496
2287
  * @returns Return true if successful, else return false.
1497
2288
  */
1498
2289
  clear(): boolean;
2290
+
1499
2291
  /**
2292
+ *
2293
+ * 添加选择集观察者
2294
+ *
1500
2295
  * The method is used to add an observer to the selection object.
1501
2296
  * @param observer The observer to add.
1502
2297
  * @returns Return true if successful, else return false.
1503
2298
  */
1504
2299
  addObserver(observer: KSelectionObserver): boolean;
2300
+
1505
2301
  /**
2302
+ *
2303
+ * 移除选择集观察者
2304
+ *
1506
2305
  * The method is used to remove an observer from the selection object.
1507
2306
  * @param observer The observer to remove.
1508
2307
  * @returns Return true if successful, else return false.
@@ -1511,6 +2310,11 @@ declare global {
1511
2310
  }
1512
2311
 
1513
2312
  /**
2313
+ *
2314
+ * 选择集观察者
2315
+ *
2316
+ * 此观察者接口用于接收酷大师选择集的变化事件
2317
+ *
1514
2318
  * This observer interface is implemented to react to selection events.
1515
2319
  * To create a new observer, you must define a new class that implements all the methods of the KSelectionObserver class.
1516
2320
  * Once you have defined a observer class, you can add it to the selection object by the KSelection.addObserver method.
@@ -1518,6 +2322,9 @@ declare global {
1518
2322
  */
1519
2323
  interface KSelectionObserver {
1520
2324
  /**
2325
+ *
2326
+ * 当酷大师选择集发生变化时,酷大师会调用这个接口
2327
+ *
1521
2328
  * The method is called whenever items are added or removed from the selection object.
1522
2329
  * @return
1523
2330
  */
@@ -1525,20 +2332,39 @@ declare global {
1525
2332
  }
1526
2333
 
1527
2334
  /**
2335
+ *
2336
+ * 壳体
2337
+ *
2338
+ * 壳体是一组面的集合。它代表一个 Brep 数据结构的壳体(Shell)
2339
+ *
2340
+ * 酷大师会尽最大可能将相互连接的面放置在一个壳体中。
2341
+ * 但这并不永远成立,有可能一个壳体会包含一些互不相连的面。插件开发者最好不要依赖于这一假设来写业务逻辑
2342
+ *
1528
2343
  * The KShell class represents the BRep shell.
1529
2344
  */
1530
2345
  interface KShell extends KEntity, KTopoShell {
1531
2346
  /**
2347
+ *
2348
+ * 获取酷大师图形实体类型
2349
+ *
1532
2350
  * Get the entity's type.
1533
2351
  * @returns The entity's type.
1534
2352
  */
1535
2353
  getType(): KTopoType;
2354
+
1536
2355
  /**
2356
+ *
2357
+ * 获取所包含的面
2358
+ *
1537
2359
  * Retrieve all the involved Faces of this Shell.
1538
2360
  * @return The array of Faces.
1539
2361
  */
1540
2362
  getFaces(): KFace[];
2363
+
1541
2364
  /**
2365
+ *
2366
+ * 获取所包含的边
2367
+ *
1542
2368
  * Retrieve all the involved Edges of this Shell.
1543
2369
  * @return The array of Edges.
1544
2370
  */
@@ -1546,7 +2372,12 @@ declare global {
1546
2372
  }
1547
2373
 
1548
2374
  /**
2375
+ * @deprecated 酷大师测试帮助器
2376
+ *
2377
+ * 插件开发者不应使用这一接口
2378
+ *
1549
2379
  * The KTestHelper class contains some utilities that are only used for testing.
2380
+ * Plugin developers shouldn't use this interface for it plugin development, as it would rapidly change and might also be removed later
1550
2381
  */
1551
2382
  interface KTestHelper {
1552
2383
  /**
@@ -1563,63 +2394,104 @@ declare global {
1563
2394
 
1564
2395
  /**
1565
2396
  * @private used for automation test only!! execute test command.
1566
- * @param cmd
2397
+ * @param cmd
1567
2398
  */
1568
2399
  executeCmd(cmd: string): HostPromise<boolean>;
1569
2400
  }
1570
2401
 
1571
2402
  /**
2403
+ *
2404
+ * 信息提示选项
2405
+ *
1572
2406
  * The KToastOption class represents the toast option.
1573
2407
  */
1574
2408
  interface KToastOption {
1575
2409
  /**
2410
+ *
2411
+ * 信息提示内容
2412
+ *
1576
2413
  * The toast prompt content.
1577
2414
  */
1578
2415
  content: string,
2416
+
1579
2417
  /**
2418
+ *
2419
+ * 信息提示持续时间
2420
+ *
1580
2421
  * The toast prompt close delay time in milliseconds. The default value is 3000ms.
1581
2422
  */
1582
2423
  timeout?: number,
2424
+
1583
2425
  /**
2426
+ *
2427
+ * 信息提示是否可关闭
2428
+ *
1584
2429
  * Whether to show the close button or not.The default value is false
1585
2430
  */
1586
2431
  closable?: boolean,
1587
2432
  }
2433
+
1588
2434
  /**
2435
+ *
2436
+ * 酷大师信息提示
2437
+ *
1589
2438
  * The KToast class is the handle to show toasts in the UI.
1590
2439
  */
1591
2440
  interface KToast {
1592
2441
  /**
2442
+ *
2443
+ * 展示一个成功信息提示
2444
+ *
1593
2445
  * Show a success.
1594
2446
  * @param option The toast option.
1595
2447
  * @returns
1596
2448
  */
1597
2449
  success(option: KToastOption): void;
2450
+
1598
2451
  /**
2452
+ *
2453
+ * 展示一个普通信息提示
2454
+ *
1599
2455
  * Show an info.
1600
2456
  * @param option The toast option.
1601
2457
  * @returns
1602
2458
  */
1603
2459
  info(option: KToastOption): void;
2460
+
1604
2461
  /**
2462
+ *
2463
+ * 展示一个警告信息提示
2464
+ *
1605
2465
  * Show a warn.
1606
2466
  * @param option The toast option.
1607
2467
  * @returns
1608
2468
  */
1609
2469
  warn(option: KToastOption): void;
2470
+
1610
2471
  /**
2472
+ *
2473
+ * 展示一个错误信息提示
2474
+ *
1611
2475
  * Show an error.
1612
2476
  * @param option The toast option.
1613
2477
  * @returns
1614
2478
  */
1615
2479
  error(option: KToastOption): void;
2480
+
1616
2481
  /**
2482
+ *
2483
+ * 展示一个加载信息提示
2484
+ *
1617
2485
  * Show an loading.
1618
2486
  * @param option The toast option.
1619
2487
  * @returns
1620
2488
  */
1621
2489
  loading(option: KToastOption): void;
2490
+
1622
2491
  /**
2492
+ *
2493
+ * 清空所有信息提示
2494
+ *
1623
2495
  * Clear all the toasts.
1624
2496
  * @returns
1625
2497
  */
@@ -1628,14 +2500,24 @@ declare global {
1628
2500
 
1629
2501
 
1630
2502
  /**
2503
+ *
2504
+ * 推断吸附结果
2505
+ *
1631
2506
  * The KInferenceResult class represents the inference result.
1632
2507
  */
1633
2508
  interface KInferenceResult {
1634
2509
  /**
2510
+ *
2511
+ * 吸附点
2512
+ *
1635
2513
  * The inference point.
1636
2514
  */
1637
2515
  position: KPoint3d;
2516
+
1638
2517
  /**
2518
+ *
2519
+ * 吸附图形实体
2520
+ *
1639
2521
  * The inference entity from which we get the inference point.
1640
2522
  * NOTE: The inference entities can only be the following types:
1641
2523
  * KEntityType.Vertex, KEntityType.Edge, KEntityType.Face, KEntityType.AuxiliaryBoundedCurve,
@@ -1643,7 +2525,10 @@ declare global {
1643
2525
  * If other objects from which we get the inference point, undefined will be returned.
1644
2526
  */
1645
2527
  entity?: KEntity;
2528
+
1646
2529
  /**
2530
+ * 被吸附图形实体所在的组实例的路径
2531
+ *
1647
2532
  * The instance path the inference point.
1648
2533
  * When the inference entity are from group instances, The group instances will be in the instance path.
1649
2534
  */
@@ -1651,6 +2536,10 @@ declare global {
1651
2536
  }
1652
2537
 
1653
2538
  /**
2539
+ *
2540
+ * 酷大师插件自定义工具
2541
+ * 实现此接口,即可接受酷大师的各种键盘和鼠标事件,从而创建出一个像酷大师内置工具一样的自定义工具
2542
+ *
1654
2543
  * The KTool class is the interface that you implement to create a KuDaShi tool.
1655
2544
  * To create a new tool, you must define a new class that implements all the methods of the KTool class.
1656
2545
  * Once you have defined a tool class, you select that tool by creating an instance of it
@@ -1658,63 +2547,103 @@ declare global {
1658
2547
  */
1659
2548
  interface KTool {
1660
2549
  /**
2550
+ *
2551
+ * 工具激活响应函数
2552
+ *
1661
2553
  * The method is called by KuDaShi when the tool is activated.
1662
2554
  * @return
1663
2555
  */
1664
2556
  onToolActive(): void;
2557
+
1665
2558
  /**
2559
+ *
2560
+ * 工具反激活响应函数
1666
2561
  * The method is called by KuDaShi when the tool is deactivated.
1667
2562
  * @return
1668
2563
  */
1669
2564
  onToolDeactive(): void;
2565
+
1670
2566
  /**
2567
+ *
2568
+ * 工具撤销回调函数。当用户点击鼠标右键,或者键盘上的 ESC 键的时候,会调用这个回调函数
2569
+ * 如果自定义工具没有实现这个回调函数,那么系统会直接关闭自定义工具
2570
+ *
1671
2571
  * This is an optional callback to retract the KTool from one status to a previous status. It is called when user clicks RMB or presses ESC key.
1672
2572
  * If the tool does not implement this callback, then system will close the tool directly without ask when user click RMB.
1673
2573
  * @return Return an object which contains the retraction result and a flag about whether all the tool steps were retracted and the tool is ready to exit.
1674
2574
  * If that return flag is false, then it means the tool was retracted but it has multiple steps and still in one of the steps.
1675
2575
  */
1676
2576
  onToolRetract?(): { retracted: boolean, readyToExit: boolean };
2577
+
1677
2578
  /**
2579
+ *
2580
+ * 鼠标移动事件响应函数
2581
+ *
1678
2582
  * The method is called by KuDaShi whenever the mouse is moved.
1679
2583
  * @param event It describes a user interaction with the mouse.
1680
2584
  * @param inferenceResult The inference result if Using inference, else undefined.
1681
2585
  * @return
1682
2586
  */
1683
2587
  onMouseMove(event: KMouseEvent, inferenceResult?: KInferenceResult): void;
2588
+
1684
2589
  /**
2590
+ *
2591
+ * 鼠标左键抬起响应函数
2592
+ *
1685
2593
  * The method is called by KuDaShi when the left mouse button is released.
1686
2594
  * @param event It describes a user interaction with the mouse.
1687
2595
  * @param inferenceResult The inference result if Using inference, else undefined.
1688
2596
  * @return
1689
2597
  */
1690
2598
  onLButtonUp(event: KMouseEvent, inferenceResult?: KInferenceResult): void;
2599
+
1691
2600
  /**
2601
+ *
2602
+ * 鼠标右键抬起响应函数
2603
+ *
1692
2604
  * The method is called by KuDaShi when the right mouse button is released.
1693
2605
  * @param event It describes a user interaction with the mouse.
1694
2606
  * @param inferenceResult The inference result if Using inference, else undefined.
1695
2607
  * @return
1696
2608
  */
1697
2609
  onRButtonUp(event: KMouseEvent, inferenceResult?: KInferenceResult): void;
2610
+
1698
2611
  /**
2612
+ *
2613
+ * 鼠标左键双击响应函数
2614
+ *
1699
2615
  * The method is called by KuDaShi when the user double clicks with the left mouse button.
1700
2616
  * @param event It describes a user interaction with the mouse.
1701
2617
  * @param inferenceResult The inference result if Using inference, else undefined.
1702
2618
  * @return
1703
2619
  */
1704
2620
  onLButtonDbClick(event: KMouseEvent, inferenceResult?: KInferenceResult): void;
2621
+
1705
2622
  /**
2623
+ *
2624
+ * 允许使用吸附行为的回调函数
2625
+ * 如果此函数返回 true, 则酷大师的默认吸附行为将被打开
2626
+ *
1706
2627
  * The method used to set whether to use the inference.
1707
2628
  * It is called by KuDaShi when the tool is activated or the user presses a key on the keyboard or moves the mouse.
1708
2629
  * @return True if using the inference, else false.
1709
2630
  */
1710
2631
  allowUsingInference(): boolean;
2632
+
1711
2633
  /**
2634
+ *
2635
+ * 按键按下响应函数
2636
+ *
1712
2637
  * The method is called by KuDaShi when the user presses a key on the keyboard.
1713
2638
  * @param event It describes a user interaction with the keyboard.
1714
2639
  * @return
1715
2640
  */
1716
2641
  onKeyDown(event: KKeyBoardEvent): void;
2642
+
1717
2643
  /**
2644
+ *
2645
+ * 按键抬起响应函数
2646
+ *
1718
2647
  * The method is called by KuDaShi when the user releases a key on the keyboard.
1719
2648
  * @param event It describes a user interaction with the keyboard.
1720
2649
  * @return
@@ -1724,24 +2653,75 @@ declare global {
1724
2653
 
1725
2654
 
1726
2655
  /**
2656
+ *
2657
+ * 选择行为
2658
+ *
1727
2659
  * The KSelectBehavior class represents select behavior types.
1728
2660
  */
1729
2661
  enum KSelectBehavior {
2662
+ /**
2663
+ * 反选。点击一个图元,会使其选择状态在选中和非选中之间切换。
2664
+ * 提示:在酷大师中,选择时按住 shift 键会进入反选状态
2665
+ *
2666
+ * toggle selection. clicking on an entity will toggle its selection status between selected/un-selected
2667
+ * hint: in UI opeation, pressing shift when doing selection turns on the toggle selection mode
2668
+ *
2669
+ */
1730
2670
  TOGGLE = 'toggle',
2671
+
2672
+ /**
2673
+ * 减选。点击一个图元,会使其从选择集中删除。如果它本来就不在选择集中,则无变化。
2674
+ * 提示:在酷大师中,选择时按住 ctrl + shift 键会进入减选状态
2675
+ *
2676
+ * remove selection. clicking on an entity will remove it from the selection set
2677
+ * hint: in UI operation, pressing ctrl + shift when doing selection turns on the remove selection mode
2678
+ *
2679
+ */
1731
2680
  REMOVE = 'remove',
2681
+
2682
+ /**
2683
+ * 加选。点击一个图元,会使其加入选择集。如果它本来就在选择集中,则无变化。
2684
+ * 提示:在酷大师中,选择时按住 ctrl 键会进入加选状态
2685
+ *
2686
+ * add selection. clicking on an entity will add it to the selection set
2687
+ * hint: in UI operation, pressing ctrl when doing selection turns on the add selection mode
2688
+ *
2689
+ */
1732
2690
  ADD = 'add',
2691
+
2692
+ /**
2693
+ * 单选。点击一个图元,会使其加入选择集。如果它本来就在选择集中,则无变化。点击另一个图元会使另一个图元加入选择集,而使当前被选择图元退出选择集。点击空白处会清空选择集。
2694
+ * 提示:在酷大师中,选择时不按任何键的默认选择状态就是单选
2695
+ *
2696
+ * replace selection. also known as single selection. clicking on an entity will add it to the selection set. clicking on another entity will add another entity
2697
+ * to the selection set, and remove the current selected entity from it. clicking on empty space will clear the selection set.
2698
+ * hit: in UI operation, replace selection is the default behavior when doing selection, without pressing any keys
2699
+ *
2700
+ */
1733
2701
  REPLACE = 'replace',
1734
2702
  }
1735
2703
 
2704
+ /**
2705
+ *
2706
+ * 自定义工具帮助器
2707
+ *
2708
+ */
1736
2709
  interface KToolHelper {
1737
2710
  /**
2711
+ *
2712
+ * 允许或禁止酷大师默认的选择行为
2713
+ *
1738
2714
  * Enable or disable the picking process of the system defauts.
1739
2715
  * Note: This method only works within an activated KTool. By default, picking process is not enabled for a KTool.
1740
2716
  * @param enable enable the picking if true, or disable if false.
1741
2717
  * @returns void
1742
2718
  */
1743
2719
  enablePicking(enable: boolean): void;
2720
+
1744
2721
  /**
2722
+ *
2723
+ * 允许或禁止酷大师的框选行为
2724
+ *
1745
2725
  * Enable or disable the rect picking process of the system defauts.
1746
2726
  * Note: This method only works within an activated KTool. By default, rect picking process is not enabled for a KTool.
1747
2727
  * Rect picking only can be enabled when picking process is enabled.
@@ -1749,19 +2729,34 @@ declare global {
1749
2729
  * @returns void
1750
2730
  */
1751
2731
  enableRectPicking(enable: boolean): void;
2732
+
1752
2733
  /**
2734
+ *
2735
+ * 设置选择器过滤器。可以仅允许用户选择特定类型的图形实体
2736
+ *
1753
2737
  * Set the selectable entity types.
1754
2738
  * Note: This method only works within an activated KTool.
1755
2739
  * @param pickableEntityTypes the selectable entity types. If it is empty, then all entities are selectable.
1756
2740
  * @returns void
1757
2741
  */
1758
2742
  setPickingFilter(pickableEntityTypes: KEntityType[]): void;
2743
+
1759
2744
  /**
2745
+ *
2746
+ * 清空选择器过滤器
2747
+ *
1760
2748
  * Clear the user setting of selectable entity types.
1761
2749
  * @returns void
1762
2750
  */
1763
2751
  clearPickingFilter(): void;
2752
+
1764
2753
  /**
2754
+ *
2755
+ * 设置酷大师的默认选择行为。
2756
+ * 这可以使用户在并没有按住 shift, control 或 shift + control 时,可以拥有不一样的选择行为。(酷大师在没有按住上述按键时的默认选择行为是单选)
2757
+ * 用户在做框选时,总是要按住 shift, control 或者 shift + control,所以框选没有默认选择行为
2758
+ * 但是如果插件禁止了酷大师的框选行为,实现了它自己的框选,那这里设置的默认选择行为也会应用到插件自定义的框选行为中
2759
+ *
1765
2760
  * Set the default select behavior when user didn't press shift key, control key or shift + control key.
1766
2761
  * Note: by default system uses the replace mode.
1767
2762
  * user has to allways explicitly press shift key, control key or shift + control key to do box picking, so box picking has no default select behavior.
@@ -1770,23 +2765,38 @@ declare global {
1770
2765
  * @returns void
1771
2766
  */
1772
2767
  setDefaultSelectBehavior(behavior: KSelectBehavior): void;
2768
+
1773
2769
  /**
2770
+ *
2771
+ * 设置被排除在外的用于吸附的图形实体列表
2772
+ *
1774
2773
  * Set the excluded inference entities.
1775
2774
  * @param entities The excluded inference entities.
1776
2775
  * @returns Return true if successful, else return false.
1777
2776
  */
1778
2777
  setExcludedInferenceEntities(entities: KEntity[]): boolean;
2778
+
1779
2779
  /**
2780
+ * 清空被排除在外的用于吸附的图形实体列表
2781
+ *
1780
2782
  * Clear the excluded inference entities.
1781
2783
  * @returns Return true if successful, else return false.
1782
2784
  */
1783
2785
  clearExcludedInferenceEntities(): boolean;
2786
+
1784
2787
  /**
2788
+ *
2789
+ * 获取当前鼠标 hover 高亮的图形实体
2790
+ *
1785
2791
  * Get the hovered item.
1786
2792
  * @returns Return the hovered entity. If it is a continuous edge or face, then return all its KEdges or KFaces.
1787
2793
  */
1788
2794
  getHoveredItem(): KEntity[] | null;
2795
+
1789
2796
  /**
2797
+ *
2798
+ * 将一个点投影到一组面上,求投影点、投影面、投影点法向和投影距离
2799
+ *
1790
2800
  * The method is used to project a point onto a face region.
1791
2801
  * Note: currently it only supports faces in the active group definition.
1792
2802
  * @param targetFaces The face region where the point projects onto.
@@ -1796,7 +2806,11 @@ declare global {
1796
2806
  * otherwise return null. If the projected face is in a continuouse face group, then we will return all of the faces in that continuouse face group.
1797
2807
  */
1798
2808
  projectPointOntoFaces(targetFaces: KFace[], point: KPoint3d, projectDirection: KVector3d): { projectedFace: KFace[], projection: KPoint3d, normal: KVector3d, distance: number } | null;
2809
+
1799
2810
  /**
2811
+ *
2812
+ * 将一个点投影到一个成组实例上,求投影点、投影点法向和投影距离
2813
+ *
1800
2814
  * The method is used to project a point onto a group instance.
1801
2815
  * Note: currently it only supports group instance in the active group definition.
1802
2816
  * @param groupInstance The target groupInstnace where the point projects onto.
@@ -1805,17 +2819,28 @@ declare global {
1805
2819
  * @returns Return an object which contains project location, face normal at the project location and project distance if successful, otherwise return null.
1806
2820
  */
1807
2821
  projectPointOntoGroupInstance(groupInstance: KGroupInstance, point: KPoint3d, projectDirection: KVector3d): { projection: KPoint3d, normal: KVector3d, distance: number } | null;
2822
+
1808
2823
  /**
2824
+ * 获取一组面的顶点
2825
+ *
1809
2826
  * @param faces The target faces where to collect vertices.
1810
2827
  * @returns Return the unique vertex array.
1811
2828
  */
1812
2829
  getVerticesOfFaces(faces: KFace[]): KVertex[];
2830
+
1813
2831
  /**
2832
+ *
2833
+ * 获取一组面的顶点的几何点
2834
+ *
1814
2835
  * @param faces The target faces.
1815
2836
  * @returns Return the unique vertex point array.
1816
2837
  */
1817
2838
  getVertexPointsOfFaces(faces: KFace[]): KPoint3d[];
2839
+
1818
2840
  /**
2841
+ *
2842
+ * 获取一组面的包围盒
2843
+ *
1819
2844
  * @param faces The target faces.
1820
2845
  * @returns Return the bounding box of the faces.
1821
2846
  */
@@ -1823,26 +2848,38 @@ declare global {
1823
2848
  }
1824
2849
 
1825
2850
  /**
2851
+ *
2852
+ * 酷大师图形实体:造型顶点
2853
+ * 它对应于一个Brep数据结构的顶点 (Vertex)
2854
+ *
1826
2855
  * The KVertex class represents the BRep vertex.
1827
2856
  */
1828
2857
  interface KVertex extends KTopoVertex, KEntity {
1829
2858
  /**
2859
+ *
2860
+ * 获取图形实体类型
2861
+ *
1830
2862
  * Get the entity's type.
1831
2863
  * @returns The entity's type.
1832
2864
  */
1833
2865
  getType(): KTopoType;
1834
2866
 
1835
2867
  /**
2868
+ *
2869
+ * 获取和这个顶点相连的边
2870
+ *
1836
2871
  * Retrieve the vertex's edges whose start or end vertex is this vertex.
1837
2872
  * @return The vertex's edges.
1838
2873
  */
1839
2874
  getEdges(): KEdge[];
1840
2875
 
1841
2876
  /**
2877
+ *
2878
+ * 设置这个顶点是否为软化顶点
2879
+ * 当在酷大师中选择一条边时,会将从这条边开始,所有通过软化顶点相连的边一起选中
2880
+ *
1842
2881
  * Set the vertex to be soft.
1843
- * A soft vertex will cause the connected edges to be treated as a curve.
1844
- * This means that if you select one edge it will also
1845
- * select all edges connected with soft vertices.
2882
+ * If you select one edge it will also select all edges connected with soft vertices.
1846
2883
  * @param isSoft The soft value.
1847
2884
  * @return Return true if it is a soft vertex, otherwise return false.
1848
2885
  */
@@ -1850,111 +2887,205 @@ declare global {
1850
2887
  }
1851
2888
 
1852
2889
  /**
2890
+ * 用红绿蓝三原色表示的颜色值
2891
+ *
1853
2892
  * The KColor class represents a color.
1854
2893
  */
1855
2894
  interface KColor {
1856
2895
  /**
2896
+ *
2897
+ * 红色分量,在 0 到 255 之间取值
2898
+ *
1857
2899
  * Red channel value between 0 and 255.
1858
2900
  */
1859
2901
  r: number;
2902
+
1860
2903
  /**
2904
+ *
2905
+ * 绿色分量,在 0 到 255 之间取值
2906
+ *
1861
2907
  * Green channel value between 0 and 255.
1862
2908
  */
1863
2909
  g: number;
2910
+
1864
2911
  /**
2912
+ *
2913
+ * 蓝色分量,在 0 到 255 之间取值
2914
+ *
1865
2915
  * Blue channel value between 0 and 255.
1866
2916
  */
1867
2917
  b: number;
1868
2918
  }
2919
+
1869
2920
  /**
2921
+ *
2922
+ * 临时点绘制选项
2923
+ *
1870
2924
  * The KDrawPointsOption class represents the option for Drawing temporary points.
1871
2925
  */
1872
2926
  interface KDrawPointsOption {
1873
2927
  /**
2928
+ *
2929
+ * 点的颜色
2930
+ *
1874
2931
  * The points color. Default is { r: 0, g: 0, b: 0}.
1875
2932
  */
1876
2933
  color?: KColor;
2934
+
1877
2935
  /**
2936
+ *
2937
+ * 点的尺寸
2938
+ *
1878
2939
  * The points size. Default is 50.
1879
2940
  */
1880
2941
  size?: number;
1881
2942
  }
2943
+
1882
2944
  /**
2945
+ *
2946
+ * 临时线线型
2947
+ *
1883
2948
  * The KLinePattern class represents the line pattern.
1884
2949
  */
1885
2950
  enum KLinePattern {
1886
2951
  /**
2952
+ *
2953
+ * 实线
2954
+ *
1887
2955
  * The solid line.
1888
2956
  */
1889
2957
  Solid = 'solid line',
2958
+
1890
2959
  /**
2960
+ *
2961
+ * 虚线
2962
+ *
1891
2963
  * The dash line.
1892
2964
  */
1893
2965
  Dash = 'dash line'
1894
2966
  }
2967
+
1895
2968
  /**
2969
+ *
2970
+ * 临时线绘制选项
2971
+ *
1896
2972
  * The KDrawLinesOption class represents the option for Drawing temporary lines.
1897
2973
  */
1898
2974
  interface KDrawLinesOption {
1899
2975
  /**
2976
+ *
2977
+ * 颜色
2978
+ *
1900
2979
  * The lines color. Default is { r: 0, g: 0, b: 0}.
1901
2980
  */
1902
2981
  color?: KColor;
2982
+
1903
2983
  /**
2984
+ *
2985
+ * 线型
2986
+ *
1904
2987
  * The line pattern. Default is Solid.
1905
2988
  */
1906
2989
  pattern?: KLinePattern;
2990
+
1907
2991
  /**
2992
+ *
2993
+ * 虚线长度
2994
+ *
1908
2995
  * The size of the dash. Default is 100.
1909
2996
  */
1910
2997
  dashSize?: number;
2998
+
1911
2999
  /**
3000
+ *
3001
+ * 虚线间距
3002
+ *
1912
3003
  * The size of the gap. Default is 100.
1913
3004
  */
1914
3005
  gapSize?: number;
1915
3006
  }
3007
+
1916
3008
  /**
3009
+ *
3010
+ * 酷大师图形显示视口
3011
+ *
1917
3012
  * The KViewport class represents the viewport.
1918
3013
  */
1919
3014
  interface KViewport {
1920
3015
  /**
3016
+ *
3017
+ * 视口长
3018
+ *
1921
3019
  * The height of the viewport.
1922
3020
  */
1923
3021
  height: number;
3022
+
1924
3023
  /**
3024
+ *
3025
+ * 视口宽
3026
+ *
1925
3027
  * The width of the viewport.
1926
3028
  */
1927
3029
  width: number;
1928
3030
  }
3031
+
1929
3032
  /**
3033
+ *
3034
+ * 临时文字绘制选项
3035
+ *
1930
3036
  * The KDrawTextOption class represents the option for Drawing temporary text.
1931
3037
  */
1932
3038
  interface KDrawTextOption {
1933
3039
  /**
3040
+ *
3041
+ * 文字颜色
3042
+ *
1934
3043
  * The text color. Default is { r: 0, g: 0, b: 0}.
1935
3044
  */
1936
3045
  color?: KColor;
3046
+
1937
3047
  /**
3048
+ *
3049
+ * 文字尺寸
3050
+ *
1938
3051
  * The text size. Default is 12.
1939
3052
  */
1940
3053
  size?: number;
1941
3054
  }
3055
+
1942
3056
  /**
3057
+ *
3058
+ * 酷大师视图窗口
3059
+ *
1943
3060
  * The KView class now contains methods for getting the camera handle.
1944
3061
  * You can access the KView by calling the app.activeView method.
1945
3062
  */
1946
3063
  interface KView {
1947
3064
  /**
3065
+ *
3066
+ * 获取相机
3067
+ *
1948
3068
  * Get the camera handle.
1949
3069
  * @returns The camera handle.
1950
3070
  */
1951
3071
  getCamera(): KCamera;
3072
+
1952
3073
  /**
3074
+ *
3075
+ * 获取图形显示视口
3076
+ *
1953
3077
  * Get the viewport for the view.
1954
3078
  * @returns The viewport.
1955
3079
  */
1956
3080
  getViewport(): KViewport;
3081
+
1957
3082
  /**
3083
+ *
3084
+ * 在视口中临时绘制点。
3085
+ *
3086
+ * 1. 一般我们只能在自定义工具的交互过程中绘制这种临时图形元素
3087
+ * 2. 临时绘制的图形元素会在自定义工具退出时,自动清空
3088
+ *
1958
3089
  * This method is used to draw temporary points.
1959
3090
  * Note: 1.This method is usually invoked within a KTool, and invalid elsewhere.
1960
3091
  * 2. The temporary points will be cleared when deactivating the KTool.
@@ -1963,7 +3094,14 @@ declare global {
1963
3094
  * @returns True if success, else false.
1964
3095
  */
1965
3096
  drawPoints(points: KPoint3d[], option?: KDrawPointsOption): boolean;
3097
+
1966
3098
  /**
3099
+ *
3100
+ * 在视口中临时绘制线段。
3101
+ *
3102
+ * 1. 一般我们只能在自定义工具的交互过程中绘制这种临时图形元素
3103
+ * 2. 临时绘制的图形元素会在自定义工具退出时,自动清空
3104
+ *
1967
3105
  * This method is used to draw a temporary polyline.
1968
3106
  * Note: 1.This method is usually invoked within a KTool, and invalid elsewhere.
1969
3107
  * 2. The temporary lines will be cleared when deactivating the KTool.
@@ -1972,7 +3110,14 @@ declare global {
1972
3110
  * @returns True if success, else false.
1973
3111
  */
1974
3112
  drawLines(points: KPoint3d[], option?: KDrawLinesOption): boolean;
3113
+
1975
3114
  /**
3115
+ *
3116
+ * 在视口中临时绘制一组多段线。
3117
+ *
3118
+ * 1. 一般我们只能在自定义工具的交互过程中绘制这种临时图形元素
3119
+ * 2. 临时绘制的图形元素会在自定义工具退出时,自动清空
3120
+ *
1976
3121
  * This a batch method to draw a set of polylines.
1977
3122
  * Note: 1.This method is usually invoked within a KTool, and invalid elsewhere.
1978
3123
  * 2. The temporary lines will be cleared when deactivating the KTool.
@@ -1981,7 +3126,14 @@ declare global {
1981
3126
  * @returns True if success, else false.
1982
3127
  */
1983
3128
  drawPolylines(points: KPoint3d[][], option?: KDrawLinesOption): boolean;
3129
+
1984
3130
  /**
3131
+ *
3132
+ * 在视口中临时绘制一段文字。
3133
+ *
3134
+ * 1. 一般我们只能在自定义工具的交互过程中绘制这种临时图形元素
3135
+ * 2. 临时绘制的图形元素会在自定义工具退出时,自动清空
3136
+ *
1985
3137
  * This method is used to draw temporary text.
1986
3138
  * Note: 1.This method is usually invoked within a KTool, and invalid elsewhere.
1987
3139
  * 2. The temporary text will be cleared when deactivating the KTool.
@@ -1992,7 +3144,14 @@ declare global {
1992
3144
  * @returns True if success, else false.
1993
3145
  */
1994
3146
  drawText(text: string, position: KPoint3d, direction?: KVector3d, option?: KDrawTextOption): boolean;
3147
+
1995
3148
  /**
3149
+ *
3150
+ * 在视口中临时绘制一段提示线。这段提升线类似于酷大师直线绘制工具中的虚线。
3151
+ *
3152
+ * 1. 一般我们只能在自定义工具的交互过程中绘制这种临时图形元素
3153
+ * 2. 临时绘制的图形元素会在自定义工具退出时,自动清空
3154
+ *
1996
3155
  * This method is used to draw prompt lines. This method is used to draw prompt lines quickly.
1997
3156
  * The style is consistent with the drawing line tool in KuDaShi and no modify style interface provided.
1998
3157
  * If the style does not meet the requirements, you may combine other interfaces in this KView class to draw.
@@ -2006,7 +3165,11 @@ declare global {
2006
3165
  * @returns True if success, else false.
2007
3166
  */
2008
3167
  drawPromptLine(startPoint: KPoint3d, endPoint: KPoint3d, normal?: KVector3d, promptText?: string): boolean;
3168
+
2009
3169
  /**
3170
+ *
3171
+ * 强制清空临时绘制的图形
3172
+ *
2010
3173
  * This method is used to clear temporary shapes.
2011
3174
  * @returns
2012
3175
  */
@@ -5666,6 +6829,9 @@ declare global {
5666
6829
  }
5667
6830
 
5668
6831
  /**
6832
+ *
6833
+ * 代表异步操作的结果
6834
+ *
5669
6835
  * The HostPromise class represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
5670
6836
  * NOTE: The promise passed from host cannot be chained.
5671
6837
  */
@@ -5673,43 +6839,72 @@ declare global {
5673
6839
  then(resolve?: (value: T) => void, reject?: (error: any) => void): void;
5674
6840
  catch(reject?: (error: any) => void): void;
5675
6841
  }
6842
+
5676
6843
  /**
6844
+ *
6845
+ * 代表展示插件 UI html 的窗口
6846
+ *
5677
6847
  * The KPluginUI class now contains methods for operating plugin UIs.
5678
6848
  * You can access the KPluginUI by calling the app.getPluginUI() method.
5679
6849
  */
5680
6850
  interface KPluginUI {
5681
6851
  /**
6852
+ * 代表 UI 窗口是否已经被显示。true 为已显示
6853
+ *
5682
6854
  * Return true if the plugin UI is mounted, else return false.
5683
6855
  */
5684
6856
  readonly mounted: boolean;
6857
+
5685
6858
  /**
6859
+ *
6860
+ * 显示插件 UI 窗口
6861
+ *
5686
6862
  * Mount the plugin UI.
5687
6863
  * @returns
5688
6864
  */
5689
6865
  mount(): void;
6866
+
5690
6867
  /**
6868
+ *
6869
+ * 关闭插件 UI 窗口
6870
+ *
5691
6871
  * UnMount the plugin UI.
5692
6872
  * @returns
5693
6873
  */
5694
6874
  unmount(): void;
6875
+
5695
6876
  /**
6877
+ *
6878
+ * 调整插件 UI 窗口大小
6879
+ *
5696
6880
  * Resize the plugin UI.
5697
6881
  * @returns
5698
6882
  */
5699
6883
  resize(width: number, height: number): void;
6884
+
5700
6885
  /**
6886
+ *
6887
+ * 注册插件 UI 窗口显示完成后的回调函数
6888
+ *
5701
6889
  * Register the callback function.
5702
6890
  * When the plugin UI is ready, the callback function will be called.
5703
6891
  * @returns
5704
6892
  */
5705
6893
  onReady(callback: () => void): void;
6894
+
5706
6895
  /**
6896
+ * 注册插件 UI 窗口发送的自定义消息的响应函数
6897
+ *
5707
6898
  * Register the callback function for the plugin UI.
5708
6899
  * When a message is sent from the plugin UI, the callback function will be called.
5709
6900
  * @returns
5710
6901
  */
5711
6902
  onMessage(callback: (data: any, origin: string) => void): void;
6903
+
5712
6904
  /**
6905
+ *
6906
+ * 从沙盒 JS 代码向插件 UI 窗口发送自定义消息
6907
+ *
5713
6908
  * Post a message from the sandbox to the plugin UI.
5714
6909
  * @param data The data posted from the sandbox.
5715
6910
  * @param origin The origin of the sender.
@@ -5719,18 +6914,29 @@ declare global {
5719
6914
  }
5720
6915
 
5721
6916
  /**
6917
+ *
6918
+ * 本地浏览器临时存储接口
6919
+ * 它类似于 Window.seesionStorage,可用于存储各种自定义数据。清空浏览器缓存会导致数据丢失
6920
+ *
5722
6921
  * The KClientStorage class allows you to store data on the user's local machine. This data is not synchronized across users.
5723
6922
  * It's similar to the Window.sessionStorage, and allows storing objects, arrays, strings, numbers, booleans, null, undefined and Uint8Array.
5724
6923
  * Like sessionStorage, you should expect that user actions such as clearing the browser cache might clear all stored data.
5725
6924
  */
5726
6925
  interface KClientStorage {
5727
6926
  /**
6927
+ *
6928
+ * 根据 key 获取存储内容
6929
+ *
5728
6930
  * Retrieve a value from client storage with the given key.
5729
6931
  * @param key The given key.
5730
6932
  * @returns The value from client storage with the given key.
5731
6933
  */
5732
6934
  getAsync(key: string): HostPromise<any | undefined>
6935
+
5733
6936
  /**
6937
+ *
6938
+ * 用 <key, value> 的形式存储内容
6939
+ *
5734
6940
  * Set a value to client storage with the given key.
5735
6941
  * @param key The given key.
5736
6942
  * @param value The given value.