diff --git a/package.json b/package.json index 50850812a99d1f6a5897b42aff5768d91220698d..b2b0ebdbd722cd989c93b6c8fb24afe053143f94 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "workbox-webpack-plugin": "5.1.4", "memoizee": "^0.4.15", "@types/memoizee": "^0.4.5", - "message-lite": "0.0.1", + "message-lite": "0.10.5-alpha.2", "@manycore/custom-miniapp-sdk": "^0.20.18", "@manycore/custom-sdk": "^3.1.14", "@manycore/idp-sdk": "^1.55.0" diff --git a/packages/pages-vm-api/package.json b/packages/pages-vm-api/package.json index 7cb9048fde5d15c1b9384aee7cc1e1095860fecf..a3c962c56509224f6bbff65feae703c6f3c148c1 100644 --- a/packages/pages-vm-api/package.json +++ b/packages/pages-vm-api/package.json @@ -7,6 +7,6 @@ "license": "ISC", "scripts": {}, "dependencies": { - "message-lite": "0.0.1" + "message-lite": "0.10.5-alpha.2" } } diff --git a/packages/pages-vm-api/src/decl/bom.service.ts b/packages/pages-vm-api/src/decl/master/bom.service.ts similarity index 90% rename from packages/pages-vm-api/src/decl/bom.service.ts rename to packages/pages-vm-api/src/decl/master/bom.service.ts index 354a95bd475fbcac615bae66c5761970553720b8..94bf2b9313e773f017539d5e6e9eb4642384890d 100644 --- a/packages/pages-vm-api/src/decl/bom.service.ts +++ b/packages/pages-vm-api/src/decl/master/bom.service.ts @@ -1,4 +1,4 @@ -import { ApiDecl, ApiDeclApi, ApiUnSupport, BaseService } from 'message-lite'; +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService as BaseService } from 'message-lite'; export type ICreateMaterialsAsyncFuncType = typeof IDP.Integration.Bom.createMaterialsAsync; export type ICreateMaterialsParams = Parameters; diff --git a/packages/pages-vm-api/src/decl/master/custom.model.service.ts b/packages/pages-vm-api/src/decl/master/custom.model.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..7507f9fc355c87c48abda70fbe19db5f7fbf04d7 --- /dev/null +++ b/packages/pages-vm-api/src/decl/master/custom.model.service.ts @@ -0,0 +1,22 @@ +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService as BaseService } from 'message-lite'; + + +export type IGetTopModelsLiteInfoAsyncFuncType = typeof IDP.Custom.Design.CustomModel.getTopModelsLiteInfoAsync; +export type IGetTopModelsLiteInfoAsyncParameters = Parameters[0]; +export type IGetTopModelsLiteInfoAsyncResult = ReturnType; +export type ICustomModel = IDP.Custom.Design.CustomModel.CustomModel; + +@ApiDecl({ + name: 'miniapp.custom.model.service', +}) +export class CustomModelService extends BaseService { + @ApiDeclApi() + getTopModelsLiteInfoAsync(options?: IGetTopModelsLiteInfoAsyncParameters): IGetTopModelsLiteInfoAsyncResult { + return ApiUnSupport(); + } + + @ApiDeclApi() + getCustomModelByModelIdAsync(id: string): Promise { + return ApiUnSupport(); + } +} diff --git a/packages/pages-vm-api/src/decl/master/design.service.ts b/packages/pages-vm-api/src/decl/master/design.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9c30f54b8aa2513bc79f851237cd50c2057dd9e --- /dev/null +++ b/packages/pages-vm-api/src/decl/master/design.service.ts @@ -0,0 +1,11 @@ +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService as BaseService } from 'message-lite'; + +@ApiDecl({ + name: 'miniapp.design.service', +}) +export class DesignService extends BaseService { + @ApiDeclApi() + save() { + return ApiUnSupport(); + } +} diff --git a/packages/pages-vm-api/src/decl/master/event.service.ts b/packages/pages-vm-api/src/decl/master/event.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bae25a151a026df0bbe0423f4000837bf0cfe59 --- /dev/null +++ b/packages/pages-vm-api/src/decl/master/event.service.ts @@ -0,0 +1,24 @@ +import { ApiDecl, ApiDeclEvent, IEventer, MBaseService as BaseService } from 'message-lite'; + +export type ElementId = IDP.DB.Types.ElementId; +export type OrderModel = IDP.EventTypes['IDP.Integration.FOP.OrderMode.OrderModel.Update'] + +@ApiDecl({ + name: 'miniapp.event.service', +}) +export class EventService extends BaseService { + @ApiDeclEvent() + customModelAdded!: IEventer; + + @ApiDeclEvent() + customModelUpdate!: IEventer; + + @ApiDeclEvent() + customModelDelete!: IEventer; + + @ApiDeclEvent() + designSaved!: IEventer; + + @ApiDeclEvent() + orderModelUpdate!: IEventer; +} diff --git a/packages/pages-vm-api/src/decl/export.service.ts b/packages/pages-vm-api/src/decl/master/export.service.ts similarity index 88% rename from packages/pages-vm-api/src/decl/export.service.ts rename to packages/pages-vm-api/src/decl/master/export.service.ts index e7c13a32f5921d77f7bcfedee83306e362ba8483..d6a31f63f5c2ab62d190a5c78cd5668f8330c97e 100644 --- a/packages/pages-vm-api/src/decl/export.service.ts +++ b/packages/pages-vm-api/src/decl/master/export.service.ts @@ -1,4 +1,4 @@ -import { ApiDecl, ApiDeclApi, ApiUnSupport, BaseService } from 'message-lite'; +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService as BaseService } from 'message-lite'; export type IGetFittingDataFromAuxiliaryFuncType = typeof IDP.Custom.Design.Export.getFittingDataFromAuxiliaryAsync; export type IGetFittingDataFromAuxiliaryParams = Parameters; diff --git a/packages/pages-vm-api/src/decl/fitting.design.service.ts b/packages/pages-vm-api/src/decl/master/fitting.design.service.ts similarity index 89% rename from packages/pages-vm-api/src/decl/fitting.design.service.ts rename to packages/pages-vm-api/src/decl/master/fitting.design.service.ts index ff1ead3b090e9228df0dc99db9d1fa87577bfd7e..0dc8925a7e7adadd46508655808e6f6a327bd996 100644 --- a/packages/pages-vm-api/src/decl/fitting.design.service.ts +++ b/packages/pages-vm-api/src/decl/master/fitting.design.service.ts @@ -1,4 +1,4 @@ -import { ApiDecl, ApiDeclApi, ApiUnSupport, BaseService } from 'message-lite'; +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService as BaseService } from 'message-lite'; export type IPutDesignDataAsyncFuncType = typeof IDP.Custom.FittingDesignV2.putDesignDataAsync; export type IPutFittingDesignDataParameters = Parameters; diff --git a/packages/pages-vm-api/src/decl/fop.order.service.ts b/packages/pages-vm-api/src/decl/master/fop.order.service.ts similarity index 68% rename from packages/pages-vm-api/src/decl/fop.order.service.ts rename to packages/pages-vm-api/src/decl/master/fop.order.service.ts index 7a7182ae0954dfce4778b5a3bfb1d7c9330e64ca..81ffb1179ed86071f8898d96876a6f960fb59d8d 100644 --- a/packages/pages-vm-api/src/decl/fop.order.service.ts +++ b/packages/pages-vm-api/src/decl/master/fop.order.service.ts @@ -1,4 +1,4 @@ -import { ApiDecl, ApiDeclApi, ApiUnSupport, BaseService } from 'message-lite'; +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService as BaseService } from 'message-lite'; @ApiDecl({ name: 'miniapp.fop.order.service', diff --git a/packages/pages-vm-api/src/decl/index.ts b/packages/pages-vm-api/src/decl/master/index.ts similarity index 62% rename from packages/pages-vm-api/src/decl/index.ts rename to packages/pages-vm-api/src/decl/master/index.ts index 2812a17cd61f99c8f04a840d900780c0b3e4c868..ebb6dc4cd8f0e8c990d199b81b196552fa202ba8 100644 --- a/packages/pages-vm-api/src/decl/index.ts +++ b/packages/pages-vm-api/src/decl/master/index.ts @@ -1,5 +1,8 @@ export * from './toast.service'; export * from './export.service'; export * from './fitting.design.service'; +export * from './event.service'; +export * from './custom.model.service'; +export * from './design.service'; export * from './bom.service'; export * from './fop.order.service'; diff --git a/packages/pages-vm-api/src/decl/toast.service.ts b/packages/pages-vm-api/src/decl/master/toast.service.ts similarity index 70% rename from packages/pages-vm-api/src/decl/toast.service.ts rename to packages/pages-vm-api/src/decl/master/toast.service.ts index 31436395abf50b46034839bd9c697855b23cd993..dac3c6a37b85e6998b2eda73d8ae3d15cdef4808 100644 --- a/packages/pages-vm-api/src/decl/toast.service.ts +++ b/packages/pages-vm-api/src/decl/master/toast.service.ts @@ -1,4 +1,4 @@ -import { ApiDecl, ApiDeclApi, ApiUnSupport, BaseService } from 'message-lite'; +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService as BaseService } from 'message-lite'; @ApiDecl({ name: 'miniapp.toast.service', diff --git a/packages/pages-vm-api/src/decl/slave/index.ts b/packages/pages-vm-api/src/decl/slave/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..599d80dce9a49165a58ab6b0f5761c942535571b --- /dev/null +++ b/packages/pages-vm-api/src/decl/slave/index.ts @@ -0,0 +1 @@ +export * from './timer.service'; \ No newline at end of file diff --git a/packages/pages-vm-api/src/decl/slave/timer.service.ts b/packages/pages-vm-api/src/decl/slave/timer.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f3e5994a4c9bb5b824483e3ea9d0fe93a7deb22 --- /dev/null +++ b/packages/pages-vm-api/src/decl/slave/timer.service.ts @@ -0,0 +1,12 @@ +import { ApiDecl, ApiDeclApi, ApiUnSupport, MBaseService } from 'message-lite'; + +@ApiDecl({ + name: 'com.custom.test.timer', +}) +export class TimerService extends MBaseService { + + @ApiDeclApi() + timeout(time?: number): Promise { + return ApiUnSupport(); + } +} diff --git a/packages/pages-vm-api/src/index.ts b/packages/pages-vm-api/src/index.ts index 1b15026ae96ed85108960e959fcab07c182e2ac9..e34ecebff74fbaa99b9c6f6cee9096a9c243b81a 100644 --- a/packages/pages-vm-api/src/index.ts +++ b/packages/pages-vm-api/src/index.ts @@ -1 +1,2 @@ -export * from './decl'; +export * from './decl/master'; +export * from './decl/slave'; diff --git a/packages/vm/node_modules/@manycore/idp-sdk/CHANGELOG.md b/packages/vm/node_modules/@manycore/idp-sdk/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..a057b81ebe880270f7889bd7747097944b3cc2ec --- /dev/null +++ b/packages/vm/node_modules/@manycore/idp-sdk/CHANGELOG.md @@ -0,0 +1,77 @@ +# DEV + +# 1.35.0 (2023-11-21) +### Features +- ✨ 小程序 `MainMountPointOptions` 属性 `resizable` 新增类型 `width`、`height'`, 支持配置窗口拉伸规则 + +# 1.34.0 (2023-11-07) +### Features +- ✨ 小程序 `MainMountPointOptions` 新增参数 `widthResponsive`、`heightResponsive`,支持面板宽度、高度随浏览器自适应 + +# 1.33.0 (2023-10-10) +### Features +- ✨ 小程序 `IDP.EventTypes` 新增事件 `IDP.UI.Layout.WindowResize` + +# 1.29.0 (2023-08-01) +### Features +- ✨ 小程序 `MainMountPointOptions` `windowMode` 新增类型 `topWindowed`,窗口模式,高显示优先级 + +# 1.23.0 (2023-04-18) +### Features +- ✨ 小程序 `IDP.Platform` 新增接口 `IDP.Platform.getLocale` + +# 1.21.0 (2023-03-21) +### Features +- ✨ 小程序 `IDP.EventTypes` 新增事件 `IDP.Design.Save` + +# 1.20.0 (2023-03-07) +### Features +- ✨ 小程序 `IDP.Integration.Bom` Namespace 中新增如下API: + 1. `deleteGroupsByProductIdAsync` 通过产品ID,批量删除分组 + 2. `findGroupsByProductIdAsync` 通过产品ID,查询分组 + 3. `deleteMaterialsByOrderIdAsync` 通过订单ID,删除物料 +- ✨ 小程序 `IDP.Integration.Bom` Namespace 中如下API,更新了参数更新: + 1. `deletePlanksByProductIdsAsync` 通过产品ID,删除板信息时,新增必传参数orderId + 2. `findPlankListAsync` 通过产品ID,查询板件信息时,新增必传参数orderId + 3. `deleteFinishedProductsAsync` 通过产品ID删除成品五金时,新增必传参数orderId + 4. `findFinishedProductsAsync` 通过产品ID查询成品五金时,新增必传参数orderId + +# 1.19.0 (2023-02-21) +### Features +- ✨ 小程序 `IDP.Integration.Bom` Namespace 中修改如下接口: + 1. `createGroupsAsync` 创建分组时,新增非必填字段: `comment` + +# 1.18.0 (2023-02-07) +### Features +- ✨ 小程序 `IDP.Integration.Bom` Namespace 中修改如下接口: + 1. `updatePlankAsync`, `updatePlanksAsync`, `updateFinishedProductsAsync`, `updateMoldingsAsync`, `createGroupsAsync` 新增品类与属性相关非必须字段: `category`, `attributes` + 2. `findPlankListAsync`, `getPlankListAsync`, `findFinishedProductsAsync`, `findMoldingsAsync`, `findGroupsByRootIdAsync`, `findGroupsByBomIdAsync`, `findGroupsByOrderIdAsync` 新增必须返回字段: `category`, `attributes` + 3. `updateGroupsAsync` 支持批量更新分组的品类与属性 +- ✨ 小程序 `IDP.Custom.Drawing` Namespace 中修改如下接口: + 1. `DivisionType` 施工图出图方式新增柜组出图枚举 + 1. `getConstructionDrawingByElementsAsync` 支持柜组出图 + +# 1.16.0 (2022-12-07) +### Features +- ✨ 小程序 `IDP.Integration.Bom` Namespace 中新增如下接口: + 1. `createBomsAsync` 批量创建物料 +- ✨ 命名空间 `IDP.Platform` 下: + 1. 新增 `AppMode` 枚举值,列举已知应用模式标识 + 2. 新增 `getAppMode` 方法,获取当前应用模式 +- ✨ 命名空间 `IDP.DB.Types` 下新增 `Opening` 类型 +- ✨ 命名空间 `IDP.DB.Methods` 下: + 1. 新增 `getAllWallList` 方法 + 2. 新增 `getAllRoomList` 方法 + 3. 新增 `getAllOpeningList` 方法 + +# 1.14.0 (2022-11-08) +### Features +- ✨ 小程序 定制模型参数 功能完善: + 1. 支持复合公式,参数覆写等功能 + 2. 支持获取参数完整信息 + 3. 标示『setPrimitiveOverride』『getPrimitiveOverride』标记为过期方法 +- ✨ 命令空间 `IDP.User` 下,新增方法: + 1. 新增 `getUserDetailsAsync` 方法,获取用户详情信息 + +# 1.0.1 +- 初次发布 diff --git a/packages/vm/node_modules/@manycore/idp-sdk/README.md b/packages/vm/node_modules/@manycore/idp-sdk/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c9840a643001c1d231195d3b1d6179b38ae39a90 --- /dev/null +++ b/packages/vm/node_modules/@manycore/idp-sdk/README.md @@ -0,0 +1,20 @@ +# `@manycore/idp-sdk` + +> 酷家乐开放平台`IDP`命名空间API声明包 + +## 使用方式 +```bash +# npm +npm install @manycore/idp-sdk --dev +# yarn +yarn add @manycore/idp-sdk -D +``` + +```js +/// + +IDP.Miniapp.view.defaultFrame.mount(IDP.Miniapp.view.mountPoints.main); // 挂载默认视图 + +// TODO.... + +``` diff --git a/packages/vm/node_modules/@manycore/idp-sdk/index.d.ts b/packages/vm/node_modules/@manycore/idp-sdk/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa25ed39dd55678384f6d841ad9fd219e77d5fec --- /dev/null +++ b/packages/vm/node_modules/@manycore/idp-sdk/index.d.ts @@ -0,0 +1,15987 @@ +/** + * @vm-type UnknownType + */ +declare type AugmentedOptional = Omit & Partial>; +/** + * @vm-type UnknownType + */ +declare type AugmentedRequired = Omit & Required>; +/* Excluded from this release type: CadImportParams */ +/* Excluded from this release type: CadImportType */ +/* Excluded from this release type: CadK2dInfo */ +/* Excluded from this release type: CameraAttributes */ +/* Excluded from this release type: CameraType */ +declare interface CheckModelSplitOrderResult { + /** 模型id */ + modelId: string; + /** 模型是否拆单 */ + isSplitOrder: boolean; +} +/* Excluded from this release type: CommonCameraAttributes */ +/* Excluded from this release type: ConfirmType */ +/** + * 云图环境下,查询到模型极简信息 + * @vm-type UnknownType + */ +declare type CustomModelSimple = ICustomModelPureSimple | ICustomModelAssemblySimple; +declare type DeleteFinishedProductOption = AugmentedRequired | AugmentedRequired | AugmentedRequired; +/** + * @vm-type UnknownType + */ +declare type DeleteMoldingsOption = Pick | Pick | Pick; +declare interface DesignUnlockModelResult { + /** 模型id */ + modelId: string; + /** 导致解锁的事件key */ + eventKey: string; +} +/** 检测规则类型 */ +declare enum DetectionRuleType { + /** 有效性检测 */ + VALID = 1, + /** 规则检测 */ + RULE, + /** 干涉检测 */ + INTERSECT +} +/* Excluded from this release type: DialogProps */ +/* Excluded from this release type: DrawColumnType */ +/* Excluded from this release type: DrawWallType */ +/** 检测告警等级 */ +declare enum EAlertLevel { + /** 异常 */ + ERROR = 0, + /** 警告 */ + WARNING = 1 +} +/** + * 槽应用类型 + */ +declare enum EAppliedGrooveType { + /** + * 板件槽 + */ + PLANK = "PLANK", + /** + * 五金槽 + */ + FITTING = "FITTING", + /** + * 辅助槽 + */ + AUXILIARY = "AUXILIARY", + /** + * 拉米诺槽 + */ + LAMELLO = "LAMELLO", + /** + * 乐扣槽 + */ + LOCK = "LOCK", + /** + * 边型槽 + */ + EDGE = "EDGE", + /** + * 隐形件槽 + */ + INVISIBLE = "INVISIBLE", + /** + * 阵列槽 + */ + ARRAY = "ARRAY" +} +/** + * 孔的应用类型 + */ +declare enum EAppliedHoleType { + /** + * 板件孔 + */ + PLANK = "PLANK", + /** + * 五金孔 + */ + FITTING = "FITTING", + /** + * 辅助孔 + */ + AUXILIARY = "AUXILIARY" +} +/** + * 附件类型 + */ +declare enum EAttachmentType { + /** 设计附件 */ + DESIGN_ATTACHMENT = 1, + /** 审核附件 */ + AUDIT = 2, + /** 拆单附件 */ + SPLIT_ORDER_ATTACHMENT = 3, + /** 订单附件 */ + ORDER_ATTACHMENT = 4 +} +/** + * 线段类型 + */ +declare enum EBomCurveType { + /** + * 线段 + */ + LineSeg = "LineSeg", + /** + * 弧线 + */ + Arc = "Arc" +} +/** + * 切角类型 + */ +declare enum EBomMoldingCornerType { + /** + * 平切 + */ + FLAT = "FLAT", + /** + * 阳角 + */ + OUTSIDE = "OUTSIDE", + /** + * 阴角 + */ + INSIDE = "INSIDE" +} +/** + * 线条类型 + */ +declare enum EBomMoldingType { + /** + * 顶线 + */ + CROWN = "CROWN", + /** + * 脚线 + */ + SKIRTING = "SKIRTING", + /** + * 灯线 + */ + LIGHT = "LIGHT", + /** + * 其他 + */ + OTHER = "OTHER" +} +/** + * 槽应用类型 + */ +declare enum EBomPlankGrooveType { + /** + * 板件槽 + */ + PLANK = "PLANK", + /** + * 五金槽 + */ + FITTING = "FITTING", + /** + * 辅助槽 + */ + AUXILIARY = "AUXILIARY", + /** + * 拉米诺槽 + */ + LAMELLO = "LAMELLO", + /** + * 乐扣槽 + */ + LOCK = "LOCK", + /** + * 边型槽 + */ + EDGE = "EDGE", + /** + * 隐形件槽 + */ + INVISIBLE = "INVISIBLE", + /** + * 阵列槽 + */ + ARRAY = "ARRAY", + /** + * 斜边槽 + */ + BEVEL = "BEVEL" +} +/** + * 孔应用类型 + */ +declare enum EBomPlankHoleType { + /** + * 板件孔 + */ + PLANK = "PLANK", + /** + * 五金孔 + */ + FITTING = "FITTING", + /** + * 辅助孔 + */ + AUXILIARY = "AUXILIARY" +} +/** + * 板件的类型 + */ +declare enum EBomPlankType { + /** + * 柜体 + */ + BODY = "BODY", + /** + * 背板 + */ + BACK = "BACK", + /** + * 门板 + */ + DOOR = "DOOR", + /** + * 移门 + */ + SLIDINGDOOR = "SLIDINGDOOR" +} +/** + * 大板类型 + */ +declare enum EBomRawPlankType { + /** + * 大板 + */ + RAW = "RAW", + /** + * 余料 + */ + SURPLUS = "SURPLUS" +} +/** + * 自定义字段枚举类型 + */ +declare enum EBzPropertyType { + /** + * 数字类型 + */ + number = "number", + /** + * 字符串类型 + */ + string = "string", + /** + * boolean类型 + */ + boolean = "boolean" +} +/** 检测结果状态 */ +declare enum ECheckModelsStatus { + /** 成功 */ + SUCCESS = "success", + /** 失败 */ + FAIL = "fail" +} +/** + * 线是否顺时针的值 + */ +declare enum EClockWise { + /** + * 顺时针 + */ + TRUE = "true", + /** + * 逆时针 + */ + FALSE = "false" +} +/** + * 处于定制工具线时,进入某和独立环境模式 + */ +declare enum ECustomAppMode { + /** + * 内空模式 + **/ + INNER_SPACE = "INNER_SPACE", + /* Excluded from this release type: PARTITION_TOOL */ + /** + * 订单审核环境 + */ + ORDER_AUDIT = "ORDER_AUDIT", + /** + * FOP订单模式 + */ + FOP_ORDER = "FOP_ORDER", + /** + * 掩门五金 + */ + DOOR_COVERING_HARDWARE = "DOOR_COVERING_HARDWARE" +} +/** + * 客户信息查询范围枚举 + */ +declare enum ECustomerQueryRange { + /** 当前用户创建的客户 */ + MYSELF = 1, + /** 查询所有的 */ + ALL = 2 +} +/** + * 客户信息查询字段类型枚举 + */ +declare enum ECustomerQueryType { + /** 客户姓名 */ + CUSTOMER_NAME = 1, + /** 客户电话 */ + CUSTOMER_PHONE = 2, + /** 客户地址 */ + CUSTOMER_ADDR = 3 +} +/** + * 客户来源 + */ +declare enum ECustomerSource { + /**其他客户 */ + OTHER = 0, + /**门店自然进店客户 */ + NATURAL = 1, + /**楼盘样板间流量客户 */ + MODEL_ROOM = 2, + /**新媒体客户(抖音,美团,淘宝,小红书和品牌微信) */ + NEW_MEDIA = 3, + /**直播间流量客户(会包含1.2.3部分客户) */ + LIVE = 4, + /**异业合作(家具大联盟个品牌之间互相带客户) */ + CROSS_COOP = 5, + /**电销客户 */ + TELEMARKETING = 6, + /**老介新 */ + OLD_INTRODUCE = 7, + /**二次购买客户 */ + REPURCHASE = 8 +} +/** + * 商品库节点 + */ +declare enum ECustomLibraryPosition { + /** 产品库 */ + PRODUCT_LIBRARY = 0, + /** 组合库 */ + ASSEMBLY_LIBRARY = 1, + /** 组件库 */ + COMPONENT_LIBRARY = 2, + /** 材质库 */ + TEXTURE_LIBRARY = 3, + /** 铝门窗库 */ + ALUMINIFEROUS_LIBRARY = 4, + /** 关联组件库 */ + RELATIONAL_COMPONENT_LIBRARY = 5, + /** 装配库 */ + FITTING_PRODUCT_LIBRARY = 6, + /** 混合库 */ + MIX_LIBRARY = 7, + /** 布尔造型库 */ + BOOL_MODELING_LIBRARY = 8 +} +/** + * 定制商品库类型 + */ +declare enum ECustomLibraryType { + /** 企业库 */ + Enterprise = "enterprise", + /** 公共库 */ + Public = "public", + /** 品牌库 */ + Brand = "brand", + /** 供应链库 */ + SupplyChain = "supplyChain", + /** 我的(收藏)库 */ + My = "my" +} +/** + * 定制模型类型 + */ +declare enum ECustomModelType { + /** 实体模型 */ + PARAM_ENTITY = 1, + /** 家具模型,3d模型文件 */ + PARAM_FURNITURE = 2, + /** 基元模型,需要计算mesh */ + PARAM_PRIMITIVE = 3, + /** 虚拟模型 */ + PARAM_VIRTUAL = 4, + /** 参数化组合:即在设计方案当中,选中多个模型,组合之后的结果 */ + PARAM_ASSEMBLY = 5, + /** + * 参数化组合:在参数化编辑器中,对多个模型进行组合操作 + */ + TEMPLATE_ASSEMBLY = 6 +} +/** + * 获取JSON信息导出时的状态码信息 + */ +declare enum EDesignExportCode { + /** + * 成功 + */ + SUCCESS = 1, + /** + * 失败 + */ + FAIL = -1 +} +/** 方案类型 */ +declare enum EDesignType { + /** 设计方案 */ + Design = "Design", + /** 审核方案 */ + Audit = "Audit", + /** 生产方案 */ + Production = "Production" +} +/** + * 检测类型 + */ +declare enum EDetectType { + /** + * 干涉检测 + */ + Intersect = "intersect", + /** + * 有效性检测 + */ + Validity = "validity", + /** + * 规则检测 + */ + Rule = "rule" +} +/** + * 出图方式 + */ +declare enum EDivisionType { + /** + * 空间出图 + */ + Space = "spaceDivision", + /** + * 柜组出图 + */ + Relation = "relationDivision" +} +/** + * 出图文件格式 + */ +declare enum EDrawingFileType { + CAD = 7, + JPG = 2, + PDF = 3 +} +/** + * 云排版计算处理状态 + */ +declare enum EEngravingMachineCuttingStatus { + waiting = "waiting", + assigned = "assigned", + running = "running", + finished = "finished", + abnormal = "abnormal", + failed = "failed" +} +/** + * 内空的朝向信息 + */ +declare enum EFace { + LEFT = "left", + RIGHT = "right", + BOTTOM = "bottom", + TOP = "top", + BACK = "back", + FRONT = "front" +} +declare enum EFieldEnum { + /** 紧急程度 */ + emergencyLevel = 6, + /** 单据类型 */ + receiptType = 7 +} +/** + * 单位枚举 + */ +declare enum EFinishedProductUnit { + /** + * 个 + */ + NONE = "NONE", + /** + * 千克 + */ + KG = "KG", + /** + * 米 + */ + METRE = "METRE", + /** + * 平米 + */ + SQUARE_METRE = "SQUARE_METRE", + /** + * 公升 + */ + LITRE = "LITRE" +} +/** + * 孔槽配件类型 + */ +declare enum EFittingType { + /** + * 槽 + */ + GROOVE = 1, + /** + * 孔 + */ + HOLE = 2, + /** + * 五金 + */ + HARDWARE = 3, + /** + * 五金槽 + */ + HARDWARE_GROOVE = 4, + /** + * 交接面信息 + */ + INTERSECTED = "intersected", + /** + * 孔V2 + */ + HOLE_V2 = "holeV2", + /** + * 方槽 + */ + SQUARE_GROOVE = "squareGroove", + /** + * 圆角方槽 + */ + ROUND_CORNER_GROOVE = "roundCornerGroove", + /** + * 异形槽 + */ + SPECIAL_SHAPED_GROOVE = "specialShapedGroove", + /** + * 路径槽 + */ + PATH_GROOVE = "pathGroove" +} +/** + * 槽几何类型 + */ +declare enum EGrooveGeometryType { + /** + * 方槽 + */ + SQUARE = "SQUARE", + /** + * 圆角方槽 + */ + ROUND_CORNER = "ROUND_CORNER", + /** + * 路径槽 + */ + PATH = "PATH", + /** + * 异形槽 + */ + SPECIAL_SHAPED = "SPECIAL_SHAPED" +} +/** + * 交接信息的产生方式 + */ +declare enum EIntersectedCreatedType { + /** + * 板与板之间产生的交界 + */ + BOTH_PLANK = 0, + /** + * 板与五金之间产生的交界信息 + */ + PLANK_FURNITURE = 1 +} +/** + * 支持配置输出的交接数据类型 + */ +declare enum EIntersectedInfoType { + /** + * 交接体 + */ + SHELL = "1", + /** + * 贯穿交接体 + */ + THROUGH_SHELL = "3" +} +/** + * 交接数据的数据类型 + */ +declare enum EIntersectedType { + /** + * 交接体 + */ + SHELL = "1", + /** + * 交界面 + */ + FACE = "2", + /** + * 贯穿交接体 + */ + THROUGH_SHELL = "3" +} +/** + * 交接对象类型 + */ +declare enum EIntersectModelType { + /** + * 板件 + */ + PLANK = 0, + /** + * 五金 + */ + HARDWARE = 1, + /** + * 商品 + */ + PRODUCT = 2 +} +/** + * 设计对象 ID + */ +declare interface ElementId_2 { + /** 实例 ID */ + id: string; + /** 类型 */ + type: ElementType_2; +} +/** + * 定制设计对象类型 + */ +declare enum ElementType_2 { + /** 全屋定制家具 */ + Wardrobe = "Wardrobe", + /** 全屋定制家具副本 */ + WardrobeCopy = "WardrobeCopy", + /** 厨卫 */ + Cabinet = "Cabinet", + /** 厨卫副本 */ + CabinetCopy = "CabinetCopy", + /** 门窗 */ + DoorWindow = "DoorWindow", + /** 门窗副本 */ + DoorWindowCopy = "DoorWindowCopy", + /** 定制组合 */ + CustomGroup = "CustomGroup", + /** 厨卫引用模型 */ + CabinetRef = "CabinetRef", + /** 厨卫副本引用模型 */ + CabinetCopyRef = "CabinetCopyRef", + /** 全屋引用模型 */ + WardrobeRef = "WardrobeRef", + /** 全屋副本引用模型 */ + WardrobeCopyRef = "WardrobeCopyRef" +} +/** + * 线的类型 + */ +declare enum ELineType { + /** + * 直线 + */ + SEGMENT = 0, + /** + * 圆弧 + */ + CIRCLE_ARC = 1, + /** + * 椭圆 + * 当前代码中,暂不支持 + */ + ELLIPSE_ARC = 3, + /** + * 圆 + */ + CIRCLE_CENTER = 4 +} +/** + * 开门方向 + */ +declare enum EOpenDirection { + /** + * 左开门 + */ + LEFT = "LEFT", + /** + * 右开门 + */ + RIGHT = "RIGHT", + /** + * 上开门 + */ + TOP = "TOP", + /** + * 下开门 + */ + BOTTOM = "BOTTOM", + /** + * 无开门方向(一般用于假门、抽屉面板) + */ + NONE = "NONE" +} +/** + * 订单动态操作类型 + */ +declare enum EOrderEventType { + /** + * 系统预设 + */ + sys = 0, + /** + * 自定义 + */ + custom = 1 +} +/** 字段数据权限 */ +declare enum EOrderFieldDataAuth { + /** 可见 */ + Visible = "visible", + /** 可编辑 */ + Editable = "editable" +} +/** + * 订单字段类型 + */ +declare enum EOrderFieldType { + /** + * 字符串 + */ + STR = 0, + /** + * 整数 + */ + INT = 1, + /** + * 浮点数 + */ + FLOAT = 2, + /** + * 布尔值 + */ + BOOL = 3 +} +/** + * 订单模式配置类型 + */ +declare enum EOrderModeConfigType { + /** + * 模型可编辑性 + */ + MODEL_EDITABLE = 0 +} +/** + * 订单操作类型 + */ +declare enum EOrderOperationType { + /** + * 动态操作,执行会修改订单状态 + */ + DYNAMIC = 0, + /** + * 静态操作,执行不修改订单状态 + */ + STATIC = 1 +} +/** + * 订单备注类型 + */ +declare enum EOrderRemarkType { + /** 审核备注 */ + AUDIT = 0, + /** 订单备注 */ + ORDER_REMARK = 1, + /** 设计备注 */ + DESIGN_REMARK = 2 +} +/** + * 当前参数的类型 + */ +declare enum EParamForm { + /** + * 单值, 老数据 + * */ + SINGLE = 0, + /** + * 区间 + * */ + RANGE = 1, + /** + * 可选 + * */ + OPTION = 2, + /** + * 递增 + * */ + STEP = 3, + /** + * 复合公式, 可以在公式和值之间切换 + * */ + COMPOUND_FORMULA = 4, + /** + * 公式 + * */ + FIXED_FORMULA = 5, + /** + * 固定值 + * */ + FIXED_VALUE = 6, + /** + * 复合公式, 公式+可选的组合 + * */ + COMPOUND_FORMULA_OPTION = 7 +} +/** + * 当前模型的类型 + */ +declare enum EParamModelType { + /** + * 普通模型的单一模型 + */ + COMMON = 0, + /** + * 实例组合:即在设计方案当中,选中多个模型,组合之后的结果 + */ + ASSEMBLY = 1, + /** + * 参数化组合:在参数化编辑器中,对多个模型进行组合操作 + */ + TEMPLATE_ASSEMBLY = 2 +} +declare enum EParamType { + /** + * 浮点数 + */ + FLOAT = "float", + /** + * 二维浮点数 + */ + FLOAT2 = "float2", + /** + * 三维浮点数 + */ + FLOAT3 = "float3", + /** + * 浮点数 + */ + FLOAT_BUFFER = "floatbuf", + /** + * 二维浮点数 + */ + FLOAT2_BUFFER = "float2buf", + /** + * 三维浮点数 + */ + FLOAT3_BUFFER = "float3buf", + /** + * 引用 + */ + REFERENCE = "reference", + /** + * 整数 + */ + INT = "int", + /** + * 整数 + */ + INT_BUFFER = "intbuf", + /** + * 字符串 + */ + STRING = "string", + /** + * 轮廓,一般为商品ID + */ + SHAPE = "shape", + /** + * 材质,一般存储为商品ID + */ + MATERIAL = "material", + /** + * 布尔 + */ + BOOLEAN = "boolean", + /** + * 布尔 + */ + BOOLEAN_BUFFER = "booleanbuf", + /** + * 适配 + */ + FIT = "fit", + /** + * 路径 + */ + PATH = "paramcornerpath", + /** + * 样式 + */ + STYLE = "style", + /** + * 字符串 + */ + FORMULA_STRING = "formulaString", + /** + * 多布尔 + */ + BOOLEAN_LIST = "booleanlist" +} +/** + * 值的单位类型 + */ +declare enum EParamUnitType { + /** + * 单位默认值 + */ + DEFAULT = 0, + /** + * 长度单位 + */ + LENGTH = 1, + /** + * 面积单位 + */ + AREA = 2, + /** + * 数量单位 + */ + NUMBER = 3 +} +/** + * 线的类型 + */ +declare enum EPlankPathLineType { + /** + * 直线 + */ + SEGMENT = 0, + /** + * 圆弧 + */ + CIRCLE_ARC = 1, + /** + * 圆 + */ + CIRCLE_CENTER = 4 +} +/** + * 点的类型 + */ +declare enum EPlankPathPointType { + /** + * 普通点 + */ + NONE = 0, + /** + * 倒圆 + */ + CIRCLE = 1, + /** + * 倒角 + */ + LINE = 2, + /** + * 切圆,就是内挖一个倒圆的形状 + */ + CUT_CIRCLE = 3, + /** + * 圆心点 + */ + CIRCLE_CENTER = 5 +} +/** 板件关联类型 */ +declare enum EPlankRelationType { + /** 拆板 */ + SPLIT = "split", + /** 放大 */ + ENLARGE = "enlarge", + /** 合并 */ + MERGE = "merge", + /** 分拆,属于合并(merge)关系的返回类型 */ + DEMERGE = "demerge" +} +/** + * 点的类型 + */ +declare enum EPointType { + /** + * 普通点 + */ + NONE = 0, + /** + * 倒圆 + */ + CIRCLE = 1, + /** + * 倒角 + */ + LINE = 2, + /** + * 切圆,就是内挖一个倒圆的形状 + */ + CUT_CIRCLE = 3, + /** + * 椭圆 + */ + ELLIPSE = 4, + /** + * 圆心点 + */ + CIRCLE_CENTER = 5 +} +/** + * 订单流程方向 + */ +declare enum EProcessDirect { + /** 正向 */ + FORWARD = 0, + /** 逆向 */ + REVERSE = 1 +} +/** + * 商品建模方向 + */ +declare enum EProductDirection { + XY = 0, + YZ = 1, + XZ = 2 +} +declare enum EQuotationLibraryType { + /** + * 私库 + */ + PRIVATE = 0, + /** + * 公库 + */ + PUBLIC = 1 +} +/** 定制工具线 */ +declare enum EToolType { + /** 厨卫定制 */ + Cabinet = "Cabinet", + /** 家居定制 */ + Wardrobe = "Wardrobe", + /** 门窗定制 */ + DoorWindow = "DW", + /** 厨卫定制副本 */ + CabinetCopy = "Cabinet_Copy", + /** 家居定制副本 */ + WardrobeCopy = "Wardrobe_Copy", + /** 门窗定制副本 */ + DoorWindowCopy = "DW_Copy" +} +/** + * 文件上传bucket + */ +declare enum EUploadFileBucket { + /**订单存储bucket */ + ORDER = "order-mini-app", + /**报价清单存储bucket */ + QUOTATION = "report-miniapp" +} +declare type FindFinishedProductOption = DeleteFinishedProductOption | AugmentedRequired; +/** + * @vm-type UnknownType + */ +declare type FindMoldingsOption = Pick | Pick | Pick | Pick; +/* Excluded from this release type: FloorPlanCadInfo */ +/* Excluded from this release type: FloorPlanLayerInfo */ +/** + * iframe代理结构 + */ +declare interface FrameHost { + /** + * 标识释放当前iframe已经被挂载 + */ + readonly mounted: boolean; + /** + * 挂载当前iframe + * @param mountPointIndex 容器挂载点索引, @see View.mountPoints + * @returns 当前iframe是否挂载成功 + */ + mount(mountPointIndex: number): boolean; + /** + * 卸载当前iframe + */ + unmount(): void; + /** + * 缩放当前iframe + */ + resize(width: number, height: number): void; + /** + * 设置一个回调,在iframe加载完成时触发 + * @param fn + */ + onReady(fn: () => void): void; + /** + * 设置一个回调,在接收到由iframe postMessage发来的信息时触发 + * @param fn callback + */ + onMessageReceive(fn: (data: any, origin: string) => void): void; + /** + * 当iframe的大小被变更时触发 + * @param fn callback + */ + onResize(fn: (width: number, height: number) => void): void; + /** + * 将数据发送至iframe + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage + * @param data 需要发送的数据 + * @param origin iframe的origin, 默认'*' + */ + postMessage(data: any, origin?: string): void; +} +/** + * 软装家具详细信息 + */ +declare interface Furniture { + /** 设计对象 ID */ + elementId: IDP.DB.Types.ElementId; + /** 商品 ID */ + productId: string; + /** 位置 */ + position: KPoint3d; + /** 旋转 */ + rotation: KPoint3d; + /** 大小 */ + size: KPoint3d; + /** 缩放 */ + scale: KPoint3d; +} +/** + * 创建软装家具所需的信息 + */ +declare interface FurnitureCreateInfo { + /** 商品 ID */ + productId: string; + /** 位置 */ + position?: KPoint3d; + /** 旋转 */ + rotation?: KPoint3d; + /** 缩放 */ + scale?: KVector3d; +} +/* Excluded from this release type: FurnitureGroup */ +/* Excluded from this release type: FurnitureGroupCreateInfo */ +declare interface GetModelJsonOptionV2 { + /** + * 模型id + * 只支持同一工具线的模型同时查询 + */ + modelIds: string | string[]; + /** + * 楼层Id + * 默认当前所在楼层 + */ + levelId?: string; + /** + * 超时时间,单位(s) + * 默认最大超时时间(10min) + */ + timeout?: number; + /** + * 模板ID + */ + templateId?: string; +} +declare interface GetModelJsonResultV2 { + /** + * 模型ID + */ + modelId: string; + /** + * JSON url地址 + */ + url: string; +} +/* Excluded from this release type: HighlightElementConfig */ +declare interface IAddOrderStateAttachmentOption { + /** + * 订单ID + */ + orderId: string; + /** + * 附件列表 + */ + attachments: IOrderAttachment[]; + /** 订单状态 */ + orderState: number; +} +/** + * 通过orderState新增订单备注参数 + */ +declare interface IAddOrderStateRemarkOption { + /** 订单id */ + orderId: string; + /** 备注内容 */ + content: string; + /** 订单状态 */ + orderState: number; + /** 图片 */ + images?: IOrderAttachment[]; +} +/** + * 组合模型信息 + */ +declare interface IAssemblyModels { + /** + * 组合模型的唯一识别id + */ + id: string; + /** + * 组合模型在方案中的名称 + */ + name: string; + /** + * 组合对应的商品的id,若无对应商品,则值为null + */ + obsBrandGoodId: string; + /** + * 组合的参数 + */ + parameters: IParamModelParameter[]; + /** + * 组合中中所包含的模型id + */ + paramModelIds: Array; + /** + * 组合尺寸 + */ + size: Number3; + /** + * 组合的坐标 + */ + position: Number3; + /** + * 组合的旋转的弧度值 + */ + rotate: Number3; + /** + * 组合的旋转的角度值 + */ + rotateDegree: Number3; + /** + * 组合收藏转素材后的商品的id,若为实例组合,则值为null + */ + obsCollectBrandGoodId: string; + /** + * 组合自身的价格 + */ + price: number; + /** + * 组合类型;"instance" 为实例组合,即工具中的组合;"template"为 模板组合,即编辑器中建立的组合 + */ + assemblyModelType: string; + /** + * 组合模型的备注 + */ + remark: string; + /** + * 模型安装位置编码,受“产品编号”功能控制 + */ + installationCode: string; + /** + * 模型是否标准,标准模型值为true,非标模型值为false;受“非标检测”功能控制 + */ + standard: boolean; + /** + * other fields + */ + [key: string]: any; +} +declare interface IAssociatedSchema { + /** + * 关联的方案的 id + */ + planId: string; + /** + * 关联的方案的 id + */ + designId: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 生产单信息 + */ +declare interface IAuditDesignOrders { + /** + * 生产单编号 + */ + productOrderCode: string; + /** + * 审批通过并创建生产单时,审核员填写的生产单号 + */ + productCode: string; + /** + * 对应客户订单单号 + */ + orderCode: string; + /** + * 对应审核单的名称 + */ + auditName: string; + /** + * 对应审核单单号 + */ + auditCode: string; + /** + * 客户名称deleted + */ + customerName: string; + /** + * 加密后的设计师userid + */ + obsDesignerUserId: string; + /** + * 设计师名称 + */ + designerName: string; + /** + * 加密后的审核员userid + */ + obsAuditorUserId: string; + /** + * 审核员名称 + */ + auditorName: string; + /** + * 工具线名称 + */ + typeName: string; + /** + * 工具线类型; 0、 1 分别表示橱柜、全屋家具 + */ + type: number; + /** + * 生产单状态;已下单、已退回等 + */ + statusName: string; + /** + * 生产单状态码;已下单=0,已退回=1,已作废=2 + */ + status: number; + /** + * 生产单状态;英文 + */ + state: string; + /** + * 生产单状态;中文 + */ + stateName: string; + /** + * 生产单操作记录,包含生产单每个状态的操作人、日期等信息 + */ + productOrderOperations: IProductOrderOperation[]; + /** + * 拆单员名称 + */ + bomOperatorName: string; + /** + * 拆单员id + */ + obsBomOperatorId: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 审核单信息 + */ +declare interface IAuditOrder { + /** + * 审核单名称 + */ + auditName: string; + /** + * 审核单编号 + */ + auditCode: string; + /** + * 审核员名称 + */ + auditorName: string; + /** + * 审核单外部关联编号 + */ + associatedNumber: string; + /** + * 审核单操作记录,包含审核单每个状态的操作人、日期等信息 + */ + auditOrderOperations: IAuditOrderOperation[]; + /** + * 审核单中的自定义订单信息,包含信息的名称与取值 + */ + userDefinedInfos: IUserDefinedInfo[]; + /** + * other fields + */ + [key: string]: any; +} +declare interface IAuditOrderOperation extends IOrderOperation { + /** + * other fields + */ + [key: string]: any; +} +/** 审核备注 */ +declare interface IAuditOrderRemarks extends IOrderRemarks { + images: IOrderAttachment[]; +} +declare interface IAuxiliaryBizProperties { + bizProperties: Record; +} +/** + * 孔槽数据基础示意 + */ +declare interface IBaseFittingData { + /** + * 开发者自己生成的孔、槽信息标识ID(自行区分) + */ + id: string; + /** + * 当前数据类型 + */ + fittingType: EFittingType; + /** + * 附加通用参数,开发者可以自己存储一些数据 + */ + params?: IBaseFittingParameters[]; +} +/** + * 附加通用参数存储 + * + * **内部占用key:** + * - $$geometry_color: 孔槽五金槽模型颜色 + * - $$geometry_opacity: 孔槽五金槽模型不透明度 + */ +declare interface IBaseFittingParameters { + /** + * 通用参数的key + * + * 不建议使用 **$$** 开头命名, **$$** 开头通常为SDK内部使用参数 + */ + key: string; + /** + * 通用参数的value + */ + value: string; + /** + * 当前value值的数据类型 + */ + type: string; +} +/** + * 孔/槽的基础数据结构 + */ +declare interface IBaseHoleGrooveData extends IBaseFittingData { + /** + * 孔/槽的深度 + */ + depth: number; + /** + * 所处的板面 + */ + plankFaceId: number; + /** + * 起点 + */ + start: Number3; + /** + * 终点 + */ + end: Number3; +} +/** + * 交接信息 + * @vm-type UnknownType + */ +declare type IBaseIntersected = (ICommonIntersected & IPlankFaceId) | (ICommonIntersected & IPlankFaceId) | ICommonIntersected; +/** + * 自定义属性数据 + */ +declare interface IBizPropertyData { + /** + * 属性key + */ + key: string; + /** + * 属性名称 + */ + name: string; + /** + * @ignore + */ + namespace: string; + /** + * 属性值 + */ + value: string; + /** + * 属性类型 + */ + valueType: string; +} +declare interface IBomAddition extends Required, Required, Required { +} +/** + * 通过凸度定义圆弧 + */ +declare interface IBomArcCurveByBulge { + /** + * 线段类型 + */ + type: EBomCurveType.Arc; + /** + * 凸度 + */ + bulge: number; +} +/** + * 通过半径、绕向、是否劣弧定义圆弧 + */ +declare interface IBomArcCurveByRadius { + /** + * 线段类型 + */ + type: EBomCurveType.Arc; + /** + * 逆时针 + */ + isCCW: boolean; + /** + * 劣弧 + */ + minorArc: boolean; + /** + * 半径 + */ + radius: number; +} +declare interface IBomCategoryAttr { + /** + * 品类 + */ + category?: string; + /** + * 属性 + */ + attributes?: { + [key: string]: T; + }; +} +/** + * 线段描述 + * @vm-type UnknownType + */ +declare type IBomCurve = IBomLineSegCurve | IBomArcCurveByBulge | IBomArcCurveByRadius; +/** + * 下料尺寸信息 + */ +declare interface IBomCuttingInfo { + /** + * 下料宽度; + * 根据产品尺寸和封边设置得到; + * 单位:毫米 + */ + cuttingWidth: number; + /** + * 下料高度; + * 根据产品尺寸和封边设置得到; + * 单位:毫米 + */ + cuttingHeight: number; + /** + * 下料轮廓 + * 根据产品尺寸和封边设置得到; + */ + cuttingProfile: IBomProfile; +} +/** + * 成品五金完整信息 + * @vm-type UnknownType + */ +declare type IBomFinishedProduct = IBomFinishedProductWithId & AugmentedRequired, 'attributes' | 'category'> & IProductCodeInOrder; +/** + * 成品五金底层数据 + */ +declare interface IBomFinishedProductBaseDataEditable extends AugmentedRequired, IBomCategoryAttr { + /** + * 数量 + */ + quantity: number; + /** + * 部件所属包裹 + */ + packageId?: string; + /** + * 单位:个(NONE),千克(KG),米(METRE),平米(SQUARE_METRE),公升(LITRE) + */ + unit: EFinishedProductUnit; + /** + * 材质 + */ + material: string; + /** + * 规格型号 + */ + model: string; + /** + * 成品类型:成品家具(FINISHED_FURNITURE)、五金(HARDWARE)、其他(OTHERS) + */ + productType: string; +} +/** + * 成品五金 + * @vm-type UnknownType + */ +declare type IBomFinishedProductEditable = IBomFinishedProductEditableByModelId | IBomFinishedProductEditableByProductId; +/** + * 创建成品五金 + */ +declare interface IBomFinishedProductEditableByModelId extends IBomFinishedProductBaseDataEditable, IBomRoomMetaInfo { + /** + * 方案中模型ID + */ + modelId: string; +} +/** + * 方案中不存在模型时,创建成品信息 + */ +declare interface IBomFinishedProductEditableByProductId extends IBomFinishedProductBaseDataEditable, Required { + /** + * 方案中,实例ID + */ + productId: string; + /** + * 产品名 + */ + productName: string; + /** + * 订单ID + */ + orderId: string; + /** + * 订单名称 + */ + orderName: string; +} +/** + * 更新成品五金信息 + * @vm-type UnknownType + */ +declare type IBomFinishedProductUpdate = IBomFinishedProductWithId & Partial; +declare interface IBomFinishedProductWithId { + /** + * 成品五金ID + */ + finishedId: string; +} +/** + * BomGroup顶层节点 + */ +declare interface IBomGroup extends IBomGroupBase { + /** + * 订单ID + */ + orderId: string; +} +declare interface IBomGroupBase extends IBomCategoryAttr, Pick, IBomRoomMetaInfo { + /** + * 叶子节点对应的物料ID + */ + bomId?: string; + /** + * 名称 + */ + name?: string; + /** + * 子节点 + */ + children?: IBomGroupBase[]; + /** + * 备注信息 + */ + comment?: string; + /** + * 产品ID + * 如果不传的话,将会从attributes中的source字段来进行逻辑填充; + * 响应时,此字段一定存在 + */ + productId?: string; +} +/** + * 更新分组 + */ +declare interface IBomGroupEditable extends IBomCategoryAttr, IBomGroupId, Pick { +} +/** + * 分组信息 + * @vm-type UnknownType + */ +declare type IBomGroupFull = AugmentedRequired, 'children'>, 'category' | 'attributes'> & IBomGroupId & Required & IProductCodeInOrder & { + /** + * 产品名称 + */ + productName: string; + /** + * 所属订单名称 + */ + orderName: string; + /** + * 包裹ID + */ + packageId?: string; + /** + * 子节点 + */ + children?: Array>; +}; +/** + * BomGroup顶层节点ID + */ +declare interface IBomGroupId { + /** + * Group ID + */ + id: string; +} +/** + * 清除Group的属性 + */ +declare interface IBomGroupPropertiesClearOption { + /** + * 分组节点的物料id集合 + */ + ids: string[]; + /** + * 需要清空的属性值 + */ + properties: T[]; +} +/** + * 直线 + */ +declare interface IBomLineSegCurve { + /** + * 线段类型 + */ + type: EBomCurveType.LineSeg; +} +declare interface IBomMetaInfo { + /** + * 部件名称 + */ + name?: string; + /** + * 部件编码 + */ + code?: string; + /** + * 部件备注 + */ + comment?: string; + /** + * 包裹ID + */ + packageId?: string; + /** + * 分拣号 + */ + sortingCode?: string; +} +/** + * 线条完整信息 + * @vm-type UnknownType + */ +declare type IBomMolding = IBomMoldingWithId & AugmentedRequired, 'attributes' | 'category'> & IBomAddition & IProductCodeInOrder; +/** + * 线条 + */ +declare interface IBomMoldingEditable extends AugmentedRequired, IBomPlankModelId, IBomCategoryAttr, IBomRoomMetaInfo { + /** + * 部件所属包裹ID + */ + packageId?: string; + /** + * 线条类型 + */ + moldingType: EBomMoldingType | string; + /** + * 左切角类型 + */ + cornerTypeLeft: EBomMoldingCornerType; + /** + * 右切角类型 + */ + cornerTypeRight: EBomMoldingCornerType; + /** + * 左切度数; + * 单位:角度 + */ + cornerAngleLeft: number; + /** + * 右切度数; + * 单位:角度 + */ + cornerAngleRight: number; + /** + * 宽 + */ + width: number; + /** + * 长 + */ + length: number; + /** + * 厚 + */ + thickness: number; + /** + * 在创建时,当不传产品ID,将会从modelId中查询到对应的productId进行补全 + * 在响应数据中,productId会一直存在 + */ + productId?: string; + /** + * 商品名称 + */ + productName: string; +} +declare interface IBomMoldingWithId { + /** + * 线条ID + */ + moldingId: string; +} +declare interface IBomOrderMetaInfo { + /** + * 所属订单ID + */ + orderId?: string; + /** + * 订单名称 + */ + orderName?: string; +} +/** + * 成品板件轮廓 + * @vm-type UnknownType + */ +declare interface IBomPath { + /** + * 点的坐标,每两个值代表一个点 + * eg: [100, 200, 250, 300] + */ + points: number[]; + curves: T[]; +} +/** + * 板件基本信息 + * @vm-type UnknownType + */ +declare type IBomPlank = IBomPlankWithId & IBomPlankEditable & IProductCodeInOrder & IBomCuttingInfo; +/** 板件边信息 */ +declare interface IBomPlankEdge { + /** 封边名称 */ + bandName?: string; + /** 封边编号 */ + bandCode?: string; + /** 封边厚度 */ + bandThickness?: number; + /** 预铣厚度 */ + preMillingThickness?: number; +} +/** + * 板件数据结构 + */ +declare interface IBomPlankEditable extends IBomPlankModelId, AugmentedRequired, IBomCategoryAttr, IBomPlankRelation, IBomRoomMetaInfo { + /** + * 产品Id,当不传产品ID时,将会从modelId中查询到对应的productId进行补全 + */ + productId?: string; + /** + * 板件类型 + */ + plankType: EBomPlankType; + /** + * 门板类型 + * 当板件类型为门板时,需要传此字段 + */ + doorType?: string; + /** + * 材质 + */ + material: string; + /** + * 反面材质 + */ + backMaterial?: string; + /** + * 正面材质 + */ + frontMaterial?: string; + /** + * 基材 + */ + baseMaterial: string; + /** + * 纹理 + * @deprecated 推荐使用`textureDirection`字段,后续此字段将会下线 + */ + texture?: string; + /** + * 纹理方向;枚举值 + * HORIZONTAL 水平 + * VERTICAL 垂直 + * NONE 无 + */ + textureDirection?: 'HORIZONTAL' | 'VERTICAL' | 'NONE'; + /** + * 成品宽度 + * 单位:毫米 + */ + finishedWidth?: number; + /** + * 成品高度 + * 单位:毫米 + */ + finishedHeight?: number; + /** + * 厚度 + * 单位:毫米 + */ + thickness: number; + /** + * 成品板件轮廓,如果为空,则代表矩形板件 + */ + finishedProfile?: IBomProfile; + /** + * 封边信息,与 Profile 中的每条边一一对应。如果 Profile 为空,则与矩形版 1,2,3,4 四条边一一对应 + */ + edgeBanding?: number[]; + /** + * 孔 + */ + holes?: H[]; + /** + * 槽 + */ + grooves?: G[]; + /** + * 当为门板时,需要传此字段 + * 开门方向 + */ + openDirection?: EOpenDirection; + /** + * 铰链位置 + */ + hinges?: number[]; + /** + * 成品内轮廓 + */ + inners?: IBomProfile[]; + /** + * 板件反面编码 + */ + backCode?: string; + /** + * 四个方向上的封边值 + */ + fourEdgesBanding?: [number, number, number, number]; + /** + * 板件边信息 + */ + edges?: IBomPlankEdge; + /** + * 板件四个方向边信息 + */ + fourEdges?: IBomPlankFourEdge; +} +/** 板件四个方向的边信息 */ +declare interface IBomPlankFourEdge { + /** 封边厚度 */ + bandThickness?: number; + /** 预铣厚度 */ + preMillingThickness?: number; +} +/** + * 板件完整信息(附带订单信息) + * @vm-type UnknownType + */ +declare type IBomPlankFull = Required & IBomAddition; +/** + * 槽的完整信息 + * @vm-type UnknownType + */ +declare type IBomPlankGroove = IBomPlankGrooveWithId & IBomPlankGrooveEditable; +/** + * 槽 + */ +declare interface IBomPlankGrooveEditable extends IBomPlankHoleOrGrooveShare { + /** + * 起点圆心 + */ + start?: Number3; + /** + * 终点 + */ + end?: Number3; + /** + * 板面 + */ + plankFaceId: string; + /** + * 槽宽 + */ + width?: number; + /** + * 槽工艺类型 + */ + type: EBomPlankGrooveType; + /** + * 槽几何类型,不填默认是SQUARE + */ + geometryType?: EGrooveGeometryType; + /** + * 槽路径点 + */ + profile?: IBomProfile; + /** + * 圆弧路径 + */ + radius?: number; + /** + * 多点路径 + */ + path?: IBomPath; + /** + * 额外附属信息 + */ + extra?: Record; +} +/** + * 槽附带ID信息 + */ +declare interface IBomPlankGrooveWithId extends IBomPlankWithId { + /** + * 槽ID信息 + */ + grooveId: string; +} +/** + * 孔的完整信息 + * @vm-type UnknownType + */ +declare type IBomPlankHole = IBomPlankHoleWithId & IBomPlankHoleEditable; +/** + * 孔 + */ +declare interface IBomPlankHoleEditable extends IBomPlankHoleOrGrooveShare { + /** + * 起点圆心 + */ + start: Number3; + /** + * 终点 + */ + end: Number3; + /** + * 板面 + */ + plankFaceId: string; + /** + * 类型 + */ + type: EBomPlankHoleType; + /** + * 直径 + */ + diameter: number; +} +declare interface IBomPlankHoleOrGrooveShare { + /** + * 孔/槽深 + */ + depth: number; + /** + * 名称 + */ + name: string; +} +/** + * 孔附带ID信息 + */ +declare interface IBomPlankHoleWithId extends IBomPlankWithId { + /** + * 孔ID + */ + holeId: string; +} +declare interface IBomPlankLayoutArrange extends IBomPlankWithId, IBomRawPlankMeta, IBomPlankLayoutArrangeMeta { +} +declare interface IBomPlankLayoutArrangeMeta { + /** + * 旋转幅度,逆时针为正方向 + * 单位:弧度 + */ + rotation: number; + /** + * 是否绕X轴翻转 + */ + flipX: boolean; + /** + * 是否绕Y轴翻转 + */ + flipY: boolean; + /** + * 相对大板偏移量 + */ + translation: IBomPlankLayoutTranslation; +} +declare interface IBomPlankLayoutProcessAttribute extends IBomRawPlankMeta { + /** + * 排版时的小板间距 + */ + plankSpacing: number; +} +/** + * 相对大板的偏移量 + */ +declare interface IBomPlankLayoutTranslation { + /** + * X轴相对大板的偏移量 + */ + x: number; + /** + * Y轴相对大板的偏移量 + */ + y: number; +} +declare interface IBomPlankMetaInfo { + /** + * 材质 + */ + material: string; + /** + * 基材 + */ + baseMaterial: string; + /** + * 厚度 + * 单位:毫米 + * 当为浮点数时,将会是字符串 + */ + thickness: number | string; + /** + * 宽度 + * 单位:毫米 + * 当为浮点数时,将会是字符串 + */ + width: number | string; + /** + * 高度 + * 单位:毫米 + * 当为浮点数时,将会是字符串 + */ + height: number | string; +} +/** + * 方案模型ID + */ +declare interface IBomPlankModelId { + /** + * 酷家乐工具中,该板件对应的子模型 ID + */ + modelId: string; +} +/** + * 关联的板件信息 + * 仅支持创建板件时写入,更新板件时不支持更新关联关系 + */ +declare interface IBomPlankRelation { + relation?: { + /** 关联类型 */ + relationType: EPlankRelationType; + /** 关联板件数据 */ + relationData: IBomPlankEditable[]; + }; +} +/** + * 更新板件时,使用的信息 + * @vm-type UnknownType + */ +declare type IBomPlankUpdate = IBomPlankWithId & Partial, 'relation'>>; +/** + * 板件ID信息 + */ +declare interface IBomPlankWithId { + /** + * 板件ID + */ + plankId: string; +} +/** + * 产品基本信息 + */ +declare interface IBomProductMetaInfo { + /** + * 产品ID + */ + productId?: string; + /** + * 产品名称 + */ + productName?: string; +} +/** + * 成品板件轮廓 + * @vm-type UnknownType + */ +declare interface IBomProfile { + /** + * 点的坐标,每两个值代表一个点 + * eg: [100, 200, 250, 300] + */ + points: number[]; + curves: T[]; + /** 名称 */ + name?: string; +} +/** + * 清除Bom物料的属性 + */ +declare interface IBomPropertiesClearOption> { + /** + * 物料id集合 + */ + ids: string[]; + /** + * 需要清空的属性值 + */ + properties: T[]; +} +/** + * @vm-type UnknownType + */ +declare type IBomRawPlank = IBomRawPlankEditable & IBomRawPlankWithId; +/** + * 大板可编辑字段 + */ +declare interface IBomRawPlankEditable extends Omit, IBomPlankMetaInfo { + /** + * 数量 + */ + quantity: number; + /** + * 使用大板的批次 + */ + mergeId: string; + /** + * 规格 + */ + model: string; +} +/** + * 排版结果信息 + * @vm-type UnknownType + */ +declare interface IBomRawPlankLayoutResult { + /** + * 综合的平均利用率 + */ + averageRate: number; + layouts: Array & { + /** + * 大板或余料利用率 + */ + rate: number; + /** + * 宽度 + * 单位:毫米 + */ + width: number; + /** + * 高度 + * 单位:毫米 + */ + height: number; + /** + * 厚度 + * 单位:毫米 + */ + thickness?: number; + /** + * 大板面积 + */ + rawPlankArea: number; + /** + * 所有小板件面积之和 + */ + sumOfPlankArea: number; + /** + * 切割的板件列表 + */ + planks: Array; + /** + * 排版记录id + */ + layoutId: string; + }>; + }>; +} +declare interface IBomRawPlankMeta { + /** + * 大板序号 + * 从0开始 + */ + rawPlankIndex: number; + /** + * 大板类型:大板(RAW),余料(SURPLUS) + */ + rawPlankType: EBomRawPlankType; + /** + * 大板ID或余料ID + */ + rawPlankId: string; +} +declare interface IBomRawPlankWithId { + /** + * 板ID + */ + id: string; +} +/** + * 房间基本信息 + */ +declare interface IBomRoomMetaInfo { + /** + * 房间号 + */ + roomId?: string; + /** + * 房间名称 + */ + roomName?: string; +} +/** + * @vm-type UnknownType + */ +declare type IBomSurplusPlank = IBomSurplusPlankEditable & IBomSurplusPlankWithId; +/** + * 余料 + */ +declare interface IBomSurplusPlankEditable extends Omit, IBomPlankMetaInfo { + /** + * 产生余料的批次 + */ + fromMergeId: string; + /** + * 使用余料的批次 + */ + usedMergeId: string; +} +declare interface IBomSurplusPlankWithId { + id: string; +} +/** + * 自定义参数 + * @vm-type IBzParamType + */ +declare interface IBzParamModelLiteProperty { + /** + * 参数命名空间 + */ + namespace: string; + /** + * 参数名称,为key + */ + name: string; + /** + * 参数中存取的值 + */ + value: string | undefined; + /** + * 当前字段数据类型 + */ + type: EBzPropertyType | string; + /** + * 当前参数是否只读 + */ + readonly: boolean; + /** + * 获取参数名称 + */ + getName(): string; + /** + * 获取参数命名空间 + */ + getNamespace(): string; + /** + * 获取当前参数类型 + */ + getType(): string; + /** + * 读取值 + */ + getValue(): T | undefined; + /** + * 设置值 + */ + setValue(value: T): void; +} +declare interface ICategory { + /** + * 品类编码 + */ + code: string; + /** + * 品类名称 + */ + name: string; + /** + * 详细描述该品类的定义 + */ + description?: string; +} +/** + * 扩展自定义字段 + */ +declare interface ICategoryAttribute { + /** + * 属性值在JSON中的名称 + */ + name: string; + /** + * 当前字段的含义的详细描述 + */ + description?: string; + /** + * 字段类型 + * @vm-type UnknownType + */ + type: 'STRING' | 'INTEGER' | 'FLOAT' | 'TIME'; + /** + * 属性的约束规则 + */ + rules: ICategoryAttributeRule[]; +} +/** + * 属性的约束规则 + */ +declare interface ICategoryAttributeRule { + /** + * 是否可以为空; + * @default false + */ + notNull?: boolean; + /** + * 限定枚举可选值 + * 当前categoryAttribute + * 当name为:textureDirection(纹理方向)时: + * enumValues可以为以下几个值: + * * HORIZONTAL 水平 + * * VERTICAL 垂直 + * * NONE 无 + * 当name为:openDirection(开门方向)时: + * enumValues可以为以下几个值: + * * LEFT 左开门 + * * RIGHT 右开门 + * * TOP 上开门 + * * BOTTOM 下开门 + * * NONE 无 + */ + enumValues?: string[]; +} +/** + * 检查是否具有某个订单的操作权限参数 + */ +declare interface ICheckOperatePermissionOption { + /** + * @deprecated 可使用 `operationKey` 替代 + */ + eventKey?: string; + /** + * 操作的key,可使用 `getOperationsAsync` API获取 + */ + operationKey: string; + /** + * 订单ID,对于通用的操作不需要传递订单ID,例如:创建订单操作 + */ + orderId?: string; +} +/** + * 检查订单模式下权限的参数 + */ +declare interface ICheckOrderModePermissionOption { + /** + * 订单ID + */ + orderId: string; + /** + * 配置类型 + */ + mode: EOrderModeConfigType; + /** + * 操作类型 + */ + action: string; +} +/** + * 方案中所有组合的基本信息 + */ +declare interface ICombinationData { + /** + * 组合对应的商品名称 + */ + name: string; + /** + * 组合对应的商品 id(这里未加密,用户应该用不了) + */ + brandGoodId: number; + /** + * 组合中模型的 id + */ + paramModelIds: Array; + /** + * 组合尺寸 + */ + size: Number3; + /** + * 组合旋转 + */ + rotate: Number3; + /** + * 组合坐标 + */ + position: Number3; + /** + * 组合收藏转素材后的商品 id(这里也没加密,用户应该用不了) + */ + collectBrandGoodId: number; + /** + * 组合类型。"instance" 实例组合;"template" 模板组合 + */ + assemblyModelType: string; + /** + * id + */ + id: string; + /** + * other fields + */ + [key: string]: any; +} +declare interface ICommonIntersected { + /** + * 当前交接信息所有顶点的信息 + * * 如果为交接面,length为4 + * * 如果为交接体,length为8 + */ + points: Number3[]; + /** + * 当前交接信息产生的元件ID + */ + linkedModelId: string; + /** + * 交接信息产生元件的父母ID + */ + linkedParentModelId: string; + /** + * 交接数据的数据类型 + */ + '@type': T; + /** + * @ignore + * 交接体的shell数据 + */ + shell?: string; + /** + * 交接体板面是否需要开槽 + * 当五金与板面产生的交接信息,为板面的部分,则为true + */ + needGroove?: boolean; +} +/** + * 创建售后单 + */ +declare type ICreateAfterSaleOrderFromDesignOption = ICreateOrderOption; +/** + * 创建客户参数 + */ +declare interface ICreateCustomerOption { + /** 客户姓名 */ + customerName: string; + /** 客户电话 */ + customerPhone: string; + /** 客户地址 */ + customerAddr?: string; + /**门店id */ + storeId?: string; +} +declare interface ICreateCustomerResult { + /** 客户id */ + customerId: string; +} +/** + * 云图环境,创建定制模型时,API参数 + */ +declare interface ICreateCustomModelSimpleOption extends Partial { + /** + * 商品ID + */ + productId: string; +} +/** + * 创建订单参数 + */ +declare interface ICreateOrderOption { + /**订单名称 */ + orderName: string; + /**订单类型 */ + orderType: EToolType[]; + /** 客户id */ + customerId: string; + /**客户姓名 */ + customerName: string; + /**客户电话 */ + customerPhone: string; + /**客户地址 */ + customerAddr?: string; + /** 门店id */ + storeId?: string; + /**门店名称 */ + storeName?: string; + /**联系人 */ + contactUser?: string; + /**联系电话 */ + contactPhone?: string; + /**收货地址 */ + shippingAddr?: string; + /**订单备注 */ + remark?: string; + /**提审的顶层模型 ID 列表 */ + modelIds: string[]; + /**自定义字段 (key:自定义字段名称、value:字段值)*/ + customFields?: Record; + /** 设计附件信息 */ + designAttachments?: IDesignAttachments[]; + /** 紧急程度 */ + emergencyLevel?: number; + /** 单据类型 */ + receiptType?: number; + /** 父订单ID */ + parentOrderId?: string; + /** 组件提审信息,如果提审的是组合下的顶层模型也存放在该字段 */ + subModels?: ISubModel[]; + /** 设计备注 */ + designRemark?: string; + /** 订单附件信息 */ + attachments?: IDesignAttachments[]; +} +/** + * 创建订单返回结果 + */ +declare interface ICreateOrderResult { + /**订单id */ + orderId: string; + /**订单编号 */ + orderNo: string; +} +/** + * 两点之间的曲线 + */ +declare interface ICurve { + type: string; + /** 表示凸度,正表示逆时针,负表示顺时针 */ + bulge?: number; + ellipse?: IEllipse; +} +/** + * 进入定制环境某个模式时,附带参数信息 + */ +declare interface ICustomEnterAppMode { + /** + * 需要进入的模式 + */ + mode: ECustomAppMode; + /** + * other options + */ + [s: string]: any; +} +declare interface ICustomerBaseInfo { + /** 客户姓名 */ + customerName: string; + /** 客户电话 */ + customerPhone: string; + /** 客户地址 */ + customerAddr: string; +} +/** + * 客户信息 + */ +declare interface ICustomerInfo extends ICustomerBaseInfo { + /** 客户id */ + customerId: string; + /** 门店名称 */ + storeName: string; + /** 创建者名称 */ + creatorName: string; +} +/** + * 订单2.0 + */ +/** + * 客户订单详情 + */ +declare interface ICustomerOrderDetail { + /** + * 订单模板 + */ + templateKey: string; + /** + * 订单ID + */ + orderId: string; + /** + * 订单可读编号 + */ + orderReadableId: string; + /** + * 订单名称 + */ + orderName: string; + /** + * 客户名称 + */ + customerName: string; + /** + * 客户联系方式 + */ + customerPhoneNumber: string; + /** + * 客户所在地区 + * @example 北京市/海淀区 + */ + customerArea?: string; + /** + * 客户详细地址 + */ + customerAddress?: string; +} +declare interface ICustomField { + /** + * 自定义信息的系统ID + */ + fieldId: string; + /** + * 自定义信息的字段名称 + */ + fieldName: string; + /** + * 自定义信息的字段值 + */ + customFieldValue: string; + /** + * 材质商品id,同obsBrandGoodId + */ + obsBrandGoodId: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 参数化组合或实例组合 + */ +declare interface ICustomModelAssemblySimple extends Omit { + /** + * 当为参数化组合时,商品ID + */ + productId?: string; + /** + * 当为参数化组合时,商品名称 + */ + productName?: string; + /** + * 组合下的实例模型 + */ + children: ICustomModelPureSimple[]; +} +/** + * 针对IFindParamModelOption作简化后的版本,需要仍然对IFindParamModelOption作兼容处理 + */ +declare interface ICustomModelFilter { + /** + * 返回的结果中是否包含锁定的模型 + * @default false + */ + locked?: boolean; + /** + * 返回结果中,是否包含隐藏的模型 + * @default false + */ + hidden?: boolean; + /** + * 返回的结果中,是否包含已提审的模型 + * @default false + */ + submitted?: boolean; + /** + * 返回的结果中,是否包含只读的模型 + * @default false + */ + readonly?: boolean; + /** + * 返回的结果中,是否包含非当前房间的模型(当前房间为方案中选中的房间) + * @default false + */ + exclusive?: boolean; +} +/** + * 模型轻量信息 + */ +declare interface ICustomModelLiteInfo { + /** + * 模型ID + */ + id: string; + /** + * 所属工具线 + */ + toolType: EToolType; + /** + * 模型名称 + */ + name: string; + /** + * 户型信息 + */ + roomInfo: IRoomInfo; + /** + * 模型是否已拆单 + */ + isSplit: boolean; + /** + * 模型是否锁定 + */ + isLocked: boolean; + /** + * 模型是否隐藏 + */ + isHidden: boolean; + /** + * 模型是否提审 + */ + isAudited: boolean; +} +/** + * 获取到的定制模型信息 + */ +declare interface ICustomModelPureSimple extends ICustomModelSimpleChangeable { + /** + * 模型ID + */ + elementId: ElementId_2; + /** + * 当前模型所属的工具线 + */ + toolType: EToolType; + /** + * 商品ID + */ + productId: string; + /** + * 商品名称 + */ + productName: string; + /** + * 模型的真分类ID + */ + category: number; +} +/** + * 模型在非定制环境下,可以被更新的属性集合 + */ +declare interface ICustomModelSimpleChangeable { + /** + * 模型名称 + */ + name: string; + /** + * 模型的位置信息 + */ + position: Number3; + /** + * 模型的旋转 + */ + rotation: Number3; + /** + * 模型的尺寸(当为模型) + */ + size: Number3; +} +/** + * 删除订单附件参数 + */ +declare interface IDeleteAttachmentOption { + /** 附件key */ + uploadKey: string; + /** 订单id */ + orderId: string; +} +/** + * 删除线条时的配置信息 + * 以下参数必传一个或多个 + */ +declare interface IDeleteMoldingsOption { + /** + * 订单ID + */ + orderId: string; + productIds: string[]; + moldingIds: string[]; + orderIds: string[]; +} +/** + * 删除订单备注参数 + */ +declare interface IDeleteOrderRemarkOption { + /** 备注id */ + remarkId: string; + /** 订单ID */ + orderId?: string; +} +/** + * 通过订单状态删除附件 + */ +declare interface IDeleteOrderStateAttachmentOption { + /** 附件key */ + uploadKey: string; + /** 订单id */ + orderId: string; + /** 订单状态 */ + orderState: number; +} +declare interface IDesignAttachments { + /**附件上传key */ + uploadKey: string; + /**附件名称 */ + name: string; + /**附件CDN地址 */ + url: string; +} +/** + * 方案信息 + */ +declare interface IDesignData { + /** + * 房间基本信息,包含房间id、房间名称 + */ + roomDataList: IRoomData[]; + /** + * 方案中所有顶层模型的id + */ + paramModelIds: Array; + /** + * 方案对应的楼层信息 + */ + levelIndex: string; + /** + * 方案中的组合模型信息 + */ + combinationDataList: ICombinationData[]; + /** + * other fields + */ + [key: string]: any; +} +/** + * 方案JSON导出数据 + */ +declare interface IDesignExportData { + /** + * 模型信息 + */ + paramModel: IExportParamModelData[]; + /** + * 素材商品信息 + */ + resource: IResource; + /** + * 客户订单信息 + */ + partnerOrder: IPartnerOrder; + /** + * 方案信息 + */ + designData: IDesignData; + /** + * 组合模型信息 + */ + assemblyModels: IAssemblyModels[]; + /** + * 生产单信息 + */ + auditDesignOrders: IAuditDesignOrders[]; + /** + * 审核单信息 + */ + auditOrder: IAuditOrder; + /** + * Json基本信息 + */ + jsonInfo: IJsonInfo; + /** + * 工具线 + */ + toolTypes: Array; + /** + * 其他新增字段 + */ + [key: string]: any; +} +/** + * 获取方案JSON数据入参 + */ +declare interface IDesignExportDataParams { + /** + * 楼层Id + * 默认当前所在楼层 + */ + levelId?: string; + /** + * 工具线 + * 默认当前所在工具线 + */ + toolType?: EToolType; + /** + * 房间id + * 默认当前选中的房间 + */ + roomId?: string; + /** + * 超时时间,单位(s) + * 默认最大超时时间(10min) + */ + timeout?: number; + /** + * 模板id + */ + templateId?: string; + /** + * 模型id + */ + modelIds?: string | string[]; +} +/** + * 方案JSON数据导出返回数据类型 + */ +declare interface IDesignExportDataResponse { + /** + * 状态码 + */ + code: EDesignExportCode; + /** + * 失败等错误信息 + */ + message: string; + /** + * 返回数据结果 + */ + data: T; +} +/** + * 方案数据导出 url + */ +declare type IDesignExportUrlDataResponse = IDesignExportDataResponse<{ + url: string; +} | null>; +/** + * XML导出入参 + */ +declare interface IDesignExportXmlDataParams { + /** + * 模型列表 + */ + elements?: Array; + /** + * 楼层Id + * 默认当前所在楼层 + */ + levelId?: string; + /** + * 工具线 + * 默认模型所在工具线/当前所在工具线 + */ + toolType?: EToolType; + /** + * 超时时间,单位(s) + * 默认最大超时时间(10min) + * @default 600 + */ + timeout?: number; +} +/** + * 获取方案关联的全部订单列表参数 + */ +declare interface IDesignOrderListOption { + /**订单状态 */ + orderState?: number; +} +/** + * 获取方案关联的全部订单列表返回结果 + */ +declare type IDesignOrderListResult = IOrderBaseInfo; +/** 检测结果 */ +declare interface IDetectBaseResult { + /** 接口状态 */ + status: ECheckModelsStatus; + /** 是否有权限 */ + hasPermission: boolean; + /** 错误消息 */ + error?: any; + /** 检测结果 */ + result?: T; +} +/** + * 下单检测配置项 + */ +declare type IDetectConfig = Partial>; +/** + * 检测项 + */ +declare type IDetectItem = Partial>; +/** + * 检测参数 + */ +declare interface IDetectOption { + /** + * 工具线 + * 默认当前所在工具线 + */ + toolType?: EToolType; +} +declare interface IDetectResult { + /** + * 检测结果 + * 当无权限时不返回 + */ + result?: boolean; + /** + * 错误消息 + */ + errMsg?: string; +} +declare interface IDoorCoveringHardwareMode { + /** + * 五金模式: + * edit: 编辑五金 + * add: 添加五金 + */ + hardwareModel: 'edit' | 'add'; + /** + * 选择的对象: + * door:掩门 + * cabinet:柜体 + */ + selectTarget: 'door' | 'cabinet'; +} +declare global { + namespace IDP { + export namespace Platform { + /* Excluded from this release type: pauseActivities */ + /* Excluded from this release type: resumeActivities */ + } + } +} +export {}; +declare global { + namespace IDP { + /** + * 小程序与酷家乐页面承载方(以iframe形式承载酷家乐)通讯相关接口 + */ + export namespace Host { + /** + * 发送消息至承载方,会验证承载方的origin是否满足要求,如果没有承载方或者不满足要求,则不会发送 + * @param data 发送的数据 + */ + export function postMessage(data: any): void; + /** + * 监听来自酷家乐承载方的消息,会验证承载方的origin是否满足要求,如果没有承载方或者不满足要求,则不会触发 + * @param callback 消息回调 + */ + export function onMessageReceive(callback: (data: any) => void): void; + } + } +} +export {}; +declare global { + namespace IDP { + /** + * 小程序基础接口,包括退出等 + * + * @vm-type Miniapp + */ + export namespace Miniapp { + /** + * 小程序视图实例,用于控制iframe挂载,创建等 + */ + const view: View; + /* Excluded from this release type: getLaunchOptions */ + /* Excluded from this release type: broadcast */ + /** + * 退出小程序 + */ + export function exit(): void; + } + } +} +export {}; +declare global { + namespace IDP { + /** + * UI控制相关接口 + */ + export namespace UI { + /** + * 布局信息, 字段含义等同于`getBoundingClientRect`,建议参考: https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect + */ + export interface ClientRect { + top: number; + left: number; + bottom: number; + right: number; + width: number; + height: number; + } + /** + * 页面布局尺寸信息 + */ + export interface Layout { + /** + * 窗口宽度,等同于`window.innerWidth` + */ + windowWidth: number; + /** + * 窗口高度,等同于`window.innerHeight` + */ + windowHeight: number; + /** + * 顶部栏布局信息 + */ + topBar: ClientRect; + /** + * 底部栏布局信息 + */ + bottomBar: ClientRect; + /** + * 左侧栏布局信息 + */ + leftPanel: ClientRect; + } + /** + * 注册一个回调当主题发生变更的时候触发 + * @param fn callback + * + * @vm-function-keepArgsHandle + */ + export function onThemeChange(fn: (theme: Theme) => void): void; + /** + * 隐藏除了场景之外的所有ui元素,包括左侧栏,顶部栏等 + */ + export function hideAll(): void; + /** + * 获取计算后的布局信息 + */ + export function computeLayout(): Layout; + /** + * toast实例 + */ + const toast: Toast; + /** + * 当前的主题 + */ + const theme: Theme; + } + } +} +export {}; +declare global { + namespace IDP { + export namespace Design { + /** + * 保存方案 + */ + export function save(): Promise; + } + } +} +export {}; +declare global { + namespace IDP { + export namespace Scene3D { + /* Excluded from this release type: updateCameraType */ + /* Excluded from this release type: updateCameraAttributes */ + /* Excluded from this release type: getCameraAttributes */ + } + } +} +export {}; +declare global { + /** 小程序接口合集 */ + namespace IDP { + /** 云设计工具主应用级别接口 */ + export namespace Platform { + } + /** + * UI控制相关接口 + */ + export namespace UI { + /* Excluded from this release type: dialogConfirm */ + /* Excluded from this release type: showFullscreenMask */ + /* Excluded from this release type: hideFullscreenMask */ + } + /** 方案信息相关接口 */ + export namespace Design { + } + /** 用户信息相关接口 */ + export namespace User { + } + /** 数据相关接口 */ + export namespace DB { + export namespace Types { + } + } + /** 用户交互行为相关接口 */ + export namespace Interaction { + /** + * 获取当前选中的对象列表 + */ + export function getSelectedElements(): IDP.DB.Types.ElementId[]; + /** + * 设置当前选中的对象列表 + * 目前支持下面几种 ElementType:Wardrobe、WardrobeCopy、Cabinet、CabinetCopy、DoorWindow、DoorWindowCopy、CustomGroup; + * @param option + * @returns 返回已选中的对象列表,没有选中的对象则返回[]; + */ + export function setSelectedElements(option: IDP.DB.Types.ElementId[]): IDP.DB.Types.ElementId[]; + /* Excluded from this release type: setHighlightedElements */ + } + /** 小程序可监听的事件集合 */ + // eslint-disable-next-line @typescript-eslint/no-empty-interface + export interface EventTypes { + } + /** 小程序事件相关接口 */ + export namespace Events { + } + } +} +export {}; +declare global { + namespace IDP { + export namespace Platform { + /* Excluded from this release type: getURLSearchParams */ + /** + * 应用模式标识 + */ + export enum AppMode { + /** + * 云图模式 + */ + DefaultMode = 'DefaultMode', + /** + * 户型模式 + */ + SuperFloorplanMode = 'SuperFloorplanMode', + /** + * 定制模式 + */ + CustomMode = 'CustomMode', + /** + * 其余模式统称 + */ + UnknownMode = 'UnknownMode' + } + /** + * 获取当前应用模式 + */ + export function getAppMode(): AppMode; + /** + * 获取当前语言和地区设置 + */ + export function getLocale(): Locale; + /* Excluded from this release type: redirect */ + /** + * 长度单位类型 + */ + export enum LengthUnitType { + /** 毫米 */ + mm, + /** 米 */ + m, + /** 英尺 */ + ft, + /** 英寸 */ + in + } + /** + * 获取全局默认长度单位类型 + */ + export function getGlobalLengthUnit(): LengthUnitType; + /** + * 获取全局默认长度展示精度 + * + * 展示精度有两类,小数和分数: + * - 小数类,比如 '0.001',1.23456 在该展示精度下应展示为 '1.235' + * - 分数类,比如 '1/4',1.23456 在该展示精度下应展示为 '1 1/4' + * + * @returns {string} + */ + export function getGlobalLengthPrecision(): string; + /* Excluded from this release type: setCursorStyle2D */ + /* Excluded from this release type: unSetCursorStyle2D */ + /* Excluded from this release type: setCursorStyle3D */ + /* Excluded from this release type: unSetCursorStyle3D */ + /* Excluded from this release type: getPubInjectionAsync */ + } + export namespace Events { + /** + * 添加小程序事件监听 + * + * @vm-type IDP_Events_on + */ + export function on(eventType: T, callback: (data: IDP.EventTypes[T]) => void): void; + /** + * 添加仅一次的小程序事件监听 + * + * @vm-type IDP_Events_once + */ + export function once(eventType: T, callback: (data: IDP.EventTypes[T]) => void): void; + /** + * 移除小程序事件监听 + * + * @vm-type IDP_Events_off + */ + export function off(eventType: T, callback: (data: IDP.EventTypes[T]) => void): void; + } + export namespace Design { + export interface Level { + // 楼层的id + id: string; + // 楼层的名称 + name: string; + // 楼层位置。1,2,3表示地上一层二层三层;-1,-2,-3表示地下一层二层三层;其他以此类推 + index: number; + } + /** + * 获取当前方案id + */ + export function getDesignId(): string | undefined; + /** + * 获取方案名称 + */ + export function getName(): string | undefined; + /** + * 获取方案全部楼层的信息 + * + * @returns 方案全部楼层,按照从低到高排序,如果是新方案会返回空数组 + */ + export function getAllLevels(): Level[]; + /** + * 获取方案当前所在楼层的信息 + * + * @returns 当前所在楼层的信息,如果是新方案会返回undefined + */ + export function getCurrentLevel(): Level | undefined; + /** + * 切换方案当前的楼层 + * + * @param levelId + * @returns 切换楼层完成后promise resolve,切换失败reject + */ + export function changeCurrentLevelAsync(levelId: string): Promise; + } + export namespace User { + /** + * 获取当前用户id + */ + export function getUserId(): string; + } + export namespace DB { + export namespace Types { + /** + * 设计对象类型 + */ + export enum ElementType { + /** 软装家具 */ + Furniture = 'Furniture', + /* Excluded from this release type: FurnitureGroup */ + /** 全屋定制家具 */ + Wardrobe = 'Wardrobe', + /** 全屋定制家具副本 */ + WardrobeCopy = 'WardrobeCopy', + /** 厨卫 */ + Cabinet = 'Cabinet', + /** 厨卫副本 */ + CabinetCopy = 'CabinetCopy', + /** 门窗 */ + DoorWindow = 'DoorWindow', + /** 门窗副本 */ + DoorWindowCopy = 'DoorWindowCopy', + /** 踢脚线 */ + Skirting = 'Skirting', + /** 硬装铺贴 */ + Paving = 'Paving', + /* Excluded from this release type: ParamCeiling */ + /** 定制组合 */ + CustomGroup = 'CustomGroup', + /** 模型门窗 */ + ModelDoorWindow = 'ModelDoorWindow', + /** 模型踢脚线 */ + ModelMolding = 'ModelMolding', + /** 混组 */ + MixGroup = 'MixGroup', + /** + * 户型-墙 + */ + Wall = 'Wall', + /* Excluded from this release type: Opening */ + /** + * 户型-房间 + */ + Room = 'Room', + /** 家具图例 */ + FurnitureLegend = 'FurnitureLegend', + /** 参数化图例 */ + ParamLegend = 'ParamLegend', + /** 图例组合 */ + LegendGroup = 'LegendGroup', + /* Excluded from this release type: Zone */ + /** 厨卫引用模型 */ + CabinetRef = 'CabinetRef', + /** 厨卫副本引用模型 */ + CabinetCopyRef = 'CabinetCopyRef', + /** 全屋引用模型 */ + WardrobeRef = 'WardrobeRef', + /** 全屋副本引用模型 */ + WardrobeCopyRef = 'WardrobeCopyRef', + /** 厨卫装配模型 */ + CabinetSnapper = 'CabinetSnapper', + /** 厨卫副本装配模型 */ + CabinetCopySnapper = 'CabinetCopySnapper', + /** 全屋装配模型 */ + WardrobeSnapper = 'WardrobeSnapper', + /** 全屋副本装配模型 */ + WardrobeCopySnapper = 'WardrobeCopySnapper', + /** 厨卫装配体 */ + CabinetSnapperGroup = 'CabinetSnapperGroup', + /** 厨卫副本装配体 */ + CabinetCopySnapperGroup = 'CabinetCopySnapperGroup', + /** 全屋装配体 */ + WardrobeSnapperGroup = 'WardrobeSnapperGroup', + /** 全屋副本装配体 */ + WardrobeCopySnapperGroup = 'WardrobeCopySnapperGroup' + } + /** + * 设计对象 ID + */ + export interface ElementId { + /** 实例 ID */ + id: string; + /** 类型 */ + type: ElementType; + } + } + } + export interface EventTypes { + /** 监听当前选中的对象列表的变更 */ + 'IDP.Interaction.SelectedElementsChange': IDP.DB.Types.ElementId[]; + /** + * 监听定制模型新增 + */ + 'IDP.Custom.Design.CustomModel.Add': IDP.DB.Types.ElementId[]; + /** + * 监听定制模型删除 + */ + 'IDP.Custom.Design.CustomModel.Delete': IDP.DB.Types.ElementId[]; + /** + * 监听模型新增 + */ + 'IDP.DB.Element.Add': IDP.DB.Types.ElementId[]; + /** + * 监听模型删除 + */ + 'IDP.DB.Element.Delete': IDP.DB.Types.ElementId[]; + /* Excluded from this release type: "IDP.DB.Element.Update" */ + /** + * 监听是否触发保存 + */ + 'IDP.Design.Save': void; + /* Excluded from this release type: "IDP.Design.Loaded" */ + /** + * 监听定制数据加载完成 + */ + 'IDP.Custom.Design.Loaded': void; + /** + * 监听 **云设计工具页面** 文档视图(窗口)大小调整 + */ + 'IDP.UI.Layout.WindowResize': void; + } + export namespace Miniapp { + /** + * 获取通过 uploadDataAsync 上传的临时存储数据 + * + * 需要将 uploadDataAsync 返回的 **uniqueId** 作为 URL 参数 **miniappUploadId** 传入 + * + * https://yun.kujiale.com/cloud/tool/h5/bim?designid=${designId}&miniappUploadId=${uniqueId} + */ + export function getUploadedDataAsync(): Promise; + /** + * 临时存储数据,24 小时后自动清理 + * + * 返回值中的 **uniqueId** 是获取临时存储数据的媒介 + */ + export function uploadDataAsync(option: MiniappUploadDataOption): Promise; + /* Excluded from this release type: launchMiniappById */ + } + } +} +export {}; +declare global { + namespace IDP { + export namespace Math { + const KGeomLib: KGeomLib_2; + const KCurve2dType: typeof KCurve2dType_2; + const KCurve3dType: typeof KCurve3dType_2; + const KPtInLoopType: typeof KPtInLoopType_2; + const KCurveSurfaceIntersectType: typeof KCurveSurfaceIntersectType_2; + const KSurfaceType: typeof KSurfaceType_2; + const KCurveInLoopType: typeof KCurveInLoopType_2; + const KFaceBooleanType: typeof KFaceBooleanType_2; + export type KBoundedCurve2d = KBoundedCurve2d_2; + export type KBoundedCurve3d = KBoundedCurve3d_2; + export type KLineSegment3d = KLineSegment3d_2; + export type KGeomFace2d = KGeomFace2d_2; + export type KLine3d = KLine3d_2; + export type KArc3d = KArc3d_2; + export type KFace3d = KFace3d_2; + } + } +} +export {}; +declare global { + namespace IDP { + export namespace DB { + export namespace Methods { + /* Excluded from this release type: updateDecorationByTaskIdAsync */ + /* Excluded from this release type: deleteMoldingById */ + /* Excluded from this release type: isProductInDecorationDesignAsync */ + /* Excluded from this release type: replaceDecorationProductAsync */ + /* Excluded from this release type: isDecorationProductAsync */ + } + } + } +} +export {}; +declare global { + namespace IDP { + export namespace Interaction { + /** + * 拖拽创建设计对象到场景 + * @param productId 商品 ID + */ + export function startDragProductAsync(productId: string): Promise; + } + export namespace DB { + export namespace Types { + /** + * 门窗类型定义,值和模型门窗中一致 + */ + export enum ModelDoorWindowType { + /** 普通窗 */ + Window = 1, + /** 落地窗 */ + FrenchWindow, + /** 飘窗 */ + BayWindow, + /** 单开门 */ + Door, + /** 双开门 */ + DoubleDoor, + /** 移门 */ + SlidingDoor + } + } + export namespace Methods { + /** + * 直接创建软装家具 + * @param furnitureInfo 创建软装家具所需的信息 + */ + export function createFurniture(furnitureInfo: FurnitureCreateInfo): Promise; + /* Excluded from this release type: createFurnitureList */ + /** + * 根据设计对象 ID 删除软装家具 + * @param elementId 设计对象 ID + */ + export function deleteFurniture(elementId: IDP.DB.Types.ElementId): boolean; + /** + * 根据设计对象 ID 查询软装家具详细信息 + */ + export function getFurniture(elementId: IDP.DB.Types.ElementId): Furniture | undefined; + /* Excluded from this release type: createFurnitureGroup */ + /* Excluded from this release type: deleteFurnitureGroup */ + /* Excluded from this release type: getAllFurnitureList */ + /* Excluded from this release type: getAllFurnitureGroupList */ + /* Excluded from this release type: getAllModelMoldingList */ + /* Excluded from this release type: getElementTypeByProductIdAsync */ + /* Excluded from this release type: replaceModelMoldingAsync */ + /** + * 查询所有模型门窗详细信息 + */ + export function getAllModelDoorWindowList(): ModelDoorWindow[]; + /** + * 根据设计对象 ID 查询模型门窗详细信息 + * @param elementId 设计对象 ID + */ + export function getModelDoorWindow(elementId: IDP.DB.Types.ElementId): ModelDoorWindow | undefined; + /** + * 根据设计对象 ID 删除模型门窗 + * @param elementId 设计对象 ID + */ + export function deleteModelDoorWindow(elementId: IDP.DB.Types.ElementId): boolean; + /** + * 创建模型门窗 + * @param modelDoorWindowInfo 创建模型门窗所需信息 + */ + export function createModelDoorWindowAsync(modelDoorWindowInfo: ModelDoorWindowCreateInfo): Promise; + } + } + } +} +export {}; +declare global { + namespace IDP { + export namespace DB { + export namespace Methods { + /* Excluded from this release type: createParamCeilingListAsync */ + /* Excluded from this release type: getParamCeilingList */ + /* Excluded from this release type: deleteParamCeilingList */ + } + } + } +} +export {}; +declare global { + namespace IDP { + export namespace DB { + // Types + export namespace Types { + /* Excluded from this release type: CourseType */ + export interface GrepFace { + /** + * 建筑面Id + */ + readonly id: string; + /** + * 3D几何 + */ + readonly geometry: KFace3d_2; + /** + * 参与围成的房间 + */ + readonly roomIds: IDP.DB.Types.ElementId[]; + } + /* Excluded from this release type: StructuralWallUsage */ + export interface Wall { + readonly id: IDP.DB.Types.ElementId; + /* Excluded from this release type: location */ + /* Excluded from this release type: thickness */ + /* Excluded from this release type: height */ + /* Excluded from this release type: structuralUsage */ + readonly profile2d: KGeomFace2d_2[]; + readonly geometry3d: GrepFace[]; + } + export interface Opening { + readonly id: IDP.DB.Types.ElementId; + readonly hostId: IDP.DB.Types.ElementId; + /* Excluded from this release type: contour */ + readonly profile2d: KGeomFace2d_2[]; + } + export interface Room { + readonly id: IDP.DB.Types.ElementId; + readonly type: number; + readonly name: string; + readonly profile2d: KGeomFace2d_2[]; + } + } + // Methods + export namespace Methods { + /** + * 获取所有墙 + * get all walls + */ + export function getAllWallList(): IDP.DB.Types.Wall[]; + /** + * 获取所有房间 + * get all rooms + */ + export function getAllRoomList(): IDP.DB.Types.Room[]; + /** + * 获取所有洞 + * get all openings + */ + export function getAllOpeningList(): IDP.DB.Types.Opening[]; + /* Excluded from this release type: CreateConstructionLayerParam */ + /* Excluded from this release type: RoomConstructionLayerRequest */ + /* Excluded from this release type: AreaConstructionLayerRequest */ + /* Excluded from this release type: HorizontalConstructionCourseRequest */ + /* Excluded from this release type: VerticalConstructionLayerRequest */ + /* Excluded from this release type: VerticalConstructionCourseRequest */ + /* Excluded from this release type: __deprecated__createConstructionLayer */ + /* Excluded from this release type: getSpatialDataAsync */ + /* Excluded from this release type: saveSpatialDataAsync */ + /* Excluded from this release type: deleteConstructionLayerBySourceFaceIds */ + } + } + // TODO + // 暂时先放在这里 + export namespace Design { + /* Excluded from this release type: getDesignConfig */ + } + export namespace Interaction { + /* Excluded from this release type: triggerCadImport */ + /* Excluded from this release type: getCadInfo */ + /* Excluded from this release type: changeCadLayerVisible */ + /* Excluded from this release type: startDrawWall */ + /* Excluded from this release type: startDrawColumn */ + /* Excluded from this release type: startDrawFlue */ + /* Excluded from this release type: startDrawBeam */ + } + /* Excluded from this release type: Integration */ } +} +export {}; +declare global { + namespace IDP { + export namespace Custom { + export namespace DoorWindow { + /* Excluded from this release type: DWModelData */ + /* Excluded from this release type: findDWModelByOpeningIds */ + /* Excluded from this release type: DWReplaceModelInfo */ + /* Excluded from this release type: DWReplaceResponse */ + /* Excluded from this release type: replaceDWModelAsync */ + /* Excluded from this release type: DWReplaceModelInfoV2 */ + /* Excluded from this release type: DWReplaceResponseV2 */ + /* Excluded from this release type: replaceDWModelV2Async */ + } + } + } +} +export {}; +declare global { + namespace IDP { + export namespace Design { + /* Excluded from this release type: getMixGroupAsync */ + /* Excluded from this release type: findMixGroupsAsync */ + } + export interface EventTypes { + /** + * 进入定制子模式下触发的事件 + */ + 'IDP.Custom.Mode.Enter': ECustomAppMode; + /** + * 退出定制子模式下触发的事件 + */ + 'IDP.Custom.Mode.Exit': ECustomAppMode; + /** + * 掩门五金模式,选项配置发生变化时触发 + */ + 'IDP.Custom.DoorCoveringHardware.Mode': IDoorCoveringHardwareMode; + /** + * 掩门五金模式下,模型选中事件 + */ + 'IDP.Custom.DoorCoveringHardware.SelectedElementsChange': IDP.DB.Types.ElementId[]; + /** + * 定制模式下,模型更新事件 + */ + 'IDP.Custom.Design.CustomModel.Update': IDP.DB.Types.ElementId[]; + /** + * 订单模式下,自动更新模型范围变更时触发 + */ + 'IDP.Integration.FOP.OrderMode.OrderModel.Update': Pick; + } + /** + * 定制模式(包含厨卫/家居工具线)下的 API 能力 + */ + export namespace Custom { + /** + * 定制下的一些通用变量或通用函数存放位置 + */ + export namespace Common { + export interface OpenOrCloseOption { + /** + * 调用clientId + */ + clientId?: string; + /** + * 超时时间,默认为30s + */ + timeout?: number; + } + /** + * 定制的ElementId + */ + export type CustomElementId = ElementId_2; + /** + * 定制工具线内部行业线区分 + */ + const ToolType: typeof EToolType; + /** + * 方案类型 + */ + const DesignType: typeof EDesignType; + /** + * 打开对接2.0通信通道,当前此调用此方法,需要先挂载,并且仅支持挂载到main节点 + * 如果需要打开多条通道时,需要指定clientId,否则会出现异常 + * + * @remarks 打开通道 + * ```typescript + * IDP.Miniapp.view.defaultFrame.mount(IDP.Miniapp.view.mountPoints.main); + * ID.Custom.Common.openTerminalAsync().catch(() => { + * IDP.Miniapp.view.defaultFrame.unmount(); + * IDP.Custom.Common.closeTerminalAsync(); + * }); + * ``` + * + */ + export function openTerminalAsync(option?: OpenOrCloseOption): Promise; + /** + * 关闭对接2.0通信通道(在小程序退出时,会自动关闭已打开的通道) + * + */ + export function closeTerminalAsync(option?: OpenOrCloseOption): Promise; + /** + * 获取当前所在的行业线 + */ + export function getCurrentToolType(): EToolType | undefined; + /** + * 获取当前方案类型 + */ + export function getDesignType(): EDesignType | undefined; + /** + * 获取审核/生产方案ID + */ + export function getOrderDesignId(): string | undefined; + /** + * 获取定制数据是否加载完成 + */ + export function isDesignLoaded(): boolean; + } + /** + * 提供内空相关能力 + */ + export namespace InnerSpace { + /** + * 内空的朝向信息 + */ + const Face: typeof EFace; + /** + * 监听主工具当中,选中的内空信息 + * + * @remarks 监听单次选中的内空信息 + * ```typescript + * const cancel = IDP.Custom.InnerSpace.selection.once((inner) => { + * // will log inner + * }); + * // 手动取消监听 + * cancel(); + * ``` + * + * @remarks 监听内空变化触发函数 + * ```typescript + * const cancel = IDP.Custom.InnerSpace.selection.on((inner) => { + * + * }); + * // 手动取消监听 + * cancel(); + * ``` + * @vm-type ISelectionEvtType + */ + const selection: IEvent; + /** + * 获取当前选中的内空信息 + * + * @remarks + * ```typescript + * const innerData = IDP.Custom.InnerSpace.getSelected(); + * ``` + */ + export function getSelected(): IInnerSpaceData | undefined; + } + /** + * 掩门五金模式 + */ + export namespace DoorCoveringHardware { + /** + * 设置商品配置信息 + */ + export interface SetOption { + /** + * 商品ID + */ + productId: string; + } + /** + * 获取掩门五金模式下的配置状态 + */ + export function getOption(): IDoorCoveringHardwareMode; + /** + * 设置掩门五金模式配置 + * @param option + */ + export function setOption(option: IDoorCoveringHardwareMode): void; + /** + * 设置掩门五金模式下的中间件商品ID + * @param option + */ + export function setProductId(option: SetOption): void; + /** + * 在掩门五金模式下,获取当前选中的模型 + */ + export function getSelectedElements(): IDP.DB.Types.ElementId[]; + } + /** + * 提供定制模式切换能力 + */ + export namespace Mode { + /** + * 定制子模式枚举 + * @remarks + * ```typescript + * // 内空模式 + * IDP.Custom.Mode.AppMode.INNER_SPACE + * ``` + */ + const AppMode: typeof ECustomAppMode; + /** + * 在定制制模式下,获取定制子模式 如:内空, 生成等 + * @remarks + * ```typescript + * const mode = IDP.Custom.Mode.current(); + * ``` + */ + export function current(): ECustomAppMode | null; + /** + * 进入定制子模式 + * @remarks 进入内空模式 + * ```typescript + * IDP.Custom.Mode.enter({ + * mode: IDP.Custom.Mode.AppMode.INNER_SPACE, + * }); + * ``` + * @param mode 定制子模式 + * @param {string} mode.orderId 进入订单模式时需传递订单ID (orderId),否则无法进入 + * + * @remarks 进入订单模式 + * ```typescript + * IDP.Custom.Mode.enter({ + * mode: IDP.Custom.Mode.AppMode.FOP_ORDER, + * orderId: 'xxxx' + * }); + * ``` + */ + export function enter(mode: ICustomEnterAppMode): void; + /** + * 退出当前定制子模式 + * @remarks + * ```typescript + * IDP.Custom.Mode.exit(); + * ``` + */ + export function exit(): void; + } + /** + * 提供方案相关能力 + */ + export namespace Design { + /** + * 提供方案输出能力 + */ + export namespace Export { + const DesignExportCode: typeof EDesignExportCode; + const PointType: typeof EPointType; + const ClockWise: typeof EClockWise; + const LineType: typeof ELineType; + /** + * 交接对象类型 + */ + const IntersectModel: typeof EIntersectModelType; + /** + * 商品建模方向 + */ + const ProductDirection: typeof EProductDirection; + /** + * 输出的交接类型 + */ + const IntersectedInfoType: typeof EIntersectedInfoType; + /** + * json输出数据 + */ + export interface ModelJson { + /** + * 模型列表 + */ + paramModel: IExportParamModelData[]; + } + /** + * 获取当前方案导出JSON数据 + * + * 获取厨卫工具线的方案JSON数据 + * @remarks + * ```typescript + * IDP.Custom.Design.Export.getDesignJson({toolType: IDP.Custom.Common.ToolType.Cabinet}).then(res => { + * log(res); + * }); + * ``` + * 附带超时时间 + * @remarks + * ```typescript + * IDP.Custom.Design.Export.getDesignJson({toolType: IDP.Custom.Common.ToolType.Cabinet,timeout: 120}).then(res => { + * log(res); + * }); + * ``` + * 获取指定房间方案输出 + * @remarks + * ```typescript + * IDP.Custom.Design.Export.getDesignJson({roomId: '10250'}).then(res => { + * log(res); + * }) + * ``` + * + * @param option 相关参数 + */ + export function getDesignJsonAsync(option?: IDesignExportDataParams): Promise; + /** + * 获取当前方案完整JSON数据 + * @param option 相关参数 + */ + export function getDesignFullJsonAsync(option?: IDesignExportDataParams): Promise; + /** + * 获取模型json数据,json数据同孔槽方案关联,重新获取清空孔槽方案 + * @deprecated + * WARNING: This API is deprecated. Please use the `getModelJsonAsyncV2` instead. + */ + export function getModelJsonAsync(option: IGetModelJsonOption): Promise; + /** + * 获取当前方案导出JSON数据下载URL地址 + * + * @param option + */ + export function getDesignJsonUrlAsync(option?: IDesignExportDataParams): Promise>; + /** + * 获取当前方案完整JSON数据数据的下载URL地址 + * @param option + */ + export function getDesignFullJsonUrlAsync(option?: IDesignExportDataParams): Promise>; + /** + * 获取当前方案导出XML的数据下载URL地址 + * @param option DesignExportXmlDataParams + */ + export function getDesignXmlUrlAsync(option?: IDesignExportXmlDataParams): Promise; + /** + * 获取渲染报价清单 + * @param {QuotationOption} option + */ + export function getQuotation(option: IQuotationOption): IQuotationResult; + /** + * 获取报价模板 + */ + export function getQuotationTemplateAsync(option?: IQuotationReportTemplateParam): Promise<{ + result: IQuotationReportTemplateItem[]; + }>; + /* Excluded from this release type: getPrivateTopModelList */ + /* Excluded from this release type: getPrivateAssemblyListAsync */ + /** + * 获取模型json数据 + * 按照模型维度生成json数据 + */ + export function getModelJsonAsyncV2(option: GetModelJsonOptionV2): Promise; + /** + * 获取辅助结构定义的孔槽 + * 坐标系原点为关联模型的左后下 + * @remarks + * ```typescript + * const fittingDataList = await IDP.Custom.Design.Export.getFittingDataFromAuxiliaryAsync({modelId: '17EB6C45-A02E-4660-9058-5A8A9E1D1094'}); + * ``` + */ + export function getFittingDataFromAuxiliaryAsync(option: IGetFittingDataByAuxiliaryOption): Promise; + /** + * 获取当前方案楼层模型交接数据 + * 坐标系原点为关联模型的左后下 + * @remarks 获取模型的交接数据 + * ```typescript + * const intersectedData = await IDP.Custom.Design.Export.getIntersectedDataAsync({modelId: '17EB6C45-A02E-4660-9058-5A8A9E1D1094'}); + * ``` + */ + export function getIntersectedDataAsync(option: IGetIntersectedOption): Promise; + } + /** + * 提供参数化模型增删改查能力 + */ + // eslint-disable-next-line no-shadow + export namespace CustomModel { + /** + * 参数类型 + */ + const ParamType: typeof EParamType; + /** + * 定制模型类别 + */ + const ParamModelType: typeof EParamModelType; + /** + * 自定议参数类型 + */ + const BzPropertyType: typeof EBzPropertyType; + /** + * 输出CustomModel类型 + */ + export type CustomModel = IParamModelLite; + /** + * 定制参数化模型类型 + */ + export type CustomModelParam = IParamModelLiteParam; + /** + * 用户自定议参数 + */ + export type CustomModelProperty = IBzParamModelLiteProperty; + /** + * 通过真分类创建一个CustomModel对象 + * @param category 真分类ID + * + * @vm-type NewCustomModelByCategoryAsync + */ + export function newCustomModelByCategoryAsync(category: number): Promise; + /** + * 通过商品ID创建一个CustomModel对象 + * @param productId 商品ID + * + * @vm-type NewCustomModelByProductIdAsync + */ + export function newCustomModelByProductIdAsync(productId: string): Promise; + /** + * 根据模型的的ID,获取方案中的模型信息 + * @param id 模型ID + * + * @vm-type GetCustomModelByModelIdAsync + */ + export function getCustomModelByModelIdAsync(id: string): Promise; + /* Excluded from this release type: getCustomModelInternalByModelIdAsync */ + /** + * 获取当前场景中的顶层模型 + * @param options CustomModel对象数组 + * + * @vm-type FindTopModelsAsync + */ + export function findTopModelsAsync(options?: IListTopModelsOptions): Promise; + /* Excluded from this release type: findTopModelsInternalAsync */ + /** + * 向方案中插入顶层节点 + * @param options CustomModel对象数组 + * + * @vm-type UpdateCustomModelAsync + */ + export function insertAsync(options: { + models: CustomModel[]; + }): Promise; + /** + * 更新CustomModel模型 + * @param options + * + * @vm-type UpdateCustomModelAsync + */ + export function updateAsync(options: { + models: CustomModel[]; + }): Promise; + /** + * 删除指定顶层模型 + * @param options + * + * @vm-type DeleteTopModelsAsync + */ + export function deleteTopModelsAsync(options: { + models: CustomModel[]; + }): Promise; + /** + * 根据模型id获取模型的缩略图信息 + * @param option.modelId 模型ID + * @param option.ignoreCategory 按真分类ID过滤缩略图内部分模型图像 + */ + export function getPreviewImgAsync(option: IGetPreviewImgOption): Promise; + /* Excluded from this release type: getCustomModelToolTypeByProductIdAsync */ + /** + * 分页获取顶层模型轻量信息 + */ + export function getTopModelsLiteInfoAsync(option: IGetTopModelsLiteInfoOption): Promise<{ + /** + * 当前查询总数 + */ + count: number; + /** + * 当前页码 + */ + page: number; + /** + * 分页数量 + */ + size: number; + /** + * 模型数据 + */ + data: ICustomModelLiteInfo[]; + }>; + /* + * 模型或组件高亮 + * @internal + */ + export function highlightModels(option: { + modelIds: string[]; + }): void; + } + /** + * 创建分单方案 + * @param {SplitDesignParams} option + */ + export function splitDesignByElementsAsync(option: ISplitDesignParams): Promise; + } + export namespace Product { + /** + * 判断模型是否是企业库模型 + * @param {string} id 模型id + * @returns {*} {boolean} + */ + export function isEnterpriseLibraryModel(id: string): boolean; + /** + * 反向导入模型 + * 详细介绍及使用可参考 https://open.kujiale.com/open/apps/2/docs?doc_id=653&tab_id=api&path=0_536_651_653 + * @param {ImportModel} option + */ + export function importProductAsync(option: IImportModel): Promise; + /* Excluded from this release type: getProductInfoAsync */ + /* Excluded from this release type: setSelectedLibraryPosition */ + /* Excluded from this release type: setDefaultSelectedLibraryPosition */ + } + /** + * 图纸 + */ + export namespace Drawing { + /** + * 出图方式 + */ + const DivisionType: typeof EDivisionType; + /** + * 出图文件类型 + */ + const FileType: typeof EDrawingFileType; + /** + * 获取模型施工图 + * @param {DrawingExportParams} option + */ + export function getConstructionDrawingByElementsAsync(option: IDrawingExportParams): Promise; + } + /** + * 孔槽方案相关能力 + * @deprecated 接口已废弃,计划于`2024年9月30日`完全下线,请尽快使用`FittingDesignV2`代替,解锁更丰富的孔槽类型 + */ + export namespace FittingDesign { + /** + * 交接对象类型 + * @deprecated 接口已废弃, 请使用`IDP.Custom.Design.Export.IntersectModel`代替 + */ + const IntersectModel: typeof EIntersectModelType; + /** + * 商品建模方向 + * @deprecated 接口已废弃, 请使用`IDP.Custom.Design.Export.ProductDirection`代替 + */ + const ProductDirection: typeof EProductDirection; + /** + * 输出的交接类型 + * @deprecated 接口已废弃, 请使用`IDP.Custom.Design.Export.IntersectedInfoType`代替 + */ + const IntersectedInfoType: typeof EIntersectedInfoType; + /** + * 获取当前方案楼层模型交接数据 + * @deprecated 接口已废弃, 请使用`IDP.Custom.Design.Export.getIntersectedDataAsync`代替 + */ + export function getIntersectedDataAsync(option: IGetIntersectedOption): Promise; + /** + * 获取当前方案楼层孔槽方案 + */ + export function getDesignDataAsync(option: IFittingDesignOption): Promise; + /** + * 保存或更新当前方案楼层孔槽方案 + * >保存孔槽方案前确认已初始化模型json: `IDP.Custom.Design.Export.getModelJsonAsync` + */ + export function saveDesignDataAsync(option: ISaveFittingDesignOption): Promise; + /** + * 删除当前方案楼层孔槽方案 + */ + export function deleteDesignDataAsync(option: IFittingDesignOption): Promise; + /** + * 批量获取模型孔槽方案 + * @param ids 模型id集合 + */ + export function findDesignDataAsync(ids: string[]): Promise; + /** + * 批量写入模型孔槽方案 + */ + export function saveDesignDatasAsync(option: ISaveFittingDesignOption[]): Promise; + /** + * 批量删除模型孔槽方案 + * @param ids 模型id集合 + */ + export function deleteDesignDatasAsync(ids: string[]): Promise; + } + /** + * 孔槽方案V2 + * 支持复杂工艺的孔槽:比如圆角方槽、路径槽 + * 描述孔槽空间关系的坐标系原点为孔槽关联模型的中心点 + */ + export namespace FittingDesignV2 { + /** + * 批量保存或更新孔槽方案 + * @remark 限制最大批量更新值为`20` + * ```typescript + * const fittingDesigns = await IDP.Custom.FittingDesignV2.putDesignDataAsync([{id:"xxx", fittingDesign: [{modelId: "xxx", holes: [], grooves: []}]}]) + * ``` + */ + export function putDesignDataAsync(option: IFittingDesignDataV2[]): Promise[]>; + /** + * 批量获取孔槽方案 + * @param ids 孔槽方案关联的顶层模型id + * @remark 限制最大批量查找值为`20` + * ```typescript + * const fittingDesigns = await IDP.Custom.FittingDesignV2.findDesignDataAsync(['xxx1', 'xxx2']) + * ``` + */ + export function findDesignDataAsync(ids: string[]): Promise[]>; + /** + * 批量删除孔槽方案 + * @param ids 孔槽方案关联的顶层模型id + * @remark 限制最大批量删除值为`20` + * ```typescript + * await IDP.Custom.FittingDesignV2.deleteDesignDataAsync(['xxx1', 'xxx2']) + * ``` + */ + export function deleteDesignDataAsync(ids: string[]): Promise; + } + /** + * 检测相关能力 + */ + export namespace Detection { + /** + * 检测类型 + */ + const DetectType: typeof EDetectType; + /** + * 获取指定模型的干涉检测结果 + * 默认会检测方案所有的模型 + * + * @param {IntersectCheckOption} [option] + */ + export function checkIntersectionAsync(option?: IIntersectCheckOption): Promise; + /** + * 集成的检测接口 + * 调用后会打开检测面板,执行config中等于true的检测,并返回检测后的结果 + * 注意:该检测只针对当前场景中的房间,建议配合IDP.Interaction.getSelectedRooms使用 + * @param config 检测的类型 + * @param option 检测的选项 toolType默认当前所在工具线 + * @return 检测的结果 + */ + export function detectAsync(config: IDetectItem, option?: IDetectOption): Promise>; + /** + * 获取各工具线支持的检测规则 + */ + export function getDetectConfig(): IDetectConfig; + /* Excluded from this release type: checkValidityByModelIdsAsync */ + /* Excluded from this release type: checkRuleByModelIdsAsync */ + /* Excluded from this release type: checkIntersectionByModelIdsAsync */ + } + /** + * 订单相关 + */ + export namespace Order { + /** + * 订单详情 + */ + export type CustomerOrderDetail = ICustomerOrderDetail; + /** + * 获取设计方案关联的客户订单 + * @param option.designId 设计方案ID + * @returns 订单详情 无权限/无客户订单返回空 + */ + export function getCustomerOrderAsync(option: { + designId: string; + }): Promise; + } + /** + * 分组相关 + */ + export namespace Group { + /** + * 获取方案中的分组数据 + */ + export function getGroupDataAsync(): Promise; + /** + * 更新分组数据 + * @param updateData + */ + export function updateGroupDataAsync(updateData: IGroupData): Promise; + } + /** + * 安装相关 + */ + export namespace InstallCode { + /** + * 附加安装信息 + * @param installData + */ + export function attachInstallDataAsync(installData: IInstallData): Promise; + /** + * 生成安装编码 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function getInstallCodeAsync(option: { + /** + * 工具线,当不传时,为当前所在的默认工具线 + */ + toolType?: EToolType; + /** + * 超时时间;默认为50s + * 单位:秒 + */ + timeout?: number; + }): Promise>; + } + /* Excluded from this release type: KA */ /* Excluded from this release type: Kada */ } + export namespace Product { + /** + * 获取商品信息 + * @param productId + */ + export function getProductAsync(productId: string): Promise; + /** + * 批量获取商品信息 + * 当前批量获取时,不支持获取`customFields`字段 + * @param productIds + * @return 返回值为一个对象,对象中key为productId,而对应值为商品信息 + * + * @vm-type AsyncFunctionType + */ + export function getProductsAsync(productIds: string[]): Promise>; + /** 查询定制产品包商品类目 */ + export function findCustomFoldersAsync(options: IFindCustomFoldersOptions): Promise; + /** 查询定制产品包商品 */ + export function findCustomProductsAsync(options: IFindCustomProductsOptions): Promise<{ + list: IProduct[]; + totalCount: number; + }>; + } + export namespace DB { + export namespace Types { + /** + * 定制组合对象 + */ + export interface CustomGroup { + /** ID */ + elementId: IDP.DB.Types.ElementId; + /** 子对象 */ + subElements: IDP.DB.Types.ElementId[]; + } + } + export namespace Methods { + /** + * 获取定制组合对象 + * @param eid + */ + export function getCustomGroup(eid: IDP.DB.Types.ElementId): IDP.DB.Types.CustomGroup | undefined; + /** + * 在非定制环境下,创建一个定制厨卫模型到方案当中 + */ + export function createCabinetAsync(option: ICreateCustomModelSimpleOption): Promise; + /** + * 在非定制环境下,更新定制厨卫模型相关参数 + * @param option + */ + export function updateCabinetAsync(option: IUpdateCustomModelSimpleOption): Promise; + /** + * 通过elementId,来删除一下定制厨卫模型(当找不到模型时,会返回false) + * + * @param elementId + */ + export function deleteCabinetAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 通过elementId来获取一个定制厨卫模型数据 + * @param elementId + */ + export function getCabinetAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 定制厨卫模型数据列表 + */ + export function findCabinetListAsync(): Promise; + /** + * 定制厨卫引用模型数据列表 + * + * @vm-type AsyncFunctionType + */ + export function findCabinetRefListAsync(): Promise; + /** + * 在非定制环境下,创建一个定制厨卫副本模型到方案当中 + */ + export function createCabinetCopyAsync(option: ICreateCustomModelSimpleOption): Promise; + /** + * 在非定制环境下,更新定制厨卫副本模型相关参数 + * @param option + */ + export function updateCabinetCopyAsync(option: IUpdateCustomModelSimpleOption): Promise; + /** + * 通过elementId,来删除一下定制厨卫副本模型(当找不到模型时,会返回false) + * + * @param elementId + */ + export function deleteCabinetCopyAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 通过elementId来获取一个定制厨卫副本模型数据 + * @param elementId + */ + export function getCabinetCopyAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 定制厨卫副本模型数据列表 + */ + export function findCabinetCopyListAsync(): Promise; + /** + * 定制厨卫副本引用模型数据列表 + * + * @vm-type AsyncFunctionType + */ + export function findCabinetCopyRefListAsync(): Promise; + /** + * 在非定制环境下,创建一个定制家居模型到方案当中 + */ + export function createWardrobeAsync(option: ICreateCustomModelSimpleOption): Promise; + /** + * 在非定制环境下,更新定制家居模型相关参数 + * @param option + */ + export function updateWardrobeAsync(option: IUpdateCustomModelSimpleOption): Promise; + /** + * 通过elementId,来删除一下定制家居模型(当找不到模型时,会返回false) + * + * @param elementId + */ + export function deleteWardrobeAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 通过elementId来获取一个定制家居模型数据 + * @param elementId + */ + export function getWardrobeAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 批量获取定制家居模型参数信息 + */ + export function findWardrobeListAsync(): Promise; + /** + * 在非定制环境下,创建一个定制家居副本模型到方案当中 + */ + export function createWardrobeCopyAsync(option: ICreateCustomModelSimpleOption): Promise; + /** + * 在非定制环境下,更新定制家居副本模型相关参数 + * @param option + */ + export function updateWardrobeCopyAsync(option: IUpdateCustomModelSimpleOption): Promise; + /** + * 通过elementId,来删除一下定制家居副本模型(当找不到模型时,会返回false) + * + * @param elementId + */ + export function deleteWardrobeCopyAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 通过elementId来获取一个定制家居副本模型数据 + * @param elementId + */ + export function getWardrobeCopyAsync(elementId: IDP.DB.Types.ElementId): Promise; + /** + * 批量获取定制家居副本模型参数信息 + */ + export function findWardrobeCopyListAsync(): Promise; + /** + * 获取定制全屋家具的引用模型数据 + * + * @vm-type AsyncFunctionType + */ + export function findWardrobeRefListAsync(): Promise; + /** + * 获取定制全屋家具的引用模型数据 + * + * @vm-type AsyncFunctionType + */ + export function findWardrobeCopyRefListAsync(): Promise; + } + } + export namespace Integration { + export namespace FOP { + export type GetOrderFieldsResult = IGetOrderFieldsResult; + /** + * 客户来源 + */ + const CustomerSource: typeof ECustomerSource; + /** + * 客户信息查询字段类型 + */ + const CustomerQueryType: typeof ECustomerQueryType; + /* Excluded from this release type: OrderFieldType */ + /** + * 添加附件 + */ + export type AddOrderStateAttachmentOption = IAddOrderStateAttachmentOption; + /** + * 删除附件 + */ + export type DeleteOrderStateAttachmentOption = IDeleteOrderStateAttachmentOption; + /** + * 更新备注 + */ + export type UpdateOrderStateRemarkOption = IUpdateOrderStateRemarkOption; + /** + * 添加备注 + */ + export type AddOrderStateRemarkOption = IAddOrderStateRemarkOption; + /** + * 查询订单附件参数 + */ + export type GetOrderAttachmentsOption = IGetOrderAttachmentsOption; + /** + * 查询订单附件结果 + */ + export type GetOrderAttachmentsResult = IGetOrderAttachmentsResult; + /** + * 查询订单备注参数 + */ + export type GetOrderRemarksOption = IGetOrderRemarksOption; + /** + * 查询订单备注结果 + */ + export type GetOrderRemarksResult = IGetOrderRemarksResult; + /** + * 订单状态定义 + */ + export type OrderStateData = IOrderStateData; + /** + * 订单事件定义 + */ + export type OrderEventData = IOrderEventData; + /** + * 订单操作定义 + */ + export type OrderOperationData = IOrderOperationData; + /** + * 执行订单操作参数 + */ + export type ExecuteOrderOperationOption = IExecuteOrderOperationOption; + /** + * 检查是否具有某个订单的操作权限参数 + */ + export type CheckOperatePermissionOption = ICheckOperatePermissionOption; + /** + * 创建订单 + * @param {CreateOrderOption} option + */ + export function createOrderAsync(option: ICreateOrderOption): Promise; + /** + * 获取订单数据 + * @param orderId + */ + export function getOrderAsync(orderId: string): Promise; + /* Excluded from this release type: addOrderAttachmentAsync */ + /** + * 添加订单附件 + * @param {AddOrderStateAttachmentOption} option + * + * @vm-type AsyncFunctionType + */ + export function addAttachmentAsync(option: AddOrderStateAttachmentOption): Promise; + /* Excluded from this release type: deleteOrderAttachmentAsync */ + /** + * 删除附件 + * @param {DeleteAttachmentOption} option + * + * @vm-type AsyncFunctionType + */ + export function deleteAttachmentAsync(option: IDeleteAttachmentOption): Promise; + /* Excluded from this release type: updateOrderRemarkAsync */ + /** + * 修改订单备注 + * @param {UpdateOrderStateRemarkOption} option + * + * @vm-type AsyncFunctionType + */ + export function updateRemarkAsync(option: UpdateOrderStateRemarkOption): Promise; + /* Excluded from this release type: addOrderRemarkAsync */ + /** + * 新增订单备注 + * @param {AddOrderStateRemarkOption} option + * + * @vm-type AsyncFunctionType + */ + export function addRemarkAsync(option: AddOrderStateRemarkOption): Promise; + /* Excluded from this release type: deleteOrderRemarkAsync */ + /** + * 删除订单备注 + * @param {DeleteOrderRemarkOption} option + */ + export function deleteRemarkAsync(option: IDeleteOrderRemarkOption): Promise; + /** + * 获取方案关联的指定状态的全部订单列表 + * @param {DesignOrderListOption} option + */ + export function getDesignOrderListAsync(option: IDesignOrderListOption): Promise; + /** + * 判断模型是否关联未作废的订单 + * @param {ModelIsAssociatedOrderResult} option + */ + export function getModelAssociatedOrderAsync(option: IModelIsAssociatedOrderOption): Promise; + /* Excluded from this release type: unlockAuditedModel */ + /** + * 执行订单操作 + * @param option + */ + export function executeOrderOperationAsync(option: ExecuteOrderOperationOption): Promise; + /* Excluded from this release type: checkCreateOrderAuthAsync */ + /** + * 校验是否具有某个订单的操作权限 + */ + export function checkOperatePermissionAsync(option: CheckOperatePermissionOption): Promise; + /* Excluded from this release type: getOrderVisibleFieldsAsync */ + /** + * 创建客户信息 + * @param option + */ + export function createCustomerAsync(option: ICreateCustomerOption): Promise; + /* Excluded from this release type: getCustomerListAsync */ + /** + * 查询客户信息列表 + * @param option + */ + export function findCustomerListAsync(option: IGetCustomerListOption): Promise; + /** + * 获取当前用户所在的门店信息,如果没有门店则返回null + */ + export function getStoreAsync(): Promise; + /** + * 获取订单字段配置详情 + * @param option.orderId 订单ID,返回创建订单时账号下的字段配置,不传返回最新的字段配置 + * @return {Promise} + * + * @vm-type AsyncFunctionType + */ + export function getOrderFieldsAsync(option?: { + orderId?: string; + }): Promise; + /** + * 根据筛选条件查询当前方案的订单 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function findOrdersAsync(option?: IFindOrdersOption): Promise; + /* Excluded from this release type: getOrderAttachmentsAsync */ + /** + * 查询附件 + * @param {GetOrderAttachmentsOption} option + * @throws Error 报错即表示查询失败 + * + * @vm-type AsyncFunctionType + */ + export function getAttachmentsAsync(option: GetOrderAttachmentsOption): Promise; + /* Excluded from this release type: getOrderRemarksAsync */ + /** + * 查询备注 + * @param {GetOrderRemarksOption} option + * @throws Error 报错即表示查询失败 + * + * @vm-type AsyncFunctionType + */ + export function getRemarksAsync(option: GetOrderRemarksOption): Promise; + /** + * 创建售后单 + * @param {CreateAfterSaleOrderFromDesignOption} option + */ + export function createAfterSaleOrderFromDesignAsync(option: ICreateAfterSaleOrderFromDesignOption): Promise; + /** + * 查询订单提审模型信息 + * @param {orderId} option + * @throws Error 报错即表示查询失败 + */ + export function findAuditedModelAsync(option: { + orderId: string; + }): Promise; + /** + * 查询当前用户可见的所有门店信息 + */ + export function getStoresAsync(): Promise; + /** + * 获取订单流程状态列表 + */ + export function getStatesAsync(): Promise<{ + /** + * 系统订单流程状态 + */ + sysStates: OrderStateData[]; + /** + * 商家自定义订单流程状态 + */ + customStates: OrderStateData[]; + }>; + /** + * 获取订单流程操作列表 + */ + export function getOperationsAsync(): Promise<{ + /** + * 系统内置订单操作 + */ + sysOperations: OrderOperationData[]; + /** + * 商家自定义订单操作 + */ + customOperations: OrderOperationData[]; + }>; + /* Excluded from this release type: updateOrderModelsAsync */ + /* Excluded from this release type: getDetectionsAsync */ + /* Excluded from this release type: checkModelSplitOrderAsync */ + /* Excluded from this release type: getDesignUnlockModelListAsync */ + /** + * 获取报表文件地址,格式:PDF + * @throws Error 报错即表示获取失败 + */ + export function getReportFileAsync(option: IGetOrderReportFileOption | IGetMergeTaskReportFileOption): Promise<{ + url: string; + }>; + /** + * 订单模式相关 + */ + export namespace OrderMode { + /** + * 获取订单模式是否可编辑状态 + * 该API仅限订单模式下使用 + * @default false + * @returns {Boolean} 是否可编辑 + */ + export function getEditable(): boolean; + /** + * 设置订单模式的编辑状态 + * 该API仅限订单模式下使用 + * @param editable + * @default false + */ + export function setEditable(editable: boolean): void; + /** + * 获取订单模式当前订单ID + * 如果不在订单模式则获取不到订单ID + * @returns {string | undefined} 订单ID | 未获取到订单ID + */ + export function getOrderId(): string | undefined; + /** + * 切换订单模式下的当前订单 + * 该API仅限订单模式下使用 + * @param {Object} option + */ + export function switchOrderAsync(option: { + orderId: string; + }): Promise; + /** + * 暂停方案保存时自动更新订单模型范围 + * 该API仅限订单模式下使用 + */ + export function pauseAutoUpdateOrderModel(): void; + /** + * 恢复方案保存时自动更新订单模型范围 + * 该API仅限订单模式下使用 + */ + export function resumeAutoUpdateOrderModel(): void; + /* Excluded from this release type: getAutoUpdateOrderModelEnabled */ + /* Excluded from this release type: checkOrderPermissionAsync */ + } + /** + * 配置相关 + */ + export namespace Config { + /** + * 自定义配置字段枚举 + */ + const FieldEnum: typeof EFieldEnum; + /** + * 获取自定义配置返回结果 + */ + export type FieldEnumResult = IFieldEnumResult; + export interface GetDetectionConfigRes { + /** 检测范围 */ + rules: DetectionRuleType[]; + /** 触发检测的订单操作项 */ + operations: string[]; + } + /** + * 获取自定义配置枚举 + * @param option + */ + export function getEnumAsync(option: { + field: EFieldEnum; + }): Promise; + /* Excluded from this release type: getDetectionConfigAsync */ + } + } + export namespace Upload { + /* Excluded from this release type: uploadFileAsync */ + /* Excluded from this release type: Bucket */ + } + /** + * 华为云排版算法 + */ + export namespace EngravingMachineCutting { + /** + * 排版任务详情 + */ + export type EngravingMachineCuttingResponse = IEngravingMachineCuttingResponse; + /* Excluded from this release type: EngravingMachineCuttingSearchResult */ + /** + * 创建排版任务入参 + */ + export type EngravingMachineCuttingCreateTask = IEngravingMachineCuttingTaskCreate; + /** + * 创建排版任务响应参数 + */ + export type EngravingMachineCuttingTaskCreateResponse = IEngravingMachineCuttingTaskCreateResponse; + /** + * 创建排版任务入参数校验不能过时,响应 + */ + export type EngravingMachineCuttingTaskCreateErrResponse = IEngravingMachineCuttingTaskCreateErrResponse; + /** + * 删除/查询任务 + */ + export type FindOrDeleteTaskOption = Record<'task_id', string>; + /* Excluded from this release type: getTaskListAsync */ + /** + * 创建新的排版任务 + * @param {EngravingMachineCuttingCreateTask} option + */ + export function createTaskAsync(option: EngravingMachineCuttingCreateTask): Promise; + /** + * 查询排版任务详情 + * @param option + */ + export function findTaskAsync(option: FindOrDeleteTaskOption): Promise; + /** + * 删除排版任务 + * @param option + */ + export function deleteTaskAsync(option: FindOrDeleteTaskOption): Promise; + } + /** + * BOM数据 + */ + export namespace Bom { + /** + * 新增板件时入参 + */ + export type BomPlankEditable = IBomPlankEditable; + /** + * 更新板件时的入参 + */ + export type BoomPlank = IBomPlankUpdate; + /** + * 板件附带订单的完整信息 + */ + export type BomPlankFull = IBomPlankFull; + /** + * 删除板件后的入参 + */ + export type BoomPlankWithId = IBomPlankWithId; + /** + * 板件类型 + */ + const BomPlankType: typeof EBomPlankType; + /** + * 线段类型 + */ + const BomCurveType: typeof EBomCurveType; + /** + * 孔/槽类型 + */ + const BomPlankHoleType: typeof EBomPlankHoleType; + /** + * 查找板件入参 + */ + export type FindPlankListOption = IFindPlankListOption; + /** + * 创建物料参数 + * + * @vm-type UnknownType + */ + export interface CreateMaterialsOption { + /** + * 线条 + */ + moldings?: BomMoldingEditable[]; + /** + * 板件 + */ + planks?: BomPlankEditable[]; + /** + * 成品五金 + */ + finishedProducts?: BomFinishedProductEditable[]; + } + export interface CreateMaterialsResult { + /** + * 线条 + */ + moldingIds?: string[]; + /** + * 板件 + */ + plankIds?: string[]; + /** + * 成品五金 + */ + finishedProductIds?: string[]; + } + /** + * 删除物料参数 + */ + export interface DeleteMaterialsOption { + /** + * 订单ID + */ + orderId: string; + /** + * 产品ID + */ + productIds: string[]; + } + export interface DeleteMaterialsResult { + productMaterials: Array<{ + /** + * 物料ID + */ + bomIds: string[]; + /** + * 产品ID + */ + productId: string; + /** + * 分组ID + */ + groupIds: string[]; + }>; + } + export interface DeleteMaterialsByOrderIdResult { + orderMaterial: { + /** + * 物料ID + */ + bomIds: string[]; + /** + * 分组ID + */ + groupIds: string[]; + }; + } + /** + * 批量创建物料 + * @param option + */ + export function createMaterialsAsync(option: CreateMaterialsOption): Promise; + /** + * 通过订单ID及产品ID,批量删除物料 + * @param option + */ + export function deleteMaterialsAsync(option: DeleteMaterialsOption): Promise; + /** + * 通过订单ID删除物料 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function deleteMaterialsByOrderIdAsync(option: Omit): Promise; + /** + * 通过物料ID批量解包物料 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function unpackMaterialsByBomIdAsync(option: { + bomIds: string[]; + }): Promise<{ + /** + * 物料ID + */ + bomIds: string[]; + /** + * 分组ID + */ + groupIds: string[]; + }>; + /** + * 通过包裹ID,批量解包物料 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function unpackMaterialsByPackageIdAsync(option: { + packageIds: string[]; + }): Promise<{ + /** + * 物料ID + */ + bomIds: string[]; + /** + * 分组ID + */ + groupIds: string[]; + }>; + /** + * 通过订单ID批量解包物料 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function unpackMaterialsByOrderIdAsync(option: { + orderIds: string[]; + }): Promise<{ + /** + * 物料ID + */ + bomIds: string[]; + /** + * 分组ID + */ + groupIds: string[]; + }>; + /** + * 查询板件列表 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function findPlankListAsync(option: FindPlankListOption): Promise<{ + result: BomPlankFull[]; + }>; + /** + * 创建板件接口 + * @param plank + * + * @vm-type AsyncFunctionType + */ + export function createPlankAsync(plank: BomPlankEditable): Promise; + /** + * 更新板件接口 + * @throws Error 如果报错就表示更新失败 + * @param plank + * + * @vm-type AsyncFunctionType + */ + export function updatePlankAsync(plank: BoomPlank): Promise; + /** + * 删除板件 + * @throws {Error} 报错即表示删除失败 + * @param plankId + */ + export function deletePlankAsync(plankId: string): Promise; + /** + * 批量创建板件接口 + * @throws {Error} 报错即表示创建失败 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function createPlanksAsync(option: { + planks: BomPlankEditable[]; + }): Promise<{ + plankIds: string[]; + }>; + /** + * 批量更新创建板件接口 + * @throws {Error} 报错即表示创建失败 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function updatePlanksAsync(option: { + planks: BoomPlank[]; + }): Promise; + /** + * 批量删除板件接口 + * @throws {Error} 报错即表示删除失败 + * @param option + */ + export function deletePlanksAsync(option: { + plankIds: string[]; + }): Promise<{ + plankIds: string[]; + }>; + /** + * 通过产品ID 批量删除产品和这个产品下的所有子部件(包含孔槽) + * @throws {Error} 报错即表示删除失败 + * @param option + */ + export function deletePlanksByProductIdsAsync(option: { + orderId: string; + productIds: string[]; + }): Promise<{ + plankIds: string[]; + }>; + /** + * 通过订单ID 批量删除整个订单和这个订单下的所有子部件(包含孔槽) + * @throws {Error} 报错即表示删除失败 + * @param option + */ + export function deletePlanksByOrderIdsAsync(option: { + orderIds: string[]; + }): Promise<{ + plankIds: string[]; + }>; + /** + * 板中的局部操作逻辑 + */ + export namespace Plank { + /** + * 孔附带ID + */ + export type BoomPlankHoleWithId = IBomPlankHoleWithId; + /** + * 孔可被编辑的信息 + */ + export type BomPlankHoleEditable = IBomPlankHoleEditable; + /** + * 孔的完整信息 + */ + export type BomPlankHole = IBomPlankHole; + /** + * 板面上,创建孔 + * @param hole 孔信息 + * + * @vm-type AsyncFunctionType + */ + export function createHolesAsync(option: { + holes: Array; + }): Promise; + /** + * 更新孔 + * @param hole 孔信息 + * + * @vm-type AsyncFunctionType + */ + export function updateHoleAsync(hole: BomPlankHole & BoomPlankWithId): Promise; + /** + * 删除孔 + * @param holeId 孔Id + * + * @vm-type AsyncFunctionType + */ + export function deleteHoleAsync(holeId: string): Promise; + /** + * 孔附带ID + */ + export type BoomPlankGrooveWithId = IBomPlankGrooveWithId; + /** + * 孔可被编辑的信息 + */ + export type BomPlankGrooveEditable = IBomPlankGrooveEditable; + /** + * 孔的完整信息 + */ + export type BomPlankGroove = IBomPlankGroove; + /** + * 板面上,创建槽 + * @param option 槽信息 + * + * @vm-type AsyncFunctionType + */ + export function createGroovesAsync(option: { + grooves: Array; + }): Promise; + /** + * 更新槽 + * @param groove 槽信息 + * + * @vm-type AsyncFunctionType + */ + export function updateGrooveAsync(groove: BomPlankGroove & BoomPlankWithId): Promise; + /** + * 删除槽 + * @param grooveId 槽Id + * + * @vm-type AsyncFunctionType + */ + export function deleteGrooveAsync(grooveId: string): Promise; + } + /** + * 线条相关API + */ + export type BomMoldingEditable = IBomMoldingEditable; + /** + * 完整的线条数据 + */ + export type BomMolding = IBomMolding; + /** + * 创建线条 + * @param option 线条信息 + * + * @vm-type AsyncFunctionType + */ + export function createMoldingsAsync(option: { + moldings: BomMoldingEditable[]; + }): Promise<{ + moldingIds: string[]; + }>; + /** + * 更新线条 + * @param option 线条信息 + * + * @vm-type AsyncFunctionType + */ + export function updateMoldingsAsync(option: { + moldings: BomMoldingEditable[]; + }): Promise; + /** + * 删除线条 + * @param option + * + * @vm-type AsyncFunctionType + */ + export function deleteMoldingsAsync(option: DeleteMoldingsOption): Promise; + /** + * 查询线条 + * @param option 查询条件 + * + * @vm-type AsyncFunctionType + */ + export function findMoldingsAsync(option: FindMoldingsOption): Promise<{ + moldings: BomMolding[]; + }>; + /** + * 通过模型顶层ID创建成品 + */ + export type BomFinishedProductEditableByProductId = IBomFinishedProductEditableByProductId; + /** + * 通过方案中模型ID创建成品ID + */ + export type BomFinishedProductEditableByModelId = IBomFinishedProductEditableByModelId; + /** + * 成品五金相关API + */ + export type BomFinishedProductEditable = IBomFinishedProductEditable; + /** + * 完整的成品信息 + */ + export type BomFinishedProduct = IBomFinishedProduct; + /** + * 更新成品配置信息 + */ + export type BomFinishedProductUpdate = IBomFinishedProductUpdate; + /** + * 批量创建成品五金 + * @param option 五金信息 + * + * @vm-type AsyncFunctionType + */ + export function createFinishedProductsAsync(option: { + finishedProducts: BomFinishedProductEditable[]; + }): Promise<{ + finishedProductIds: string[]; + }>; + /** + * 批量更新成品五金 + * @param option 五金信息 + * + * @vm-type AsyncFunctionType + */ + export function updateFinishedProductsAsync(option: { + finishedProducts: BomFinishedProductUpdate[]; + }): Promise; + /** + * 批量删除成品五金 + * @param option 五金删除参数 + * + * @vm-type AsyncFunctionType + */ + export function deleteFinishedProductsAsync(option: DeleteFinishedProductOption): Promise<{ + finishedProductIds: string[]; + }>; + /** + * 查询成品五金列表 + * @param option 查询信息 + * + * @vm-type AsyncFunctionType + */ + export function findFinishedProductsAsync(option: FindFinishedProductOption): Promise<{ + finishedProducts: BomFinishedProduct[]; + }>; + /** + * 分组管理 + */ + /** + * BomGroup信息 + */ + export type BomGroup = IBomGroup; + export interface BomGroupDeleteOption { + rootIds: string[]; + } + export interface BomGroupDeleteByProductIdsOption { + /** + * 订单ID + */ + orderId: string; + /** + * 商品ID + */ + productIds: string[]; + } + export interface BomGroupDeleteByProductIdsResult { + groups: Array<{ + /** + * 产品ID + */ + productId: string; + /** + * 产品下的分组ID + */ + groupIds: string[]; + }>; + } + /** + * 创建分组 + * @param option 分组信息 + * + * @vm-type AsyncFunctionType + */ + export function createGroupsAsync(option: { + groups: BomGroup[]; + }): Promise<{ + rootIds: string[]; + }>; + /** + * 更新分组 + * @param option 分组信息 + * + * @vm-type AsyncFunctionType + */ + export function updateGroupsAsync(option: { + groups: IBomGroupEditable[]; + }): Promise<{ + groupIds: string[]; + }>; + /** + * 批量删除 + * @param option 删除参数 + * + * @vm-type AsyncFunctionType + */ + export function deleteGroupsAsync(option: BomGroupDeleteOption): Promise; + /** + * 通过产品ID,批量删除分组 + * @param option 删除参数 + */ + export function deleteGroupsByProductIdAsync(option: BomGroupDeleteByProductIdsOption): Promise; + /** + * 根据订单号,重新构建分组层级关系 + * + * @param option + */ + export function generateGroupRelationsAsync(option: { + /** + * 是否重新构建,当regenerate为false,会自动判断当前订单层级是否需要构建;而为true时,强制重新构建 + * @default false + */ + regenerate?: boolean; + /** + * 订单号 + */ + orderId: string; + }): Promise; + /** + * 通过关联的分组ID查询Group分组信息 + * + * @param option 分组Id + * + * @vm-type AsyncFunctionType + */ + export function findGroupsByRootIdAsync(option: { + /** + * 分组ID + */ + rootIds: string[]; + }): Promise<{ + groups: IBomGroupFull[]; + }>; + /** + * 通过叶子节点对应的物料ID查询Group分组信息 + * @param option 物料Id + * + * @vm-type AsyncFunctionType + */ + export function findGroupsByBomIdAsync(option: { + /** + * 叶子节点对应的物料ID + */ + bomIds: string[]; + }): Promise<{ + groups: IBomGroupFull[]; + }>; + /** + * 通过关联的订单ID查询Group分组信息 + * @param option 订单Id + * + * @vm-type AsyncFunctionType + */ + export function findGroupsByOrderIdAsync(option: { + /** + * 订单ID + */ + orderIds: string[]; + }): Promise<{ + groups: IBomGroupFull[]; + }>; + /** + * 通过产品ID查询分组信息 + * @param option 查询信息 + * + * @vm-type AsyncFunctionType + */ + export function findGroupsByProductIdAsync(option: { + /** + * 订单ID + */ + orderId: string; + /** + * 产品ID + */ + productIds: string[]; + }): Promise<{ + groups: IBomGroupFull[]; + }>; + /** + * 排版加工 + */ + export type BomRawPlankEditable = IBomRawPlankEditable; + /** + * 完成排版信息 + */ + export type BomRawPlank = IBomRawPlank; + export interface FindBomRawPlankOption { + /** + * 合并批次ID + */ + mergeIds?: string[]; + /** + * 大板ID + */ + rawPlankIds?: string[]; + } + /** + * 批量创建大板 + * @param option 大板信息 + * + * @vm-type AsyncFunctionType + */ + export function createRawPlanksAsync(option: { + rawPlanks: BomRawPlankEditable[]; + }): Promise<{ + rawPlankIds: string[]; + }>; + /** + * 批量删除大板 + * @param option 大板Id集合 + * + * @vm-type AsyncFunctionType + */ + export function deleteRawPlanksAsync(option: { + rawPlankIds: string[]; + }): Promise<{ + rawPlankIds: string[]; + }>; + /** + * 批量更新大板信息 + * @param option 大板信息 + * + * @vm-type AsyncFunctionType + */ + export function updateRawPlanksAsync(option: { + rawPlanks: Array>; + }): Promise; + /** + * 查询大板信息 + * @param option 查询条件 + * + * @vm-type AsyncFunctionType + */ + export function findRawPlanksAsync(option: FindBomRawPlankOption): Promise<{ + rawPlanks: BomRawPlank[]; + }>; + /** + * Bom创建排版信息配置 + */ + export type BomPlankLayoutArrange = IBomPlankLayoutArrange; + /** + * 排版结果 + */ + export type BomRawPlankLayoutResult = IBomRawPlankLayoutResult; + /** + * 设置大板加工工艺参数 + */ + export type BomPlankLayoutProcessAttribute = IBomPlankLayoutProcessAttribute; + /** + * 将一块板件排版到一块大板 + * @param option 排版信息配置 + * + * @vm-type AsyncFunctionType + */ + export function arrangePlanksAsync(option: { + layouts: BomPlankLayoutArrange[]; + }): Promise<{ + layoutIds: string[]; + }>; + /** + * 设置大板加工工艺 + * @param option + */ + export function updateRawPlankProcessingAttributesAsync(option: { + attributes: BomPlankLayoutProcessAttribute[]; + }): Promise; + /** + * 查询排版结果 + * + * @vm-type AsyncFunctionType + * @param option 查询条件 + */ + export function findLayoutAsync(option: { + mergeId: string; + }): Promise; + /** + * 批量删除排版记录 + * @param option 排版ID集合 + * + * @vm-type AsyncFunctionType + */ + export function deleteLayoutsAsync(option: { + layoutIds: string[]; + }): Promise<{ + layoutIds: string[]; + }>; + /** + * 通过板件id 批量删除排版记录 + * @param option 板件ID集合 + * + * @vm-type AsyncFunctionType + */ + export function deleteLayoutsByPlankIdAsync(option: { + plankIds: string[]; + }): Promise<{ + layoutIds: string[]; + }>; + /** + * 余料 + */ + export type BomSurplusPlankEditable = IBomSurplusPlankEditable; + /** + * 完成余料信息 + */ + export type BomSurplusPlank = IBomSurplusPlank; + export interface FindSurplusPlanksOption { + /** + * 从哪个批次剩余的合批ID + */ + fromMergeIds?: string[]; + /** + * 用于哪个批次的合批ID + */ + usedMergeIds?: string[]; + /** + * 对应的大板IDs + */ + surplusPlankIds?: string[]; + } + /** + * 批量创建余料 + * @param option 余料信息 + * + * @vm-type AsyncFunctionType + */ + export function createSurplusPlanksAsync(option: { + surplusPlanks: BomSurplusPlankEditable[]; + }): Promise<{ + surplusPlankIds: string[]; + }>; + /** + * 批量删除余料 + * @param option 余料Id集合 + * + * @vm-type AsyncFunctionType + */ + export function deleteSurplusPlanksAsync(option: { + surplusPlankIds: string[]; + }): Promise<{ + surplusPlankIds: string[]; + }>; + /** + * 批量更新余料 + * @param option 余料信息 + * + * @vm-type AsyncFunctionType + */ + export function updateSurplusPlanksAsync(option: { + surplusPlanks: BomSurplusPlank[]; + }): Promise; + /** + * 查询余料信息 + * @param option 查询条件 + * + * @vm-type AsyncFunctionType + */ + export function findSurplusPlanksAsync(option: FindSurplusPlanksOption): Promise<{ + surplusPlanks: BomSurplusPlank[]; + }>; + /** + * 查询品类与属性配置信息 + */ + export interface FindCategoryAttrOption { + categoryCodes: string[]; + } + /** + * 扩展属性 + */ + export type CategoryAttribute = ICategoryAttribute; + /** + * 品类 + */ + export type Category = ICategory; + export interface FindCategoryAttrResult { + catAttrs: Array<{ + /** + * 扩展属性 + */ + attributes: CategoryAttribute[]; + /** + * 品类 + */ + category: Category; + }>; + } + /** + * 查询品类和属性对应关系 + * @param option + */ + export function findCategoryAttrsAsync(option: FindCategoryAttrOption): Promise; + /** + * 清除物料的属性 + */ + export function clearMaterialPropertiesAsync(option: IBomPropertiesClearOption): Promise; + /** + * 清除分组节点的属性 + */ + export function clearGroupPropertiesAsync(option: IBomGroupPropertiesClearOption): Promise; + export interface ProductCodeInOrder { + products?: IProductCodeInOrderInfo[]; + } + /** 更新产品编号 */ + export interface UpdateProductsOption extends ProductCodeInOrder { + /** 订单ID */ + orderId: string; + } + /** + * 自动生成订单下产品的产品编码 + * @param option 订单ID + */ + export function refreshProductCodeInOrderAsync(option: { + orderId: string; + }): Promise; + /** + * 更新订单下产品编号信息 + * @param option + */ + export function updateProductsAsync(option: UpdateProductsOption): Promise; + } + } + export namespace User { + export interface UserDetails { + /** + * 用户的 openid + */ + userId: string; + company: { + /** + * 主帐号的open id + */ + id: string; + /** + * 公司名称 + */ + name: string; + }; + /** + * 主站用户名 + * 用户可以随意修改,主账号不能修改 + */ + userName: string; + /** + * 商家后台用户名 + * 由主账号设置,用户不可自己修改 + */ + businessName: string; + } + /** + * 获取商家appUid + * - 没有appUid返回null + */ + export function getAppUidAsync(): Promise; + /* Excluded from this release type: getUserName */ + /** + * 获取用户信息 + */ + export function getUserDetailsAsync(): Promise; + } + /** + * 通用存储能力 + */ + export namespace Storage { + /** + * 跨方案的通用存储(用户账号维度隔离) + * 同一小程序数据可在不同方案进行数据存储 + */ + export namespace Common { + /** + * 创建/更新数据, + * 如果传入的key不存在则新建数据 + * 如果传入的key存在则更新数据(直接覆盖原有数据) + * @throws {Error} 报异常则表示创建/更新失败 + * @param option + */ + export function putItemAsync(option: IStorageItem): Promise; + /** + * 查询单个数据 + * 没有查到则返回undefined + * @param key + */ + export function getItemAsync(key: string): Promise | undefined>; + /** + * 批量查询数据 + * @param keys + */ + export function getItemListAsync(keys: string[]): Promise; + /** + * 删除数据 + * @param key + * @throws {Error} 报异常则表示删除失败 + */ + export function deleteItemAsync(key: string): Promise; + /** + * 查询所有的key + * 默认会查询第一页10条数据 + * @param option + */ + export function getKeysAsync(option?: IStorageGetKeysOption): Promise; + } + /** + * 方案隔离存储(用户账号维度隔离) + * 同一小程序数据仅在对应的方案进行数据存储,无法跨方案进行操作 + */ + export namespace Design { + /** + * 创建/更新数据, + * 如果传入的key不存在则新建数据 + * 如果传入的key存在则更新数据(直接覆盖原有数据) + * @throws {Error} 报异常则表示创建/更新失败 + * @param option + */ + export function putItemAsync(option: IStorageItem): Promise; + /** + * 查询单个数据 + * 没有查到则返回undefined + * @param key + */ + export function getItemAsync(key: string): Promise | undefined>; + /** + * 批量查询数据 + * @param keys + */ + export function getItemListAsync(keys: string[]): Promise; + /** + * 删除数据 + * @param key + * @throws {Error} 报异常则表示删除失败 + */ + export function deleteItemAsync(key: string): Promise; + /** + * 查询所有的key + * 默认会查询第一页10条数据 + * @param option + */ + export function getKeysAsync(option?: IStorageGetKeysOption): Promise; + } + /** + * 方案存储 + * 小程序数据跟随方案进行数据存储,可随方案进行复制 + */ + export namespace DesignV2 { + /** + * 创建/更新数据 + * 如果传入的key不存在则新建数据 + * 如果传入的key存在则更新数据(直接覆盖原有数据) + * @throws {Error} 报异常则表示创建/更新失败 + * @param option + */ + export function putItemAsync(option: IStorageItem): Promise; + /** + * 查询单个数据 + * 没有查到则返回undefined + * @param key + */ + export function getItemAsync(key: string): Promise | undefined>; + /** + * 删除数据 + * @param key + * @throws {Error} 报异常则表示删除失败 + */ + export function deleteItemAsync(key: string): Promise; + } + /** + * 虚体维度的通用存储 + * 同一小程序数据可在不同方案进行数据存储 + * 同时数据可在同一个商家账号下子账号之间互通 + */ + export namespace Enterprise { + /** + * 创建/更新数据, + * 如果传入的key不存在则新建数据 + * 如果传入的key存在则更新数据(直接覆盖原有数据) + * @throws {Error} 报异常则表示创建/更新失败 + * @param option + */ + export function putItemAsync(option: IStorageItem): Promise; + /** + * 查询单个数据 + * 没有查到则返回undefined + * @param key + */ + export function getItemAsync(key: string): Promise | undefined>; + /** + * 批量查询数据 + * @param keys + */ + export function getItemListAsync(keys: string[]): Promise; + /** + * 删除数据 + * @param key + * @throws {Error} 报异常则表示删除失败 + */ + export function deleteItemAsync(key: string): Promise; + /** + * 查询所有的key + * 默认会查询第一页10条数据 + * @param option + */ + export function getKeysAsync(option?: IStorageGetKeysOption): Promise; + } + } + export namespace Interaction { + /** + * 获取当前选中的对象列表 + */ + export function getSelectedElements(): IDP.DB.Types.ElementId[]; + /** + * 设置当前选中的对象列表 + * 目前支持下面几种 ElementType::Wardrobe、WardrobeCopy、Cabinet、CabinetCopy、DoorWindow、DoorWindowCopy、CustomGroup; + * @param option + * @returns 返回已选中的对象列表,没有选中的对象则返回[]; + */ + export function setSelectedElements(option: IDP.DB.Types.ElementId[]): IDP.DB.Types.ElementId[]; + /** + * 获取当前选中的房间列表 + * @returns 返回已选中的房间列表,未单独选中房间则返回[] + */ + export function getSelectedRooms(): { + roomId: string; + roomName: string; + }[]; + } + export namespace Platform { + /** + * 进入定制模式 + * @default { EToolType.Wardrobe } 默认进入【家居定制】行业线 + * @param toolType 定制行业线 + */ + export function enterCustomModeAsync(toolType?: EToolType): Promise; + } + } +} +export {}; +declare global { + namespace IDP { + export namespace DB { + export namespace Types { + export interface FurnitureLegend { + readonly id: IDP.DB.Types.ElementId; + readonly area: number; + } + export interface ParamLegend { + readonly id: IDP.DB.Types.ElementId; + readonly area: number; + } + export interface LegendGroup { + readonly id: IDP.DB.Types.ElementId; + readonly subElements: IDP.DB.Types.ElementId[]; + } + } + export namespace Methods { + /** + * 获取所有家具图例 + */ + export function getAllFurnitureLegendList(): IDP.DB.Types.FurnitureLegend[]; + /** + * 获取所有参数化图例 + */ + export function getAllParamLegendList(): IDP.DB.Types.ParamLegend[]; + /** + * 获取所有图例组合 + */ + export function getAllLegendGroupList(): IDP.DB.Types.LegendGroup[]; + } + } + } +} +export {}; +declare global { + namespace IDP { + export namespace Interaction { + /* Excluded from this release type: goIntelligentLayoutAndMatch */ + /* Excluded from this release type: goIntelligentWholeLayout */ + /* Excluded from this release type: goIntelligentMatch */ + /* Excluded from this release type: goIntelligentCeiling */ + } + } +} +export {}; +declare global { + namespace IDP { + export namespace DB { + export namespace Types { + /* Excluded from this release type: Zone */ + } + export namespace Methods { + /* Excluded from this release type: getAllZoneList */ + } + } + export namespace Interaction { + /* Excluded from this release type: openZoneAsync */ + /* Excluded from this release type: changeZoneStyle */ + /* Excluded from this release type: startDrawZone */ + } + export interface EventTypes { + } + } +} +export {}; +/** + * 图纸导出基础参数 + */ +declare interface IDrawingExportBase { + /** + * 模型列表 + */ + elements: Array; + /** + * 宏数据 + */ + macroData?: Record; + /** + * 出图方式 + */ + divisionType: T; + /** + * 出图文件类型 + * 可同时支持多种出图方式 + */ + fileType: EDrawingFileType | Array; +} +/** + * 图纸导出接口入参 + */ +declare type IDrawingExportParams = IDrawingExportBase | (IDrawingExportBase & { + /** + * 柜组出图时文件夹名称 + */ + name?: string; +}); +/** + * 图纸导出接口出参 + */ +declare interface IDrawingExportResponse { + /** + * 状态 + * 成功or失败 + */ + status: boolean; + /** + * 图纸地址 + */ + url?: string; + /** + * 图纸文件格式 + */ + fileType: EDrawingFileType; +} +/** + * 椭圆的信息及绘制方向 + */ +declare interface IEllipse { + /** 椭圆的坐标系 */ + ccs: { + /** 原点坐标 */ + o: number[]; + /** 表示 X 轴方向 */ + dx: number[]; + }; + /** 长半轴的长度 */ + majorRadius: number; + /** 短半轴的长度 */ + minorRadius: number; + /** 绘制方向,正表示逆时针,负表示顺时针 */ + clock: number; +} +declare interface IEngravingMachineCuttingPlate { + /** + * 是否为余料 + * Example : false + */ + is_residual: boolean; + /** + * 大板成本,目前可设置为大板面积 + * Minimum value (exclusive) : 0 + * Example : 2976800.0 + */ + plate_cost: number; + /** + * 大板可用数量 + * Minimum value (exclusive) : 0 + * Example : 1000 + */ + plate_count: number; + /** + * 大板id,从0开始,依序递增 + * Minimum value : 0 + * Example : 0 + */ + plate_id: number; + /** + * 大板长度,单位mm + * Minimum value (exclusive) : 0 + * Maximum value : 1000000 + * Example : 2440.0 + */ + plate_length: number; + /** + * 大板名 + * Length : 1 - 256 + * Example : "plate_0" + */ + plate_name: string; + /** + * 大板宽度,单位mm + * Minimum value (exclusive) : 0 + * Maximum value : 1000000 + * Example : 1220.0 + */ + plate_width: number; +} +declare interface IEngravingMachineCuttingResponse { + /** + * 异步任务的执行结果 + * Example : RespInfo + */ + result?: IEngravingMachineCuttingResultResponse; + /** + * 任务状态 + * Example : "finished" + */ + status: EEngravingMachineCuttingStatus; + /** + * 任务ID + * Length : 36 + * Example : "0d229512-7778-4097-a6ce-47b20c493e5f" + */ + task_id: string; +} +declare interface IEngravingMachineCuttingResultResponse { + /** + * 每类大板的包含的派样方案 + * Example : [ "object" ] + */ + objects: IEngravingMachineCuttingResultResponseObjects[]; + /** + * 坐标系的原点;0表示大板左下点,1表示大板左上点,2表示大板右上点,3表示大板右下点 + * Example : 0 + */ + origin: number; + /** + * 使用大板的类型数量,以板材以及厚度进行区分 + * Minimum value : 0 + * Example : 0 + */ + plate_type_num: number; + /** + * 项目名,项目唯一标识ID + * Length : 1 - 256 + * Example : "TESTPRO" + */ + project_id: string; + /** + * 任务名,任务唯一标识ID + * Length : 1 - 256 + * Example : "TESTTASK" + */ + task_id: string; +} +declare interface IEngravingMachineCuttingResultResponseObjects { + /** + * 平均大板利用率 + * Minimum value : 0 + * Maximum value : 1 + * Example : 0.9 + */ + average_ratio: number; + /** + * 大板形状及大板包含的排版小板列表 + * Example : [ "object" ] + */ + nesting: IIEngravingMachineCuttingResultResponseNesting[]; + /** + * 使用大板数量 + * Minimum value : 0 + * Example : 1 + */ + plate_count: number; + /** + * 使用大板的类型 + * Length : 1 - 256 + * Example : "颗粒可可糖-18" + */ + plate_type: string; + /** + * 所使用的小板数量 + * Minimum value : 0 + * Example : 2 + */ + total_item_count: number; +} +/** + * 查询任务列表-响应结果 + */ +declare interface IEngravingMachineCuttingSearchResult { + /** + * Example : 0 + */ + total: number; + /** + * Example : 0 + */ + count: number; + tasks: IEngravingMachineCuttingResponse[]; +} +declare interface IEngravingMachineCuttingTaskCreate { + /** + * 零间距,单位mm。 + * Minimum value : 0 + * Maximum value : 20 + * Example : 6.0 + */ + item_spacing: number; + /** + * 排版任务列表,每个item描述小板形状 + */ + items: IEngravingMachineCuttingTaskItem[]; + /** + * 坐标系的原点;0表示大板左下点,1表示大板左上点,2表示大板右上点,3表示大板右下点 + * Example : 0 + */ + origin: number; + /** + * 板间距,单位mm。 + * Minimum value : 0 + * Maximum value : 20 + * Example : 2.0 + */ + plate_spacing: number; + /** + * 可用大板情况 + */ + plates: IEngravingMachineCuttingPlate[]; + /** + * 项目名,项目唯一标识ID + * Length : 1 - 256 + * Example : "TESTPRO" + */ + project_id: string; + /** + * 任务名,任务唯一标识ID + * Length : 1 - 256 + * Example : "TESTTASK" + */ + task_id: string; + /** + * 用户指定算法运行时间,单位分钟。 + * Minimum value (exclusive) : 0 + * Maximum value : 60 + * Example : 1 + */ + time: number; +} +/** + * 创建任务参数验证不通过时,响应的参数 + */ +declare interface IEngravingMachineCuttingTaskCreateErrResponse { + /** + * 输入数据json解析失败 + * Minimum length : 0 + * Example : "error_code: oroas.00000002, error_msg: Json parsing error" + */ + error_code?: string; + /** + * 输入数据校验失败 + * Minimum length : 0 + * Example : "error_code: oroas.00000006, error_msg: Input data validate error" + */ + error_msg?: string; +} +/** + * 创建任务响应 + */ +declare interface IEngravingMachineCuttingTaskCreateResponse { + /** + * 预估剩余完成时间 + * Example : "1 min" + */ + etr?: string; + /** + * 任务ID + * Example : "string" + */ + task_id?: string; +} +/** + * 创建排版任务细节参数 + */ +declare interface IEngravingMachineCuttingTaskItem { + /** + * 描述大板材质以及厚度 + * Length : 1 - 256 + * Example : "颗粒夏特原木横纹-18" + */ + item_type: string; + /** + * 同种材质以及厚度的待排小板,每个item描述小板形状 + */ + objects: IEngravingMachineCuttingTaskItemObject[]; +} +/** + * 同种材质以及厚度的待排小板,每个item描述小板形状 + */ +declare interface IEngravingMachineCuttingTaskItemObject { + /** + * 排版小板个数 + * Minimum value (exclusive) : 0 + * Example : 2 + */ + count: number; + /** + * 小板是否可以翻转,取值0或1。0表示不允许翻转,1表示允许翻转。 + * Minimum value : 0 + * Maximum value : 1 + * Example : 0 + */ + flip: number; + /** + * true:表示异形, false:表示矩形, 目前接口仅支持方形件 + */ + is_irshape: boolean; + /** + * 描述item id + * Length : 1 - 256 + * Example : "1" + */ + item_id: string; + /** + * 小板名称 + * Length : 1 - 256 + * Example : "item_1" + */ + item_name: string; + /** + * 小板可以选择的旋转角度,目前支持矩形小板90度旋转 + * Example : [ 0, 90 ] + */ + orientations: string; + /** + * 矩形轮廓的点集,点集逆时针顺序 + * Example : [ [ 0, 0 ], [ 433, 0 ], [ 433, 2337 ], [ 0, 2337 ] ] + */ + vertices: Array<[number, number]>; +} +/** + * 通用事件监听对象 + * common event listener + */ +declare interface IEvent { + /** + * 监听事件 + * @param listener 事件监听函数 + * @return IEventUnListener 取消事件监听句柄 + */ + on(listener: IEventListener): IEventUnListener; + /** + * 监听单次,触发后,自动取消监听 + * @param listener IEventListener 事件监听函数 + * @return IEventUnListener 取消事件监听句柄 + */ + once(listener: IEventListener): IEventUnListener; + /** + * 触发事件 + * @param args + */ + emit(args: A): void; +} +/** + * 事件监听函数 + */ +declare interface IEventListener { + (args: A): void; +} +/** + * 取消事件监听 + */ +declare interface IEventUnListener { + (): void; +} +/** + * 执行订单操作参数 + */ +declare interface IExecuteOrderOperationOption { + /** 订单操作key */ + key: string; + /** 订单id */ + orderId: string; + /** + * 额外参数,特殊的订单操作时才需要传递此参数,支持以下操作 + * 重新提审:传递参数 **CreateOrderOption** + */ + extraParam?: Record; +} +/* Excluded from this release type: IExportAssemblyInfo */ +/* Excluded from this release type: IExportModelInfo */ +/** + * 模型JSON信息导出数据 + */ +declare interface IExportParamModelData { + /** + * 模型的唯一识别id + */ + id: string; + /** + * 模型类型(小程序用) + */ + '@type': string; + /** + * 模型类型,用于区分参数化模型1、五金2、元件3、虚拟模型4、参数化组合模型5 + */ + modelTypeId: number; + /** + * 模型在方案中的名称 + */ + modelName: string; + /** + * 模型原始名称,建模时的名称,即素材表里的名称 + */ + originalModelName: string; + /** + * 子模型列表 + */ + subModels: IExportParamModelData[]; + /** + * 模型对应的商品id,根据商品id可以在source中查询相关商品的信息 + */ + obsBrandGoodId: string; + /** + * 商品对应的真分类id + */ + prodCatId: number; + /** + * 模型对应的商品名称 + */ + modelBrandGoodName: string; + /** + * 模型对应商品上的产品编码 + */ + modelNumber: string; + /** + * 模型对应商品上的产品编码 + */ + modelBrandGoodCode: string; + /** + * 模型对应商品上的型号 + */ + modelProductNumber: string; + /** + * 模型对应的商品是否已删除,已删除则为true,否则为false + */ + modelAvailable: boolean; + /** + * 模型对应商品上的自定义编码 + */ + customCode: string; + /** + * 商品所属的商家id + */ + obsModelAccountId: string; + /** + * 模型主材质的商品id,根据商品id可以在source中查询相关商品的信息 + */ + textureObsBrandGoodId: string; + /** + * 材质商品名称 + */ + textureName: string; + /** + * 材质商品上的产品编码 + */ + textureNumber: string; + /** + * 材质商品上的产品编码 + */ + textureBrandGoodCode: string; + /** + * 材质商品上的型号 + */ + textureProductNumber: string; + /** + * 材质商品是否已删除,已删除则为true,否则为false + */ + textureAvailable: boolean; + /** + * 材质商品上的自定义编码 + */ + textureCustomCode: string; + /** + * 材质商品所属的商家id + */ + obsTextureAccountId: string; + /** + * 材质商品上的基材 + */ + baseTexture: string; + /** + * 收藏转素材商品的id,若不为空,则实际用户使用的是该商品 + */ + obsCollectBrandGoodId: string; + /** + * 模型是否需要报价,默认true + */ + needQuotation: boolean; + /** + * 模型是否需要在清单中输出(编辑器中定义),默认true + */ + displayInCostList: boolean; + /** + * 商品是否在清单中输出(商品详情页定义),默认true + */ + billOutput: boolean; + /** + * 商品自定义信息 + */ + customFields: ICustomField[]; + /** + * 代表模型价格信息的list,包含模型单价、数量、成本单价等报价信息 + */ + modelCostInfo: IModelCostInfo; + /** + * 模型参数列表,会输出模型身上所有的非隐藏系统变量、基础变量与自定义变量;这里的参数化模型不包括生成类模型 + */ + parameters: IParamModelParameter[]; + /** + * 模型参数列表,会输出模型身上所有的隐藏系统变量、基础变量与自定义变量;这里的参数化模型不包括生成类模型 + */ + ignoreParameters: IParamModelParameter[]; + /** + * 模型中间变量列表,会输出模型身上所有的中间变量;这里的参数化模型不包括生成类模型 + */ + constParameters: IParamModelParameter[]; + /** + * 模型所属房间id + */ + roomId: string; + /** + * 非原生组件;原型为组件库拖入组件时值为true,否则为false + */ + accessoryModel: boolean; + /** + * 模型脚本描述模型树的唯一id(酷家乐内部使用) + */ + modelInstanceId: string; + /** + * 原生子模型已删除 + */ + deleted: boolean; + /** + * 模型不显示(工具中设置) + */ + ignore: boolean; + /** + * 生成类模型所关联的模型id,以台面为例,会关联侧台面id和柜子id + */ + unitParamModelIds: Array; + /** + * 子模型坐标的调用方式,比如子模型都是左后下,或都是中心点;只向下影响一层,不会影响子模型的子模型 + */ + globalInvokedPositionTypeId?: number; + /** + * 模型安装位置编码,受“产品编号”功能控制 + */ + installationCode: string; + /** + * 父模型id + */ + parentId: string; + /** + * 模型备注 + */ + remark: string; + /** + * 模型是否标准,标准模型值为true,非标模型值为false;受“非标检测”功能控制 + */ + standard: boolean; + /** + * 模型原点坐标。如果是顶层模型,为世界坐标系下的坐标;如果是子模型,为父模型局部坐标系下的坐标 + */ + position?: Number3; + /** + * 中心点坐标。如果是顶层模型,为世界坐标系下的坐标;如果是子模型,为父模型局部坐标系下的坐标 + */ + center?: Number3; + /** + * 模型原点旋转。如果是顶层模型,为世界坐标系下的坐标;如果是子模型,为父模型局部坐标系下的旋转 + */ + rotate?: Number3; + /** + * rotate 由弧度转换成角度后的值 + */ + rotateDegree?: Number3; + absBoundingBox?: { + min: Number3; + max: Number3; + }; + boundingBox?: { + min: Number3; + max: Number3; + }; + /** + * 模型缩放比例。仅针对五金模型有意义,其他模型都是 {1, 1, 1} + */ + scale: Number3; + /** + * 模型 mesh 所产生的最小包围盒(包含子模型) + */ + size: Number3; + /** + * 模型矩形外框所产生的最小包围盒(包含子模型)。注意:五金对应的值为 {0, 0, 0} + */ + boxSize: Number3; + /** + * 世界坐标系下的模型原点坐标 + */ + absPosition: Number3; + /** + * 世界坐标系下的模型原点旋转 + */ + absRotation: Number3; + /** + * Number3 absRotation 由弧度转换成角度后的值 + */ + absRotationDegree: Number3; + /** + * 用于模型报价时的尺寸计算;普通参数化模型优先取模型在编辑器中设置的报价尺寸,没有的话,取长宽高;台面线条由对应的算量算法计算得到 + */ + customSize: Number3; + /** + * 阵列方向 + */ + direction?: IParamModelDirection; + /** + * 阵列长度 + */ + length: number; + arrayStyle: { + /** + * 阵列步长 + */ + step: number; + /** + * 阵列数量 + */ + number: number; + }; + type: string; + element: IExportParamModelData; + /** + * 放样轮廓高 + */ + scaleHeight: number; + /** + * TODO + * 老板放样路径 + */ + paramLoftPath: any; + /** + * 与 resources 中的数据重复 + */ + profile: IResourceProfiles[]; + /** + * 放样轮廓,通常是线条、前后挡水、开孔截面的商品id + */ + profileBrandGoodIds: Array; + /** + * 边信息 + */ + edges: IParamModelEdges[]; + /** + * 轮廓商品信息 + */ + profiles: IResourceProfiles[]; + /** + * TODO + * 线条模型的切割分段信息 + */ + profileSegments: any; + /** + * 板件厚度 + */ + thickness: number; + /** + * 板件路径 + */ + paramPlankPath: IPlankPathData; + /** + * 旧板件路径(与ParamPlankPath仅有数据结构差异) + */ + productionOldPath: IPlankPathData; + /** + * 材质方向 + */ + textureAngle: number; + /** + * 正面喷绘效果材质商品 id + */ + brushMaterialBgId?: number; + /** + * 背面喷绘效果材质商品 id + */ + bottomBrushMaterialBgId?: number; + /** + * 平面板件基础信息 + */ + points?: Number2; + /** + * 平面板件基础信息 + */ + arcIndex?: number; + /** + * 平面板件基础信息 + */ + radius?: number; + /** + * 平面板件基础信息 + */ + clockwise?: boolean; + /** + * 平面板件基础信息 + */ + minorArc?: boolean; + /** + * other fields + */ + [key: string]: any; +} +/* Excluded from this release type: IExportRes */ +/** + * 拉伸模型 + */ +declare interface IExtrusionModel extends IModelBaseInfo { + /** 子模型的参数 */ + parameters: IParameter[]; + texture?: ITexture; + /** 构件的外轮廓 */ + profile: IImportPath; + /** 构件的洞,可以为 null, 为空或多个 */ + holes?: IImportPath[]; +} +/** + * 通用配置 + */ +declare interface IFieldEnumResult { + /** 自定义名称 */ + name: string; + /** 自定义值 */ + value: string | number | boolean; +} +declare interface IFieldOptionItem { + /** 选项名称 */ + name?: string; + /** + * 选项值 + * 具体值类型参考: EOrderFieldType + */ + value: any; +} +/** + * 查询提审模型信息结果 + */ +declare interface IFindAuditedModelResult { + /** 提审的顶层模型ID 即创建订单时传递的modelIds */ + modelIds: string[]; + /** 组件提审信息 */ + subModels: ISubModel[]; +} +/** 查询定制产品包商品类目选项 */ +declare interface IFindCustomFoldersOptions { + /** 商品库类型, 暂只支持企业库(默认) */ + lib?: ECustomLibraryType; + /** 定制行业线 */ + tool: EToolType; + /** 产品包id */ + packageId: string; + /** 真分类id (复数时并集) */ + categoryIds?: number[]; +} +/** 查询定制产品包商品选项 */ +declare interface IFindCustomProductsOptions { + /** 商品库类型, 暂只支持企业库(默认) */ + lib?: ECustomLibraryType; + /** 定制行业线 */ + tool: EToolType; + /** 产品包id */ + packageId: string; + /** 真分类id (复数时并集) */ + categoryIds?: number[]; + /** 拉取列表的偏移量,从0开始 */ + start: number; + /** 一次拉取的数量上限, 从数据安全以及性能上考虑, 最大值限制为50, 如果有拉取更多数据的需求, 请发起多次请求 */ + num: number; + /** 商品类目ID(默认根目录) */ + folderId?: string; + /** 是否深搜索(folderId及)所有后代类目, 默认 true */ + deep?: boolean; +} +declare interface IFindMoldingsOption { + /** + * 订单ID + */ + orderId: string; + /** + * 产品ID + */ + productIds: string[]; + /** + * 部件编码 + */ + codes: string[]; + /** + * 线条ID + */ + moldingIds: string[]; + /** + * 订单ID + */ + orderIds: string[]; +} +/** + * 查询或删除成品五金筛选条件 + */ +declare interface IFindOrDeleteFinishedProductOption { + /** + * 成品ID + */ + finishedIds?: string[]; + /** + * 订单ID + */ + orderIds?: string[]; + /** + * 部件编码 + */ + codes?: string[]; + /** + * 成品五金ID + * 当传入成品五金时,orderId必传 + */ + productIds?: string[]; + /** + * 订单ID + */ + orderId?: string; +} +/** + * 订单列表结果中订单信息 + */ +declare interface IFindOrderItem extends ICustomerBaseInfo, IOrderBaseInfo { + /** 订单类型 */ + orderType: EToolType[]; + /** 下单时间 */ + placeTime: number; + /** 门店名称 */ + storeName: string; + /** 方案ID */ + designId: string; + /** 方案名称 */ + designName: string; + /** 订单动态操作,执行操作会修改订单流程状态 */ + events: IOrderEvent[]; + /** 流程方向 */ + processDirect: EProcessDirect; + /** 紧急程度 */ + emergencyLevel: number; + /** 紧急程度 */ + emergencyLevelName: string; + /** 单据类型 */ + receiptType: number; + /** 单据类型 */ + receiptTypeName: string; + /** 订单静态操作,执行操作不修改订单流程状态 */ + actions: IOrderAction[]; + /** 删除时间 */ + deleteTime: number; + /** 是否被删除 */ + deleted: boolean; +} +/** + * 查询订单订单参数 + */ +declare interface IFindOrdersOption extends IPaginationQuery, Partial> { + /** 订单类型 */ + orderType?: EToolType; + /** 客户姓名 */ + customerName?: string; + /** 设计师姓名 */ + designerName?: string; + /** 下单时间起始(时间戳) */ + placeTimeStart?: number; + /** 下单时间结束(时间戳) */ + placeTimeEnd?: number; + /** + * 排序规则(asc 或 desc) + * @default asc + */ + sortRule?: 'asc' | 'desc'; + /** 排序字段 */ + sortField?: string; + /** 搜索类型 */ + searchType?: number; + /** 紧急程度 */ + emergencyLevel?: number; + /** 单据类型 */ + receiptType?: number; + /** 查询删除记录 */ + includeDeleted?: boolean; + /** 删除起始时间(时间戳) */ + deleteTimeStart?: number; + /** 删除终止时间(时间戳) */ + deleteTimeEnd?: number; +} +/** + * 查询订单结果 + */ +declare type IFindOrdersResult = IPaginationResult; +/** + * @vm-type UnknownType + */ +declare type IFindPlankListOption = AugmentedRequired | AugmentedRequired | AugmentedRequired | AugmentedRequired | AugmentedRequired | AugmentedRequired | AugmentedRequired; +/** + * 查找板件入参 + */ +declare interface IFindPlankListPortionOption { + /** + * 订单id,多个订单时,使用orderIds字段 + * @deprecated 推荐使用orderIds字段 + */ + orderId?: string; + /** + * 查询多个订单时,使用的ID + */ + orderIds?: string[]; + /** + * 部件编码 + */ + codes?: string[]; + /** + * 合批Id + */ + mergeIds?: string[]; + /** + * 混淆板件ID + */ + plankIds?: string[]; + /** + * 板件反面编码 + */ + backCodes?: string[]; + /** + * 产品ID + */ + productIds?: string[]; +} +/** + * 孔槽数据 + * @vm-type UnknownType + */ +declare interface IFittingDataV2 { + /** + * 孔槽关联的商品id + */ + modelId: string; + /** + * 孔的集合 + */ + holes?: Array; + /** + * 槽的集合 + */ + grooves?: Array; +} +/** + * 孔/槽方案的数据结构 + */ +declare interface IFittingDesignData { + /** + * 所属模型的id + */ + id?: string; + /** + * 所有的孔的数据 + */ + holes: IFittingHoleCollect; + /** + * 槽的数据 + */ + grooves: IFittingGrooveCollect; + /** + * 五金数据 + */ + hardwares: IFittingHardwareCollect; + /** + * 五金槽数据 + */ + hardwareGrooves: IFittingHardwareGrooves; +} +/** + * 孔槽方案数据 + * @vm-type UnknownType + */ +declare interface IFittingDesignDataV2 { + /** + * 方案关联的顶层模型id + */ + id: string; + /** + * 孔槽方案 + */ + fittingDesign: Array>; +} +/** + * 获取、删除孔槽数据参数 + */ +declare interface IFittingDesignOption { + /** + * 模型id + */ + modelId: string; +} +/** + * 方案中的所有槽的数据 + */ +declare type IFittingGrooveCollect = Record; +/** + * 五金数据 + */ +declare type IFittingHardwareCollect = Record; +/** + * 五金槽数据 + */ +declare type IFittingHardwareGrooves = Record; +/** + * 方案中,所有孔的数据 + */ +declare type IFittingHoleCollect = Record; +/** 模型关联户型数据 */ +declare interface IFloorplanRelation { + /** 关联墙体id */ + hostIds: string[]; + /** 关联墙洞id */ + openingIds: string[]; + /** 是否与墙体方向反向 与 模型旋转角度 和 内外开启参数(pushOrPull)、开门方向参数(doorOpenDirection) 共同决定展示的开向 */ + reverse?: boolean; +} +/** + * 定制商品类目 + */ +declare interface IFolder { + id: string; + /** 类目名 */ + name: string; + /** 类目封面图 */ + imageUrl?: string; + /** 子类目 */ + children: IFolder[]; +} +/** + * 获取ka商家appuid返回值 + */ +declare interface IGetAppUidResult { + appUid: string | number | null; +} +/** + * 客户信息查询 + */ +declare interface IGetCustomerListOption extends IPaginationQuery { + /** + * 搜索的关键字 + */ + keyWord?: string; + /** 关键字查询 */ + queryType?: ECustomerQueryType; + /** + * 查询范围 + */ + queryRange: ECustomerQueryRange; +} +/** + * 客户信息查询结果 + */ +declare type IGetCustomerListResult = IPaginationResult; +declare interface IGetFittingDataByAuxiliaryOption { + /** + * 需要获取辅助结构定义的孔槽的模型id + */ + modelId: string; + /** + * 距离容差 单位:毫米 + * @default 0.5 + * + */ + distanceTol?: number; +} +/** + * @vm-type UnknownType + */ +declare interface IGetFittingDataByAuxiliaryResult { + /** + * 孔槽直接关联的对象id + * 可能是元件或者商品 + */ + id: string; + /** + * 孔的集合 + */ + holes: Array; + /** + * 槽的集合 + */ + grooves: Array; +} +/** + * 获取模型的交接信息 + */ +declare interface IGetIntersectedOption { + /** + * 模型ID + */ + modelId: string; + /** + * @deprecated 可使用bodyDistTol/faceDistTol分别指定交接体/面阈值 + * 含义为交接面/体进行运算过程中的阈值容差;即两个平行面之间,生成交接信息时,最大距离 + * 默认值为 0.1mm + * 单位:毫米 + */ + tolerance?: number; + /** + * 超时时间 + * 单位:秒 + */ + timeout?: number; + /** + * 交接体阈值 + * 单位:毫米 + * @default 0.1 + */ + bodyDistTol?: number; + /** + * 交接面阈值 + * 单位:毫米 + * @default 0.1 + */ + faceDistTol?: number; + /** + * 是否过滤板厚 + * @default true + */ + thicknessFilter?: boolean; + /** + * 参与计算的对象 + * 传入商品需要明确指定prodCatIds + * @default [EIntersectModelType.PLANK,EIntersectModelType.HARDWARE] + */ + computeModelTypes?: Array; + /** + * 参与计算的商品 + */ + products?: Array<{ + /** + * 真分类 + */ + category: number; + }>; + /** + * 商品统一建模方向 + * @default EProductDirection.XY + */ + direction?: EProductDirection; + /** + * 支持配置的交接类型 + * 默认输出交接面&交接体 + * 交接面不支持配置(一定输出) + * 支持配置输出交接体/贯穿交接体 + */ + intersectedInfoType?: EIntersectedInfoType[]; + /** + * 不足板厚,是否输出交接体 + * @default true 默认true,即输出交接体 + */ + thicknessFilterBody?: boolean; + /** + * 不足板厚,配置允许输出交接面的阈值范围; + * 在阈值范围内输出交界面,在阈值范围外不输出交界面; + * 该字段需要配合`thicknessFilter`一起使用,即 `thicknessFilter`为true时,该字段才会生效; + * @default 0.05 + */ + thicknessFilterFaceDistTol?: number; +} +/** 获取合批单清单文件参数 */ +declare interface IGetMergeTaskReportFileOption { + /** 合批单ID */ + mergeId: string; + /** 清单模板ID */ + templateId: string; +} +/** + * getModelJsonAsync获取模型json参数 + */ +declare interface IGetModelJsonOption { + /** + * 模型ID + */ + modelId: string; + /** + * 模板ID + */ + templateId?: string; + /** + * 忽略缓存,重新获取模型数据,默认检查模型是否存在孔槽方案,如果存在则获取缓存模型数据,否则重新生成模型数据,重新生成模型数据会清空孔槽方案 + */ + force?: boolean; +} +/** 查询附件参数 */ +declare interface IGetOrderAttachmentsOption { + /** 查询数据起始 index ,从0开始 */ + start?: number; + /** 查询数据条数 */ + num?: number; + /** 排序规则 默认 asc 升序 */ + sortRule?: 'asc' | 'desc'; + /** 排序字段 */ + sortField?: string; + /** 订单ID */ + orderId: string; + /** 附件名称 */ + name?: string; + /** 订单状态 */ + orderState?: number; + /** 操作人名称 */ + userName?: string; +} +/** 查询附件结果 */ +declare type IGetOrderAttachmentsResult = IPaginationResult; +/** + * 订单字段配置列表 + */ +declare interface IGetOrderFieldsResult { + /** + * 订单默认字段 + */ + systemFields: Omit[]; + /** + * 订单自定义字段 + */ + customFields: IOrderField[]; +} +/** 查询订单备注参数 */ +declare interface IGetOrderRemarksOption { + /** 订单id */ + orderId: string; +} +/** 查询订单备注结果 */ +declare interface IGetOrderRemarksResult { + /** 用户名 */ + userName: string; + /** 用户头像 */ + userAvatar: string; + /** 订单状态 */ + orderState: number; + /** 订单状态名称 */ + orderStateName: string; + /** 备注id */ + remarkId: string; + /** 备注内容 */ + content: string; + /** 上传时间 */ + createTime: number; + /** 订单备注业务类别,null: 节点备注 */ + type: EOrderRemarkType | null; + /** 数据权限集合 */ + auths: EOrderFieldDataAuth[]; + /** 备注图片 */ + images?: IOrderAttachment[]; +} +/** 获取订单清单文件参数 */ +declare interface IGetOrderReportFileOption { + /** 订单ID */ + orderId: string; + /** 清单模板ID */ + templateId: string; + /** 包裹ID,对清单数据筛选,仅包含包裹相关数据 */ + packageId?: string; +} +/** + * 获取模型缩略图信息参数 + */ +declare interface IGetPreviewImgOption { + /** + * 模型id + */ + modelId: string; + /** + * 真分类ID过滤截图内容 + */ + ignoreCategory?: number[]; +} +/** + * 获取门店信息 + */ +declare interface IGetStoreInfoResult { + /** 门店id */ + storeId: string; + /** 门店名称 */ + storeName: string; + /** 联系人 */ + contactUser: string; + /** 联系电话 */ + contactPhone: string; + /** 门店地址 */ + shippingAddr: string; +} +/** + * 分页获取模型轻量信息参数 + */ +declare interface IGetTopModelsLiteInfoOption { + /** + * 分页页码 + * @default 1 + */ + page?: number; + /** + * 分页数量 + * =-1返回所有顶层模型 + * @default 20 + */ + size?: number; + /** + * 真分类ID过滤 + */ + ignoreCategory?: number[]; +} +declare interface IGrooveData extends IBaseHoleGrooveData { + width: number; +} +declare interface IGrooveDataV2 { + /** + * 起点圆心 + */ + start?: Number3; + /** + * 终点 + */ + end?: Number3; + /** + * 板面 + */ + plankFaceId: string; + /** + * 槽宽 + */ + width?: number; + /** + * 槽应用类型 + */ + type: EAppliedGrooveType; + /** + * 槽几何类型,不填默认是SQUARE + */ + geometryType?: EGrooveGeometryType; + /** + * 槽路径点 + */ + profile?: IProfileOrPath; + /** + * 圆弧路径 + */ + radius?: number; + /** + * 多点路径 + */ + path?: IProfileOrPath; + /** + * 槽深 + */ + depth: number; + /** + * 名称 + */ + name: string; +} +declare type IGrooveDataV2WithId = IGrooveDataV2 & IGrooveId; +declare interface IGrooveId { + /** + * 槽ID + */ + grooveId: string; +} +/** + * 分组数据 + */ +declare interface IGroupData { + /** + * 方案内的房间 + */ + rooms: { + /** + * 房间唯一id + */ + roomId: string; + /** + * 房间顺序。值越小,位置越靠前 + */ + order: number; + /** + * 房间中的分组数据 + */ + groups: { + /** + * 分组名称 + */ + name: string; + /** + * 分组顺序,值越小,位置越靠前 + */ + order: number; + /** + * 由模型找墙工具生成的分组唯一id + */ + id: string; + /** + * 分组内的墙面数组 + */ + wallFaces?: { + /** + * 墙面id + */ + wallFaceId: string; + }[]; + /** + * 分组内的定制模型数组 + */ + models?: { + /** + * 定制模型id + */ + id: string; + }[]; + }[]; + }[]; +} +/** + * 五金相关的信息 + */ +declare interface IHardwareData extends IBaseFittingData { + /** + * 建模原点在板件坐标系下的坐标 + */ + position: Number3; + /** + * 相对建模坐标系中夹角,不传默认没有任何基于板件坐标的旋转,会将五金以建模原点放在 position 上,五金建模方向和板件建模方向一致进行摆放。 + */ + rotate: Number3; + /** + * 相对建模坐标系中缩放,不传默认五金和上传大小完全一致 + */ + scale: Number3; + /** + * 商品ID + */ + brandGoodId: string; + /** + * 关联孔槽ID + */ + linkedIds: string[]; +} +/** + * 闭合路径中的点,需要按逆时针顺序上传,否则会导致异常 + */ +declare interface IHardwareGrooveData extends IBaseFittingData { + /** + * 槽的深度 + */ + depth: number; + /** + * 所处的板面 + */ + plankFaceId: number; + /** + * 闭合路径的所有点 + */ + points: IPointData[]; + /** + * 闭合路径的所有线 + */ + lines: ILineData[]; +} +declare interface IHoleData extends IBaseHoleGrooveData { + /** + * 孔直径 + */ + diameter: number; +} +/** + * 孔数据结构 + * 坐标原点为关联模型的中心点 + */ +declare interface IHoleDataV2 { + /** + * 起点圆心 + */ + start: Number3; + /** + * 终点 + */ + end: Number3; + /** + * 板面 + */ + plankFaceId: string; + /** + * 应用类型 + */ + type: EAppliedHoleType; + /** + * 直径 + */ + diameter: number; + /** + * 孔深 + */ + depth: number; + /** + * 名称 + */ + name: string; +} +declare interface IHoleDataV2WithId extends IHoleDataV2 { + /** + * 孔的id + */ + holeId: string; +} +declare interface IIEngravingMachineCuttingResultResponseNesting { + /** + * 此大板排版小板数量 + * Minimum value : 0 + * Example : 2 + */ + item_count: number; + /** + * 大板中小板排版结果 + * Example : [ "object" ] + */ + items: IIEngravingMachineCuttingResultResponseNestingItem[]; + /** + * 大板id,从0开始,依序递增 + * Minimum value : 0 + * Example : 0 + */ + plate_id: number; + /** + * 大板长度 + * Minimum value : 0 + * Example : 2440.0 + */ + plate_length: number; + /** + * 大板名 + * Length : 1 - 256 + * Example : "plate_1" + */ + plate_name: string; + /** + * 大板利用率 + * Minimum value : 0 + * Maximum value : 1 + * Example : 0.9 + */ + plate_ratio: number; + /** + * 大板宽度 + * Minimum value : 0 + * Example : 1220.0 + */ + plate_width: number; +} +declare interface IIEngravingMachineCuttingResultResponseNestingItem { + /** + * 小板是否沿x轴翻转,取值0或1,0表示不翻转,1表示翻转 + * Minimum value : 0 + * Maximum value : 1 + * Example : 0 + */ + flip_x: number; + /** + * 小板是否沿y轴翻转,取值0或1,0表示不翻转,1表示翻转 + * Minimum value : 0 + * Maximum value : 1 + * Example : 0 + */ + flip_y: number; + /** + * 小板旋转角度 + * Example : 90 + */ + item_angle: number; + /** + * 小板名全程 + * Length : 1 - 256 + * Example : "item_1" + */ + item_name: string; + /** + * 矩形轮廓的点集,点集逆时针顺序 + * Example : [ [ 0, 0 ], [ 433, 0 ], [ 433, 2337 ], [ 0, 2337 ] ] + */ + vertices: Array<[number, number]>; +} +/** + * 导入模型 + */ +declare interface IImportModel { + /** + * 模型商品ID,用于模型更新场景。模型商品ID在导入任务执行成功后会返回 + * 更新场景会有以下限制: + * 1、仅支持顶层模型更新; + * 2、用户只能更新自己导入的模型; + * 3、只能更新模型的子模型(subModels)、变量(parameters)、预览图(previewImgUrl OR previewImgData)、商品名(name)。 + */ + id?: string; + /** 标识模型类型, 值为`importModel` */ + type: string; + /** 模型名称 */ + name: string; + /** 模型类别,可选值详见 https://open.kujiale.com/open/apps/2/docs?doc_id=653&tab_id=api&path=0_536_651_653《模型类别表》 */ + category: string; + /** 模型预览图 */ + previewImgUrl?: string; + /** Base64 编码格式的模型预览图数据 以类型data:image/jpg;base64, 或data:image/png;base64 开头 除去类型数据外,其他数据不超过1048576个字符; + * 和 previewImgUrl 二选一 */ + previewImgData?: string; + /** 模型变量信息,将创建模型变量,个数不能超过10 */ + parameters?: IParameter[]; + /** 模型的所有部件,结构说明具体查看子模型部分 */ + subModels: Array; +} +/** + * 导入模型返回结果 + */ +declare interface IImportModelResult { + /** 模型商品ID */ + productId: string; +} +declare interface IImportPath { + /** 点的列表,每连个数字代表一个点,按轮廓顺序排列 */ + points: number[]; + /** 表示了两点之间的曲线。如果表达了一个封闭的轮廓,那么曲线数量和点数量相同;如果表达了一段连续的路径,那么曲线数量比点数量少 1 */ + curves: ICurve[]; +} +/** + * 内空信息 + */ +declare interface IInnerSpaceData { + /** + * 内空的尺寸大小 + */ + size: Number3; + /** + * 内空的位置信息,位置是当前内空的中心点,相对于模型中心点的坐标 + */ + position: Number3; + /** + * 当前内空的旋转角度 + * @deprecated 将废弃,推荐使用 rotation + */ + rotate: Number3; + /** + * 当前内空的旋转角度 + */ + rotation: Number3; + /** + * 当前内空的朝向 + */ + face: EFace; + /** + * 当前内空所关联的模型 + */ + parent: IParamModelLite; +} +/** + * 安装数据 + */ +declare interface IInstallData { + /** + * 房间编码 + */ + rooms: { + /** + * 房间唯一id + */ + roomId: string; + /** + * 房间编码,由三方小程序反写 + */ + roomCode: string; + }[]; + /** + * 定制模型编码 + */ + models: { + /** + * 定制模型id + */ + id: string; + /** + * 安装编码,由三方小程序反写 + */ + installCode: string; + }[]; +} +/** + * 干涉检测参数 + */ +declare interface IIntersectCheckOption { + /** + * 模型id + * 默认为全方案模型检测 + */ + modelIds?: string | string[]; + /** + * 定制工具线 + */ + toolType?: EToolType | EToolType[]; +} +/** + * 干涉检测结果 + */ +declare interface IIntersectCheckResult { + /** + * 模型id + */ + id: string; + /** + * 模型名称 + */ + name: string; + /** + * 当前所在层级 + */ + level: number; + /** + * 定制工具线 + */ + toolType?: EToolType; + /** + * 当前存在干涉的模型 + */ + children: IIntersectCheckResult[]; +} +/** + * 交接信息 + */ +declare interface IIntersectedData { + /** + * 交接信息集合 + */ + intersectedGroups: IIntersectedGroup[]; +} +/** + * 一组交接信息 + */ +declare interface IIntersectedGroup { + /** + * 交接信息的唯一标识ID + */ + id: string; + /** + * 交接信息的产生来源 + */ + intersectType: EIntersectedCreatedType; + /** + * 关联元素产生的多组交接信息 + */ + intersecteds: IBaseIntersected[]; +} +/** 干涉检测结果 */ +declare interface IIntersectResult { + /** + * 模型id + */ + id: string; + /** + * 模型名称 + */ + name: string; + /** + * 当前存在干涉的模型 + */ + children: IIntersectResult[]; + /** + * other options + */ + [s: string]: any; +} +/** + * Json基本信息 + */ +declare interface IJsonInfo { + /** + * Json生成时间戳,单位为毫秒 + */ + generatedTime: number; + /** + * other fields + */ + [key: string]: any; +} +/** + * 线段表示 + */ +declare interface ILineBase { + /** + * 线条类型 + */ + type: ELineType; + /** + * 圆弧是否为顺时针 + */ + clockwise?: boolean; + /** + * 圆弧是否为劣弧 + */ + minorArc?: boolean; + /** + * 圆弧半径 + */ + radius?: number; + /** + * 椭圆弧长轴 + */ + majorRadius?: number; + /** + * 椭圆弧短轴 + */ + minorRadius?: number; + /** + * 椭圆圆心 + */ + ellipseCenter?: Number2; +} +declare type ILineData = ILineDataBase | ILineDataCircle; +/** + * 直线 + */ +declare interface ILineDataBase extends Omit { + /** + * 线条类型 + */ + type: ELineType.SEGMENT; +} +/** + * 弧线 + */ +declare interface ILineDataCircle extends Omit { + /** + * 线条类型 + */ + type: ELineType.CIRCLE_ARC; + /** + * 是否顺时针 + */ + clockwise: boolean; + /** + * 优弧劣弧 (只有弧线有) + */ + minorArc: boolean; + /** + * 半径 (只有弧线有) + */ + radius: number; +} +/** + * 获取顶层模型参数 + */ +declare interface IListTopModelsOptions extends ICustomModelFilter { + /** 顶层模型真分类id */ + categories?: number[]; + /** + * 工具线 + * 默认所处工具线 + */ + toolType?: EToolType | EToolType[]; +} +declare interface IModelBaseInfo { + /** 标识子模型类型 + * 引用模型:`reference` + * 拉伸模型:`extrusion` + * 扫掠模型: `sweep` + */ + type: string; + /** 长度为三数组,表示子模型相对父模型的偏移,以父模型包围盒的“左后下”为原点 */ + translate: [number, number, number]; + /** 长度为三数组,表示子模型的旋转,以弧度为单位 */ + rotate: [number, number, number]; + /** 模型名称 */ + name: string; + /** 任意字符,当前模型中子模型唯一标记,生成时由酷家乐生成,导入API中返回,用于模型更新 */ + instanceId: string; +} +/** + * 模型价格信息 + */ +declare interface IModelCostInfo { + /** + * 单价 + */ + unitPrice: string; + /** + * 数量 + */ + quantity: string; + /** + * 成本单价 + */ + unitCost: string; + /** + * 附加费用 + */ + aditionalFee: string; + /** + * 非标系数 + */ + nonStandardCoef: string; + /** + * 总价 + */ + price: number; + /** + * 单位 + */ + quotationUnit: string; + /** + * 单位 + */ + unitNumber: number; + /** + * 总价 + */ + description: number; + /** + * other fields + */ + [key: string]: any; +} +/** + * 获取模型是否关联未作废的订单参数 + */ +declare interface IModelIsAssociatedOrderOption { + /**模型id */ + modelIds: string | string[]; + /**排除检查的订单id,将不会检测该订单中的模型关联关系 */ + excludeOrderId?: string; +} +/** + * 获取模型是否关联未作废的订单 + */ +declare interface IModelIsAssociatedOrderResult { + /**模型id */ + modelId: string; + /**模型关联的订单id */ + orderId: string | null; +} +/** + * 订单静态操作定义 + */ +declare interface IOrderAction { + /** 操作名 */ + name: string; + /** 操作Key */ + key: string; + /** 额外信息 */ + extra?: IOrderJumpActionExtra; +} +/** + * 订单附件 + */ +declare interface IOrderAttachment { + /** 附件key */ + uploadKey: string; + /** 附件名称 */ + name: string; + /** 附件url */ + url: string; +} +/** 查询附件信息 */ +declare interface IOrderAttachmentItem extends IOrderAttachment { + /** 附件ID */ + attachmentId: number; + /** 订单状态 */ + orderState: number; + /** 订单状态名称 */ + orderStateName: string; + /** 操作人用户ID */ + userId: string; + /** 操作人用户名称 */ + userName: string; + /** 用户头像 */ + userAvatar: string; + /** 上传时间 */ + createTime: number; + /** 订单附件业务类别,null: 节点附件 */ + attachmentType: EAttachmentType | null; + /** 数据权限集合 */ + auths: EOrderFieldDataAuth[]; +} +declare interface IOrderAttachments extends IOrderAttachment { + /** 订单附件业务类别,null: 节点附件 */ + attachmentType: EAttachmentType | null; + /** 数据权限集合 */ + auths: EOrderFieldDataAuth[]; +} +/** + * 订单的基本信息 + */ +declare interface IOrderBaseInfo { + /**订单id */ + orderId: string; + /**订单编号 */ + orderNo: string; + /**订单名称 */ + orderName: string; + /**订单状态 */ + orderState: number; + /** 订单状态名称 */ + orderStateName: string; +} +/** + * 订单数据 + */ +declare interface IOrderData extends IOrderBaseInfo, ICustomerBaseInfo { + /** 订单类型 */ + orderType: EToolType[]; + /** 流程方向 */ + processDirect: EProcessDirect; + /** 下单时间 */ + placeTime: number; + /** 客户id */ + customerId: string; + /** 客户来源 */ + customerSource: ECustomerSource; + /** 门店id */ + storeId: string; + /** 门店名称 */ + storeName: string; + /** 门店联系人 */ + contactUser: string; + /** 门店联系电话 */ + contactPhone: string; + /** 门店收货地址 */ + shippingAddr: string; + /** + * 订单备注 + * @deprecated 请使用`orderRemarks` 包含数据权限 + */ + remark: string; + /** + * 订单备注(带数据权限) + */ + orderRemarks: IOrderRemarks[]; + /** 订单附件 */ + attachments: IOrderAttachments[]; + /** 设计方案id */ + designId: string; + /** 设计方案名称 */ + designName: string; + /** 设计师名称 */ + designerName: string; + /** 设计师id */ + designerId: string; + /* Excluded from this release type: planArea */ + /** 自定义字段 */ + customFields: Record; + /** + * 设计备注 + * @deprecated 请使用`designRemarks` 包含数据权限 + */ + designRemark: string; + /** 设计备注(带数据权限) */ + designRemarks: IOrderRemarks[]; + /** 设计附件 */ + designAttachments: IOrderAttachments[]; + /** 审核订单号 */ + auditOrderNo: string; + /** 审核员名称 */ + auditorName: string; + /** 审核备注 */ + auditRemarks: IAuditOrderRemarks[]; + /** 审核附件 */ + auditAttachments: IOrderAttachments[]; + /** 应付金额 */ + payAmt: string; + /** 实付金额 */ + actualPayAmt: string; + /** 付款记录创建人 */ + payRecordCreator: string; + /** 付款凭证是否已退回 */ + payCertificateSendBack: boolean; + /** 付款凭证 */ + payCertificates: IOrderAttachment[]; + /** 订单动态操作,执行操作会修改订单流程状态 */ + events: IOrderEvent[]; + /** 紧急程度 */ + emergencyLevel: number; + /** 紧急程度 */ + emergencyLevelName: string; + /** 单据类型 */ + receiptType: number; + /** 单据类型 */ + receiptTypeName: string; + /** 关联的父订单的ID */ + parentOrderId: string; + /** 关联的父订单的名称 */ + parentOrderName: string; + /** 创建者 */ + creatorName: string; + /** 订单静态操作,执行操作不修改订单流程状态 */ + actions: IOrderAction[]; + /** 订单是否被删除 */ + deleted: boolean; +} +/** + * 订单动态操作 + */ +declare interface IOrderEvent { + /** 操作名称 */ + name: string; + /** 操作key */ + key: string; + /** 下一个订单状态 */ + nextState: number; + /** 下一个订单状态名称 */ + nextStateName: string; + /** 操作类型:系统预设 | 自定义 */ + eventType: EOrderEventType; +} +/** + * 订单事件定义 + */ +declare interface IOrderEventData { + /** + * 事件key + */ + key: string; + /** + * 事件名称 + */ + name: string; +} +/** + * 订单字段配置 + */ +declare interface IOrderField { + /** + * 字段key + */ + key: string; + /** + * 字段类型 + */ + type: EOrderFieldType; + /** + * 字段名称 + */ + name: string; + /** + * 字段描述 + */ + desc?: string; + /** + * 是否可见(订单详情) + */ + isVisible: boolean; + /** + * 是否可编辑 + */ + isEditable: boolean; + /** + * 创建订单是否必填 + * @default false + */ + required?: boolean; + /** + * 字段可选项配置 + * @deprecated 请使用optionalItems + */ + optionalValue?: string; + /** + * 默认值 + */ + defaultValue?: any; + /** + * 字段配置的可选项(结构化数据) + */ + optionalItems?: IFieldOptionItem[]; +} +/** + * 小程序跳转操作额外信息,操作key: jumpOtherMp + */ +declare interface IOrderJumpActionExtra { + /** + * 跳转小程序ID + */ + targetMiniappId: string; + /** + * 跳转小程序名称 + */ + targetMiniappName: string; + /** + * 携带信息 + */ + info?: { + /** + * 小程序跳转携带订单ID + */ + needWriteOrderId?: boolean; + /** + * 小程序跳转携带合批单ID + */ + needWriteMergeId?: boolean; + /** + * 小程序跳转携带自定义内容 + */ + customContent?: string; + }; +} +declare interface IOrderOperation { + operator: string; + operationName: string; + roleName: string; + role: number; + operation: number; + createTime: string; +} +/** + * 订单操作定义 + */ +declare interface IOrderOperationData { + /** + * 操作key + */ + key: string; + /** + * 操作名称 + */ + name: string; + /** + * 操作类型 + */ + type: EOrderOperationType; +} +/** 订单备注 */ +declare interface IOrderRemarks extends IGetOrderRemarksResult { + friendlyTime: string; +} +/** + * 订单状态定义 + */ +declare interface IOrderStateData { + /** + * 状态名称 + */ + name: string; + /** + * 状态key + */ + key: number; +} +declare interface IPaginationQuery { + /** + * 开始查询的条数 + * @default 0 + * */ + start?: number; + /** + * 分页量 + * @default 20 + */ + pageSize?: number; +} +declare interface IPaginationResult { + /** 查询总数 */ + totalCount: number; + /** 当前页总数 */ + count: number; + /** 是否还有下一页 */ + hasMore: boolean; + /** 查询的结果 */ + result: T[]; +} +/* Excluded from this release type: IParamCeilingParam */ +/* Excluded from this release type: IParamCeilingResult */ +/** + * 模型变量 + */ +declare interface IParameter { + /** 变量类型, system:系统变量; basic:基础变量; custom:⾃定义变量。 */ + category?: string; + /** 变量名 */ + name: string; + /** 展示名 */ + displayName?: string; + /** 变量值,该值的设置,需满足valueType和setType的要求,同时也可以设置为引用值,用#Parameter.name的方式表示,如#CZ,用于引用父模型变量中的值 */ + value: string; + /** 变量值类型,目前支持这几种:float(浮点数)、int(整数)、material(材质)、plankpath(板件轮廓)、shape(扫掠轮廓)、loftpath(扫掠放样)、string(字符串)、bool(布尔值)、float2(二维浮点数) */ + valueType?: string; + /** 变量值的设置类型,目前支持这几种,unlimited(无限制)、range(区间)、fixed(固定值)、optional(可选) */ + setType?: string; + /** 变量值的设置类型为区间条件下,min必传,表示区间的最小值 */ + min?: string; + /** 变量值的设置类型为区间条件下,max必传,表示区间的最大值 */ + max?: string; + /** 可选值 */ + options?: IParameterOption[]; +} +/** + * 模型变量可选值 + */ +declare interface IParameterOption { + /** 展示名 */ + name?: string; + /** 值 */ + value: string; + /** 隐藏条件 */ + ignore?: string; + /** 优先权重 */ + priority?: string; +} +/** + * 阵列方向 + */ +declare interface IParamModelDirection { + x: number; + y: number; + z: number; + isCustom: boolean; +} +/** + * 边信息 + */ +declare interface IParamModelEdges { + /** + * 边起点 + */ + mStart: Number2; + /** + * 边终点 + */ + mEnd: Number2; +} +/** + * 对定制参数化模型进行精简处理后的结果 + * @name CustomModel + * @vm-type CustomModel + */ +declare interface IParamModelLite { + /** + * 模型的唯一标识ID + * 如果模型是从方案当中获取至的,则为模型在方案中的ID,非方案模型,将会随机生成ID + * @readonly + * @public + * @type string + */ + readonly id: string; + /** + * 定制模型类型,在 @modelType 基础上进行了细分 + * @public + * @readonly + * @type ECustomModelType + */ + type: ECustomModelType; + /** + * 商品ID,即商品后台的商品ID + * @readonly + */ + readonly productId?: string; + /** + * 当前模型所处的真分类信息 + * @readonly + */ + category: number; + /** + * 此字段只有当模型从工具场景中获取,才具有意义 + * 当前模型在工具当中的显示与隐藏状态;如果为`true`,则表示为隐藏状态 + * @public + * @readonly + */ + isHidden?: boolean; + /** + * 模型类型,仅为从方案中获取模型才具备意义 + * @public + * @readonly + * @typedef EParamModelType + */ + modelType?: EParamModelType; + /** + * 当前模型所处的定制行业线 + * @public + * @readonly + */ + toolType?: EToolType; + /** + * 当前模型是否为root节点,如果是,则为true + * @public + * @readonly + */ + isRoot?: boolean; + /** + * 当前模型是否是合法(隐藏)模型 + * @readonly + * @public + * @type boolean + */ + readonly legal?: boolean; + /** + * 当前尺寸信息 + * @readonly + * @public + * @typedef Number3 + */ + readonly size: Number3; + /** + * 获取当前模型的产品编码 + * 此字段相当于json输出中『modelBrandGoodCode』字段 + */ + getProductCode(): string | undefined; + /** + * 获取当前模型名称 + */ + getName(): string; + /** + * 更改当前模型名称 + * + * @param name 需重新设置的模型名称 + */ + setName(name: string): void; + /** + * 获取模型备注信息 + */ + getRemark(): string | undefined; + /** + * 更改模型备注信息 + * + * @param remark 备注信息 + */ + setRemark(remark: string): void; + /** + * 更新当前模型的位置信息 + * @param position {Number3} 坐标 + */ + setPosition(position: Number3): void; + /** + * 获取当前模型的坐标信息 + * @return Number3 相对父模型坐标,如果为顶层模型,则为世界坐标 + */ + getPosition(): Number3; + /* Excluded from this release type: setPositionFormula */ + /* Excluded from this release type: getPositionFormula */ + /** + * 更新当前模型的旋转信息 + * @description 特别说明,定制模型,使用的是右手坐标系,rotation字段中 + * @param rotation {Number3} 旋转的弧度 + */ + setRotation(rotation: Number3): void; + /** + * 获取当前模型相对父级的旋转信息 + */ + getRotation(): Number3; + /* Excluded from this release type: setRotationFormula */ + /* Excluded from this release type: getRotationFormula */ + /** + * 获取当前模型所处的工具线 + */ + getToolType(): EToolType | undefined; + /** + * 设置当前模型工具线 + * @param toolType + * @throws 如果工具线不被允许,将会报错 + */ + setToolType(toolType: EToolType): void; + /** + * 模型的复制,返回一个新的`ParamModel`对象 + */ + clone(): this; + /** + * 将当前模型与父级模型断开联系 + * 可以更直接的理解为:删除当前模型 + * > 针对`clone()`后的对象,作`dispose()`操作,将不会产生任何作用 + */ + dispose(): void; + /** + * 查找当前模型的父节点 + */ + getParent(): this | undefined; + /** + * 获取root节点,如果当前模型为root节点,则返回自身 + * @param recursion 存在多root时,是否获取最顶层root + */ + getRoot(recursion?: boolean): this; + /** + * 获取当前模型的所有子模型 + */ + getChild(): this[]; + /** + * 获取当前模型下的所有非原生模型 + * @description 说明一下:非原生模型可以大致理解为:在方案当中,手动生成一个模型,添加到其他模型上;与之对应子模型可以理解为原生模型,即参数 + * 化编辑中自带的模型 + */ + getAccessory(): this[]; + /** + * 向当前模型中,添加一个子模型;一般会向包裹层当中,添加子模型;另外,五金配件,也必须使用此方法添加 + * @param child {IParamModelLite} 待添加的模型 + */ + appendChild(child: this): void; + /* Excluded from this release type: replaceChild */ + /** + * 向当前模型中,添加一个非原生模型;一般会使用在添加五金 + * @param accessory {IParamModelLite} 待添加的模型 + */ + appendAccessory(accessory: this): void; + /** + * 获取当前模型中的参数信息(参数即在参数化编辑中的信息) + * @example + * `m.getParam('W')` 获取模型的宽度信息 + * @param name {string} 参数名称 + */ + getParam(name: string): IParamModelLiteParam | undefined; + /** + * 获取用户自定义属性 + * @param name {string} 属性名称 + * @param namespace {string} 命名空间(当不传时,即表示当前小程序下的命名空间,格式如下:miniapp-${appId}) + */ + getBzProperty(name: string, namespace?: string): IBzParamModelLiteProperty | undefined; + /** + * 判断当前模型是否包含某个属性 + * @param name {string} 属性名称 + * @param namespace {string} 命名空间 + */ + hasBzProperty(name: string, namespace?: string): boolean; + /** + * 删除自定义属性、当删除成功时,将返回true,否则返回false + * + * @param name + * @param namespace + */ + removeBzProperty(name: string, namespace?: string): boolean; + /** + * 判断当前模型是否包含某个参数 + * @param name {string} 参数名称 + */ + hasParam(name: string): boolean; + /** + * 将当前数据转换成一个纯对象 + * @private + */ + toJSON(): Record; + /** + * 对当前模型数据进行序列化操作 + */ + serialize(): string; + /** + * 将一个序列化之后的模型,进行反序列化操作 + */ + deserialize(model: string): this; + /** + * 刷新某个模型,此API仅适用于反向对接的模型: + * 当前某个模型在后台更新了,但用户方案中,存储的仍然是之前的版本,调用此方法后,会自动将当前模型更新成后台最新的版本。 + * > 需要注意的是,此方法会导致更新后,模型ID存在变化 + * > 模型中,添加的appendChild或addAccessory等参数,可能会失效不起作用 + */ + forceUpdate(update?: boolean): void; + /** + * 获取设计对象id + */ + getElementId(): ElementId_2 | undefined; + /** + * 获取当前模型中的板件轮廓信息 + */ + getPlankPathAsync(): Promise; + /** + * 获取户型关系 + */ + getFloorplanRelation(): Readonly | undefined; + /** + * 设置户型关系 + * @param floorplanRelation {IFloorplanRelation} 户型关系 + */ + setFloorplanRelation(floorplanRelation: Omit): void; +} +/** + * 模型的参数信息 + * @vm-type IParamType + */ +declare interface IParamModelLiteParam { + /** + * 获取参数名称 + */ + getName(): string; + /** + * 当前参数描述信息 + */ + getDescription(): string | undefined; + /** + * 获取参数简写名称 + */ + getSimpleName(): string | undefined; + /** + * 获取参数的显示名称 + */ + getDisplayName(): string; + /** + * 当前参数在工具中是否可见 + */ + getVisible(): boolean | undefined; + /** + * 当前字段是否被覆盖 + */ + isOverridden(): boolean | undefined; + /** + * 取消当前字段被覆盖 + */ + cancelOverride(): any; + /** + * 获取当前字段的单位类型 + */ + getUnitType(): EParamUnitType | undefined; + /** + * 获取当前参数类型 + */ + getParamForm(): EParamForm | undefined; + /** + * 判断当前值是否使用复合公式 + */ + isUsingMixFormula(): boolean; + /** + * 重置当前参数使用复合公式 + */ + useMixFormula(): void; + /** + * 获取当前参数解析后的值内容 + */ + getValue(): T; + /** + * @deprecated 请直接使用'getValue'方法 + */ + getParsedValue(): T; + /** + * 设置当前参数的值 + * @description 当前函数并未对输入的参数进行校验 + * @param value + */ + setValue(value: T): any; + /** + * @deprecated 请直接使用'setValue'方法 + * @param value + */ + setParsedValue(value: T): any; + /** + * 获取当前参数值类型 + */ + getType(): EParamType; + /** + * 获取当前参数输入值的最大值(参数化编辑器中设置的) + */ + getMax(): number | undefined; + /** + * 获取当前参数输入值的最小值(参数化编辑器中设置的) + */ + getMin(): number | undefined; + /** + * 获取当前参数的步长信息 + */ + getStep(): number | undefined; + /** + * 获取可选值 + */ + getOptionValues(): NamedValue[]; + /** + * 当前参数是否可以被编辑 + * @description 如果为不可编辑的话,强制更改参数也不会生效 + */ + getEditable(): boolean; + /** + * 获取当前模型在参数化编辑器中设置的推荐值 + */ + getRecommendValues(): NamedValue[]; + /** + * 当为多布尔值时,展示的内容 + */ + getValueDisplayNames(): string[]; + /** + * 是否需要将设置的参数覆盖原始参数信息 + * 仅对部分参数设计有效,具体细节,见对应场景 + * @deprecated 直接调用isOverridden()方法即可 + */ + getPrimitiveOverride(): boolean; + /** + * 是否需要将设置的参数覆盖原始参数信息 + * @deprecated 此逻辑,将在调用setValue时,自动完成此步骤,此方法可以忽略 + * @param value {boolean} + */ + setPrimitiveOverride(value: boolean): void; + /* Excluded from this release type: getFormula */ + /* Excluded from this release type: setFormula */ + /** + * 获取约束的产品包id + */ + getPackageId(): string | undefined; +} +/** + * 模型的板件轮廓信息 + */ +declare interface IParamModelLitePlankPath { + /** + * 获取原始外轮廓 + * 编辑器设置的外轮廓 + */ + getOriginOuterPath(): IPathData; + /** + * 获取原始内轮廓洞 + * 编辑器设置的内轮廓洞 + */ + getOriginInnerHoles(): IPathData[]; + /** + * 获取原始槽 + * 编辑器设置的槽 + */ + getOriginSlots(): ISlotData[]; + /** + * 获取外轮廓 + */ + getOuterPath(): IPathData; + /** + * 获取内轮廓洞的集合 + */ + getInnerHoles(): IPathData[]; + /** + * 获取槽 + */ + getSlots(): ISlotData[]; + /** + * 设置外轮廓 + * 全量替换原有的外轮廓 + */ + setOuterPath(path: IPathData): void; + /** + * 设置内轮廓洞 + * 全量替换原有的内轮廓洞 + */ + setInnerHoles(holes: IPathData[]): void; + /** + * 设置槽 + * 全量替换原有的槽 + */ + setSlots(slots: ISlotData[]): void; +} +declare interface IParamModelOptionValues { + /** + * 可选项名称 + */ + name: string; + /** + * 可选项值 + */ + value: string; + /** + * 可选项忽略 + */ + ignore: string; + /** + * 可选项是否忽略解析 + */ + parsedIgnore: boolean; + /** + * other fields + */ + [key: string]: any; +} +/** + * 模型参数 + */ +declare interface IParamModelParameter { + /** + * 全局变量唯一id + */ + globalId: string; + /** + * 参数名称 + */ + name: string; + /** + * 参数简化名,如材质的引用名为materialBrandGoodId,但其缩写为CZ + */ + simpleName: string; + /** + * 编辑器中设定的参数类型 + */ + type: string; + /** + * 值类型 + */ + paramTypeId: number; + /** + * 序列化值 + */ + value: string; + /** + * 在编辑器中定义的公式 + */ + formula: string; + /** + * 若参数为公式,则值为false,否则为true + */ + editable: boolean; + /** + * 多布尔每位的显示名称 + */ + valueDisplayNames: Array; + /** + * 可选值字段所包含的信息,包括可选值、隐藏条件、显示名称等 + */ + optionValues: IParamModelOptionValues[]; + /** + * 可选值字段中的可选值 + */ + options: Array; + /** + * 推荐值字段所包含的信息,包括可选值、隐藏条件、显示名称等 + */ + recommendValues: IParamModelOptionValues[]; + /** + * 推荐值字段中的可选值 + */ + recommends: Array; + /** + * 最小值 + */ + min: string; + /** + * 最大值 + */ + max: string; + /** + * 步长 + */ + step: string; + /** + * 产品包id + */ + link: string; + /** + * 参数显示名,如 "W" 对应的displayName是"宽度" + */ + displayName: string; + /** + * 复合公式显示名 + */ + formulaDisplayName: string; + /** + * 工具不展示 + */ + ignored: boolean; + /** + * 工具中是否修改参数,若是为true,否则为false + */ + override: boolean; + /** + * 工具中是否可修改,可修改为true,否则为false + */ + overridable: boolean; + /** + * 元件进行过板件编辑或喷绘时,值为true,否则为false + */ + primitiveOverride: boolean; + /** + * 参数状态;参数为非复合公式时值为-1,当参数为复合公式时,值状态为0,公式状态为1 + */ + status: number; + /** + * 参数继承的聚合类型 + */ + instanceGroupTypeId: number; + /** + * 参数描述 + */ + description: string; + /** + * 参数不显示(编辑器中的设定) + */ + visible: boolean; + /** + * 是否为系统变量或基础变量。如系统给的W、D、H为true,用户添加的自定义变量W1为false + */ + required: boolean; + /** + * 与value值相同 + */ + originalValue: string; + /** + * 经过公式运算得到的结果,一定是数值 + */ + quotationValue: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 客户订单信息 + */ +declare interface IPartnerOrder { + /** + * 订单编号 + */ + orderCode: string; + /** + * 设计师姓名 + */ + customerName: string; + /** + * 客户电话 + */ + telephone: string; + /** + * 客户性别 + */ + sex: string; + /** + * 现住址,具体地址门牌号 + */ + detailAddress: string; + /** + * 客户来源。线上引流、线下沟通、站会与活动等 + */ + source: string; + /** + * 客户来源备注 + */ + sourceRemark: string; + /** + * 客户需求 + */ + remark: string; + /** + * 楼盘小区 + */ + buildingVillage: string; + /** + * 楼盘具体门牌号 + */ + address: string; + /** + * 面积(㎡) + */ + size: number; + /** + * 房屋类型。如小区房、自建房等。新版没有这个字段。 + */ + houseType: string; + /** + * 房屋状态。期房、现房、二手房等 + */ + houseStatus: string; + /** + * 户型。一居、两居等 + */ + houseModel: string; + /** + * 交房日期 + */ + orderTime: string; + /** + * 需要支付定金。默认 false + */ + needDeposit: boolean; + /** + * 定金金额 + */ + depositCost: string; + /** + * 装修风格 + */ + decoStyle: string; + /** + * 提供房型图 + */ + providedPlan: boolean; + /** + * 装修预算 + */ + decoBudget: string; + /** + * 设计费 + */ + designCost: string; + /** + * 工程造价 + */ + constructCost: string; + /** + * 开工日期 + */ + beginDate: string; + /** + * 竣工日期 + */ + endDate: string; + /** + * 项目经理 + */ + manager: string; + /** + * 监理 + */ + supervisor: string; + /** + * 当前客户进展。intention, discarded + */ + currentNodeKey: string; + /** + * 是否废单。1 - 废单;0 - 非废单 + */ + discard: number; + /** + * 废单原因 + */ + discardReason: string; + /** + * 关联的方案 + */ + associatedSchema: IAssociatedSchema[]; + /** + * 楼盘信息的全地址 + */ + location: string; + /** + * 订单创建时间 + */ + createTime: string; + /** + * 订单状态 + */ + statusId: number; + /** + * 加密后的设计师userid + */ + obsDesignerUserId: string; + /** + * 设计师名称 + */ + designerName: string; + /** + * 订单业务员 + */ + salesman: string; + /** + * 所属门店名称 + */ + storeName: string; + /** + * 所属门店、经销商编码 + */ + storeCode: string; + /** + * 所属门店、经销商地图地址 + */ + storeAddress: string; + /** + * 所属门店、经销商详细地址 + */ + storeSpecificAddress: string; + /** + * 所属门店、经销商电话 + */ + storeTelephone: string; + /** + * 签单日期 + */ + signDate: string; + /** + * 交货日期 + */ + deliveryDate: string; + /** + * 外部关联编号 + */ + associatedNumber: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 轮廓数据 + */ +declare interface IPathData { + /** + * 轮廓上的点 + */ + paramPoints: IPlankPathPoint[]; + /** + * 轮廓上的线 + */ + paramPathLines: IPlankPathLine[]; + /** + * other fields + */ + [key: string]: any; +} +declare interface IPlankFaceId { + /** + * 当前交接信息所处的板面信息 + */ + plankFaceId: number; +} +declare interface IPlankPathData { + path?: IPlankPathPathData; + holes: IPlankPathPathData[]; + /** + * other fields + */ + [key: string]: any; +} +declare interface IPlankPathLine { + /** + * 线条类型 + */ + type: EPlankPathLineType; + /** + * 是否顺时针 + */ + clockwise?: boolean; + /** + * 优弧劣弧 (只有弧线有) + */ + minorArc?: boolean; + /** + * 半径 (只有弧线有) + */ + radius?: string; +} +declare type IPlankPathLineData = ILineBase; +declare interface IPlankPathPathData { + /** + * 偏移, 正数扩大路径范围,负数缩小路径范围 + */ + offset?: number; + /** + * 轮廓上的点 + */ + paramPoints: IPlankPathPointData[]; + /** + * 轮廓上的线 + */ + paramPathLines: IPlankPathLineData[]; +} +declare interface IPlankPathPoint { + /** + * 点的位置 + * @example + * "123,-345" + * "#W/2,#D/2" + */ + position: string; + /** + * 点的类型 + */ + type: EPlankPathPointType; + /** + * 切角两边上切点距离当前点的距离(切角专用) + */ + cornerCutDistance?: [string, string]; + /** + * 切圆必传 + * 轮廓路径顺时针 true=外弧 false=内弧 + * 轮廓路径逆时针 true=内弧 false=外弧 + */ + clockwise?: boolean; + /** + * 半径 (倒圆切圆专用) + * @example + * "345.12" + */ + radius?: string; + /** + * 圆心偏移 (切圆专用) + * @example + * "0,0" + * "#W/2,#D/2" + */ + offset?: string; + /** + * 长轴 (椭圆必传) + * @example + * "345.12" + */ + majorRadius?: string; + /** + * 短轴 (椭圆必传) + * @example + * "345.12" + */ + minorRadius?: string; +} +declare type IPlankPathPointData = IPointBase; +/** + * 点的基本类型 + */ +declare interface IPointBase { + type: EPointType; + /** + * 点的位置 + * + * @example + * "123,-345" + */ + position: Number3 | Number2; + /** + * 切角长度 + */ + cornerCutDistance?: [number, number]; + /** + * 椭圆端点长轴 + */ + majorRadius?: number; + /** + * 椭圆端点短轴 + */ + minorRadius?: number; + /** + * 圆弧、切圆半径 + */ + radius?: number; + /** + * 圆弧是否为顺时针 + */ + clockwise?: boolean; + /** + * 圆弧、椭圆弧圆心偏移 + */ + offset?: Number2; +} +/** + * 点的类型参数 + */ +declare type IPointData = IPointWithNone | IPointWithLine | IPointWithCircle | IPointWithCutCircle; +/** + * 倒圆 + */ +declare interface IPointWithCircle extends Omit { + /** + * 切角类型 + */ + type: EPointType.CIRCLE; + /** + * 切角边边距 + */ + /** + * 半径 (倒圆切圆专用) + * @example + * "345.12" + */ + radius: number; +} +/** + * 切圆(就是内挖一个倒圆的形状) + */ +declare interface IPointWithCutCircle extends Omit { + type: EPointType.CUT_CIRCLE; + /** + * 是否顺时针 + * 未设置时,则为false + */ + clockwise: boolean; +} +/** + * 切角 + */ +declare interface IPointWithLine extends Omit { + /** + * 切角类型 + */ + type: EPointType.LINE; + /** + * 切角边边距 + */ + cornerCutDistance: [number, number]; +} +/** + * 普通点类型 + */ +declare interface IPointWithNone extends Omit { + /** + * 普通点 + */ + type: EPointType.NONE; + /** + * 是否顺时针 + * 未设置时,则为false + */ + clockwise?: boolean; +} +/** + * 获取模型缩略图信息返回值 + */ +declare interface IPreviewImgInfo { + /** + * 模型id + */ + modelId: string; + /** + * 模型缩略图base64数据 + */ + imgData: string; +} +/** + * 商品信息 + */ +declare interface IProduct { + /** + * 商品ID + */ + productId: string; + /** + * 所属真分类 + */ + category: number; + /** + * 商品名称 + */ + name: string; + /** + * 封面图 + */ + coverImgUrl?: string; + /** + * 预览图 + */ + sketchImgUrl?: string; + /** + * 自定义字段 + */ + customFields?: IProductCustomField[]; +} +/** 产品编码 */ +declare interface IProductCodeInOrder { + productCodeInOrder?: string; +} +/** + * 产品与产品编号关系 + */ +declare interface IProductCodeInOrderInfo { + /** 产品ID */ + productId: string; + /** 订单中的产品编号 */ + codeInOrder?: string; +} +/** + * 商品上设置的自定义字段信息 + */ +declare interface IProductCustomField { + /** + * 字段ID + */ + id: string; + /** + * 字段名称 + */ + name: string; + /** + * 字段编码 + */ + code: string; + /** + * 字段值 + */ + value: string; +} +declare interface IProductOrderOperation extends IOrderOperation { + productOrderCode: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 槽路径/轮廓 + */ +declare interface IProfileOrPath { + /** + * 点的坐标,每两个值代表一个点 + * eg: [100, 200, 250, 300] + */ + points: number[]; + curves: Array<{ + /** + * 线段类型 + * 直线 / 弧线 + */ + type: 'LineSeg' | 'Arc'; + /** + * 逆时针 + */ + isCCW?: boolean; + /** + * 劣弧 + */ + minorArc?: boolean; + /** + * 半径 + */ + radius?: number; + /** + * 凸度 + */ + bulge?: number; + }>; +} +/** + * 获取报价清单入参 + */ +declare interface IQuotationOption { + /** json文件上传的key*/ + uploadFileKey: string; + /** + * hlk报价清单模板id + */ + hlkTemplateId?: string; +} +/** + * 响应结果 + */ +declare interface IQuotationReportTemplateItem { + /** + * 模板ID + */ + templateId: string; + /** + * 名称 + */ + name: string; +} +/** + * 获取报价清单模板接口 + */ +declare interface IQuotationReportTemplateParam { + /** + * 当前激活的工具线 + */ + activeToolType?: EToolType; + /** + * 公库类型 + */ + libraryType?: Array; +} +/** + * 报价清单返回值 + */ +declare interface IQuotationResult { + /**报价清单的url地址 */ + url: string; +} +/** + * 引用模型 + */ +declare interface IReferenceModel extends IModelBaseInfo { + /** 引用 ID,指向后台模型库中的某个模型 */ + refId: string; + /** 子模型的参数 */ + parameters: IParameter[]; +} +/** + * 定制引用模型的简化数据 + */ +declare interface IRefModelLite { + /** 引用id 及type */ + elementId: ElementId_2; + /** 引用的位置 */ + position: Number3; + /** 引用的旋转信息 */ + rotation: Number3; + /** 引用box大小 */ + size: Number3; + /** 引用的母版模型信息 */ + templateInfo: { + /** 母版是否为组合 */ + isAssembly: boolean; + } & CustomModelSimple; + /** + * 当前引用模型所属的工具线 + */ + toolType: EToolType; +} +/** + * 替换模型时的配置信息 + */ +declare interface IReplaceParamModelInfoOption { + inherit?: boolean; +} +/** + * 素材商品信息 + */ +declare interface IResource { + /** + * 轮廓商品信息 + */ + profiles: IResourceProfiles[]; + /** + * 材质商品信息 + */ + texture: IResourceTexture[]; + /** + * 模型商品信息 + */ + models: IResourceModels[]; + /** + * 喷绘商品信息 + */ + patterns: IResourcePatterns[]; + /** + * other fields + */ + [key: string]: any; +} +/** + * 模型商品信息 + */ +declare interface IResourceModels { + obsBrandGoodId: string; + brandGoodName: string; + prodCatId: number; + available: boolean; + obsAccountId: string; + brandName: string; + seriesTagName: string; + onSale: boolean; + billOutput: boolean; + price: number; + unitCost: number; + unitPrice: number; + /** + * other fields + */ + [key: string]: any; +} +declare interface IResourcePatterns { + /** + * 商家主账号id + */ + obsrootAccountId: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 轮廓商品信息 + */ +declare interface IResourceProfiles { + /** + * 商品id + */ + obsBrandGoodId: string; + /** + * 商品信息中的产品编码 + */ + brandGoodCode: string; + /** + * 商品信息中的信号 + */ + productNumber: string; + /** + * 商品名称 + */ + brandGoodName: string; + /** + * 真分类id + */ + prodCatId: number; + /** + * 商品是否已删除,已删除则为true,否则为false + */ + available: boolean; + /** + * 商品信息中的自定义编码 + */ + customCode: string; + /** + * 商品所属商家的id + */ + obsAccountId: string; + /** + * 商品信息中的品牌 + */ + brandName: string; + /** + * 商品信息中的系列 + */ + seriesTagName: string; + /** + * 商品信息中的尺寸/规格,多个值时会用";"隔开 + */ + dimensions: string; + /** + * 商品信息中的自定义材质(商品通用属性,非定制独有) + */ + customTexture: string; + /** + * 商品信息中的描述 + */ + description: string; + /** + * 商品上架/下架,上架时值为true,否则为false + */ + onSale: boolean; + /** + * 商品自定义信息 + */ + customFields: ICustomField[]; + /** + * 轮廓对应的商品id + */ + obsProfileBrandGoodId: string; + /** + * 轮廓对应商品的所属商家id + */ + obsProfileAccountId: string; + /** + * 轮廓对应商品上的自定义编码 + */ + profileCustomCode: string; + /** + * 轮廓对应商品是否在清单中输出(商品详情页定义),默认true + */ + billOutput: boolean; + /** + * 商品标签信息 + */ + Tagkeys: IResourceProfilesTagKey[]; + /** + * other fields + */ + [key: string]: any; +} +declare interface IResourceProfilesTagKey { + /** + * 标签key id + */ + obsTagKeyId: string; + /** + * 标签key name + */ + tagKeyName: string; + /** + * 是否可以打多个标签 + */ + single: boolean; + /** + * 商品自定义输出标签信息 + */ + tags: IResourceTagKeyTag[]; + /** + * other fields + */ + [key: string]: any; +} +declare interface IResourceTagKeyTag { + /** + * 标签id + */ + obsTagId: string; + /** + * 标签名 + */ + tagName: string; +} +/** + * 材质商品信息 + */ +declare interface IResourceTexture { + obsBrandGoodId: string; + brandGoodName: string; + prodCatId: number; + available: boolean; + obsAccountId: string; + brandName: string; + seriesTagName: string; + onSale: boolean; + baseTexture: string; + /** + * other fields + */ + [key: string]: any; +} +declare interface IRoomData { + /** + * 房间名称 + */ + name: string; + /** + * 房间id + */ + roomId: string; + /** + * other fields + */ + [key: string]: any; +} +/** + * 房间信息 + */ +declare interface IRoomInfo { + /** + * 所属房间ID + */ + roomId?: string; + /** + * 所属房间名 + */ + roomName?: string; +} +/** 规则检测结果 */ +declare interface IRuleResult { + /** + * 模型id + */ + id: string; + /** + * 模型名称 + */ + name: string; + /** + * 检测规则模板 + */ + ruleTemplates: RuleTemplate[]; + /** + * other options + */ + [s: string]: any; +} +/** + * 更新孔槽数据参数 + */ +declare interface ISaveFittingDesignOption extends IFittingDesignOption { + data: IFittingDesignData; +} +/** + * 槽数据 + */ +declare interface ISlotData { + /** + * 槽轮廓信息 + */ + path: IPathData; + /** + * 槽深度 + */ + deep: string; + /** + * 槽的挖槽方向 + */ + slotCaveType: SlotCaveType; + /** + * other fields + */ + [key: string]: any; +} +/** + * 方案分单入参 + */ +declare interface ISplitDesignParams { + /** + * 分单模型列表 + */ + elements: Array; + /** + * 分单方案名称 + */ + name: string; + /** + * 是否锁定分单后的方案 + */ + lock?: boolean; +} +/** + * 方案分单出参 + */ +declare interface ISplitDesignResponse { + /** + * 分单方案id + */ + designId: string; +} +/** + * 查询所有key的参数 + */ +declare interface IStorageGetKeysOption { + /** + * 查询的条数(最大限制每次100条), 默认查10条 + * @default 10 + */ + pageSize?: number; + /** + * 当前查询的页码,默认查第1页 + * @default 1 + */ + pageNum?: number; + /** + * 可按照前缀检索key, + * eg: 完整key: 'mini/demo/a', 'mini/demo/b' + * prefix: 'mini/demo' 可检索出上述两个key + */ + prefix?: string; +} +/** + * 分页获取key的返回结果 + */ +declare interface IStorageGetKeysResult extends IPaginationResult { + /** + * 当前页码 + */ + curPage: number; + /** + * 总的页数 + */ + totalPage: number; +} +/** + * 数据存储 + */ +declare interface IStorageItem { + /** + * key值,需要唯一 + */ + key: string; + /** + * 保存的值,必须是JSON格式,不支持其他类型 + */ + value: Record; +} +declare interface IStoreInfo { + /** 门店ID */ + storeId: string; + /** 门店名称 */ + storeName: string; + /** 联系人 */ + contactUser: string; + /** 联系电话 */ + contactPhone: string; + /** 门店地址 */ + shippingAddr: string; +} +/** + * 组件提审信息 + */ +declare interface ISubModel { + /** 提审的模型ID */ + modelId: string; + /** 提审模型所在顶层模型id */ + rootModelId: string; + /** 组合模型id,非组合可不传 */ + combinationModelId?: string; +} +/** + * 扫掠模型 + */ +declare interface ISweepModel extends IModelBaseInfo { + texture?: { + /** 酷家乐材质库的 ID */ + id: string; + /** 材质旋转角度,以弧度表示,默认 0 */ + angle?: number; + }; + /** 直接定义扫掠的截面,定义和 extrusion 的 profile 相同。暂未支持,当前只能使用 profileId */ + profile: IImportPath; + /** 引用 ID,指向后台线条库中的某个轮廓 */ + profileId: string; + /** 轮廓旋转角度,以弧度表示,默认 0 */ + angle?: number; + /** 放样的路径,长度为 2 的倍数,每 2 个数代表一个点 */ + path: IImportPath; +} +declare interface ITexture { + /** 顶面使用酷家乐材质库的 ID */ + topId: string; + /** 底面使用酷家乐材质库的 ID,若不指定,则和顶面相同 */ + bottomId?: string; + /** 侧面使用酷家乐材质库的 ID,若不指定,则和顶面相同 */ + sideId?: string; + /** 顶底面材质旋转角度,以弧度表示,默认 0 */ + angle?: number; + /** 侧面材质旋转角度,以弧度表示,默认 0 */ + sideAngle?: number; + /** 材质铺贴方式,”tile” 表示平铺,”stretch” 表示拉伸 */ + pavingStyle?: string; + /** 材质偏移,默认 [0, 0] */ + offset?: [number, number]; + /** 材质大小,默认后台设置的尺寸 */ + size?: number[]; +} +/** + * 解锁指定已提审的模型 + */ +declare interface IUnlockAuditedModelOption { + modelId: string | string[]; +} +/** + * 更新方案中,模型位置信息 + */ +declare interface IUpdateCustomModelSimpleOption extends Partial { + /** + * 模型ID + */ + elementId: ElementId_2; +} +/** 更改订单模型信息 */ +declare interface IUpdateOrderModel { + /** 订单Id */ + orderId: string; + /** 普通模型Ids */ + modelIds: string[]; + /** 组件&组合模型信息 */ + subModels: ISubModel[]; +} +/** + * 通过orderState修改订单备注参数 + */ +declare interface IUpdateOrderStateRemarkOption { + /** 修改备注id */ + remarkId: string; + /** 订单id */ + orderId: string; + /** 备注内容 */ + content: string; + /** 订单状态 */ + orderState: number; + /** 图片 */ + images?: IOrderAttachment[]; +} +/** + * 上传的文件信息 + */ +declare interface IUploadFileInfo { + /**文件名称 */ + name: string; + /**文件内容base64 */ + fileBase64: string; +} +/** + * 文件上传入参配置 + */ +declare interface IUploadFileOption { + /**上传的文件信息 */ + fileInfos: IUploadFileInfo | IUploadFileInfo[]; + /**并行上传文件数量,最大不超过5个, 超过仍会以5个为准 */ + parallelCount?: number; + /**上传失败重试的次数,最多重试3次 */ + retryCount?: number; + /** + * 上传文件的业务存储空间 + * @default EUploadFileBucket.ORDER + */ + bucket?: EUploadFileBucket; +} +/** + * 上传文件返回结果 + */ +declare interface IUploadFileResult { + /**状态码 */ + code: number; + /**文件名称 */ + name: string; + /**文件cdn地址 */ + url?: string; + /**文件key */ + uploadKey?: string; + /**错误消息 */ + msg?: string; +} +declare interface IUserDefinedInfo { + /** + * 信息名称 + */ + name: string; + /** + * 信息取值,未填写时,不输出 + */ + value: string; + /** + * other fields + */ + [key: string]: any; +} +/** 有效性检测结果 */ +declare interface IValidityResult { + /** + * 模型id + */ + id: string; + /** + * 模型名称 + */ + name: string; + /** + * 当前存在有效性未通过的模型 + */ + children: IValidityResult[]; + /** + * other options + */ + [s: string]: any; +} +/** + * KArc2d 类代表着二维空间中的一个圆弧。 + * + * The KArc2d class represents an arc in 2d space. + */ +declare interface KArc2d extends KBoundedCurve2d_2 { + /** + * 获取当前圆弧的圆心。 + * + * Get arc's circle center. + */ + readonly center: KPoint2d; + /** + * 获取当前圆弧的半径长度。 + * + * Get arc's circle radius. + */ + readonly radius: number; + /** + * 获取当前圆弧的中点。 + * + * Get arc's middle point. + */ + readonly middlePoint: KPoint2d; + /** + * 判断圆弧是不是逆时针方向 + * + * Get whether the arc is ccw or not. + */ + readonly isCCW: boolean; + /** + * 获取圆弧起始角度 + * + * Get the start angle of the arc + */ + readonly startAngle: number; + /** + * 获取圆弧终止角度 + * + * Get the end angle of the arc + */ + readonly endAngle: number; + /** + * 获取圆弧的角度跨度。如果圆弧是逆时针方向的,则角度为正,否则为负。 + * + * Get the sweep angle of the arc. + * The returned value is positive if arc is counter-clockwise, vice versa. + */ + readonly arcAngle: number; + /** + * 获取圆弧所在的圆。 + * + * Get the circle of the arc. + */ + readonly circle: KCircle2d; + /** + * 把圆周上的角度值转化成当前二维圆弧的参数域上对应的参数值。 + * + * Convert angle value to a parameter value in the parameter interval of the current 2d arc. + * @param angle + * 角度值。 + * + * angle vlaue. + * @returns + * 当前圆弧的参数域上对应的参数。 + * + * The corresponding parameter in the arc parameter interval. + */ + getParamFromAngle(angle: number): number; + /** + * 把当前圆弧的一个参数值转化成正规的角度值。 + * + * Convert a parameter value of the current 2d arc to be a regular angle value in [0, 2PI). + * @param param + * 当前圆弧的参数区间上的一个参数值。 + * + * A parameter in the parameter interval of the current 2d arc. + * @returns + * 一个0到2*PI之间的正规角度值。 + * + * A regular angle value in [0, 2PI). + */ + getRegularizeAngleFromParam(param: number): number; + /** + * 获得圆弧上一点处的切向量。 + * 注意:该函数调用需要确保传入点在圆弧上。 + * + * Get arc's tangent vector of a point on the arc. + * NOTE: the caller need to make sure the point is on the arc. + * @param point + * 圆弧上一点。 + * + * A point on the arc. + * @returns + * 切向量。 + * + * The tangent vector. + */ + getTangent(point: KPoint2d): KVector2d; + /** + * 对当前圆弧应用一转换矩阵,从而实现对其几何变换。 + * 如果转换后的几何不是圆弧,将会抛出error。 + * + * Transform this arc to a new one + * If the new one is not a arc, it will throw an error. + * @param matrix + * 转换矩阵。 + * + * The transform matrix. + * @returns + * 当执行正确的话,返回true;否则为false。 + * + * Return true if successful, otherwise return false. + */ + transform(matrix: KMatrix3): boolean; + /** + * 对当前圆弧进行离散,保证相邻两点之间的弦高和弦长之比小于给定的比例值。 + * + * Discretize the Arc to points with specified ratio between sagitta and chord length. + * @param ratio + * 相邻两点之间圆弧段的弦高和弦长之比。 + * 如果没有输入弦高和弦长比例值或者输入值不在(0,1)之间,则默认会采用PI/60为刻度去离散圆弧。 + * + * ratio = sagitta / chord length. + * If ratio is not provided or the value is not between (0,1), then it will use step = PI/60 radians to discretize the arc. + * @returns + * 离散点列。 + * + * The discretized points. + */ + getApproximatePointsByRatio(ratio?: number): KPoint2d[]; + /** + * 对当前圆弧进行离散,保证相邻两点之间的弦高小于给定值。 + * + * Discretize the Arc to points with specified sagitta. + * @param sagitta + * 相邻两点之间圆弧段的弦高。 + * 如果没有输入弦高值、输入值过小(<1.0e-6)或者过大(> Radius-1.0e-6),则默认会采用PI/60为刻度去离散圆弧。 + * + * The sagitta between two adjacent points. + * If sagitta is not provided or the value is too small(<1.0e-6) or big(> Radius-1.0e-6), + * then it will use step = PI/60 radians to discretize the arc. + * @returns + * 离散点列。 + * + * The discretized points. + */ + getApproximatePointsBySagitta(sagitta?: number): KPoint2d[]; + /** + * 按给定圆心角对当前圆弧进行离散。 + * + * Discretize the Arc to points with specified angle. + * @param angleSpan + * 圆心角(以弧度为单位)。 + * 如果没有输入角度值或者输入值过小(<1.0e-6),则默认使用PI/60个弧度。 + * + * Central angle span in radians. + * If angleSpan is not provided or the value is too small(<1.0e-6), then it will use default value PI/60. + * @returns + * 离散点列。 + * + * The discretized points. + */ + getApproximatePointsByAngle(angleSpan?: number): KPoint2d[]; +} +/** + * KArc3d类代表三维空间中的一个圆弧。 + * + * The KArc3d class represents an arc in 3d space. + */ +declare interface KArc3d_2 extends KBoundedCurve3d_2 { + /** + * 获得圆弧的圆心。 + * + * Get arc's circle center. + */ + readonly center: KPoint3d; + /** + * 获得圆弧的法向量。 + * + * Get arc's circle normal. + */ + readonly normal: KVector3d; + /** + * 获得圆弧的半径。 + * + * Get arc's circle radius. + */ + readonly radius: number; + /** + * 获得圆弧的中点。 + * + * Get arc's middle point. + */ + readonly middlePoint: KPoint3d; + /** + * 获得圆弧的起始角。 + * + * Get arc's start angle. + */ + readonly startAngle: number; + /** + * 获得圆弧的终止角。 + * + * Get arc's end angle. + */ + readonly endAngle: number; + /** + * 获取圆弧的角度跨度。 + * + * Get the sweep angle of the arc. + */ + readonly arcAngle: number; + /** + * 获取圆弧所在的圆。 + * + * Get the circle of the arc. + */ + readonly circle: KCircle3d; + /** + * 获得圆弧一点处的切向量。 + * 注意:需要保证传入点在圆弧上。 + * + * Get arc's tangent vector of a point on the arc. + * NOTE: the caller need to make sure the point is on the arc. + * @param point + * 圆弧上一点。 + * + * A point on the arc. + * @returns + * 切向量。 + * + * The tangent vector. + */ + getTangent(point: KPoint3d): KVector3d; + /** + * 对当前圆弧应用一转换矩阵,从而实现对其几何变换。 + * 如果转换后的几何不是圆弧,将会抛出error。 + * + * Transform this arc to a new one + * If the new one is not a arc, it will throw an error. + * @param matrix + * 转换矩阵。 + * + * The transform matrix. + * @returns + * 当执行正确的话,返回true;否则为false。 + * + * Return true if successful, otherwise return false. + */ + transform(matrix: KMatrix4): boolean; + /** + * 对当前圆弧重新参数化,使得起始角正好是从零开始。 + * 也就是把圆心到圆弧起点的方向定为X轴方向,Z轴不变,相应旋转Y轴方向。 + * + * Re-parameterize the underlying circle of the current arc, so that the arc's start angle will be set to 0. + * Rotate the circle around its local Z axis, to align the x direction of the circle with the start point of the arc. + */ + regularize(): void; + /** + * 对当前圆弧进行离散,保证相邻两点之间的弦高和弦长之比小于给定的比例值。 + * + * Discretize the Arc to points with specified ratio between sagitta and chord length. + * @param ratio + * 相邻两点之间圆弧段的弦高和弦长之比。 + * 如果没有输入弦高和弦长比例值或者输入值不在(0,1)之间,则默认会采用PI/60为刻度去离散圆弧。 + * + * ratio = sagitta / chord length. + * If ratio is not provided or the value is not between (0,1), then it will use step = PI/60 radians to discretize the arc. + * @returns + * 离散点列。 + * + * The discretized points. + */ + getApproximatePointsByRatio(ratio?: number): KPoint3d[]; + /** + * 对当前圆弧进行离散,保证相邻两点之间的弦高小于给定值。 + * + * Discretize the Arc to points with specified sagitta. + * @param sagitta + * 相邻两点之间圆弧段的弦高。 + * 如果没有输入弦高值、输入值过小(<1.0e-6)或者过大(> Radius-1.0e-6),则默认会采用PI/60为刻度去离散圆弧。 + * + * The sagitta between two adjacent points. + * If sagitta is not provided or the value is too small(<1.0e-6) or big(> Radius-1.0e-6), + * then it will use step = PI/60 radians to discretize the arc. + * @returns + * 离散点列。 + * + * The discretized points. + */ + getApproximatePointsBySagitta(sagitta?: number): KPoint3d[]; + /** + * 按给定圆心角对当前圆弧进行离散。 + * + * Discretize the Arc to points with specified angle. + * @param angleSpan + * 圆心角(以弧度为单位)。 + * 如果没有输入角度值或者输入值过小(<1.0e-6),则默认使用PI/60个弧度。 + * + * Central angle span in radians. + * If angleSpan is not provided or the value is too small(<1.0e-6), then it will use default value PI/60. + * @returns + * 离散点列。 + * + * The discretized points. + */ + getApproximatePointsByAngle(angleSpan?: number): KPoint3d[]; +} +/** + * 所有二维轮廓曲线的基类,例如KLineSegment2d(线段)和KArc2d(圆弧)。 + * + * The base class for all 2D bounded curves, such as KLineSegment2d and KArc2d. + */ +declare interface KBoundedCurve2d_2 extends KCurve2d { + /** + * 获得轮廓线的起点。 + * + * Get bounded curve's start point. + */ + readonly startPoint: KPoint2d; + /** + * 获得轮廓线的终点。 + * + * Get bounded curve's end point. + */ + readonly endPoint: KPoint2d; + /** + * 获得轮廓线的中点。 + * + * Get bounded curve's middle point. + */ + readonly middlePoint: KPoint2d; + /** + * 获得轮廓线的长度。 + * + * Get bounded curve's length. + */ + readonly length: number; + /** + * 对当前有界曲线进行离散,保证相邻两点之间的弦高和弦长之比小于给定的比例值,相邻两点之间的曲线段和弦之间的近似三角形面积小于给定值。 + * + * Discretize bounded curve to points with specified ratio and area tolerance. + * @param ratio + * 相邻两点之间曲线段的弦高和弦长之比。 + * 如果没有输入弦高和弦长比例值或者输入值不在(0,1)之间,则默认会采用0.1。 + * + * ratio = sagitta / chord length. + * If ratio is not provided or the value is not between (0,1), then it will use ratio = 0.1 to discretize the bounded curve. + * @param areaTol + * 相邻两点之间的曲线段和弦之间的近似三角形面积。 + * 如果没有输入面积值或者面积值过小(<1.0e-6), 则不使用面积误差作为判断条件。 + * + * The approximate area between the bounded curve and the chord of two adjacent points. + * If the area is not provided or the vlaue is too small(<1.0e-6), then the check condition will not use the area. + * @returns + * 离散点列和它们的参数值。 + * + * The approximate points info which contains the point locations and parameters. + */ + getApproximatePointsInfoByRatio(ratio?: number, areaTol?: number): { + points: KPoint2d[]; + params: number[]; + }; + /** + * 对当前有界曲线进行离散,保证相邻两点之间的法向夹角小于给定值,相邻两点之间的曲线段和弦之间的近似三角形面积小于给定值。 + * + * Discretize bounded curve to points with specified normal tolerance and area tolerance. + * @param normTol + * 相邻两点之间法向夹角误差(angle < acos(1-normTol))。 + * 如果没有输入法向误差值或者输入值过小(<1.0e-6)或者过大(>1.0 - 1.0e-6),则默认会采用0.01。 + * + * The normal tolerance between two adjacent points (angle < acos(1-normTol)). + * If normTol is not provided or the value is too small(<1.0e-6) or too big(>1.0 - 1.0e-6), then it will use default value 0.01. + * @param areaTol + * 相邻两点之间的曲线段和弦之间的近似三角形面积。 + * 如果没有输入面积值或者面积值过小(<1.0e-6), 则不使用面积误差作为判断条件。 + * + * The approximate area between the bounded curve and the chord of two adjacent points. + * If the area is not provided or the vlaue is too small(<1.0e-6), then the check condition will not use the area. + * @returns + * 离散点列和它们的参数值。 + * + * The approximate points info which contains the point locations and parameters. + */ + getApproximatePointsInfoByNormalTol(normTol?: number, areaTol?: number): { + points: KPoint2d[]; + params: number[]; + }; + /** + * 把当前有界曲线按给定点分成多段。 + * + * Split the bounded curve into multiple segments by the given points. + * @param points + * 分割点列。 + * + * split points. + * @param distTol + * 距离容差。如果不给定,则使用全局容差。 + * + * Distance tolerance. If not provided, then global tolerance will be used. + * @returns + * 多段有界曲线。 + * 如果点列只包含起点和终点,则返回空数组。 + * + * Multiple segments of bounded curves. + * If points only contain start and end points, empty array will be returned. + */ + splitByPoints(points: KPoint2d[], distTol?: number): KBoundedCurve2d_2[]; + /** + * 把当前有界曲线按给定点分成两段。 + * + * Split the bounded curve into two segments by the given point. + * @param point + * 分割点。 + * + * split point. + * @param distTol + * 距离容差。如果不给定,则使用全局容差。 + * + * Distance tolerance. If not provided, then global tolerance will be used. + * @returns + * 多段有界曲线。 + * 如果分割点靠近当前有界曲线的起点或者终点,则返回一条克隆曲线。 + * + * Multiple segments of bounded curves. + * If the split point is close to start or end point, a cloned bounded curve will be returned. + */ + splitByPoint(point: KPoint2d, distTol?: number): KBoundedCurve2d_2[]; + /** + * 获得当前有界曲线的轴对齐的包围盒。 + * + * Get the Axis-aligned bounding box of the bounded curve + * @returns + * 轴对齐的包围盒 + * + * the Axis-aligned bounding box + */ + getBounding(): KBoundingBox2d; +} +/** + * 所有三维轮廓曲线的基类,例如KLineSegment3d(线段)和KArc3d(圆弧)。 + * + * The base class for all 3D bounded curves, such as KLineSegment3d and KArc3d. + */ +declare interface KBoundedCurve3d_2 extends KCurve3d { + /** + * 获得轮廓线的起点。 + * + * Get bounded curve's start point. + */ + readonly startPoint: KPoint3d; + /** + * 获得轮廓线的终点。 + * + * Get bounded curve's end point. + */ + readonly endPoint: KPoint3d; + /** + * 获得轮廓线的中点。 + * + * Get bounded curve's middle point. + */ + readonly middlePoint: KPoint3d; + /** + * 获得轮廓线的长度。 + * + * Get bounded curve's length. + */ + readonly length: number; + /** + * 对当前有界曲线进行离散,保证相邻两点之间的弦高和弦长之比小于给定的比例值,相邻两点之间的曲线段和弦之间的近似三角形面积小于给定值。 + * + * Discretize bounded curve to points with specified ratio and area tolerance. + * @param ratio + * 相邻两点之间曲线段的弦高和弦长之比。 + * 如果没有输入弦高和弦长比例值或者输入值不在(0,1)之间,则默认会采用0.1。 + * + * ratio = sagitta / chord length. + * If ratio is not provided or the value is not between (0,1), then it will use ratio = 0.1 to discretize the bounded curve. + * @param areaTol + * 相邻两点之间的曲线段和弦之间的近似三角形面积。 + * 如果没有输入面积值或者面积值过小(<1.0e-6), 则不使用面积误差作为判断条件。 + * + * The approximate area between the bounded curve and the chord of two adjacent points. + * If the area is not provided or the vlaue is too small(<1.0e-6), then the check condition will not use the area. + * @returns + * 离散点列和它们的参数值。 + * + * The approximate points info which contains the point locations and parameters. + */ + getApproximatePointsInfoByRatio(ratio?: number, areaTol?: number): { + points: KPoint3d[]; + params: number[]; + }; + /** + * 对当前有界曲线进行离散,保证相邻两点之间的法向夹角小于给定值,相邻两点之间的曲线段和弦之间的近似三角形面积小于给定值。 + * + * Discretize bounded curve to points with specified normal tolerance and area tolerance. + * @param normTol + * 相邻两点之间法向夹角误差(angle < acos(1-normTol))。 + * 如果没有输入法向误差值或者输入值过小(<1.0e-6)或者过大(>1.0 - 1.0e-6),则默认会采用0.01。 + * + * The normal tolerance between two adjacent points (angle < acos(1-normTol)). + * If normTol is not provided or the value is too small(<1.0e-6) or too big(>1.0 - 1.0e-6), then it will use default value 0.01. + * @param areaTol + * 相邻两点之间的曲线段和弦之间的近似三角形面积。 + * 如果没有输入面积值或者面积值过小(<1.0e-6), 则不使用面积误差作为判断条件。 + * + * The approximate area between the bounded curve and the chord of two adjacent points. + * If the area is not provided or the vlaue is too small(<1.0e-6), then the check condition will not use the area. + * @returns + * 离散点列和它们的参数值。 + * + * The approximate points info which contains the point locations and parameters. + */ + getApproximatePointsInfoByNormalTol(normTol?: number, areaTol?: number): { + points: KPoint3d[]; + params: number[]; + }; + /** + * 把当前有界曲线按给定点分成多段。 + * + * Split the bounded curve into multiple segments by the given points. + * @param points + * 分割点列。 + * + * split points. + * @param distTol + * 距离容差。如果不给定,则使用全局容差。 + * + * Distance tolerance. If not provided, then global tolerance will be used. + * @returns + * 多段有界曲线。 + * 如果点列只包含起点和终点,则返回空数组。 + * + * Multiple segments of bounded curves. + * If points only contain start and end points, empty array will be returned. + */ + splitByPoints(points: KPoint3d[], distTol?: number): KBoundedCurve3d_2[]; + /** + * 把当前有界曲线按给定点分成两段。 + * + * Split the bounded curve into two segments by the given point. + * @param point + * 分割点。 + * + * split point. + * @param distTol + * 距离容差。如果不给定,则使用全局容差。 + * + * Distance tolerance. If not provided, then global tolerance will be used. + * @returns + * 多段有界曲线。 + * 如果分割点靠近当前有界曲线的起点或者终点,则返回一条克隆曲线。 + * + * Multiple segments of bounded curves. + * If the split point is close to start or end point, a cloned bounded curve will be returned. + */ + splitByPoint(point: KPoint3d, distTol?: number): KBoundedCurve3d_2[]; +} +/** + * KBoundingBox2d类代表着二维空间中的一个包围盒。 + * + * The KBoundingBox2d class represents a bounding box in 2d space. + */ +declare interface KBoundingBox2d { + /** + * 获取包围盒的左下端点。 + * + * Get bounding box' minimum point. + */ + readonly min: KPoint2d; + /** + * 获取包围盒的右上端点。 + * + * Get bounding box' maximum point. + */ + readonly max: KPoint2d; + /** + * 获取包围盒的中心点。 + * + * Get bounding box' center point. + */ + readonly center: KPoint2d; + /** + * 获取包围盒的宽度(x方向)。 + * + * Get bounding box' width (x direction). + */ + readonly width: number; + /** + * 获取包围盒的高度(y方向)。 + * + * Get bounding box' height (y direction). + */ + readonly height: number; + /** + * 在指定的容差下检查两个包围盒是否相等。 + * + * Check whether two bounding boxes are equal with specified tolerances. + * @param other + * 需要被比较的包围盒。 + * + * The bounding box to compare this bounding box with. + * @param tolerance + * 指定容差·1,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 两者相等返回true,否则为false。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KBoundingBox2d, tolerance?: number): boolean; + /** + * 包围盒加入一个点,包围盒的表征范围会改变。 + * + * Add point into bounding box, bounding box's min and max will maybe be changed. + * @param point + * 要加入的点。 + * + * the added point. + * @returns + */ + addPoint(point: KPoint2d): void; + /** + * 包围盒的范围各向扩大一个Δ。 + * 注意:如何Δ是一个负数,则包围盒的控制范围会减小,甚至会反转。 + * + * Expand the bounding box by a delta value. + * NOTE: if delta is a minus value, bounding box will be shrunk or even be reversed. + * @param delta + * 扩张参数。 + * + * The expanded coefficient. + * @returns + */ + expand(delta: number): void; + /** + * 合并另外一个包围盒,使得当前包围盒可以包围传入包围盒。 + * + * Merge another bounding box, thus this bounding box is able to contain the another box. + * @param box + * 要合并的包围盒。 + * + * The merged bounding box. + * @returns + */ + merge(box: KBoundingBox2d): void; + /** + * 包围盒是否有效。 + * + * Whether this bounding box is valid. + * @returns + * 当左下角点的坐标小于右上角的坐标时范围true。 + * + * True will be returned if min's xy are smaller or equal to max' xy. + */ + isValid(): boolean; + /** + * 检查输入点是否落在包围盒中,以以指定的容差。 + * 注意:包围盒的边界也是算落在之中。 + * + * Check whether the input point is in this bounding box with specified tolerance. + * NOTE: boundary is included. + * @param point + * 输入点。 + * + * The input point. + * @param tolerance + * 传入容差。 + * + * The specified tolerance. + * @returns + * 当输入点落在包围盒中,返回true。 + * + * Return True if the input point is inside this box, otherwise return false. + */ + isPointInside(point: KPoint2d, tolerance?: number): boolean; + /** + * 检查输入包围盒是否落在包围盒中,以以指定的容差。 + * 注意:包围盒的边界也是算落在之中。 + * + * Check whether this bounding box is in the input bounding box with specified tolerance. + * NOTE: boundary is included. + * @param other + * 传入包围盒。 + * + * The input bounding box. + * @param tolerance + * 传入容差。 + * + * The specified tolerance. + * @returns + * 当输入包围盒落在包围盒中,返回true。 + * + * Return True if this box is inside the input box, otherwise return false. + */ + isInside(other: KBoundingBox2d, tolerance?: number): boolean; + /** + * 检查传入包围盒与当前包围盒是否有重叠区域,以特定容差。 + * 注意:完全落入是由重叠区域的子集。 + * + * Check whether this input bounding box and this bounding box share the same space with specified tolerance. + * NOTE: 'inside' relationship is included. + * @param other + * 传入包围盒。 + * + * The input bounding box. + * @param tolerance + * 传入容差。 + * + * The specified tolerance. + * @returns + * 当输入包围盒与当前包围盒有共同区域,返回true。 + * + * Return true if two box share the same space, otherwise return false. + */ + isOverlapping(other: KBoundingBox2d, tolerance?: number): boolean; +} +/** + * KBoundingBox3d类代表着三维空间中的一个包围盒。 + * + * The KBoundingBox3d class represents a bounding box in 3d space. + */ +declare interface KBoundingBox3d { + /** + * 获取包围盒的左下端点。 + * + * Get bounding box' minimum point. + */ + readonly min: KPoint3d; + /** + * 获取包围盒的右上端点。 + * + * Get bounding box' maximum point. + */ + readonly max: KPoint3d; + /** + * 获取包围盒的中心点。 + * + * Get bounding box' center point. + */ + readonly center: KPoint3d; + /** + * 获取包围盒的宽度(x方向)。 + * + * Get bounding box' width (x direction). + */ + readonly width: number; + /** + * 获取包围盒的高度(y方向)。 + * + * Get bounding box' height (y direction). + */ + readonly height: number; + /** + * 获取包围盒的深度(z方向)。 + * + * Get bounding box' depth (z direction). + */ + readonly depth: number; + /** + * 在指定的容差下检查两个包围盒是否相等。 + * + * Check whether two bounding boxes are equal with specified tolerances. + * @param other + * 需要被比较的包围盒。 + * + * The bounding box to compare this bounding box with. + * @param tolerance + * 指定容差·1,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 两者相等返回true,否则为false。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KBoundingBox3d, tolerance?: number): boolean; + /** + * 包围盒加入一个点,包围盒的表征范围会改变。 + * + * Add point into bounding box, bounding box's min and max will maybe be changed. + * @param point + * 要加入的点。 + * + * the added point. + * @returns + */ + addPoint(point: KPoint3d): void; + /** + * 包围盒的范围三向扩大一个Δ。 + * 注意:如何Δ是一个负数,则包围盒的控制范围会减小,甚至会反转。 + * + * Expand the bounding box by a delta value. + * NOTE: if delta is a minus value, bounding box will be shrunk or even be reversed. + * @param delta + * 扩张参数。 + * + * The expanded coefficient. + * @returns + */ + expand(delta: number): void; + /** + * 合并另外一个包围盒,使得当前包围盒可以包围传入包围盒。 + * + * Merge another bounding box, thus this bounding box is able to contain the another box. + * @param box + * 要合并的包围盒。 + * + * The merged bounding box. + * @returns + */ + merge(box: KBoundingBox3d): void; + /** + * 包围盒是否有效。 + * + * Whether this bounding box is valid. + * @returns + * 当左下角点的坐标小于右上角的坐标时范围true。 + * + * True will be returned if min's xyz are smaller or equal to max' xyz. + */ + isValid(): boolean; + /** + * 检查输入点是否落在包围盒中,以以指定的容差。 + * 注意:包围盒的边界也是算落在之中。 + * + * Check whether the input point is in this bounding box with specified tolerance. + * NOTE: boundary is included. + * @param point + * 输入点。 + * + * The input point. + * @param tolerance + * 传入容差。 + * + * The specified tolerance. + * @returns + * 当输入点落在包围盒中,返回true。 + * + * Return True if the input point is inside this box, otherwise return false. + */ + isPointInside(point: KPoint3d, tolerance?: number): boolean; + /** + * 检查输入包围盒是否落在包围盒中,以以指定的容差。 + * 注意:包围盒的边界也是算落在之中。 + * + * Check whether this bounding box is in the input bounding box with specified tolerance. + * NOTE: boundary is included. + * @param other + * 传入包围盒。 + * + * The input bounding box. + * @param tolerance + * 传入容差。 + * + * The specified tolerance. + * @returns + * 当输入包围盒落在包围盒中,返回true。 + * + * Return True if this box is inside the input box, otherwise return false. + */ + isInside(other: KBoundingBox3d, tolerance?: number): boolean; + /** + * 检查传入包围盒与当前包围盒是否有重叠区域,以特定容差。 + * 注意:完全落入是由重叠区域的子集。 + * + * Check whether this input bounding box and this bounding box share the same space with specified tolerance. + * NOTE: 'inside' relationship is included. + * @param other + * 传入包围盒。 + * + * The input bounding box. + * @param tolerance + * 传入容差。 + * + * The specified tolerance. + * @returns + * 当输入包围盒与当前包围盒有共同区域,返回true。 + * + * Return true if two box share the same space, otherwise return false. + */ + isOverlapping(other: KBoundingBox3d, tolerance?: number): boolean; +} +/** + * KCircle2d类代表着二维空间中的一个圆。 + * + * The KCircle2d class represents a circle in 2d space. + */ +declare interface KCircle2d extends KCurve2d { + /** + * 获取圆心。 + * + * Get center of the circle. + */ + readonly center: KPoint2d; + /** + * 获取圆的半径。 + * + * Get radius of the circle. + */ + readonly radius: number; + /** + * 获取圆上一点的法向量。 + * 注意:传入点需要确保落在圆上。 + * + * Get circle's tangent vector of a point on the circle. + * NOTE: the caller need to make sure the point is on the circle. + * @param point + * 圆上一点。 + * + * A point on the circle. + * @returns + * 切向量。 + * + * The tangent vector. + */ + getTangent(point: KPoint2d): KVector2d; + /** + * 对当前圆进行变换。 + * 注意:如何变换之后䣌几何不是一个圆,则会抛出error,本操作仅支持旋转和平移。 + * + * Transform this circle to a new one. + * NOTE: If the new one is not a circle, it will throw error. Only support for rotate and move translation now. + * @param matrix + * 变换矩阵。 + * + * The transform matrix. + * @returns + * 当执行正确的话,返回true。 + * + * Return true if successful, otherwise return false. + */ + transform(matrix: KMatrix3): boolean; +} +/** + * KCircle3d类代表着三维空间中的一个圆。 + * + * The KCircle3d class represents a circle in 3d space. + */ +declare interface KCircle3d extends KCurve3d { + /** + * 获取圆心。 + * + * Get center of the circle. + */ + readonly center: KPoint3d; + /** + * 获取圆的半径。 + * + * Get radius of the circle. + */ + readonly radius: number; + /** + * 获取圆的法向量。 + * + * Get the normal of the circle. + */ + readonly normal: KVector3d; + /** + * 获取圆上一点的法向量。 + * 注意:传入点需要确保落在圆上。 + * + * Get circle's tangent vector of a point on the circle. + * NOTE: the caller need to make sure the point is on the circle. + * @param point + * 圆上一点。 + * + * A point on the circle. + * @returns + * 切向量。 + * + * The tangent vector. + */ + getTangent(point: KPoint3d): KVector3d; + /** + * 对当前圆进行变换。 + * 注意:如何变换之后䣌几何不是一个圆,则会抛出error,本操作仅支持旋转和平移。 + * + * Transform this circle to a new one. + * NOTE: If the new one is not a circle, it will throw error. Only support for rotate and move translation now. + * @param matrix + * 变换矩阵。 + * + * The transform matrix. + * @returns + * 当执行正确的话,返回true。 + * + * Return true if successful, otherwise return false. + */ + transform(matrix: KMatrix4): boolean; + /** + * 获取当前圆所落的平面。 + * + * Get the plane where the circle is on. + * @returns + * 当前圆所在的平面。 + * + * The plane where the circle is on. + * + */ + getPlane(): KPlane; +} +/** + * 所有二维曲线的基类。 + * + * The root class for all 2d curves. + */ +declare interface KCurve2d { + /** + * 获得曲线的类型。 + * + * Get the curve's type. + * @returns + * 曲线的类型。 + * + * The curve's type. + */ + getType(): KCurve2dType_2; + /** + * 获取曲线的参数域区间。 + * + * Get the parameter interval of the curve. + */ + getInterval(): KInterval; + /** + * 求曲线参数值对应的曲线上的点位置。 + * + * Get the point on the curve specified by the input parameter t. + * @param t + * 参数值 + * + * Parameter value + * @returns + * 曲线参数对应的曲线上的点。 + * + * The point on the curve for the input parameter. + */ + getPoint(t: number): KPoint2d; + /** + * 反求输入点对应的曲线参数值。 + * + * Get point's corresponding parameter value on the curve. + * @param point + * 曲线上的一点。 + * + * Point on curve + * @returns + * 输入点对应的曲线参数值。 + * + * The corresponding parameter of the point on curve. + */ + getParam(point: KPoint2d): number; + /** + * 对当前曲线进行变换。 + * + * Transform this curve to a new one. + * @param matrix + * 变换矩阵。 + * + * The transform matrix. + * @returns + * 当执行正确的话,返回true。 + * + * Return true if successful, otherwise return false. + */ + transform(matrix: KMatrix3): boolean; + /** + * 检查传入点以指定容差是否位于曲线上。 + * + * Check whether the input point is on the curve or not with specified tolerance. + * @param point + * 传入点。 + * + * The input point. + * @param tolerance + * 指定容差,默认容差是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果在曲线上返回true。 + * + * Return true if on the curve, otherwise return false. + */ + isPointOnCurve(point: KPoint2d, tolerance?: number): boolean; + /** + * 获得曲线上距离传入点最近的一点,以指定容差。 + * + * Get the closest point on curve for the input point with specified tolerance. + * @param point + * 传入点。 + * + * The input point. + * @param tolerance + * 指定容差,默认容差是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 最近点。 + * + * The closest point. + */ + getClosestPoint(point: KPoint2d, tolerance?: number): KPoint2d; + /** + * 以给定的容差检查两个曲线是否相等。 + * + * Check whether two curves are equal with specified tolerance. + * @param other + * 要比对的曲线。 + * + * The curve to compare this curve with. + * @param tolerance + * 指定容差,默认容差是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果相等上返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(curve: KCurve2d, tolerance?: number): boolean; + /** + * 复制一个当前曲线。 + * + * Return the cloned curve of this. + * @returns + * 复制的曲线。 + * + * The cloned curve. + */ + clone(): KCurve2d; + /** + * 把当前曲线反向。 + * + * reverse the current curve. + */ + reverse(): void; + /** + * 求曲线上某点处的曲率向量。 + * + * Get curve's curvature vector for the input point on the curve. + * @param point + * 曲线上一点。 + * + * A point on curve. + * @return + * 曲率向量。 + * 向量的模为曲率值,向量的方向为曲率方向。 + * + * A curvature vector. + * Its norm represents the curvature value. Its direction represents the curvature's direction. + */ + getCurvatureVector(point: KPoint2d): KVector2d; +} +/** + * KCurve2dType枚举类代表曲线类型。 + * + * The KCurve2dType class represents curve types. + */ +declare enum KCurve2dType_2 { + /** + * 直线。 + * + * KLine3d Type. + */ + Line2d = 'line2d', + /** + * 圆。 + * + * KCircle3d Type. + */ + Circle2d = 'circle2d', + /** + * 线段。 + * + * KLineSegment3d Type. + */ + LineSeg2d = 'lineSeg2d', + /** + * 圆弧。 + * + * KArc3d Type. + */ + Arc2d = 'arc2d', + /** + * 椭圆弧。 + * + * KEllipticalArc2d Type. + */ + EllipticalArc2d = 'ellipticalArc2d', + /** + * 折线段。 + * + * KPolylineCurve2d Type. + */ + PolylineCurve2d = 'polylineCurve2d', + /** + * 非均匀有理样条曲线。 + * + * KNurbsCurve2d Type. + */ + NurbsCurve2d = 'nurbsCurve2d' +} +/** + * 所有三维曲线的基类。 + * + * The root class for all 3d curves. + */ +declare interface KCurve3d { + /** + * 获得曲线的类型。 + * + * Get the curve's type. + * @returns + * 曲线的类型。 + * + * The curve's type. + */ + getType(): KCurve3dType_2; + /** + * 获取曲线的参数域区间。 + * + * Get the parameter interval of the curve. + */ + getInterval(): KInterval; + /** + * 对当前曲线进行变换。 + * + * Transform this curve to a new one. + * @param matrix + * 变换矩阵。 + * + * The transform matrix. + * @returns + * 当执行正确的话,返回true。 + * + * Return true if successful, otherwise return false. + */ + transform(matrix: KMatrix4): boolean; + /** + * 求曲线参数值对应的曲线上的点位置。 + * + * Get the point on the curve specified by the input parameter t. + * @param t + * 参数值 + * + * Parameter value + * @returns + * 曲线参数对应的曲线上的点。 + * + * The point on the curve for the input parameter. + */ + getPoint(t: number): KPoint3d; + /** + * 反求输入点对应的曲线参数值。 + * + * Get point's corresponding parameter value on the curve. + * @param point + * 曲线上的一点。 + * + * Point on curve + * @returns + * 输入点对应的曲线参数值。 + * + * The corresponding parameter of the point on curve. + */ + getParam(point: KPoint3d): number; + /** + * 检查传入点以指定容差是否位于曲线上。 + * + * Check whether the input point is on the curve or not with specified tolerance. + * @param point + * 传入点。 + * + * The input point. + * @param tolerance + * 指定容差,默认容差是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果在曲线上返回true。 + * + * Return true if on the curve, otherwise return false. + */ + isPointOnCurve(point: KPoint3d, tolerance?: number): boolean; + /** + * 获得曲线上距离传入点最近的一点,以指定容差。 + * + * Get the closest point on curve for the input point with specified tolerance. + * @param point + * 传入点。 + * + * The input point. + * @param tolerance + * 指定容差,默认容差是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 最近点。 + * + * The closest point. + */ + getClosestPoint(point: KPoint3d, tolerance?: number): KPoint3d; + /** + * 以给定的容差检查两个曲线是否相等。 + * + * Check whether two curves are equal with specified tolerance. + * @param other + * 要比对的曲线。 + * + * The curve to compare this curve with. + * @param tolerance + * 指定容差,默认容差是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果相等上返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KCurve3d, tolerance?: number): boolean; + /** + * 复制一个当前曲线。 + * + * Return the cloned curve of this. + * @returns + * 复制的曲线。 + * + * The cloned curve. + */ + clone(): KCurve3d; + /** + * 把当前曲线反向。 + * + * reverse the current curve. + */ + reverse(): void; + /** + * 求曲线上某点处的曲率向量。 + * + * Get curve's curvature vector for the input point on the curve. + * @param point + * 曲线上一点。 + * + * A point on curve. + * @return + * 曲率向量。 + * 向量的模为曲率值,向量的方向为曲率方向。 + * + * A curvature vector. + * Its norm represents the curvature value. Its direction represents the curvature's direction. + */ + getCurvatureVector(point: KPoint3d): KVector3d; +} +/** + * KCurve3dType枚举类代表曲线类型。 + * + * The KCurve3dType class represents curve types. + */ +declare enum KCurve3dType_2 { + /** + * 直线。 + * + * KLine3d Type. + */ + Line3d = 'line3d', + /** + * 圆。 + * + * KCircle3d Type. + */ + Circle3d = 'circle3d', + /** + * 线段。 + * + * KLineSegment3d Type. + */ + LineSeg3d = 'lineSeg3d', + /** + * 圆弧。 + * + * KArc3d Type. + */ + Arc3d = 'arc3d' +} +/** + * 曲线与环的位置关系类型。 + * + * Curve and loop position relation type. + */ +declare enum KCurveInLoopType_2 { + /** + * 曲线不在环内(曲线完全在环外,曲线与环相交或者部分在环外)。 + * + * The curve is not in the loop(include fully out of loop, cross loop or partially out of loop) + */ + NotIn = 0, + /** + * 曲线在环边界上。 + * + * The curve is on the edge of loop + */ + OnEdge = 1, + /** + * 曲线完全在环内,曲线的端点不在环的边界上。 + * + * The curve is fully in the loop, no vertex is on the edge + */ + FullyIn = 2, + /** + * 曲线部分在环内,即存在部分曲线端点在环边界上。 + * + * The curve is partially in the loop, exist vertex on the edge. + */ + PartiallyIn = 3 +} +/** + * 曲线位置关系计算结果。 + * + * Curves position relation check result. + */ +declare interface KCurvesIntersectRet { + /** + * 交点。 + * + * The intersection point. + */ + point: KPoint3d; + /** + * 是否重叠。 + * + * The overlap status. + */ + isOverlap?: boolean; +} +/** + * 曲线与面的位置关系计算结果。 + * + * Curve and surface position relation check result. + */ +declare interface KCurveSurfaceIntersectRet { + /** + * 曲线与面的关系类型。 + * + * The curve and surface intersection type. + */ + intersectType: KCurveSurfaceIntersectType_2; + /** + * 如果KCurveSurfaceIntersectType的类型是点,那么point属性就是交点,否则该属性未定义。 + * + * If KCurveSurfaceIntersectType is equal to KCurveSurfaceIntersectType.Point, + * the point is the intersection point, otherwise undefined. + */ + point?: KPoint3d; + /** + * 如果KCurveSurfaceIntersectType的类型是曲线,那么curve属性就是交线,否则该属性未定义。 + * + * If KCurveSurfaceIntersectType is equal to KCurveSurfaceIntersectType.Curve, + * the curve is the intersection curve, otherwise undefined. + */ + curve?: KCurve3d; +} +/** + * 曲线与面的位置关系。 + * + * Curve and surface intersection type. + */ +declare enum KCurveSurfaceIntersectType_2 { + /** + * 点。 + * + * The point type. + */ + Point = 1, + /** + * 曲线。 + * + * The curve type. + */ + Curve = 2 +} +/** + * KEllipticalArc2d 类代表着二维空间中的一个椭圆弧。 + * + * The KEllipticalArc2d class represents an elliptical arc in 2d space. + */ +declare interface KEllipticalArc2d extends KBoundedCurve2d_2 { + /** + * 获取当前椭圆弧的圆心。 + * + * Get center of the elliptical arc. + */ + readonly center: KPoint2d; + /** + * 获取当前椭圆弧的长轴半径。 + * + * Get major radius of the elliptical arc. + */ + readonly majorRadius: number; + /** + * 获取当前椭圆弧的短轴半径。 + * + * Get minor radius of the elliptical arc. + */ + readonly minorRadius: number; + /** + * 获取椭圆弧的起点参数 + * + * Get the start parameter. + */ + readonly startParam: number; + /** + * 获取椭圆弧的终点参数 + * + * Get the end parameter. + */ + readonly endParam: number; + /** + * 判断椭圆弧是不是逆时针方向 + * + * Get whether the arc is ccw or not. + */ + readonly isCCW: boolean; + /** + * 获得椭圆弧上一点处的切向量。 + * 注意:该函数调用需要确保传入点在椭圆弧上。 + * + * Get tangent vector of a point on the elliptical arc. + * NOTE: the caller needs to make sure the point is on the arc. + * @param point + * 椭圆弧上一点。 + * + * A point on the arc. + * @returns + * 切向量。 + * + * The tangent vector. + */ + getTangent(point: KPoint2d): KVector2d; +} +/** + * 这是一个定义欧拉角的接口,欧拉角是用来表示旋转变换的另一种形式。 + * 其中x, y, z分别表示绕x轴,y轴和z轴旋转的角度,order表示绕x轴,y轴和z轴旋转的先后顺序。 + * + * An interface representing Euler Angles. + * Euler angles describe a rotational transformation by rotating an object around its various axes in + * specified amounts and order. + */ +declare interface KEuler { + /** + * 绕x轴旋转角度。 + * + * The rotate angle around x axis in radians. + */ + readonly x: number; + /** + * 绕y轴旋转角度。 + * + * The rotate angle around y axis in radians. + */ + readonly y: number; + /** + * 绕z轴旋转角度。 + * + * The rotate angle around z axis in radians. + */ + readonly z: number; + /** + * order表示绕x轴,y轴和z轴旋转的先后顺序。 + * 例如XYZ表示先绕X轴旋转,再绕Y轴旋转,最后绕Z轴旋转;ZYX表示先绕Z轴旋转,再绕Y轴旋转,最后绕X轴旋转。 + * + * The order in which to apply the rotations. + * Default is 'XYZ', which means that the object will firstly + * be rotated around its X axis, then its Y axis and finally + * its Z axis. Other possibilities are: 'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX'. + */ + order: KEulerOrder; + /** + * 设置绕x,y,z轴旋转的角度和旋转顺序。 + * + * Set x, y, z angles and order. + * @param x + * @param y + * @param z + * @param order + */ + set(x: number, y: number, z: number, order: KEulerOrder): void; + /** + * 克隆自己返回一个新的欧拉角对象。 + * + * Clone the euler object. + */ + clone(): KEuler; + /** + * 从另外一个欧拉角复制x,y,z和order数据,覆盖掉自己的数据。 + * + * Copy x, y, z angles and order from another Euler object. + * @param euler + */ + copyFrom(euler: KEuler): void; + /** + * 从一个变换矩阵中提取x,y,z旋转分量并结合输入的旋转顺序order,设置到当前的欧拉角对象。 + * + * Set x, y, z angles and order from a matrix. + * @param m + * @param order + */ + setFromRotationMatrix(m: KMatrix4, order?: KEulerOrder): void; + /** + * 从一个四元数对象提取x,y,z旋转分量并结合输入的旋转顺序order,设置到当前的欧拉角对象。 + * + * Set x, y, z angles and order from a quaternion. + * @param q + * @param order + */ + setFromQuaternion(q: KQuaternion, order?: KEulerOrder): void; + /** + * 把一个向量的x,y,z分量分别当作x,y,z旋转分量并结合输入的旋转顺序order,设置到当前的欧拉角对象。 + * + * Set x, y, z angles and order from a vector3d. + * NOTE: v.x is the angle of x axis, and so on. + * @param v + * @param order + */ + setFromVector3(v: KVector3d, order?: KEulerOrder): void; + /** + * 重新设置欧拉角旋转顺序。 + * + * Reorder the angles. + * @param newOrder + */ + reorder(newOrder: KEulerOrder): void; + /** + * 检查是不是和另外一个欧拉角对象相等。 + * + * Check whether this Euler object is equal to another. + */ + isEqual(euler: KEuler): boolean; + /** + * 从一个数组读取x,y,z和order数据,写入到当前对象中。 + * + * Set x, y, z angles and order from an array. + * @param array + */ + fromArray(array: any[]): void; + /** + * 把欧拉角对象转化成数组形式[x, y, z, order]。 + * + * Convert to an array containing x, y, z angles and the order. + * @param array + * @param offset + */ + toArray(): any[]; + /** + * 把当前欧拉角对象转化成一个向量[x,y,z]。 + * + * Convert to a vector3d containing x, y, z angles. + */ + toVector(): KVector3d; +} +declare enum KEulerOrder { + XYZ = 0, + YZX = 1, + ZXY = 2, + XZY = 3, + YXZ = 4, + ZYX = 5 +} +/** + * KFace2d代表二维面。 + * + * The KFace2d represents a 2d face. + */ +declare interface KFace2d { + /** + * 二维面外轮廓。 + * + * The 2d uv contour. + */ + contour: KBoundedCurve2d_2[]; + /** + * 二维内轮廓。 + * + * The 2d uv holes. + */ + holes: KBoundedCurve2d_2[][]; +} +/** + * KFace3d代表一个三维面。 + * + * The KFace3d represents a 3d face. + */ +declare interface KFace3d_2 { + /** + * 三维外轮廓。 + * + * The 3d contour + */ + contour: KBoundedCurve3d_2[]; + /** + * 三维内轮廓。 + * + * The 3d holes. + */ + holes: KBoundedCurve3d_2[][]; +} +/** + * 二维面布尔结果。 + * + * Face2d boolean result + */ +declare interface KFaceBooleanRet { + /** + * 布尔操作是否成功。 + * + * Whether the boolean operation is succeeded or not. + */ + success: boolean; + /** + * 布尔操作的结果的面数组。 + * + * The result faces of boolean operation. + */ + resultFaces: KFace2d[]; +} +/** + * 面的布尔操作类型。 + * + * Face boolean types + */ +declare enum KFaceBooleanType_2 { + /** + * 布尔并操作类型。 + * + * Boolean union type. + */ + union = 0, + /** + * 布尔交操作类型。 + * + * Boolean intersection type. + */ + intersect = 1, + /** + * 布尔差操作类型。 + * + * Boolean subtract type. + */ + subtract = 2 +} +declare interface KGeomFace2d_2 { + /** + * 获得外轮廓。 + * + * Get contour loop + */ + getContour(): KGeomLoop2d; + /** + * 获得内轮廓。 + * + * Get hole loops + */ + getHoles(): KGeomLoop2d[]; + /** + * 获得面积。 + * + * Get area + */ + area(): number; + /** + * 检查外轮廓是否逆时针。 + * + * Check whether face2d's contour is counter-clockwise + */ + isPositive(): boolean; + /** + * 检查该面是否有效,其中每一个内外轮廓均需都有效, + * 内轮廓包围所有内轮廓,所有内轮廓不相交。 + * 外轮廓与内轮廓反向。 + * + * Whether the face2d is valid, including: + * - Each contour and hole is valid + * - Contour contains all holes and holes are not overlapped. + * - Contour and holes have opposite direction. + */ + isValid(): boolean; + /** + * 判断输入点是否位于面上。 + * + * Whether the input point is in the face2d + * @param point + * @param bIncludeOn + * 是否考虑边界。 + * + * true means the point is on the boundary of the face2d is also be think in face. + */ + containsPoint(point: KPoint2d, bIncludeOn?: boolean): boolean; +} +/** + * KGeomLib类定义了若干方法以方便的执行多种几何建模操作,例如构建曲线、曲面或其他几何算法等。 + * + * The KGeometry class defines a number of methods that let you perform different geometric operations, + * such as creating geometric curves, surfaces, using geometric algorithms, etc. + */ +declare interface KGeomLib_2 { + /** + * 创建一个kpoint2d对象。 + * + * Creates an instance of KPoint2d. + * @param x + * 二维点的x坐标。 + * + * The x value of the 2D point. + * @param y + * 二维点的y坐标。 + * + * The y value of the 2D point. + * @returns + * 二维点。 + * + * The 2D point. + */ + createPoint2d(x: number, y: number): KPoint2d; + /** + * 创建一个kpoint3d对象。 + * + * Creates an instance of KPoint3d. + * @param x + * 三维点的x坐标。 + * + * The x value of the 3D point. + * @param y + * 三维点的y坐标。 + * + * The y value of the 3D point. + * @param z + * 三维点的z坐标。 + * + * The z value of the 3D point. + * @returns + * 三维点。 + * + * The 3D point. + */ + createPoint3d(x: number, y: number, z: number): KPoint3d; + /** + * 创建一个kVector2d对象。 + * + * Creates an instance of KVector2d + * @param x + * 二维向量的x分量。 + * + * The x value of the 2D vector + * @param y + * 二维向量的y分量。 + * + * The y value of the 2D vector + * @returns + * 二维向量。 + * + * The 2D vector. + */ + createVector2d(x: number, y: number): KVector2d; + /** + * 创建一个kVector3d对象。 + * + * Creates an instance of KVector3d. + * @param x + * 三维向量的x分量。 + * + * The x value of the 3D vector. + * @param y + * 三维向量的y分量。 + * + * The y value of the 3D vector. + * @param z + * 三维向量的z分量。 + * + * The z value of the 3D vector. + * @returns + * 三维向量。 + * + * The 3D vector. + */ + createVector3d(x: number, y: number, z: number): KVector3d; + /** + * 创建一个KBoundingBox2d对象。 + * + * Creates an instance of KBoundingBox2d. + * @param minPoint + * 二维包围盒的左下角点。 + * + * The minimum point of the bounding box. + * @param maxPoint + * 二维包围盒的右上顶点。 + * + * The maximum point of the bounding box. + * @returns + * 包围盒。 + * + * The bounding box. + */ + createBoundingBox2d(minPoint: KPoint2d, maxPoint: KPoint2d): KBoundingBox2d; + /** + * 创建一个KBoundingBox3d对象。 + * + * Creates an instance of KBoundingBox3d. + * @param minPoint + * 三维包围盒的左下角点。 + * + * The minimum point of the bounding box. + * @param maxPoint + * 三维包围盒的右上顶点。 + * + * The maximum point of the bounding box. + * @returns + * 包围盒。 + * + * The bounding box. + */ + createBoundingBox3d(minPoint: KPoint3d, maxPoint: KPoint3d): KBoundingBox3d; + /** + * 创建一个单位矩阵。 + * + * Create an identity matrix. + * @returns + * 单位矩阵。 + * + * The identity matrix. + */ + createIdentityMatrix3(): KMatrix4; + /** + * 创建平移变换矩阵。 + * + * Create an translation transform matrix. + * @param x + * x方向平移分量。 + * + * The amount to translate in the X axis. + * @param y + * y方向平移分量。 + * + * The amount to translate in the Y axis. + * @returns + * 平移变换矩阵。 + * + * The translation transform matrix. + */ + createTranslationMatrix3(x: number, y: number): KMatrix3; + /** + * 创建围绕轴旋转的变换矩阵。 + * 旋转轴由一点定义,旋转角度由弧度值给出。 + * + * Create an transform matrix that does rotation about an axis. + * The axis is defined by a point. The angle is given in radians. + * @param angle + * 旋转角弧度。 + * + * The angle of rotation in radians. + * @param center + * 定义旋转轴的点。 + * + * The point to define the axis. + * @returns + * 旋转变换矩阵。 + * + * The rotation transform matrix. + */ + createRotateMatrix3(angle: number, center: KPoint2d): KMatrix3; + /** + * 创建缩放矩阵。 + * + * Create a matrix as scale transform. + * @param x + * x方向缩放分量。 + * + * The amount to scale in the X axis. + * @param y + * y方向缩放分量。 + * + * The amount to scale in the Y axis. + * @returns + * 缩放矩阵。 + * + * The scale transform matrix. + */ + createScaleMatrix3(x: number, y: number): KMatrix3; + /** + * 创建四阶单位矩阵。 + * + * Create an identity matrix. + * @returns + * 单位矩阵。 + * + * The identity matrix. + */ + createIdentityMatrix4(): KMatrix4; + /** + * 创建平移变换矩阵。 + * + * Create an translation transform matrix. + * @param x + * x方向平移分量。 + * + * The amount to translate in the X axis. + * @param y + * y方向平移分量。 + * + * The amount to translate in the Y axis. + * @returns + * 平移变换矩阵。 + * + * The translation transform matrix. + */ + createTranslationMatrix4(x: number, y: number, z: number): KMatrix4; + /** + * 创建围绕轴旋转的变换矩阵。 + * 旋转轴由一点和一向量定义,旋转角度由弧度值给出。 + * + * Create an transform matrix that does rotation about an axis. + * The axis is defined by a point and a vector. The angle is given in radians. + * @param angle + * 旋转角弧度。 + * + * The angle of rotation in radians. + * @param a + * 用于定义旋转轴的向量。 + * + * The vector to define the axis. + * @param center + * 用于定义旋转轴的点。 + * + * The point to define the axis. + * @returns + * 旋转矩阵。 + * + * The rotation transform matrix. + */ + createRotateMatrix4(angle: number, a: KVector3d, center: KPoint3d): KMatrix4; + /** + * 创建缩放矩阵。 + * + * Create a matrix as scale transform. + * @param x + * x方向缩放分量。 + * + * The amount to scale in the X axis. + * @param y + * y方向缩放分量。 + * + * The amount to scale in the Y axis. + * @param z + * z方向缩放分量。 + * + * The amount to scale in the Z axis. + * @returns + * 缩放矩阵。 + * + * The scale transform matrix. + */ + createScaleMatrix4(x: number, y: number, z: number): KMatrix4; + /** + * 创建一个变换矩阵,是从全局坐标系到局部坐标系的变换。 + * + * Create a transformation matrix which align global ccs to the given ccs. + * @param x + * 给定坐标系的x方向。 + * + * The x direction of the given coordinate system. + * @param y + * 给定坐标系的y方向。 + * + * The y direction of the given coordinate system. + * @param z + * 给定坐标系的z方向。 + * + * The z direction of the given coordinate system. + * @param origin + * 给定坐标系的原点。 + * + * The origin of the given coordinate system. + * @returns + * 变换矩阵。 + * + * The transformation matrix. + */ + createAlignCCSMatrix4(x: KVector3d, y: KVector3d, z: KVector3d, origin: KPoint3d): KMatrix4; + /** + * 创建一个KLine2d对象。 + * + * Creates an instance of KLine2d. + * @param point + * 二维直线的原点。 + * + * The origin point of the 2D line. + * @param direction + *二维直线的方向。 + * + * The direction of the 2D line. + * @returns + * 二维直线。 + * + * The 2D line. + */ + createLine2d(point: KPoint2d, direction: KVector2d): KLine2d; + /** + * 创建一个KLine3d对象。 + * + * Creates an instance of KLine3d. + * @param point + * 三维直线的原点。 + * + * The origin point of the 3D line. + * @param direction + * 三维直线的方向。 + * + * The direction of the 3D line. + * @returns + * 三维直线。 + * + * The 3D line. + */ + createLine3d(point: KPoint3d, direction: KVector3d): KLine3d_2; + /** + * 创建一个KLineSegment2d对象。 + * + * Creates an instance KLineSegment2d + * @param startPoint + * 二维线段的起点。 + * + * The start point of the 2D line segment. + * @param endPoint + * 二维线段的终点。 + * + * The end point of the 2D line segment. + */ + createLineSegment2d(startPoint: KPoint2d, endPoint: KPoint2d): KLineSegment2d; + /** + * 创建一个KLineSegment3d对象。 + * + * Creates an instance KLineSegment3d + * @param startPoint + * 二维线段的起点。 + * + * The start point of the 3D line segment. + * @param endPoint + * 二维线段的终点。 + * + * The end point of the 3D line segment. + * @returns + * 三维线段。 + * + * The 3D line segment. + */ + createLineSegment3d(startPoint: KPoint3d, endPoint: KPoint3d): KLineSegment3d_2; + /** + * 通过点列创建一个二维折线段。 + * + * Create a 2D polyline by a list of points. + * @param points + * 折线段的顶点序列。 + * + * The vertice of the polyline. + * @returns + * 二维折线段。 + * + * The 2D polyline. + */ + createPolylineCurve2d(points: KPoint2d[]): KPolylineCurve2d; + /** + * 通过椭圆心、椭圆长轴方向、椭圆长轴半径、椭圆短轴半径、圆弧起点和末点来创建圆弧。 + * + * Create an elliptical arc by center, x direction, major radius, minor radius, start and end points. + * @param center + * 椭圆圆心。 + * + * The center point of the 2D elliptical arc. + * @param xDirection + * 椭圆长轴方向(X 方向)。 + * + * X direction of the 2D elliptical arc. + * @param majorRadius + * 椭圆长轴半径。 + * + * Major radius of the elliptical arc. + * @param minorRadius + * 椭圆短轴半径。 + * + * Minor radius of the elliptical arc. + * @param startPoint + * 椭圆弧的起点,需要注意,该点需要在圆弧上。 + * + * The start point of the 2D arc. The caller need to make sure it's on the arc. + * @param endPoint + * 椭圆弧的末点,需要注意,该点需要在圆弧上。 + * + * The end point of the 2D arc. The caller need to make sure it's on the arc. + * @param isCCW + * 圆弧是否是逆时针方向。 + * 如果圆弧是逆时针方向,则表示圆弧是圆上从起点开始沿逆时针方向到达终点的那一段圆,反之则表示圆上另外一侧的一段。 + * + * Whether the 2d arc is counter clockwise from startPoint to endPoint. + * True means the counter clockwise segment of the circle from startPoint to endPoint. + * False means the clockwise segment of the circle from startPoint to endPoint. + * @returns + * The 2D arc. + */ + createEllipticalArc2dByStartEndPoints(center: KPoint2d, xDirection: KVector2d, majorRadius: number, minorRadius: number, startPoint: KPoint2d, endPoint: KPoint2d, isCCW: boolean): KEllipticalArc2d; + /** + * 通过椭圆心、椭圆长轴方向、椭圆长轴半径、椭圆短轴半径、圆弧起点和末点来创建圆弧。 + * + * Create an elliptical arc by center, x direction, major radius, minor radius, start and end points. + * @param center + * 椭圆圆心。 + * + * The center point of the 2D elliptical arc. + * @param xDirection + * 椭圆长轴方向(X 方向)。 + * + * X direction of the 2D elliptical arc. + * @param majorRadius + * 椭圆长轴半径。 + * + * Major radius of the elliptical arc. + * @param minorRadius + * 椭圆短轴半径。 + * + * Minor radius of the elliptical arc. + * @param startParam + * 椭圆弧的起点参数。 + * + * The start parameter of the 2D arc. + * @param endParam + * 椭圆弧的终点参数。 + * + * The end parameter of the 2D arc. + * @param isCCW + * 圆弧是否是逆时针方向。 + * 如果圆弧是逆时针方向,则表示圆弧是圆上从起点开始沿逆时针方向到达终点的那一段圆,反之则表示圆上另外一侧的一段。 + * + * Whether the 2d arc is counter clockwise from startPoint to endPoint. + * True means the counter clockwise segment of the circle from startPoint to endPoint. + * False means the clockwise segment of the circle from startPoint to endPoint. + * @returns + * The 2D arc. + */ + createEllipticalArc2dByStartEndParams(center: KPoint2d, xDirection: KVector2d, majorRadius: number, minorRadius: number, startParam: number, endParam: number, isCCW: boolean): KEllipticalArc2d; + /** + * 通过三个点创建一个圆弧。 + * Create an arc by input three points. + * @param startPoint + * 圆弧的起点。 + * + * The start point of the 2D arc. + * @param midPoint + * 圆弧的中点。 + * + * The middle point of the 2D arc. + * @param endPoint + * 圆弧的末点。 + * + * The end point of the 2D arc. + * @returns + * 返回一个圆弧或者null,当三点共线时就是null。 + * + * The 2D arc or null (if the three points are colinear). + */ + createArc2dByThreePoints(startPoint: KPoint2d, midPoint: KPoint2d, endPoint: KPoint2d): KArc2d | null; + /** + * 通过圆心、圆弧起点和末点来创建圆弧。 + * + * Create an arc by start and end points. + * @param center + * 圆心。 + * + * The center point of the 2D arc. + * @param startPoint + * 圆弧的起点,需要注意,该点需要在圆弧上。 + * + * The startPoint point of the 2D arc. The caller need to make sure it's on the arc. + * @param endPoint + * 圆弧的末点,需要注意,该点需要在圆弧上。 + * + * The end point of the 2D arc. The caller need to make sure it's on the arc. + * @param isCCW + * 圆弧是否是逆时针方向。 + * 如果圆弧是逆时针方向,则表示圆弧是圆上从起点开始沿逆时针方向到达终点的那一段圆,反之则表示圆上另外一侧的一段。 + * + * Whether the 2d arc is counter clockwise from startPoint to endPoint. + * True means the counter clockwise segment of the circle from startPoint to endPoint. + * False means the clockwise segment of the circle from startPoint to endPoint. + * @returns + * The 2D arc. + */ + createArc2dByStartEndPoints(center: KPoint2d, startPoint: KPoint2d, endPoint: KPoint2d, isCCW: boolean): KArc2d; + /** + * 通过圆弧的圆心、半径、起始角度和终止角度来创建一段圆弧。 + * + * Create an arc by center, radius, start angle and end angle. + * @param center + * 圆心。 + * + * The center point of the 2D arc. + * @param radius + * 圆弧半径。 + * + * The radius of the 2D arc. + * @param startAngle + * 圆弧的起始角度。 + * + * The start angle of the arc. + * @param endAngle + * 圆弧的终止角度。 + * + * The end angle of the arc. + * @param isCCW + * 圆弧是否是逆时针方向。 + * 如果圆弧是逆时针方向,则表示圆弧是圆上从起始角开始沿逆时针方向到达终止角的那一段圆,反之则表示圆上另外一侧的一段。 + * + * Whether the 2d arc is counter clockwise from startAngle to endAngle. + * True means the counter clockwise segment of the circle from startAngle to endAngle. + * False means the clockwise segment of the circle from startAngle to endAngle. + * @returns + * The 2D arc. + */ + createArc2dByStartEndAngles(center: KPoint2d, radius: number, startAngle: number, endAngle: number, isCCW: boolean): KArc2d; + /** + * 通过圆弧的圆心、半径、起始角度和圆弧角度来创建一段圆弧。 + * + * Create an arc by center, radius, start angle and arc angle. + * @param center + * 圆心。 + * + * The center point of the 2D arc. + * @param radius + * 圆弧半径。 + * + * The radius of the 2D arc. + * @param startAngle + * 圆弧的起始角度。 + * + * The start angle of the arc. + * @param arcAngle + * 圆弧的角度。 + * 正的圆弧角度值表示从圆弧起始角度沿逆时针方向转动这个角度为圆弧终点。 + * 负的圆弧角度值表示从圆弧起始角度沿顺时针方向转动这个角度为圆弧终点。 + * + * The angle of the arc. + * If the angle is positive, it means the arc span is along the counter clockwise direction. + * If the angle is negative, it means the arc span is along the clockwise direction. + * @returns + * The 2D arc. + */ + createArc2dByArcAngle(center: KPoint2d, radius: number, startAngle: number, arcAngle: number): KArc2d; + /** + * 通过圆弧的弦和圆弧突起的高度比例来创建圆弧。 + * + * Create an arc by the chord of the arc and the bulge ratio. + * + * .. + * . | . + * . A | . + * ------------------- + * chord + * bulge = Math.tan(A) = sagitta / (0.5 * chord) + * + * NOTE: if signedBulge > 0, the arc is conter clockwise, otherwise it's clockwise. + * @param chord + * 圆弧的弦。 + * + * The chord of the 2d arc. + * @param signedBulge + * 圆弧的突起比例。 + * + * The bulge ratio of the arc. + * @returns + * 圆弧。 + * + * The 2d arc. + */ + createArc2dByChordAndBulge(chord: KLineSegment2d, signedBulge: number): KArc2d; + /** + * 通过圆弧起点、终点以及起点切向来创建圆弧。 + * + * Create an arc by start point, end point and tangent at start point. + * @param start + * 圆弧起点。 + * + * The start point of the 2d arc. + * @param end + * 圆弧终点。 + * + * The end point of the 2d arc. + * @param startTangent + * 圆弧起点的切向量(单位向量)。 + * 切向量的方向决定了圆弧是逆时针的还是顺时针的。 + * + * The tangent at the start point of the 2d arc. + * The direction of the tangent determines whether the arc is counter clockwise or clockwise. + * @param cosTol + * 可选参数,用于判断切向量和起点终点之间的连线方向是否平行的容差。如果平行,则返回空。 + * + * The cosin angle tolerance to check whether the tangent is parallel to the direction from start point to end point. + * If it is parallel, return null. + * @returns + * 圆弧。 + * + * The 2d arc. + */ + createArc2dByPointsAndStartTangent(start: KPoint2d, end: KPoint2d, startTangent: KVector2d, cosTol?: number): KArc2d | null; + /** + * 创建给定半径并经过给定起点和终点的圆弧。 + * 当给定圆弧起点、终点和半径之后,总共有4种选择,通过isMinorArc和isCCW两个参数再来决定是哪一种选择。 + * . . + * . . . . + * . .e . + * . . . . + * . . . . + * . . . . + * . . . . + * . .s . + * . . . . + * . . + * + * Create an arc by start end points and the radius. + * There will be 4 choices if the start end points and radius of the arc are determined, + * and the other two parameters isMinorArc and isCCW will determine which one. + * @param startPoint + * 圆弧的起点。 + * + * The startPoint point of the 2D arc. + * @param endPoint + * 圆弧的终点。 + * + * The end point of the 2D arc. + * @param radius + * 圆弧半径。 + * 如果半径小于起点和终点之间距离的一半,则取这个距离的一半。也就是圆弧会是经过起点和终点的一个半圆弧。 + * + * The radius of the 2d arc. + * If radius is smaller than the half distance from startPoint to endPoint, it will return a semicircle arc whose diameter is the distance. + * @param isMinorArc + * 当值为true时,表示的是起点和终点之间小的那两段圆弧其中之一。当值为false时,表示的是起点和终点之间大的那两段圆弧其中之一。 + * + * true: minor arc; false: major arc + * @param isCCW + * 圆弧是否是逆时针方向。 + * 如果圆弧是逆时针方向,则表示圆弧是圆上从起点开始沿逆时针方向到达终点的那一段圆,反之则表示圆上另外一侧的一段。 + * + * Whether the 2d arc is counter clockwise from startPoint to endPoint. + * True means the counter clockwise segment of the circle from startPoint to endPoint. + * False means the clockwise segment of the circle from startPoint to endPoint. + * @returns + * 圆弧。 + * + * The 2d arc. + */ + createArc2dByTwoPointsAndRadius(startPoint: KPoint2d, endPoint: KPoint2d, radius: number, isMinorArc: boolean, isCCW: boolean): KArc2d; + /** + * 通过三个点创建一个圆弧。 + * Create an arc by input three points. + * @param startPoint + * 圆弧的起点。 + * + * The start point of the 3D arc. + * @param midPoint + * 圆弧的中点。 + * + * The middle point of the 3D arc. + * @param endPoint + * 圆弧的末点。 + * + * The end point of the 3D arc. + * @returns + * 返回一个圆弧或者null,当三点共线时就是null。 + * + * The 3D arc or null (if the three points are colinear). + */ + createArc3dByThreePoints(startPoint: KPoint3d, midPoint: KPoint3d, endPoint: KPoint3d): KArc3d_2 | null; + /** + * 通过圆心和法向和半径和起点末点来创建圆弧。 + * 注意:这种方式创建的圆弧始终时围绕着法向逆时针的。 + * + * Create an arc by start and end points. + * NOTE: the created arc is always counter-clockwise around the normal. + * @param center + * 圆心。 + * + * The center point of the 3D arc. + * @param normal + * 法向。 + * + * The normal of the 3D arc. + * @param radius + * 圆弧半径。 + * + * The radius of the 3D arc. + * @param startPoint + * 圆弧的起点,需要注意,该点需要在圆弧上。 + * + * The startPoint point of the 3D arc. The caller need to make sure it's on the arc. + * @param endPoint + * 圆弧的末点,需要注意,该点需要在圆弧上。 + * + * The end point of the 3D arc. The caller need to make sure it's on the arc. + * @returns The 3D arc. + */ + createArc3dByCenterNormalRadius(center: KPoint3d, normal: KVector3d, radius: number, startPoint: KPoint3d, endPoint: KPoint3d): KArc3d_2; + /** + * 通过圆弧的圆心、X轴、Y轴、半径、起始角度和终止角度来创建一段圆弧。 + * + * Create an arc by center, x direction, y direction, radius, start angle and end angle. + * @param center + * 圆心。 + * + * The center point of the 3D arc. + * @param xDir + * 圆弧局部标架的X轴方向。 + * + * X direction of the arc's local coordinate system, must be normalized. + * @param yDir + * 圆弧局部标架的Y轴方向。 + * + * Y direction of the arc's local coordinate system, must be normalized. + * @param radius + * 圆弧半径。 + * + * The radius of the 3D arc. + * @param startAngle + * 圆弧的起始角度。 + * + * The start angle of the arc, will be clamped to [0, 2PI). + * @param endAngle + * 圆弧的终止角度。 + * + * The end angle of the arc, will be clamped to [0, 2PI). + * @returns The 3D arc. + */ + createArc3dByStartEndAngles(center: KPoint3d, xDir: KVector3d, yDir: KVector3d, radius: number, startAngle: number, endAngle: number): KArc3d_2; + /** + * 通过三点来创建一圆。 + * + * Create an circle by input three points. + * @param startPoint + * 圆上第一个点。 + * + * The start point of the 2D circle. + * @param midPoint + * 圆上第二个点。 + * + * The middle point of the 2D circle. + * @param endPoint + * 圆上第三个点。 + * + * The end point of the 2D circle. + * @returns + * 返回一个圆,也可能是null(当三点共线时)。 + * + * The 2D circle or null (if the three points are colinear). + */ + createCircle2dByThreePoints(startPoint: KPoint2d, midPoint: KPoint2d, endPoint: KPoint2d): KCircle2d | null; + /** + * 通过圆心和圆上一点创建一个二维空间的圆。 + * + * Create a 2d circle by the origin of the circle and a point on the circle. + * @param center + * 圆心。 + * + * The origin of the circle. + * @param pointOnCircle + * 圆上一点。 + * + * A point on the circle. + * @returns + * 返回一个圆,也可能是null(当两点重合时)。 + * + * The 2D circle or null if the two points overlap. + */ + createCircle2dByCenterAndPoint(center: KPoint2d, pointOnCircle: KPoint2d): KCircle2d | null; + /** + * 通过圆心和半径创建一个二维空间的圆。 + * + * Create a 2d circle by the origin and radius. + * @param center + * 圆心。 + * + * Origin of the circle. + * @param radius + * 半径。 + * + * Radius of the circle. + * @returns + * 返回一个圆。 + * + * The 2D circle. + */ + createCircle2dByCenterAndRadius(center: KPoint2d, radius: number): KCircle2d; + /** + * 通过三点来创建一圆。 + * + * Create an circle by input three points. + * @param startPoint + * 圆上第一个点。 + * + * The start point of the 3D circle. + * @param midPoint + * 圆上第二个点。 + * + * The middle point of the 3D circle. + * @param endPoint + * 圆上第三个点。 + * + * The end point of the 3D circle. + * @returns + * 返回一个圆,也可能是null(当三点共线时)。 + * + * The 3D circle or null (if the three points are colinear). + */ + createCircle3dByThreePoints(startPoint: KPoint3d, midPoint: KPoint3d, endPoint: KPoint3d): KCircle3d | null; + /** + * 通过圆心、半径和法向来创建圆。 + * 注意:创建的圆围绕着·法向时逆时针的。 + * + * Create an circle by center, normal, radius. + * NOTE: the created arc is always counter-clockwise around the normal. + * @param center + * 圆心。 + * + * The center point of the 3D circle. + * @param normal + * 法向。 + * + * The normal of the 3D circle. + * @param radius + * 半径。 + * + * The radius of the 3D circle. + * @param xDir + * 圆的X轴方向(可选参数)。 + * + * The X direction of the local coordinate system of the circle. + * @returns + * 圆。 + * + * The 3D circle. + */ + createCircle3dByCenterNormalRadius(center: KPoint3d, normal: KVector3d, radius: number, xDir?: KVector3d): KCircle3d; + /** + * 通过圆心、X轴方向、Y轴方向和半径来创建圆。 + * + * Create an circle by origin, direction of X axis, direction of Y axis and radius. + * @param center + * 圆心。 + * + * The origin of the 3D circle. + * @param xDir + * 圆的X轴方向。 + * + * The direction of the X axis of the circle. + * @param yDir + * 圆的Y轴方向。 + * + * The direction of the Y axis of the circle. + * @param radius + * 半径。 + * + * The radius of the 3D circle. + * @returns + * 圆。 + * + * The 3D circle. + */ + createCircle3dByLCSRadius(center: KPoint3d, xDir: KVector3d, yDir: KVector3d, radius: number): KCircle3d; + /** + * 通过给定阶数、节点向量、控制点以及权重构建一条非均匀有理样条曲线。 + * + * Create a nurbs curve by degree, knots, control points and weights. + * @param degree + * 阶数。 + * + * The degree of the 2d nurbs curve. + * @param knots + * 节点向量。 + * + * The knots of the 2d nurbs curve. + * @param controlPoints + * 控制顶点。 + * + * The control points of the 2d nurbs curve. + * @param weights + * 权重。 + * + * the weights of the 2d nurbs curve. + * @returns + * 二维非均匀有理样条曲线。 + * + * The 2D nurbs curve. + */ + createNurbsCurve2d(degree: number, knots: number[], controlPoints: KPoint2d[], weights: number[]): KNurbsCurve2d; + /** + * 通过三点创建一个平面。 + * 平面的原点时第一个点,平面的法向是p1到p2向量与p1到p3向量的叉乘,x轴是p1到p2向量的单位向量。 + * + * Create a plane from three points. + * The generated plane's origin is point1, the normal is the cross production + * of (point2 - point1) and (point3 - point1), the x axis is (point2 - point1).normalize(). + * @param point1 + * @param point2 + * @param point3 + * @returns + * 由三点构造的平面,若三点共线则范围null。 + * + * The plane constructed by the three points or null (if three points are colinear). + */ + createPlaneByThreePoints(point1: KPoint3d, point2: KPoint3d, point3: KPoint3d): KPlane | null; + /** + * 通过一个点和一个法向来创建平面。 + * + * Create a plane from a point and normal. + * @param point + * 平面的原点。 + * + * The origin point of the plane. + * @param normal + * 平面的法向。 + * + * The normal of the plane. + * @param xDirection + * 平面的x方向,该参数为可选参数,如给出了,则需要保证是不平行于法向。 + * + * Candidate x direction of the plane, if it's not null, the caller need to make sure it's not parallel to normal. + * @returns + * 三维平面。 + * + * The 3D plane. + */ + createPlaneByPointNormal(point: KPoint3d, normal: KVector3d, xDirection?: KVector3d): KPlane; + /** + * 通过轮廓线数组来创建二维环。 + * 需要保证轮廓线数组首尾相连。 + * + * Create a loop2d by bounded curves. + * The caller need to make sure the input curves are connected tail to head and closed. + * @param curves + */ + createGeomLoop2d(curves: KBoundedCurve2d_2[]): KGeomLoop2d; + /** + * 通过点集合来创建二维loop。loop将只含线段。 + * + * Create a loop2d by points, the result loop contains only line segments. + * @param points + * 环的顶点集合。 + * + * The vertex points of the loop. + */ + createGeomLoop2dByPoints(points: KPoint2d[]): KGeomLoop2d; + /** + * 通过内轮廓和外轮廓创建面。 + * 注意:需要保证内轮廓与外轮廓方向相反。 + * + * Create a face2d by contour and holes. + * NOTE: the caller need to make sure the contour and holes have opposite ccw direction + * @param contour + * 面的外轮廓。 + * + * The contour (outer loop) of the face + * @param holes + * 面的内轮廓。 + * + * The holes (inner loops) of the face. + */ + createGeomFace2d(contour: KGeomLoop2d, holes?: KGeomLoop2d[]): KGeomFace2d_2; + /** + * 在特定容差下,检查两曲线是否完全重合。 + * + * Get the totally overlap status of two curves with specified tolerance. + * @param curve1 + * 第一条曲线。 + * + * The first curve. + * @param curve2 + * 第二条曲线。 + * + * The second curve. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 若两条曲线完全重叠,则返回true。 + * + * Return true if two curves totally overlap, otherwise return false. + */ + areCurvesTotallyOverlap(curve1: KCurve3d, curve2: KCurve3d, tolerance?: number): boolean; + /** + * 在特定容差下,检查两曲线是否有重合部分(包括完全重合)。 + * + * Get the overlap status of two curves, include totally and partial overlap. + * @param curve1 + * 第一条曲线。 + * + * The first curve. + * @param curve2 + * 第二条曲线。 + * + * The second curve. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果两条曲线有重合部分,则返回true。 + * + * Return true if two curves overlap, otherwise return false. + */ + areCurvesOverlap(curve1: KCurve3d, curve2: KCurve3d, tolerance?: number): boolean; + /** + * 对两条曲线求交。 + * 如果两曲线完全重合,该方法返回的是空数组。 + * 所以areCurvesTotallyOverlap方法需要在使用该方法之前使用。 + * 对于部分重合的情况,结果是返回重叠的部分的两个端点。 + * + * Get the intersection of curve and curve. + * The method returns an empty array for two completely overlap curves, + * so the function "areCurvesTotallyOverlap" should be called before calling the interface to + * determine whether it is completely overlap or not. + * For two bounding curves, if there is a partial overlap, the return result is two endpoints of the overlap segment. + * @param curve1 + * 第一条曲线。 + * + * The first curve. + * @param curve2 + * 第二条曲线。 + * + * The second curve. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 返回是一个KCurvesIntersectRet数组,包含交点信息和重合信息。 + * + * The array of KCurvesIntersectRet include status of overlap, intersection point. + */ + curveIntersectCurve(curve1: KCurve3d, curve2: KCurve3d, tolerance?: number): KCurvesIntersectRet[]; + /** + * 曲线与曲面求交。 + * + * Get the intersection of a curve and a surface. + * @param curve + * 求交的曲线。 + * + * The curve to intersect. + * @param surface + * 求交的曲面。 + * + * The surface to intersect. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 返回是一个KCurveSurfaceIntersectRet数组,包含交点信息或者交线信息或重合信息。 + * + * The array of KCurveSurfaceIntersectRet include intersect type, intersection point or curve. + */ + curveIntersectSurface(curve: KCurve3d, surface: KSurface, tolerance?: number): KCurveSurfaceIntersectRet[]; + /** + * 两平面求交。 + * + * Get the intersection of two planes. + * @param plane1 + * 第一个平面。 + * + * The first plane. + * @param plane2 + * 第二个平面。 + * + * The second plane. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 返回一条直线,也有可能返回null(当两个平面不相交时)。 + * + * A line where the planes intersect if successful. Returns null if the planes do not intersect. + */ + planeIntersectPlane(plane1: KPlane, plane2: KPlane, tolerance?: number): KLine3d_2 | null; + /** + * 以特定容差检查一点是否在环中。 + * + * Check whether a point is in a loop or not with specified tolerance. + * @param point + * 要判断的点。 + * + * The point to compare with the loop. + * @param loop + * 由二维轮廓线集合组成的环,需要保证环的每一个的末点与下一个的起点时相同的,最后一个的末点与第一个的起点时相同的。 + * 还必须确保环没有自相交。 + * + * The loop composed by bounded curve2ds. + * The caller need to make sure each curve's end point is equal to + * next one's start point, and last curve's end point is equal to + * the first one's start point. + * The caller also need to make sure the loop is not self-intersected. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 返回KPtInLoopResult,包含点与环的位置关系信息。 + * + * The KPtInLoopResult include intersect type, etc. + */ + pointInLoop2D(point: KPoint2d, loop: KLoop2d, tolerance?: number): KPtInLoopResult; + /**以特定容差判断点是否在面中。 + * + * Check whether a point is in loops or not with specified tolerance. + * @param point + * 要判断的点。 + * + * The point to compare with the faceLoops. + * @param faceLoops + * 面是由环数组构成。由二维轮廓线集合组成的环,需要保证环的每一个的末点与下一个的起点时相同的,最后一个的末点与第一个的起点时相同的。 + * 还必须确保环没有自相交。 + * + * face's loops composed by bounded curve2ds, the first bounded curve array is outer loop and other is inner loop. + * The caller need to make sure each curve's end point is equal to + * next one's start point, and last curve's end point is equal to + * the first one's start point. + * The caller also need to make sure the bounded curve array is not self-intersected. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 返回KPtInLoopResult,包含点与环的位置关系信息。 + * + * The KPtInLoopResult include intersect type, etc. + */ + pointInFace2D(point: KPoint2d, faceLoops: KFace2d, tolerance?: number): KPtInLoopResult; + /** + * 判断环是否落在另一环内。 + * + * Check loop2d is inside of base loop2d. + * @param checkLoop + * 被判断的环。 + * + * The check loop2d. + * @param baseLoop + * 另一个环。 + * + * The base loop2d. + * @param bIncludeOn + * 结果是否包含两环有重叠区域的情况。 + * + * Result include check loop2d is overlap with base loop2d. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果位于环内则返回true。 + * + * Return true if inside, otherwise return false. + */ + loop2DInLoop2D(checkLoop: KLoop2d, baseLoop: KLoop2d, bIncludeOn?: boolean, tolerance?: number): boolean; + /** + * 以特定容差判断轮廓线是否落在另一环内。 + * + * Check if bounded curve is inside of base loop2d with specified tolerance. + * @param checkCurve + * 被判断的轮廓线。 + * + * The bounded curve to check. + * @param baseLoop + * 环。 + * + * The base loop2d. + * @param tolerance + * 特定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 返回CurveInLoopType,包含曲线与环的位置关系信息。 + * + * The KCurveInLoopType include intersect type. + */ + boundedCurve2dInLoop2D(checkCurve: KBoundedCurve2d_2, baseLoop: KLoop2d, tolerance?: number): KCurveInLoopType_2; + /** + * 对两组面进行布尔操作。 + * + * Calculate the boolean result between blank faces and tool faces. + * @param faces1 + * 第一组面。 + * + * the blank faces + * @param faces2 + * 第二组面。 + * + * the tool faces + * @param type + * 布尔操作类型。 + * + * the boolean type + * @returns + * 返回KFaceBooleanRet,包含布尔结果的面数组和布尔操作是否成功的状态。 + * + * The KFaceBooleanRet includes result faces and success status. + */ + faces2dBoolean(faces1: KFace2d[], faces2: KFace2d[], type: KFaceBooleanType_2): KFaceBooleanRet; + /** + * 创建一个由欧拉角定义的旋转变换矩阵。 + * + * Create a rotation matrix by the euler angles. + * @param euler + * 欧拉角和顺序 + * + * The euler angles and order + */ + createRotateMatrix4FromEuler(euler: KEuler): KMatrix4; + /** + * 创建一个由四元数定义的旋转变换矩阵。 + * + * Create a rotation matrix by the quaternion. + * @param q + * 四元数 + * + * The quaternion defining the rotations. + */ + createRotateMatrix4FromQuaternion(q: KQuaternion): KMatrix4; + /** + * 创建一个表示旋转变换的欧拉角对象。 + * + * Create an Euler object which represents a rotational transformation. + * @param x + * 绕x轴旋转角度 + * @param y + * 绕y轴旋转角度 + * @param z + * 绕z轴旋转角度 + * @param order + * 绕x,y,z轴旋转的顺序,包括XYZ,YZX, ZXY, XZY, YXZ, ZYX。 + * @returns + * The quaternion defining the rotations. + */ + createEuler(x?: number, y?: number, z?: number, order?: KEulerOrder): KEuler; + /** + * 创建一个表示旋转变换的四元数对象。 + * + * Create a quaternion which represents a rotational transformation. + * @param x + * 四元数的x分量 + * @param y + * 四元数的y分量 + * @param z + * 四元数的z分量 + * @param w + * 四元数的w分量 + * @returns + * The quaternion defining the rotations. + */ + createQuaternion(x?: number, y?: number, z?: number, w?: number): KQuaternion; + /** + * 不同于KQuaternion的slerp函数,这个函数直接基于展平的数组做球面线性插值。 + * + * 这里我们没有像Math2的Quaternion.slerpFlat函数那样把destination array当作参数传入,让slerp结果直接写到 + * destination array当中,这是因为如果经过了quickjs虚拟机,那样写入并不能同时改变插件侧的数组对象,修改的 + * 仅仅是math-apaas-impl所在的应用程序侧的数组对象。反过来应用程序“传递”给插件的数组对象,插件可以修改成功, + * 但是再传回应用程序时,则还是那个没有被改动过的应用程序侧的数组对象。quickjs不能监听对数组的修改去同步两边对应 + * 的数组数据。 + * + * Do a slerp operates directly on flat arrays of numbers. + * @param q1 The array representation of the first quaternion. + * @param offset1 The offset index in the array where the first quanternion starts. + * @param q2 The array representation of the second quaternion. + * @param offset2 The offset index in the array where the second quanternion starts. + * @param t Normalized interpolation factor (between 0 and 1). + * @returns The array representation of the result quaternion. + */ + slerpFlatQuaternion(q1: number[], offset1: number, q2: number[], offset2: number, t: number): number[]; + /** + * 根据起点和终点创建一个区间。 + * + * Create an interval by start and end points. + */ + createInterval(start: number, end: number): KInterval; + /** + * 创建一个默认的非法区间。 + * + * Create a default invalid interval. + */ + createInvalidInterval(): KInterval; + /** + * 创建一个包含输入数值的最小区间。 + * + * Create an union interval from the input values. + * @param values + * 用于创建区间的数值。 + * + * The values has to be contained by the interval. + * @param numTol + * 用于比较数值大小的容差。 + * + * A tolerance for number comparison. + * @returns + * 一个区间。 + * + * An interval contains all the values. + */ + createIntervalFromValues(values: number[], numTol: number): KInterval; + /** + * 对一组区间中重叠的区间进行合并简化。合并简化后的区间序列和原始区间序列覆盖相同的区域。 + * + * Simplify the intervals by uniting the intersected intervals. + */ + uniteIntervals(intervals: KInterval[]): KInterval[]; + /** + * 求出两组区间的所有重叠部分。 + * + * Get the common parts of the two groups of interval. + */ + intersectIntervals(intervals1: KInterval[], intervals2: KInterval[]): KInterval[]; + /** + * + */ + offsetPath2dWithDistances(path: KBoundedCurve2d_2[], deltas: number[], disTol?: number, cosTol?: number): KPath2dOffsetRet; +} +/** + * 二维环的接口类。 + * + * The interface of a geometry loop 2d. + */ +declare interface KGeomLoop2d { + /** + * 获得二维环的所有轮廓线数组。 + * + * The curves of a loop2d. + */ + getCurves(): KBoundedCurve2d_2[]; + /** + * 获得二维环的面积。 + * + * The area of the loop2d + */ + area(): number; + /** + * 获得二维环的质心。 + * + * The centroid of the loop2d + */ + centroid(): KPoint2d; + /** + * 判断该二维环是否为逆时针。 + * + * Whether the loop is counter-clockwise + */ + isCCW(): boolean; + /** + * 检查该二维环是否有效:是否自相交, + * 是否封闭,轮廓线是否一个一个首尾向量。 + * Whether the loop is valid: + * - no self-intersection, + * - closed, + * - connected one by one and tail to head. + */ + isValid(): boolean; + /** + * 该环是否自相交。 + * + * Whether the loop is self-intersect. + */ + isSelfIntersect(): boolean; + /** + * 检查传入点是否在二维环中。 + * + * Check point is inside of geometry loop2d. + * @param point + * 被判断点。 + * + * The check point + * @param bIncludeOn + * 二维环的边界是否也被考虑。 + * + * Whether returns true if the input point is on loop's boundary + */ + containsPoint(point: KPoint2d, bIncludeOn?: boolean): boolean; +} +declare interface KInterval { + /** + * 获取区间的起点。 + * + * Get start of the interval. + */ + readonly start: number; + /** + * 获取区间的终点。 + * + * Get end of the interval. + */ + readonly end: number; + /** + * 获取区间的中点。 + * + * Get middle of the interval. + */ + readonly middle: number; + /** + * 获取区间的长度。 + * + * Get length of the interval. + */ + readonly length: number; + /** + * 判断当前区间和另外一个区间是否相等。 + * + * Returns true if this interval equals to another within specified tolerance. + * @param other + * 另一个区间。 + * + * The other interval. + * @param numTol + * 用于判断两个区间的起点和终点是否相等的容差。如果不提供,则使用全局容差。 + * + * The tolerance used to check whether the starts and ends of two intervals are equal. + * @returns + * 如果两个区间的起点和终点在容差范围内,则返回真,否则为假。 + * + * True, if the starts and ends of two intervals are equal within tolerance. Otherwise, false. + */ + isEqual(other: KInterval, numTol?: number): boolean; + /** + * 克隆当前区间,返回一个新对象。 + * + * Return the cloned object. + */ + clone(): KInterval; + /** + * 把当前区间转成字符串。 + * + * Convert the interval to string format. + */ + toString(): String; + /** + * 判断当前区间是否合法。 + * + * Check whether the interval is valid. + */ + isValid(): boolean; + /** + * 构建一个新的区间,起点和终点分别是当前区间的起点和终点加上输入数值。 + * + * Create a new interval which is offset by the given number. + * @param num + * 起点和终点需要偏移的数值。 + * + * The offset value to be added to start and end. + * @returns + * 一个新的区间。 + * + * A new interval object. + */ + offset(num: number): KInterval; + /** + * 构建一个新的区间,起点和终点分别是当前区间起点和终点向外扩张给定距离。 + * + * Create a new interval whose start and end are expended by the given number. + * @param length + * 扩张距离。 + * + * The expand distance. + * @returns + * 一个新区间。 + * + * A new interval. + */ + expanded(length: number): KInterval; + /** + * 构建一个新区间,起点和终点是当前区间的起点和终点乘上一个数。 + * + * Create a new interval whose start and end are multiplied the given number. + * @param num + * 乘数 + * + * The multiply number. + * @returns + * 一个新区间。 + * + * A new interval. + */ + multiplied(num: number): KInterval; + /** + * 根据插值系数求得区间起点和终点之间的插值结果。 + * + * Get the interpolated value by the input coefficient. + * @param alpha + * 插值系数。 + * + * The interplate coefficient. + * @returns + * 区间插值结果。 + * + * Interplation result. + */ + interpolate(alpha: number): number; + /** + * 判断当前区间是否包含某个数值。 + * + * Check whether the interval contains a value. + * @param point + * 要检查的数值。 + * + * The value to check. + * @param includeEnds + * 是否把当前区间当作是闭区间。 + * + * Whether take the interval as closed. + * @param disTol + * 用于判断包含关系的容差。如果没有给定则采用全局距离容差。 + * + * The tolerance used to check the value is containded by the interval. + * If it is not provided, global distance tolerance will be used. + * @returns + * 如果区间包含输入值,则返回真,否则为假。 + * + * True, if the interval contains the value, otherwise false. + */ + contains(point: number, includeEnds: boolean, disTol?: number): boolean; + /** + * 判断当前区间是否包含另外一个区间。 + * + * Check whether the current interval contains the other interval. + * @param interval + * 是否被当前区间包含的另一个区间。 + * + * The other interval to be checked. + * @param includeEnds + * 是否把两个区间当作是闭区间。 + * + * Whether take the two intervals as closed. + * @param disTol + * 用于判断包含关系的容差。如果没有给定则采用全局距离容差。 + * + * The tolerance used to check the value is containded by the interval. + * If it is not provided, global distance tolerance will be used. + * @returns + * 如果当前区间包含输入的区间,则返回真,否则为假。 + * + * True, if current interval contains the other interval, otherwise false. + */ + containsInterval(interval: KInterval, includeEnds: boolean, disTol?: number): boolean; + /** + * 判断当前区间是否和另外一个区间相交。 + * + * Check whther the current interval intersects with the other interval. + * @param includeEnds + * 是否把两个区间当作是闭区间。 + * + * Whether take the two intervals as closed. + * @param disTol + * 用于判断相交关系的容差。如果没有给定则采用全局距离容差。 + * + * The tolerance used to check the two intervals are intersected. + * If it is not provided, global distance tolerance will be used. + */ + intersects(interval: KInterval, includeEnds: boolean, disTol?: number): boolean; + /** + * 求当前区间和另外一个区间的相交部分,返回相交部分的区间。如果两个区间不相交,则返回一个不合法区间。 + * + * Get the intersected part between current interval and the other interval. + * If two intervals are not intersected, then return an invalid interval. + * @param interval + * 另外一个区间。 + * + * The other interval. + * @returns + * 两个区间的相交部分。如果两个区间不相交,则返回一个不合法区间。 + * + * A new interval for the intersected parts of the two intervals. + * If two intervals are not intersected, then return an invalid interval. + */ + intersection(interval: KInterval): KInterval; + /** + * 合并当前区间和另外一个区间,返回叠加在一起后的区间。如果两个区间不相交,则返回一个不合法区间。 + * + * Combine the current interval and the other interval, return a new interval. + * If two intervals are not intersected, then return an invalid interval. + * @param interval + * 另外一个区间。 + * + * The other interval. + * @returns + * 合并后的区间。如果两个区间不相交,则返回一个不合法区间。 + * + * A new interval which has combined the two intervals. + * If two intervals are not intersected, then return an invalid interval. + */ + union(interval: KInterval): KInterval; +} +/** + * KLine2d类代表二维空间的一条直线。 + * 我们用一个点加一个向量来确定一条直。 + * + * The KLine2d class represents a line in 2d space. + */ +declare interface KLine2d extends KCurve2d { + /** + * 获得直线的原点。 + * + * Get line's origin point + */ + readonly origin: KPoint2d; + /** + * 获得直线的方向。 + * + * Get line's direction. + */ + readonly direction: KVector2d; + /** + * 获得直线的左侧方向。 + * + * Get Line2d's left direction (perpendicular vector pointing to the left side). + */ + readonly leftDirection: KVector2d; + /** + * 获得直线的右侧方向。 + * + * Get Line2d's right direction (perpendicular vector pointing to the right side). + */ + readonly rightDirection: KVector2d; + /** + * 检查一个点相对当前这条二维直线的位置。如果在曲线左侧,则返回1。如果在曲线上,则返回0。如果在曲线右侧,则返回-1。 + * + * Check the position of the point against the current 2d line. + * Return 1, if the point is on the left side. Return 0, if the point is on the line. Return -1, if the point is one the right side. + * @param point + * 待检查的点。 + * + * Point to check. + * @param tol + * 距离容差。如果没有给定,则采用全局容差。 + * + * distance tolerance. If it is not provided, then global tolerance is used. + * @returns + * 如果在曲线左侧,则返回1。如果在曲线上,则返回0。如果在曲线右侧,则返回-1。 + * + * Return 1, if the point is on the left side. Return 0, if the point is on the line. Return -1, if the point is one the right side. + */ + side(point: KPoint2d, tol?: number): 1 | 0 | -1; + /** + * 检查一个点是不是在直线的左侧。 + * + * Check whether a point is on the left side of the line. + * @param point + * 待检查的点。 + * + * Point to check. + * @param tol + * 距离容差。如果没有给定,则采用全局容差。 + * + * distance tolerance. If it is not provided, then global tolerance is used. + * @returns + * 如果点在直线左侧则返回真,否则为假。 + * + * True, if the point is on the left side of the line, otherwise false. + */ + onLeftSide(point: KPoint2d, tol?: number): boolean; + /** + * 检查一个点是不是在直线的右侧。 + * + * Check whether a point is on the right side of the line. + * @param point + * 待检查的点。 + * + * Point to check. + * @param tol + * 距离容差。如果没有给定,则采用全局容差。 + * + * distance tolerance. If it is not provided, then global tolerance is used. + * @returns + * 如果点在直线右侧则返回真,否则为假。 + * + * True, if the point is on the right side of the line, otherwise false. + */ + onRightSide(point: KPoint2d, tol?: number): boolean; +} +/** + * KLine3d类代表三维空间的一条直线。 + * 我们用一个点加一个向量来确定一条直。 + * + * The KLine3d class represents a line in 3d space. + */ +declare interface KLine3d_2 extends KCurve3d { + /** + * 获得直线的原点。 + * + * Get line's origin point + */ + readonly origin: KPoint3d; + /** + * 获得直线的方向。 + * + * Get line's direction. + */ + readonly direction: KVector3d; +} +/** + * KLineSegment2d类代表二维空间的一个线段。 + * + * The KLineSegment2d class represents a line segment in 2d space. + */ +declare interface KLineSegment2d extends KBoundedCurve2d_2 { + /** + * 获得线段的中点。 + * + * Get line segment's middle point. + */ + readonly middlePoint: KPoint2d; + /** + * 获得线段的方向。 + * + * Get line segment's direction. + */ + readonly direction: KVector2d; +} +/** + * KLineSegment3d类代表三维空间的一个线段。 + * + * The KLineSegment3d class represents a line segment in 3d space. + */ +declare interface KLineSegment3d_2 extends KBoundedCurve3d_2 { + /** + * 获得线段的中点。 + * + * Get line segment's middle point. + */ + readonly middlePoint: KPoint3d; + /** + * 获得线段的方向。 + * + * Get line segment's direction. + */ + readonly direction: KVector3d; +} +/** + * KLoop2d代表二维环。 + * + * The KLoop2d represents a 2d loop. + */ +declare interface KLoop2d { + /** + * 二维环。 + * 注意:环的每一条轮廓线必须是首尾相连。 + * + * The 2d uv loop. + * NOTE: The caller need to make sure the edges of the loop are connected tail to head. + */ + loop: KBoundedCurve2d_2[]; +} +/** + * KLoop3d代表三维环。 + * + * The KLoop3d represents a 3d loop. + */ +declare interface KLoop3d { + /** + * 三维环。 + * 注意:环的每一条轮廓线必须是首尾相连。 + * + * The 3d loop. + * NOTE: The caller needs to make sure the edges of the loop are connected tail to head. + */ + loop: KBoundedCurve3d_2[]; +} +/** + * KMatrix3表示一个三行三列矩阵。 + * + * The KMatrix3 class represents a 3x3 matrix. + */ +declare interface KMatrix3 { + /** + * 将当前矩阵进行求逆。 + * 如果throwOnDegenerate未设置且矩阵不可逆,则当前矩阵变成三位三列单位矩阵,并且抛出异常。 + * + * Inverse this matrix. + * If throwOnDegenerate is not set and the matrix is not invertible, set this to the 3x3 identity matrix and an exception will be threw. + * @param throwOnDegenerate + * 默认值是true。 + * + * The default value is true. + * @returns + */ + inverse(throwOnDegenerate?: boolean): void; + /** + * 将当前矩阵进行求逆。 + * 如果throwOnDegenerate未设置且矩阵不可逆,则返回三位三列单位矩阵,并且抛出异常。 + * + * Inverse this matrix. + * If throwOnDegenerate is not set and the matrix is not invertible, set this to the 3x3 identity matrix and an exception will be threw. + * @param throwOnDegenerate + * 默认值是true。 + * + * The default value is true. + * @returns + * 逆矩阵。 + * + * a new inversed matrix + */ + inversed(throwOnDegenerate?: boolean): KMatrix3; + /** + * 对当前矩阵右乘一矩阵。 + * + * Post-multiplies this matrix by the input matrix. + * @param matrix + * 传入的用于右乘矩阵。 + * + * the input matrix. + * @returns + */ + multiply(matrix: KMatrix3): void; + /** + * 对当前矩阵右乘一矩阵并得到新矩阵。 + * + * Return a new matrix for post-multiplying this matrix by the input matrix. + * @param matrix + * 传入的用于右乘矩阵。 + * + * the input matrix. + * @returns + * 一个新的矩阵。 + * + * a new multiplied matrix. + */ + multiplied(matrix: KMatrix3): KMatrix3; + /** + * 复制一个当前矩阵。 + * + * Return the cloned matrix of this. + * @returns + * 复制的矩阵。 + * + * The cloned matrix. + */ + clone(): KMatrix3; + /** + * 检查两个矩阵在特定容差下是否相等。 + * + * Check whether two matrices are equal with specified tolerances. + * @param other + * 被比较的矩阵。 + * + * The matrix to compare this matrix with. + * @returns + * 如果相等则返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KMatrix3): boolean; +} +/** + * KMatrix4表示一个四行四列矩阵。 + * + * The KMatrix4 class represents a 4x4 matrix. + */ +declare interface KMatrix4 { + /** + * 将当前矩阵进行求逆。 + * 如果throwOnDegenerate未设置且矩阵不可逆,则当前矩阵变成三位三列单位矩阵,并且抛出异常。 + * + * Inverse this matrix. + * If throwOnDegenerate is not set and the matrix is not invertible, set this to the 3x3 identity matrix and an exception will be threw. + * @param throwOnDegenerate + * 默认值是true。 + * + * The default value is true. + * @returns + */ + inverse(throwOnDegenerate?: boolean): void; + /** + * 将当前矩阵进行求逆。 + * 如果throwOnDegenerate未设置且矩阵不可逆,则返回三位三列单位矩阵,并且抛出异常。 + * + * Inverse this matrix. + * If throwOnDegenerate is not set and the matrix is not invertible, set this to the 3x3 identity matrix and an exception will be threw. + * @param throwOnDegenerate + * 默认值是true。 + * + * The default value is true. + * @returns + * 逆矩阵。 + * + * a new inversed matrix + */ + inversed(throwOnDegenerate?: boolean): KMatrix4; + /** + * 对当前矩阵右乘一矩阵。 + * + * Post-multiplies this matrix by the input matrix. + * @param matrix + * 传入的用于右乘矩阵。 + * + * the input matrix. + * @returns + */ + multiply(matrix: KMatrix4): void; + /** + * 对当前矩阵右乘一矩阵并得到新矩阵。 + * + * Return a new matrix for post-multiplying this matrix by the input matrix. + * @param matrix + * 传入的用于右乘矩阵。 + * + * the input matrix. + * @returns + * 一个新的矩阵。 + * + * a new multiplied matrix. + */ + multiplied(matrix: KMatrix4): KMatrix4; + /** + * 复制一个当前矩阵。 + * + * Return the cloned matrix of this. + * @returns + * 复制的矩阵。 + * + * The cloned matrix. + */ + clone(): KMatrix4; + /** + * 检查两个矩阵在特定容差下是否相等。 + * + * Check whether two matrices are equal with specified tolerances. + * @param other + * 被比较的矩阵。 + * + * The matrix to compare this matrix with. + * @param tolerance + * 指定容差,默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果相等则返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KMatrix4, tolerance?: number): boolean; +} +/** + * KNurbsCurve2d 类代表着二维空间中的一条非均匀有理样条曲线 + * + * The KNurbsCurve2d class represents a nurbs curve in 2d space + */ +declare interface KNurbsCurve2d extends KBoundedCurve2d_2 { + /** + * 获取当前样条曲线的阶数。 + * + * Get the degree of the nurbs curve. + */ + readonly degree: number; + /** + * 获取当前样条曲线的节点向量。 + * + * Get the knots of the nurbs curve. + */ + readonly knots: number[]; + /** + * 获取当前样条曲线的控制点集 + * + * Get the control points of the nurbs curve + */ + readonly controlPoints: KPoint2d[]; + /** + * 获取当前样条曲线的权重 + * + * Get the weights of the nurbs curve + */ + readonly weights: number[]; + /** + * 获得样条曲线上一点处的切向量。 + * 注意:该函数调用需要确保传入点在样条曲线上。 + * + * Get tangent vector of a point on the nurbs curve. + * NOTE: the caller needs to make sure the point is on the nurbs curve. + * @param point + * 样条曲线上一点。 + * + * A point on the nurbs curve. + * @returns + * 切向量。 + * + * The tangent vector. + */ + getTangent(point: KPoint2d): KVector2d; +} +/** + * + * Represent the result of path 2d offset. + */ +declare interface KPath2dOffsetRet { + /** + * The result paths after offsetting. + */ + resultPaths: KBoundedCurve2d_2[][]; + /** + * The original curve - new curves mapping + */ + originalCurves: KBoundedCurve2d_2[]; + offsetCurves: KBoundedCurve2d_2[][]; + /** + * The newly created curves to connect offset curves after offsetting. + * For example, we offset arc DEA to right, the arc will become small, we create DG and FA to + * make sure all edges are connected. + * + * B-------------------- .A + * | . + * | E : + * | . + * C-------------------- .D + * + * B-------------------------A + * | |F + * | E : + * | | G + * C----------------------- .D + * + */ + newCurves: KBoundedCurve2d_2[]; +} +/** + * KPlane类代表三维空间中的一个平面。 + * + * The KPlane class represents a plane in 3d space. + */ +declare interface KPlane extends KSurface { + /** + * 获取平面的法向量。 + * + * Get plane's normal. + */ + readonly normal: KVector3d; +} +/** + * KPoint2d类代表一个二维点。 + * 二维点有二个坐标。 + * 二维点的坐标是不可变的。 + * + * The KPoint2d class represents a 2D point. + * A 2D point is an ordered triplet of numbers (labeled x, y). + * NOTE: KPoint2d's x, y are immutable. + */ +declare interface KPoint2d { + /** + * 获得x坐标。 + * + * Get point's x value. + */ + readonly x: number; + /** + * 获得y坐标。 + * + * Get point's y value. + */ + readonly y: number; + /** + * 检查两个点在特定容差下是否相等。 + * + * Check whether two points are equal with specified tolerance. + * @param other + * 需要比较的点。 + * + * The point to compare this point with. + * @param tolerance + * 指定容差,默认值为1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果相等则返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KPoint2d, tolerance?: number): boolean; + /** + * 对当前点应用一向量,实现对点的平移。 + * + * Return a new KPoint3d which is this point add the input vector. + * @param vector + * 要平移的向量。 + * + * The vector to add. + * @returns + * 新的点。 + * + * The new point. + */ + added(vec: KVector2d): KPoint2d; + /** + * 获得由目标点指向当前点的向量。 + * + * Return a new KVector3d which is this point subtract another point. + * @param point + * 要减的点。 + * + * The point to subtract. + * @returns + * 新的向量。 + * + * The new vector. + */ + subtracted(point: KPoint2d): KVector2d; + /** + * 求当前点到另一个点的距离。 + * + * Get the distance to another point. + * @param other + * 另外一个点。 + * + * The other point. + * @returns + * 两点之间距离。 + * + * The distance between the two points. + */ + distanceTo(other: KPoint2d): number; + /** + * 求当前点到另一个点的平方距离。 + * + * Get the distance to another point. + * @param other + * 另外一个点。 + * + * The other point. + * @returns + * 两点之间平方距离。 + * + * The square distance between the two points. + */ + squaredDistanceTo(other: KPoint2d): number; + /** + * 复制一个当前点。 + * + * Return the cloned point of this. + * @returns + * 复制点。 + * + * The cloned point. + */ + clone(): KPoint2d; + /** + * 通过一个矩阵对当前点进行变换,获得一新点。 + * + * Return a new KPoint3d which is the result of this point transformed by the input matrix. + * @param matrix + * 传入变换矩阵。 + * + * the input transform matrix. + * @returns + * 新点。 + * + * The new point. + */ + appliedMatrix3(matrix: KMatrix3): KPoint2d; +} +/** + * KPoint3d类代表一个三维点。 + * 三维点有三个坐标。 + * 三维点的坐标是不可变的。 + * + * The KPoint3d class represents a 3D point. + * A 3D point is an ordered triplet of numbers (labeled x, y, and z). + * NOTE: KPoint3d's x, y and z are immutable. + */ +declare interface KPoint3d { + /** + * 获得x坐标。 + * + * Get point's x value. + */ + readonly x: number; + /** + * 获得y坐标。 + * + * Get point's y value. + */ + readonly y: number; + /** + * 获得z坐标。 + * + * Get point's z value. + */ + readonly z: number; + /** + * 检查两个点在特定容差下是否相等。 + * + * Check whether two points are equal with specified tolerance. + * @param other + * 需要比较的点。 + * + * The point to compare this point with. + * @param tolerance + * 指定容差,默认值为1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果相等则返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KPoint3d, tolerance?: number): boolean; + /** + * 对当前点应用一向量,实现对点的平移。 + * + * Return a new KPoint3d which is this point add the input vector. + * @param vector + * 要平移的向量。 + * + * The vector to add. + * @returns + * 新的点。 + * + * The new point. + */ + added(vector: KVector3d): KPoint3d; + /** + * 获得由目标点指向当前点的向量。 + * + * Return a new KVector3d which is this point subtract another point. + * @param point + * 要减的点。 + * + * The point to subtract. + * @returns + * 新的向量。 + * + * The new vector. + */ + subtracted(point: KPoint3d): KVector3d; + /** + * 求当前点到另一个点的距离。 + * + * Get the distance to another point. + * @param other + * 另外一个点。 + * + * The other point. + * @returns + * 两点之间距离。 + * + * The distance between the two points. + */ + distanceTo(other: KPoint3d): number; + /** + * 求当前点到另一个点的平方距离。 + * + * Get the distance to another point. + * @param other + * 另外一个点。 + * + * The other point. + * @returns + * 两点之间平方距离。 + * + * The square distance between the two points. + */ + squaredDistanceTo(other: KPoint3d): number; + /** + * 复制一个当前点。 + * + * Return the cloned point of this. + * @returns + * 复制点。 + * + * The cloned point. + */ + clone(): KPoint3d; + /** + * 通过一个矩阵对当前点进行变换,获得一新点。 + * + * Return a new KPoint3d which is the result of this point transformed by the input matrix. + * @param matrix + * 传入变换矩阵。 + * + * the input transform matrix. + * @returns + * 新点。 + * + * The new point. + */ + appliedMatrix4(matrix: KMatrix4): KPoint3d; +} +/** + * KPolylineCurve2d 类代表着二维空间中的一个折线段。 + * + * The KPolylineCurve2d class represents a polyline in 2d space. + */ +declare interface KPolylineCurve2d extends KBoundedCurve2d_2 { + /** + * 获取当前折线段的所有顶点。 + * + * Get all the vertices of the polyline. + */ + readonly points: KPoint2d[]; + /** + * 获取当前折线段每个顶点的弧长参数。 + * + * Get arc length parameters of all the vertices of the polyline. + */ + readonly params: number[]; + /** + * 获得折线段上一点处的切向量。 + * 注意:该函数调用需要确保传入点在折线段上。 + * + * Get tangent vector of a point on the polyline. + * NOTE: the caller needs to make sure the point is on the polyline. + * @param point + * 折线段上一点。 + * + * A point on the polyline. + * @returns + * 切向量。 + * + * The tangent vector. + */ + getTangent(point: KPoint2d): KVector2d; +} +/** + * 点与环的位置关系计算结果。 + * + * Point and loop position relation check result. + */ +declare interface KPtInLoopResult { + /** + * 点与环的位置关系。 + * + * Point and loop position relation type. + */ + ptInLoopType: KPtInLoopType_2; + /** + * 如果ptInLoopType的类型是onedge,那么点在环上所在的曲线, + * 否则该属性为未定义。 + * + * If ptInLoopType is equal to ptInLoopType.OnEdge, + * the curve is that the point is on, otherwise undefined. + */ + curve?: KBoundedCurve2d_2; +} +/** + * 点与环的位置关系类型。 + * + * Point and loop position relation type. + */ +declare enum KPtInLoopType_2 { + /** + * 点在环中。 + * + * The point is inside the loop. + */ + Inside = 1, + /** + * 点在环外。 + * + * The point is outside the loop. + */ + Outside = 0, + /** + * 点在环的边上。 + * + * The point is on the edge of loop + */ + OnEdge = -1, + /** + * 点在环的端点上。 + * + * The point is on the vertex of loop + */ + OnVertex = -2 +} +/** + * 四元数(quaternion)是用来表示旋转变换的一种形式,它可以避免欧拉角的万向节死锁问题。 + * + * An interface representing quaternion. + * Quaternion is used for rotating models without encountering the dreaded gimbal lock issue, amongst other advantages. + */ +declare interface KQuaternion { + /** + * 四元数的x虚部。 + * + * The quaternion's x value. + */ + readonly x: number; + /** + * 四元数的y虚部。 + * + * The quaternion's y value. + */ + readonly y: number; + /** + * 四元数的z虚部。 + * + * The quaternion's z value. + */ + readonly z: number; + /** + * 四元数的w实部。 + * + * The quaternion's w value. + */ + readonly w: number; + /** + * 设置四元数的虚部和实部。 + * + * Set quaternion's x, y, z and w + * @param x + * @param y + * @param z + * @param w + */ + set(x: number, y: number, z: number, w: number): void; + /** + * 克隆自己,返回一个新的四元数对象。 + * + * Get the cloned object of this quaternion. + */ + clone(): KQuaternion; + /** + * 从另外一个四元数对象复制数据,覆盖自己的数据成员。 + * + * Copy values from another quaternion. + * @param quaternion + */ + copyFrom(quaternion: KQuaternion): void; + /** + * 把一个欧拉角转化成四元数形式,并设置到自己的数据成员。 + * + * Set values by an input euler object. + * @param euler + */ + setFromEuler(euler: KEuler): void; + /** + * 从绕某个给定轴旋转给定角度的表示形式转换成四元数的表示形式,并设置到自己的数据成员。 + * + * Sets this quaternion from rotation specified by axis and angle. + * NOTE: the axis will be normalized. + * @param axis + * @param angle + */ + setFromAxisAngle(axis: KVector3d, angle: number): void; + /** + * 获取旋转轴。如果旋转角度是零的话,返回一个各分量为零的旋转轴。 + * + * @return The axis of rotation (normalized); return a zero vector if angle of rotation is zero; + */ + getAxis(): KVector3d; + /** + * 获取已弧度为单位的旋转角度。 + * + * @return Angle of rotation about the axis, in radius + */ + getAngle(): number; + /** + * 从一个变换矩阵提取旋转变换,转换成四元数形式,并设置到自己的数据成员。 + * + * Sets this quaternion from rotation component of the input matrix. + * @param m + */ + setFromRotationMatrix(m: KMatrix4): void; + /** + * 从一个向量到另外一个向量的旋转变化形式,转化成四元数表示形式,并设置到自己的数据成员。 + * + * Sets this quaternion to the rotation required to rotate direction vector vFrom to direction vector vTo. + * @param vFrom + * @param vTo + */ + setFromUnitVectors(vFrom: KVector3d, vTo: KVector3d): void; + /** + * 把自己变成自己的逆变换。 + * + * Reverse this quaternion. + */ + reverse(): void; + /** + * 把自己变成自己的共轭形式。 + * 共轭形式是指绕旋转轴转动相反角度。 + * + * Returns the rotational conjugate of this quaternion. + * The conjugate of a quaternion represents the same rotation + * in the opposite direction about the rotational axis. + */ + conjugate(): void; + /** + * 求取和另外一个四元数的点积。 + * + * Calculates the dot product of quaternions v and this one + * @param v + */ + dot(v: KQuaternion): number; + /** + * 求取各元素的平方和。 + * + * Computes the Euclidean length (straight-line length) of this quaternion, + * considered as a 4 dimensional vector. This can be useful if you are comparing + * the lengths of two quaternions, as this is a slightly more efficient + * calculation than length(). + */ + lengthSq(): number; + /** + * 求取这个四元数当成一个四维向量,求取它的欧几里得长度。 + * + * Computes the Euclidean length (straight-line length) of this quaternion, + * considered as a 4 dimensional vector. + */ + length(): number; + /** + * 归一化这个四元数。 + * 归一化后它仍旧表示相同的旋转变换,只是长度变为1。 + * + * Normalizes this quaternion - that is, calculated the quaternion + * that performs the same rotation as this one, but has length equal to 1. + */ + normalize(): void; + /** + * 右乘一个四元数。 + * + * Multiplies this quaternion by q. + * @param q + */ + multiply(q: KQuaternion): void; + /** + * 左乘一个四元数。 + * + * Pre-multiplies this quaternion by q. + * @param q + */ + premultiply(q: KQuaternion): void; + /** + * 把两个四元数的乘机结果赋值给自己。 + * + * Sets this quaternion to a x b. + * @param a + * @param b + */ + multiplyQuaternions(a: KQuaternion, b: KQuaternion): void; + /** + * 和另外一个四元数做球面线性插值。 + * + * Handles the spherical linear interpolation between quaternions. + * t represents the amount of rotation between this quaternion (where t is 0) + * and qb (where t is 1). + * This quaternion is set to the result. + * @param qb + * @param t + */ + slerp(qb: KQuaternion, t: number): void; + /** + * Decompose the rotation on to 2 parts + * http://www.euclideanspace.com/maths/geometry/rotations/for/decomposition/index.htm + * twist = rotation around the direction vector + * swing = rotation around axis that is perpendicular to direction vector + * rotate = swing * twist + */ + swingTwistDecomposition(direction: KVector3d, twist: KQuaternion, swing: KQuaternion): void; + /** + * 判断是不是和联外一个四元数相等。 + * + * Whether two quaternions are equal. + * @param quaternion + */ + isEqual(quaternion: KQuaternion): boolean; + /** + * 从数组中读取数据,赋值给自己的数据成员。 + * + * Copy values (x, y, z and w) from an array with 4 elements. + * @param array + * @param offset + */ + fromArray(array: number[]): void; + /** + * 四元数转成数据表达形式。 + * + * Convert to a array containing x, y, z, w. + */ + toArray(): number[]; +} +/** + * 三维空间所有面的基类。 + * + * Root class for all surface in 3d space. + */ +declare interface KSurface { + /** + * 获取面的类型。 + * + * Get the surface's type. + * @returns + * 面的类型。 + * + * The surface's type. + */ + getType(): KSurfaceType_2; + /** + * 对当前面应用一转换矩阵,从而实现对其几何变换。 + * + * Transform this surface to a new one. + * @param matrix + * 转换矩阵。 + * + * The transform matrix. + * @returns + * 当执行正确的话,返回true;否则为false.。 + * + * Return true if successful, otherwise return false. + */ + transform(matrix: KMatrix4): boolean; + /** + * 以指定容差检查输入点是否在面上。 + * + * Check whether the input point is on the surface or not with specified tolerance. + * @param point + * 输入点。 + * + * The input point. + * @param tolerance + * 指定容差,默认值为1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果在面上返回true。 + * + * Return true if on the surface, otherwise return false. + */ + isPointOnSurface(point: KPoint3d, tolerance?: number): boolean; + /** + * 以指定容差检查输入曲线是否在面上。 + * + * Check whether the input curve is on the surface or not with specified tolerance. + * @param curve + * 传入曲线。 + * + * The input curve. + * @param tolerance + * 指定容差,默认值为1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果在面上返回true。 + * + * Return true if on the surface, otherwise return false. + */ + isCurveOnSurface(curve: KCurve3d, tolerance?: number): boolean; + /** + * 获得面上距离传入点最近的一点,以指定容差。 + * + * Get the closest point on surface for the input point with specified tolerance. + * @param point + * 输入点。 + * + * The input point. + * @param tolerance + * 指定容差,默认值为1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 最近点。 + * + * The closest point. + */ + getClosestPoint(point: KPoint3d, tolerance?: number): KPoint3d; + /** + * 获得点到面的距离。 + * + * Get the distance from the input point to this surface. + * @param point + * 传入点。 + * + * The input point. + * @returns + * 传入的点到面的距离。 + * + * The distance from the input point to this surface. + */ + distanceToPoint(point: KPoint3d): number; + /** + * 获得点到面的距离, + * 如果点在面的正向则距离为正,否则为负。 + * + * Get signed distance between the point and the plane. + * If the point is on the positive normal side, the sign is +, otherwise it's - + * @param point + * 传入点。 + * + * The input point. + * @returns + * 传入的点到面的距离。 + * + * The distance from the input point to this surface. + */ + signedDistanceTo(point: KPoint3d): number; + /** + * 复制一个当前面。 + * + * Return the cloned surface of this. + * @returns + * 复制的面。 + * + * The cloned surface. + */ + clone(): KSurface; + /** + * 忽略两个面的边界,以指定容差检查两个面是否共面。 + * + * Check whether two surface are coplanar by ignoring their sides with specified tolerance. + * @param other + * 要比较的另一个面。 + * + * The surface to compare this surface with. + * @param tolerance + * 指定容差,默认值为1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果共面返回true。 + * + * Return true if coplanar, otherwise return false. + */ + coplanarUnsigned(other: KSurface, tolerance?: number): boolean; + /** + * 考虑两个面的边界,以指定容差检查两个面是否共面。 + * + * Check whether two surface are coplanar with respecting their sides and specified tolerance. + * @param other + * 要比较的另一个面。 + * + * The surface to compare this surface with. + * @param tolerance + * 指定容差,默认值为1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果共面返回true。 + * + * Return true if coplanar, otherwise return false. + */ + coplanar(other: KSurface, tolerance?: number): boolean; + /** + * 通过面的UV参数坐标系将三维环转换成二维环。 + * 注意:需要保证该三维环落在面上。 + * + * Convert a 3D loop to 2d loop based on surface's uv coordinate system. + * NOTE: The caller needs to make sure the loop is on the surface. + * @param loop + * 输入的三维环。 + * + * The input 3D loop. + * @returns + * 二维环。 + * + * The 2D loop. + */ + loopToUV(loop: KLoop3d): KUVLoop; + /** + * 通过面的UV参数坐标系将三维面转换成二维面。 + * 注意:需要保证该三维面落在面上。 + * + * Convert a 3D face to 2d face based on surface's uv coordinate system. + * NOTE: The caller needs to make sure the face is on the surface. + * @param face + * 输入的三维面。 + * + * The input 3D face. + * @returns + * 二维面。 + * + * The 2D face. + */ + faceToUV(face: KFace3d_2): KUVFace; + /** + * 通过面的UV参数坐标系将三维点转换成二维点。 + * 需要确保传入点在面上。 + * 输出点的x坐标是传入点的u参数。 + * y坐标是v参数。 + * + * Get a 2d point corresponding to a 3d point on the surface. + * We need make sure the input point is on the surface. + * The returned point's x coordinate is parameter u of the input 3d point. + * y coordinate is parameter v of the input 3d point. + * @param point + * 面上一点。 + * + * The input point on the surface + * @return + * 二维点。 + * + * The 2d point + */ + getUVPoint(point: KPoint3d): KPoint2d; +} +/** + * KSurfaceType代表面的类型。 + * + * The KSurfaceType class represents surface types. + */ +declare enum KSurfaceType_2 { + /** + * 平面。 + * + * KPlane Type. + */ + Plane = 'plane' +} +/** + * KUVFace代表二维UV参数面。 + * + * The KUVFace represents a 2d UV face. + */ +declare type KUVFace = KFace2d; +/** + * KUVLoop代表一个二维参数环。 + * + * The KUVLoop represent a 2d UV loop. + */ +declare type KUVLoop = KLoop2d; +/** + * KVector2d表示一个二维向量。 + * 二维向量包含二个数。 + * 注意:二维向量的二个分量不可变。 + * + * The KVector2d class represents a 2D vector. + * A 2D vector is an ordered triplet of numbers (labeled x, y). + * NOTE: KVector2d's x, y are immutable. + */ +declare interface KVector2d { + /** + * 获得向量的x值。 + * + * Get vector's x value. + */ + readonly x: number; + /** + * 获得向量的y值。 + * + * Get vector's y value. + */ + readonly y: number; + /** + * 获得向量的长度。 + * + * Get vector's length. + */ + readonly length: number; + /** + * 返回当前向量的单位向量。 + * + * Return this vector's normalized vector. + * @returns + * 一个新的单位向量。 + * + * a new normalized vector. + */ + normalized(): KVector2d; + /** + * 返回一个新的向量,该新向量为当前向量的翻转。 + * + * Return a new vector which is the reverse of this vector. + * @returns + * 一个新的翻转向量。 + * + * a new reversed vector. + */ + reversed(): KVector2d; + /** + * 返回一个新的向量,该新向量为当前向量的倍乘。 + * + * Return a new vector which is the scaler result of this vector. + * @param scale + * 乘数。 + * + * The scale factor. + * @returns + * 倍乘后的向量。 + * + * a new multiplied vector. + */ + multiplied(scale: number): KVector2d; + /** + * 在特定容差下,判断两个向量是否相等。 + * 两个向量相等需要满足在距离容差下长度相等和余弦容差下方向相等。 + * + * Check whether two vectors are equal with specified tolerances. + * If the length of two vectors are equal in the distance tolerance + * and the direction are same in the cosine tolerance, it will return true. + * @param other + * 被比较的向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @returns + * 相等则返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KVector2d, distanceTolerance?: number, cosTolerance?: number): boolean; + /** + * 在特定容差下判断两个向量是否垂直。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if this vector is perpendicular with other vector with specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec is false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @param tolerance + * 指定的容差。默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 如果垂直则返回true。 + * + * Return true if perpendicular, otherwise return false. + */ + isPerpendicular(other: KVector2d, tolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 在特定容差下判断两个向量是否平行。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if this vector is parallel with other vector with specified tolerance. + * If checkFuzzyZeroVec is true and any vector's length is nearly zero with the tolerance, false will be return directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @param tolerance + * 指定的容差。默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 如果平行则返回true。 + * + * Return true if parallel, otherwise return false. + */ + isParallel(other: KVector2d, tolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 检查当前向量是否为零向量。 + * 注意:零向量是指向量的长度在容差范围内等于零。 + * + * Check whether a vector is zero vector. + * NOTE: A vector is zero vector if its length is 0 with specified tolerance. + * @param tolerance + * 指定的容差。默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果为零向量。 + * + * Return true if the vector is zero vector, otherwise return false. + */ + isZero(tolerance?: number): boolean; + /** + * 计算两向量的夹角,以弧度计。 + * + * Calculate the angle between this vector and the other vector in radians. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @returns + * 两向量的夹角,范围为[0, PI]。 + * + * The angle between the two vectors, the range is [0, PI]. + */ + angle(other: KVector2d): number; + /** + * 以特定方向来计算两向量的夹角,以弧度计。 + * + * Calculate the angle to other vector, with vecRef as reference. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @param vecRef + * 该向量用来决定角度计算的时针方向。 + * + * the reference vec to determine the counter clockwise direction. + * @returns + * 两向量的夹角,范围为[0, 2PI]。 + * + * The angle between the two vectors, the range is [0, 2PI). + */ + angleTo(other: KVector2d): number; + /** + * 两向量相加。 + * + * Return a new KVector3d which is this vector add the input vector. + * @param other + * 被加的另一个向量。 + * + * The vector to add. + * @returns + * 两向量的和。 + * + * The new vector. + */ + added(other: KVector2d): KVector2d; + /** + * 两向量相减。 + * + * Return a new KVector3d which is this vector subtract the input vector. + * @param other + * 被减的另一个向量。 + * + * The vector to subtract. + * @returns + * 两向量的差。 + * + * The new vector. + */ + subtracted(other: KVector2d): KVector2d; + /** + * 两向量的点积。 + * + * Return the dot product of this vector and the input other vector. + * @param other + * 被点积的另一个向量。 + * + * The vector to dot. + * @returns + * 两向量点积的结果。 + * + * The dot product of the vectors. + */ + dot(other: KVector2d): number; + /** + * 两向量的叉积。 + * + * Return the cross result of this vector and the input other vector. + * @param other + * 被叉积的另一向量。 + * + * The vector to cross. + * @returns + * 两向量叉积的结果。 + * + * The cross product of the vectors. + */ + cross(other: KVector2d): number; + /** + * 复制一个当前向量。 + * + * Return the cloned vector of this. + * @returns + * 复制的向量。 + * + * The cloned vector. + */ + clone(): KVector2d; + /** + * 检查两个向量在特定容差下是否方向相同。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if the directions of two vectors are equal within specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 被比较的另外一向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 相同则返回true。 + * + * Return true if same, otherwise return false. + */ + isSameDirection(other: KVector2d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 检查两个向量在特定容差下是否为相同侧,相同侧意味着夹角小于九十度。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if the directions of two vectors are equal within specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 被比较的另外一向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 相同则返回true。 + * + * Return true if same, otherwise return false. + */ + isOnSameSide(other: KVector2d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 检查两个向量的方向在特定容差下是否相反。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if this vector is opposite with other vector with specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 被比较的另外一向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 相反则返回true。 + * + * Return true if opposite, otherwise return false. + */ + isOpposite(other: KVector2d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 对当前向量应用一个矩阵来进行变换。 + * + * Return a new Vector which is the result of this vector transformed by the input matrix. + * @param matrix + * 变换矩阵。 + * + * the input transform matrix. + * @returns + * 得到一个新的向量。 + * + * The new vector. + */ + appliedMatrix3(matrix: KMatrix3): KVector2d; +} +/** + * KVector3d表示一个三维向量。 + * 三维向量包含三个数。 + * 注意:三维向量的三个分量不可变。 + * + * The KVector3d class represents a 3D vector. + * A 3D vector is an ordered triplet of numbers (labeled x, y, and z). + * NOTE: KVector3d's x, y and z are immutable. + */ +declare interface KVector3d { + /** + * 获得向量的x值。 + * + * Get vector's x value. + */ + readonly x: number; + /** + * 获得向量的y值。 + * + * Get vector's y value. + */ + readonly y: number; + /** + * 获得向量的z值。 + * + * Get vector's z value. + */ + readonly z: number; + /** + * 获得向量的长度。 + * + * Get vector's length. + */ + readonly length: number; + /** + * 返回当前向量的单位向量。 + * + * Return this vector's normalized vector. + * @returns + * 一个新的单位向量。 + * + * a new normalized vector. + */ + normalized(): KVector3d; + /** + * 返回一个新的向量,该新向量为当前向量的翻转。 + * + * Return a new vector which is the reverse of this vector. + * @returns + * 一个新的翻转向量。 + * + * a new reversed vector. + */ + reversed(): KVector3d; + /** + * 返回一个新的向量,该新向量为当前向量的倍乘。 + * + * Return a new vector which is the scaler result of this vector. + * @param scale + * 乘数。 + * + * The scale factor. + * @returns + * 倍乘后的向量。 + * + * a new multiplied vector. + */ + multiplied(scale: number): KVector3d; + /** + * 在特定容差下,判断两个向量是否相等。 + * 两个向量相等需要满足在距离容差下长度相等和余弦容差下方向相等。 + * + * Check whether two vectors are equal with specified tolerances. + * If the length of two vectors are equal in the distance tolerance + * and the direction are same in the cosine tolerance, it will return true. + * @param other + * 被比较的向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @returns + * 相等则返回true。 + * + * Return true if equal, otherwise return false. + */ + isEqual(other: KVector3d, distanceTolerance?: number, cosTolerance?: number): boolean; + /** + * 在特定容差下判断两个向量是否垂直。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if this vector is perpendicular with other vector with specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec is false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @param tolerance + * 指定的容差。默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 如果垂直则返回true。 + * + * Return true if perpendicular, otherwise return false. + */ + isPerpendicular(other: KVector3d, tolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 在特定容差下判断两个向量是否平行。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if this vector is parallel with other vector with specified tolerance. + * If checkFuzzyZeroVec is true and any vector's length is nearly zero with the tolerance, false will be return directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @param tolerance + * 指定的容差。默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 如果平行则返回true。 + * + * Return true if parallel, otherwise return false. + */ + isParallel(other: KVector3d, tolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 检查当前向量是否为零向量。 + * 注意:零向量是指向量的长度在容差范围内等于零。 + * + * Check whether a vector is zero vector. + * NOTE: A vector is zero vector if its length is 0 with specified tolerance. + * @param tolerance + * 指定的容差。默认值是1e-6。 + * + * The specified tolerance.The default value is 1e-6. + * @returns + * 如果为零向量。 + * + * Return true if the vector is zero vector, otherwise return false. + */ + isZero(tolerance?: number): boolean; + /** + * 计算两向量的夹角,以弧度计。 + * + * Calculate the angle between this vector and the other vector in radians. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @returns + * 两向量的夹角,范围为[0, PI]。 + * + * The angle between the two vectors, the range is [0, PI]. + */ + angle(other: KVector3d): number; + /** + * 以特定方向来计算两向量的夹角,以弧度计。 + * + * Calculate the angle to other vector, with vecRef as reference. + * @param other + * 要比较的向量。 + * + * The vector to compare this vector with. + * @param vecRef + * 该向量用来决定角度计算的时针方向。 + * + * the reference vec to determine the counter clockwise direction. + * @returns + * 两向量的夹角,范围为[0, 2PI]。 + * + * The angle between the two vectors, the range is [0, 2PI). + */ + angleTo(other: KVector3d, vecRef: KVector3d): number; + /** + * 两向量相加。 + * + * Return a new KVector3d which is this vector add the input vector. + * @param other + * 被加的另一个向量。 + * + * The vector to add. + * @returns + * 两向量的和。 + * + * The new vector. + */ + added(other: KVector3d): KVector3d; + /** + * 两向量相减。 + * + * Return a new KVector3d which is this vector subtract the input vector. + * @param other + * 被减的另一个向量。 + * + * The vector to subtract. + * @returns + * 两向量的差。 + * + * The new vector. + */ + subtracted(other: KVector3d): KVector3d; + /** + * 两向量的点积。 + * + * Return the dot product of this vector and the input other vector. + * @param other + * 被点积的另一个向量。 + * + * The vector to dot. + * @returns + * 两向量点积的结果。 + * + * The dot product of the vectors. + */ + dot(other: KVector3d): number; + /** + * 两向量的叉积。 + * + * Return the cross result of this vector and the input other vector. + * @param other + * 被叉积的另一向量。 + * + * The vector to cross. + * @returns + * 两向量叉积的结果。 + * + * The cross product of the vectors. + */ + cross(other: KVector3d): KVector3d; + /** + * 复制一个当前向量。 + * + * Return the cloned vector of this. + * @returns + * 复制的向量。 + * + * The cloned vector. + */ + clone(): KVector3d; + /** + * 检查两个向量在特定容差下是否方向相同。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if the directions of two vectors are equal within specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 被比较的另外一向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 相同则返回true。 + * + * Return true if same, otherwise return false. + */ + isSameDirection(other: KVector3d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 检查两个向量在特定容差下是否为相同侧,相同侧意味着夹角小于九十度。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if the directions of two vectors are equal within specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 被比较的另外一向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 相同则返回true。 + * + * Return true if same, otherwise return false. + */ + isOnSameSide(other: KVector3d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 检查两个向量的方向在特定容差下是否相反。 + * 当checkFuzzyZeroVec为真时,如果两个向量中的任意一个长度在容差内接近零,结果直接为false。 + * 当checkFuzzyZeroVec为假时,如果两个向量中的任意一个长度精确的等于零,结果直接为false。 + * + * Check if this vector is opposite with other vector with specified tolerance. + * If checkFuzzyZeroVec is true, any vector's length is nearly zero within the tolerance, false will be returned directly. + * If checkFuzzyZeroVec if false, only when any vector's length is exact 0, false will be returned directly. + * @param other + * 被比较的另外一向量。 + * + * The vector to compare this vector with. + * @param distanceTolerance + * 距离容差,默认值是1e-6。 + * + * It will provide distance tolerance when the length of vectors are measured.The default value is 1e-6. + * @param cosTolerance + * 余弦容差,默认值是1e-6。 + * + * It will provide cosine tolerance when the direction of vectors are measured.The default value is 1e-6. + * @param checkFuzzyZeroVec + * 默认checkFuzzyZeroVec是真。 + * + * The default value is true. + * @returns + * 相反则返回true。 + * + * Return true if opposite, otherwise return false. + */ + isOpposite(other: KVector3d, distanceTolerance?: number, cosTolerance?: number, checkFuzzyZeroVec?: boolean): boolean; + /** + * 对当前向量应用一个矩阵来进行变换。 + * + * Return a new Vector which is the result of this vector transformed by the input matrix. + * @param matrix + * 变换矩阵。 + * + * the input transform matrix. + * @returns + * 得到一个新的向量。 + * + * The new vector. + */ + appliedMatrix4(matrix: KMatrix4): KVector3d; + /** + * 对当前向量应用一个由欧拉角定义的旋转变换,得到一个新向量。 + * + * Return a new Vector which is the result of this vector transformed by the input euler angles. + * @param euler + * 欧拉角和欧拉角的顺序 + * + * the input Euler angles and their order. + * @returns + * 得到一个新的向量。 + * + * The new vector. + */ + appliedEuler(euler: KEuler): KVector3d; + /** + * 对当前向量应用一个由四元数定义的旋转变换,得到一个新向量。 + * + * Return a new Vector which is the result of this vector transformed by the input quaternion. + * @param quaternion + * 四元数 + * + * the input quaternion which detines the rotation. + * @returns + * 得到一个新的向量。 + * + * The new vector. + */ + appliedQuaternion(quaternion: KQuaternion): KVector3d; +} +/** + * 左侧栏挂载点可配置项 + */ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +declare interface LeftPanelMountPointOptions { +} +declare type Locale = 'zh_CN' | 'en_US' | 'de_DE' | 'fr_FR' | 'ja_JP' | 'zh_TW' | 'ru_RU' | 'ko_KR' | 'es_ES' | 'ar_EG' | 'en_CN' | 'vi' | 'it_IT' | 'th_TH' | 'id_ID' | 'pl_PL'; +/** + * 主挂载点可配置项 + */ +declare interface MainMountPointOptions { + /** + * 窗体显示模式, 不传入则不修改, 默认值`'windowed'` + * + * @remarks + * + * `'windowed'`: 窗口模式,标准显优先级。 + * + * `'topWindowed'`: 窗口模式,高显示优先级。 + * + * `'modal'`: 模态框模式,始终居中显示,将会存在模态遮罩,位置不可修改,将会忽略`resizable`、`draggable`、`position`,高显示优先级。 + * + * `'fullscreen'`: 全屏模式,自动占满整个网页,将会忽略`resizable`和`draggable`,始终不可拖拽移动和缩放,并且不会接受任何尺寸修改,切换至此模式会修改iframe大小并锁定,高显示优先级。 + * + * **注意**: + * - 全屏模式仅为网页全屏,顶部标题边框不会移除。 + * - 窗口模式在不同优先级的显示模式之间切换时会导致`iframe`重载 + * + * @defaultValue `'windowed'` + */ + windowMode?: 'windowed' | 'topWindowed' | 'fullscreen' | 'modal'; + /** + * 窗体左上角位置 + */ + position?: { + x: number; + y: number; + }; + /** + * 容器是否可以被拖拽移动 + */ + draggable?: boolean; + /** + * 容器是否可以被用户拖拽缩放 + * + * @remarks + * - true: 均可改,此时 4 个 edge 和底部 2 个 corner 可拖拽; + * - false: 均不可改,均不可拖拽; + * - 'width': 宽度可改,仅左右两侧 edge 可拖拽; + * - 'height':高度可改,仅上下两侧 edge 可拖拽; + */ + resizable?: boolean | 'width' | 'height'; + /** + * 容器最小宽度,不传入则不修改,传入`undefined`则重置为默认配置,默认值`240` + * + * 若传入值小于默认值,则会被重置为默认值 + * + * @defaultValue `240` + */ + minWidth?: number | undefined; + /** + * 容器最大宽度,不传入则不修改,传入`undefined`则重置为默认配置,默认不限制 + * + * @defaultValue `undefined` + */ + maxWidth?: number | undefined; + /** + * 容器最小高度,不传入则不修改,传入`undefined`则重置为默认配置,默认值`120` + * + * 若传入值小于默认值,则会被重置为默认值 + * + * @defaultValue `120` + */ + minHeight?: number | undefined; + /** + * 容器最大高度,不传入则不修改,传入`undefined`则重置为默认配置,默认不限制 + * + * @defaultValue `undefined` + */ + maxHeight?: number | undefined; + /** + * **仅在窗口模式时生效**,默认值`false` + * + * 缩小浏览器: + * 优先适配位置,移动至极限位置处,再适配面板宽度,跟随浏览器边缘自适应缩小,达到最小尺寸后保持不变 + * + * 拉大浏览器: + * 优先适配面板宽度,跟随浏览器边缘自适应拉大,达到原尺寸后保持不变,再适配位置,移动至原位置后保持不变 + * + * 若默认适配规则不满足需求,可基于`IDP.UI.Layout.WindowResize`事件,搭配`UI`、`resize`等接口自主实现 + */ + widthResponsive?: boolean; + /** + * **仅在窗口模式时生效**,默认值`false` + * + * 缩小浏览器: + * 优先适配位置,移动至极限位置处,再适配面板高度,跟随浏览器边缘自适应缩小,达到最小尺寸后保持不变 + * + * 拉大浏览器: + * 优先适配面板高度,跟随浏览器边缘自适应拉大,达到原尺寸后保持不变,再适配位置,移动至原位置后保持不变 + * + * 若默认适配规则不满足需求,可基于`IDP.UI.Layout.WindowResize`事件,搭配`UI`、`resize`等接口自主实现 + */ + heightResponsive?: boolean; +} +declare interface MiniappUploadDataOption { + miniappId: string; + data: string; +} +declare interface MiniappUploadDataResult { + uniqueId: string; +} +declare interface MixGroup { + /** 混组elementId */ + id: IDP.DB.Types.ElementId; + /** 位置 */ + position: Number3; + /** 尺寸 */ + size: Number3; + /** 混组子模型 */ + subElements: IDP.DB.Types.ElementId[]; +} +/** + * 模型门窗详细信息 + */ +declare interface ModelDoorWindow { + /** 设计对象 ID */ + elementId: IDP.DB.Types.ElementId; + /** 商品 ID */ + productId: string; + /** 门窗类型 */ + type: IDP.DB.Types.ModelDoorWindowType; + /** 位置 */ + position: KPoint3d; + /** 旋转 */ + rotation: number; + /** 大小 */ + size: KPoint3d; + /** 缩放 */ + scale: KPoint3d; + /** + * 把手位置 + * [handleFlipped=false] 把手在推门方向的右边, 向左开门 + * [handleFlipped=true ] 把手在推门方向的左边, 向右开门 + */ + handleFlipped: boolean; + /** + * 开门方向 + * [facingFlipped=false] 推门 + * [facingFlipped=true] 拉门 + */ + facingFlipped: boolean; + /** 宿主(墙)id */ + hostIds: string[]; + /** 洞id */ + openingId: string; +} +/** + * 创建模型门窗所需信息 + */ +declare interface ModelDoorWindowCreateInfo { + /** 商品 ID */ + productId: string; + /** 位置 */ + position: KPoint3d; + /** 旋转 */ + rotation?: number; + /** 大小 */ + size?: KPoint3d; + /** + * 把手位置 + * [handleFlipped=false] 把手在推门方向的右边, 向左开门 + * [handleFlipped=true] 把手在推门方向的左边, 向右开门 + */ + handleFlipped?: boolean; + /** + * 开门方向 + * [facingFlipped=false] 推门 + * [facingFlipped=true] 拉门 + */ + facingFlipped?: boolean; +} +/* Excluded from this release type: ModelMolding */ +declare type MountPoints = { + /** + * 主挂载点,一个悬浮的小窗口 + */ + main: number; + /** + * 左侧素材栏挂载点 + */ + leftPanel: number; +}; +/** + * 可选值参数每项数据类型 + */ +declare interface NamedValue { + /** + * 显示的名称 + */ + name: string; + value: T; +} +/** + * 二维空间下:坐标/向量/旋转/尺寸的基础表示 + */ +declare interface Number2 { + /** + * x轴上的数据 + */ + x: number; + /** + * y轴上数据 + */ + y: number; +} +/** + * 三维空间下,坐标/向量/旋转/尺寸的基础表示 + */ +declare interface Number3 extends Number2 { + /** + * z轴方向数据 + */ + z: number; +} +/** + * 设置旋转/位置 + */ +declare interface Number3Formula { + /** + * X轴方向上的公式 + */ + x: string; + /** + * Y轴方向上的公式 + */ + y: string; + /** + * Z轴方向上的公式 + */ + z: string; +} +/** 自定义动态操作事件显示 */ +declare enum OperationShowConfig { + /** 不显示 */ + Hidden = 0, + /** 显示 */ + Show = 1 +} +/* Excluded from this release type: OrthCameraAttrs */ +/* Excluded from this release type: PerspectiveCameraAttrs */ +/** @vm-type PromiseResult */ +declare type PromiseResult = Result; +/* Excluded from this release type: PubInjection */ +/** + * Promise 结果范型 + */ +declare interface Result { + /** + * 状态码 + * - 0:成功 + * - 1:取消 + * - 2:失败 + */ + code: number; + /** 错误信息描述 */ + errorMessage?: string; + /** 数据 */ + data?: T; +} +/** 规则检测模板检测结果 */ +declare interface RuleTemplate { + /** + * 规则模板Id + */ + templateId: number; + /** + * 规则模板名称 + */ + templateName: string; + /** + * 警告级别 + */ + alertLevel: EAlertLevel; + /** + * other options + */ + [s: string]: any; +} +/** + * 设置当前商品库选中库节点参数 + */ +declare interface SetSelectedLibraryPositionOption { + /** 商品库节点 */ + libraryPosition: ECustomLibraryPosition; +} +/* Excluded from this release type: Size */ +/** + * 挖槽方向 + */ +declare enum SlotCaveType { + FROM_TOP = "1", + FROM_BOTTOM = "2" +} +/** + * 拖拽创建返回的 Promise 结果类型 + * @vm-type StartDragProductPromiseResult + */ +declare type StartDragProductPromiseResult = Result; +declare type Theme = 'light-theme' | 'dark-theme'; +declare interface Toast { + /** + * 显示一个info形式的toast + * @param message 消息 + */ + info(message: string): void; + /** + * 显示一个warn形式的toast + * @param message 消息 + */ + warn(message: string): void; + /** + * 显示一个error形式的toast + * @param message 消息 + */ + error(message: string): void; + /** + * 显示一个success形式的toast + * @param message 消息 + */ + success(message: string): void; +} +declare interface View extends View_2 { + readonly mountPoints: MountPoints; + /** + * 配置iframe容器选项,如果iframe未挂载,则不会产生响应 + * @param frame 目标iframe + * @param options 可配置项,视挂载点而定,挂载点的可配置项参考实际配置类型 + */ + setContainerOptions(frame: FrameHost, options: MainMountPointOptions | LeftPanelMountPointOptions): void; +} +/** + * 视图 + */ +declare interface View_2 { + /** + * 可用的挂载点,具体参照应用挂载点说明 + */ + readonly mountPoints: { + [key: string]: number; + }; + /** + * 默认的iframe + */ + readonly defaultFrame: FrameHost; + /** + * 创建一个iframe + * @param srcName 视图资源名称 + * @returns 创建完成的iframe + */ + createFrame(srcName: string): FrameHost; +} diff --git a/packages/vm/node_modules/@manycore/idp-sdk/package.json b/packages/vm/node_modules/@manycore/idp-sdk/package.json new file mode 100644 index 0000000000000000000000000000000000000000..143fd2cd9e0ce4050c45afaf9ae8690966e9ee4e --- /dev/null +++ b/packages/vm/node_modules/@manycore/idp-sdk/package.json @@ -0,0 +1,10 @@ +{ + "name": "@manycore/idp-sdk", + "version": "1.38.0", + "description": "idp sdk typings", + "homepage": "", + "license": "ISC", + "maintainers": [ + "kujiale" + ] +} \ No newline at end of file diff --git a/packages/vm/package.json b/packages/vm/package.json index 8dce11a06cfd2d8307433fc6f7ad8dd6950a9003..00af24a7018e1140dcb13da4a2e5a3a471a8c4bd 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -7,7 +7,7 @@ "license": "ISC", "dependencies": { "@manycore/idp-sdk": "1.38.0", - "message-lite": "0.0.1", + "message-lite": "0.10.5-alpha.2", "@manycore/pages-vm-api": "1.9.1" }, "scripts": {} diff --git a/packages/vm/src/environment-hack/hack.ts b/packages/vm/src/environment-hack/hack.ts new file mode 100644 index 0000000000000000000000000000000000000000..e846a972f8d6211c6bc058982d8e6d269f33b0e4 --- /dev/null +++ b/packages/vm/src/environment-hack/hack.ts @@ -0,0 +1,14 @@ +import { getGlobalObject } from "../util/get-global"; +import { globalTimer } from "./timer"; + +/** 全局对象 */ +export const global = getGlobalObject(); + +if (typeof global.setTimeout === 'undefined') { + global.setTimeout = globalTimer.setTimeout; + global.clearTimeout = globalTimer.clearTimeout; +} +if (typeof global.setImmediate === 'undefined') { + global.setImmediate = global.setTimeout; + global.clearImmediate = global.clearTimeout; +} diff --git a/packages/vm/src/environment-hack/index.ts b/packages/vm/src/environment-hack/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..ebabc1eb18315dad7ae4a1d2083bfeabcea7c4a0 --- /dev/null +++ b/packages/vm/src/environment-hack/index.ts @@ -0,0 +1 @@ +import './hack'; diff --git a/packages/vm/src/environment-hack/timer.ts b/packages/vm/src/environment-hack/timer.ts new file mode 100644 index 0000000000000000000000000000000000000000..b2455da82feef4b6f096125088fd407bdaaa7f32 --- /dev/null +++ b/packages/vm/src/environment-hack/timer.ts @@ -0,0 +1,80 @@ +import { IPromiseDefer, createDefer } from "../util/create-defer"; + +export interface ITimer { + defer: IPromiseDefer; + time: number; + uid: number; + started: boolean; +} + +export class Timer { + + protected uid = 0; + + protected readonly timer = new Map(); + + protected _sleep!: ((time: number) => Promise) | null; + + protected runJob = () => { + if (this.timer.size) { + // 触发立即执行 + Array.from(this.timer).forEach(([uid, iTask]) => { + if (this._sleep && !iTask.started) { + iTask.defer.resolve(this._sleep(iTask.time)); + iTask.started = true; + } + }) + } + } + + public setSleepFn = (sleep: null | ((time: number) => Promise)) => { + this._sleep = sleep; + this.runJob(); + } + + public wrapFn(uid: number, fn: Function, ...args: any): () => any { + let timer = this.timer; + return function () { + if (timer.has(uid)) { + try { + const currentTask = timer.get(uid)!; + currentTask.started = true; + fn(...args); + } finally { + timer.delete(uid); + timer = null!; + } + } + }; + } + + public setTimeout = (fn: Function, time: number = 0, ...args: any[]) => { + const val = ++this.uid; + const defer = createDefer(); + defer.promise.then(this.wrapFn(val, fn, ...args)); + this.timer.set(val, { + defer, + uid: val, + time, + started: false, + }); + this.runJob(); + return val; + } + + public clearTimeout = (uid: any) => { + if (typeof uid === 'number' && this.timer.has(uid)) { + this.timer.delete(uid); + } + } + + public setInterval = () => { + + } + + public clearInterval = () => { + + } +} + +export const globalTimer = new Timer(); diff --git a/packages/vm/src/impl/custom.model.service.impl.ts b/packages/vm/src/impl/custom.model.service.impl.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd102a3bd2d3c854c05a96bf76cdd7f2f7652827 --- /dev/null +++ b/packages/vm/src/impl/custom.model.service.impl.ts @@ -0,0 +1,15 @@ +import { ApiImpl } from 'message-lite'; +import { + CustomModelService, IGetTopModelsLiteInfoAsyncParameters, +} from '@manycore/pages-vm-api'; + +@ApiImpl() +export class CustomModelServiceImpl extends CustomModelService { + getTopModelsLiteInfoAsync(option: IGetTopModelsLiteInfoAsyncParameters) { + return IDP.Custom.Design.CustomModel.getTopModelsLiteInfoAsync(option); + } + + getCustomModelByModelIdAsync(id: string) { + return IDP.Custom.Design.CustomModel.getCustomModelByModelIdAsync(id); + } +} diff --git a/packages/vm/src/impl/design.service.impl.ts b/packages/vm/src/impl/design.service.impl.ts new file mode 100644 index 0000000000000000000000000000000000000000..b161f955532770ced8a3f054a68bd86d20e0538a --- /dev/null +++ b/packages/vm/src/impl/design.service.impl.ts @@ -0,0 +1,27 @@ +import { ApiImpl } from 'message-lite'; +import { DesignService } from '@manycore/pages-vm-api'; + +@ApiImpl() +export class DesignServiceImpl extends DesignService { + async save() { + const orderId = IDP.Integration.FOP.OrderMode.getOrderId(); + // FOP订单模式下 + if (!!orderId) { + const isEditable = IDP.Integration.FOP.OrderMode.getEditable(); + // 具备可编辑的权限 + if (isEditable) { + await Promise.all([ + // 方案保存 + IDP.Design.save(), + // 订单模型范围变更 + new Promise((res, rej) => { + IDP.Events.once('IDP.Integration.FOP.OrderMode.OrderModel.Update', res) + }) + ]) + await IDP.Design.save(); + return; + } + } + await IDP.Design.save(); + } +} diff --git a/packages/vm/src/impl/event.service.impl.ts b/packages/vm/src/impl/event.service.impl.ts new file mode 100644 index 0000000000000000000000000000000000000000..5667e6967acf785cd1847ae2da1c127314baa845 --- /dev/null +++ b/packages/vm/src/impl/event.service.impl.ts @@ -0,0 +1,9 @@ +import { ApiImpl } from 'message-lite'; +import { + EventService, +} from '@manycore/pages-vm-api'; + +@ApiImpl() +export class EventServiceImpl extends EventService { + +} diff --git a/packages/vm/src/impl/index.ts b/packages/vm/src/impl/index.ts index 27ac9eeb449fc113f5738f281da93fbe4382851d..dfd3f1d1983dd2aedcc31fc24312f7b5bb780916 100644 --- a/packages/vm/src/impl/index.ts +++ b/packages/vm/src/impl/index.ts @@ -1,13 +1,10 @@ -import { - ToastService, - ExportService, - FittingDesignService, - BomService, - FopOrderService, -} from '@manycore/pages-vm-api'; +import { ToastService, ExportService, FittingDesignService, EventService, CustomModelService, DesignService, BomService,FopOrderService } from '@manycore/pages-vm-api'; import { ToastServiceImpl } from './toast.service.impl'; import { ExportServiceImpl } from './export.service.impl'; import { FittingDesignServiceImpl } from './fitting.design.service.impl'; +import { EventServiceImpl } from './event.service.impl'; +import { CustomModelServiceImpl } from './custom.model.service.impl'; +import { DesignServiceImpl } from './design.service.impl'; import { BomServiceImpl } from './bom.service.impl'; import { FopOrderServiceImpl } from './fop.order.service.impl'; @@ -24,10 +21,22 @@ export const services = [ decl: FittingDesignService, impl: FittingDesignServiceImpl, }, + { + decl: EventService, + impl: EventServiceImpl, + }, + { + decl: CustomModelService, + impl: CustomModelServiceImpl, + }, { decl: BomService, impl: BomServiceImpl, }, + { + decl: DesignService, + impl: DesignServiceImpl, + }, { decl: FopOrderService, impl: FopOrderServiceImpl, diff --git a/packages/vm/src/index.ts b/packages/vm/src/index.ts index 7393f2748416eb3f22abc2d1e4b32a2e4892a378..88a95c680b87ec19f8f6995a9852e885d8096d2f 100644 --- a/packages/vm/src/index.ts +++ b/packages/vm/src/index.ts @@ -1,4 +1,6 @@ +import { EventService } from '@manycore/pages-vm-api'; import { master } from './master'; +import './environment-hack'; IDP.Miniapp.view.defaultFrame.mount(IDP.Miniapp.view.mountPoints.main); // 小屏展示 @@ -9,13 +11,21 @@ IDP.Miniapp.view.setContainerOptions(IDP.Miniapp.view.defaultFrame, { Promise.all([ // 等待内部连接 - master.opening({ - clientId: 'miniapp-app', - }), + master.start(), // 打开对接2.0通信通道 IDP.Custom.Common.openTerminalAsync(), IDP.Design.save() -]).catch(() => { +]).then(() => { + IDP.Events.on('IDP.Custom.Design.CustomModel.AddV2', master.getService(EventService)!.customModelAdded.emit) + IDP.Events.on('IDP.Custom.Design.CustomModel.DeleteV2', master.getService(EventService)!.customModelDelete.emit); + IDP.Events.on('IDP.Custom.Design.CustomModel.UpdateV2',master.getService(EventService)!.customModelUpdate.emit); + IDP.Events.on('IDP.Design.Saved', master.getService(EventService)!.designSaved.emit); + IDP.Events.on('IDP.Integration.FOP.OrderMode.OrderModel.Update', master.getService(EventService)!.orderModelUpdate.emit); +}).catch((e) => { IDP.Miniapp.view.defaultFrame.unmount(); IDP.Custom.Common.closeTerminalAsync(); }); + + + + diff --git a/packages/vm/src/master/index.ts b/packages/vm/src/master/index.ts index 1f7db561934b2b7fcbddecf220c56ec98e460e2d..f8175e5e64430667b39a3603a92be8c396fe9c33 100644 --- a/packages/vm/src/master/index.ts +++ b/packages/vm/src/master/index.ts @@ -1,14 +1,31 @@ -import { Master } from 'message-lite'; +import { CONNECTED, IConnectSession, Master } from 'message-lite'; import { services } from '../impl'; +import { globalTimer } from '../environment-hack/timer'; +import { TimerService } from '@manycore/pages-vm-api'; export const master = new Master({ - sendMessage(message: any) { + createSender: (origin) => (message: any) => { IDP.Miniapp.view.defaultFrame.postMessage(message); }, listenMessage(fn: (message: any) => void) { IDP.Miniapp.view.defaultFrame.onMessageReceive(fn); }, - unListenMessage(fn: (message: any) => void) {}, + unListenMessage(fn: (message: any) => void) { }, + transformMessage: (message) => { + return message; + }, }); master.addService(services); + +master.on(CONNECTED, (session: IConnectSession) => { + if (session.getName() === 'mini-app') { + globalTimer.setSleepFn((time) => { + const service = session.getService(TimerService); + return service.timeout(time); + }); + session.closed.finally(() => { + globalTimer.setSleepFn(null); + }); + } +}); \ No newline at end of file diff --git a/packages/vm/src/util/create-defer.ts b/packages/vm/src/util/create-defer.ts new file mode 100644 index 0000000000000000000000000000000000000000..7366d7c2ca90217c79f3787e35c2d6a9033f1913 --- /dev/null +++ b/packages/vm/src/util/create-defer.ts @@ -0,0 +1,43 @@ +/** + * Promise的defer内容 + */ +export interface IPromiseDefer { + // 对应的promise方法 + promise: Promise; + // 对应的resolve方法 + resolve: (it?: T | PromiseLike) => void; + // reject的错误信息 + reject: (it?: any) => void; +} + +/** + * 生成promise的defer对象 + */ +export function createDefer(): IPromiseDefer { + let resolve: (value?: T | PromiseLike) => void; + let reject: (it?: any) => void; + let timer: any; + const wrapResolveOrReject = function (fn: (...args: any) => any) { + return function (this: any, ...args: any[]) { + if (typeof timer !== 'undefined') { + clearTimeout(timer); + timer = undefined; + } + fn.call(this, ...args); + }; + }; + const promise = new Promise((r, j) => { + resolve = wrapResolveOrReject(r); + reject = wrapResolveOrReject(j); + }); + + return { + promise, + // eslint-disable-next-line @typescript-eslint/ban-ts-ignore + // @ts-ignore + resolve, + // eslint-disable-next-line @typescript-eslint/ban-ts-ignore + // @ts-ignore + reject, + }; +} \ No newline at end of file diff --git a/packages/vm/src/util/get-global.ts b/packages/vm/src/util/get-global.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae50af8e69d911d6b591a6405c05a7b314756508 --- /dev/null +++ b/packages/vm/src/util/get-global.ts @@ -0,0 +1,15 @@ + +/** + * 获取全局对象 + */ +export const getGlobalObject = function () { + if (typeof window === 'object') { + return window; + } + if (typeof globalThis === 'object') { + return globalThis; + } + return {} as any; +} + + diff --git a/pages/appPage/index.ts b/pages/appPage/index.ts index d7a5e751db23568d6a0abf0bc7835ce5041d3f1b..50a894f05a75f91af1367bcd4643742739dfb534 100644 --- a/pages/appPage/index.ts +++ b/pages/appPage/index.ts @@ -1 +1 @@ -import './src'; +import './src'; \ No newline at end of file diff --git a/pages/appPage/src/core/index.ts b/pages/appPage/src/core/index.ts index bf71eafc67c2493e5fe1b2f8a708344e1d21d503..b9833a2a25eed4cc2e41b5d9282749460e4c901e 100644 --- a/pages/appPage/src/core/index.ts +++ b/pages/appPage/src/core/index.ts @@ -5,9 +5,10 @@ export async function bootstrap() { const application = getApplication(); await application.start(); - (await application.isInCustomMiniAppMode()) + const isInCustomMiniAppMode = await application.isInCustomMiniAppMode(); + await (isInCustomMiniAppMode ? Promise.resolve() : createSlave(application).connect({ - clientId: 'miniapp-app', - }); + name: 'mini-app' + })) } diff --git a/pages/appPage/src/salve/impl/index.ts b/pages/appPage/src/salve/impl/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..1bbe6cacc8583a0293d1ec1bbb95a4948253c9ec --- /dev/null +++ b/pages/appPage/src/salve/impl/index.ts @@ -0,0 +1,9 @@ +import { TimerService } from "@manycore/pages-vm-api"; +import { TimerImplService } from "./timer-impl.service"; + +export const ALL_SERVICE = [ + { + decl: TimerService, + impl: TimerImplService, + }, +] \ No newline at end of file diff --git a/pages/appPage/src/salve/impl/timer-impl.service.ts b/pages/appPage/src/salve/impl/timer-impl.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..95145197281f968f4fe760673e78c7e2c647db93 --- /dev/null +++ b/pages/appPage/src/salve/impl/timer-impl.service.ts @@ -0,0 +1,11 @@ +import { TimerService } from '@manycore/pages-vm-api'; +import { ApiImpl } from 'message-lite'; + +@ApiImpl() +export class TimerImplService extends TimerService { + timeout(time = 0): Promise { + return new Promise((resolve) => { + setTimeout(resolve, time); + }); + } +} diff --git a/pages/appPage/src/salve/index.ts b/pages/appPage/src/salve/index.ts index 2d2e0a0f2bd042a33a44bedb0b1baf31432182c3..b8f12cbb31e5e9e219d6656051603672da702f7e 100644 --- a/pages/appPage/src/salve/index.ts +++ b/pages/appPage/src/salve/index.ts @@ -1,5 +1,6 @@ import { Application } from '@manycore/custom-sdk'; import { Slave } from 'message-lite'; +import { ALL_SERVICE } from './impl'; export let slave: Slave; @@ -8,7 +9,7 @@ export const createSlave = (app: Application) => { throw new Error('slave只允许被创建一次!'); } slave = new Slave({ - sendMessage: (message: any) => { + createSender: (data: any) => (message: any) => { app.getHost().postMessage(message, '*'); }, listenMessage: (f: (message: any) => void) => { @@ -17,7 +18,11 @@ export const createSlave = (app: Application) => { }; app.getHost().onMessageReceive(fn); }, - unListenMessage: (f: (message: any) => void) => {}, + unListenMessage: (f: (message: any) => void) => { }, + transformMessage(message: MessageEvent) { + return message; + }, }); + slave.addService(ALL_SERVICE); return slave; }; diff --git a/pages/appPage/src/store/modelList/action.ts b/pages/appPage/src/store/modelList/action.ts new file mode 100644 index 0000000000000000000000000000000000000000..4decdc0c92cc3221fadc8822217bc808a9d4fe79 --- /dev/null +++ b/pages/appPage/src/store/modelList/action.ts @@ -0,0 +1,10 @@ +import { Action } from 'redux'; +import { APP_MODEL_LIST_CHANGE } from './constant'; +import { IAppModelList } from './reducers'; + +export function actionUpdateModelList(modelList: Partial = {}) { + return { + type: APP_MODEL_LIST_CHANGE, + value: modelList, + }; +} diff --git a/pages/appPage/src/store/modelList/constant.ts b/pages/appPage/src/store/modelList/constant.ts new file mode 100644 index 0000000000000000000000000000000000000000..01f0c3e9534363e4aecdf80a53248afd9c031973 --- /dev/null +++ b/pages/appPage/src/store/modelList/constant.ts @@ -0,0 +1 @@ +export const APP_MODEL_LIST_CHANGE = 'APP_MODEL_LIST_CHANGE'; diff --git a/pages/appPage/src/store/modelList/reducers.ts b/pages/appPage/src/store/modelList/reducers.ts new file mode 100644 index 0000000000000000000000000000000000000000..d69e0f3ceb005f0ff026d9d36d48c5ee74469342 --- /dev/null +++ b/pages/appPage/src/store/modelList/reducers.ts @@ -0,0 +1,30 @@ +import { actionUpdateModelList } from './action'; +import { APP_MODEL_LIST_CHANGE } from './constant'; + +export interface IAppModelList { + modelList?: { + id: string; + name: string; + }[]; + modelPicMap: Map; +} + +export const initialState: IAppModelList = { + modelList: undefined, + modelPicMap: new Map() +}; + +export function modelListReducers( + state = initialState, + action: ReturnType +) { + switch (action.type) { + case APP_MODEL_LIST_CHANGE: { + return { + ...state, + ...action.value, + }; + } + } + return state; +} diff --git a/pages/appPage/src/store/reducers.ts b/pages/appPage/src/store/reducers.ts index 982589ebf7eef832356569181f5b1d3c6a058fac..2f455c5eff21c2042c0ea644327c1755fa1996e2 100644 --- a/pages/appPage/src/store/reducers.ts +++ b/pages/appPage/src/store/reducers.ts @@ -2,11 +2,13 @@ import { combineReducers } from 'redux'; import { intersectedReducer as splitOrderData } from './splitOrderData/reducers'; import { selectionReducers as selection } from './selection/reducers'; import { viewedModelReducers as viewedModel } from './viewed/reducers'; +import { modelListReducers as modelList } from './modelList/reducers'; const allState = { selection, splitOrderData, viewedModel, + modelList }; // 初始状态值 diff --git a/pages/appPage/src/util/actionHelper.ts b/pages/appPage/src/util/actionHelper.ts new file mode 100644 index 0000000000000000000000000000000000000000..2c60ec0c2f2c950555075eba79fd5be805df7acf --- /dev/null +++ b/pages/appPage/src/util/actionHelper.ts @@ -0,0 +1,62 @@ +import type { Dispatch } from 'redux'; +import { ModelService } from '@manycore/custom-sdk'; +import { getApplication } from '../core/app'; +import { actionUpdateModelList } from '../store/modelList/action'; +import { IRootState } from '../store/reducers'; +import { getFittingDataFromAuxiliary, getModelJson, getTopModelsLiteInfoAsync } from './vmapi'; +import { actionSetSplitOrderData } from '../store/splitOrderData/action'; + +export function actionInitModelListAsync(dispatch: Dispatch, getState: () => IRootState) { + return async function (changedIds?: string[]) { + const { data: models } = await getTopModelsLiteInfoAsync({ size: -1 }); + dispatch(actionUpdateModelList({ modelList: models.map(({ id, name }) => ({ id, name })) })); + + const modelService = getApplication().getService(ModelService); + models.forEach(async (m) => { + const { modelPicMap } = getState().modelList; + if (changedIds && !changedIds.includes(m.id)) { + return; + } + + const [selectedModelImgData] = await modelService.getParamModelPhotoById(m.id); + modelPicMap.set(selectedModelImgData.modelId, selectedModelImgData.imgData) + dispatch(actionUpdateModelList({ modelPicMap: new Map(modelPicMap) })); + }); + return models; + } +} + +export function actionInitSplitDataAsync(dispatch: Dispatch, getState: () => IRootState) { + return async function (modelId: string) { + async function getIntersectedData(id: string) { + const modelService = getApplication().getService(ModelService); + try { + const intersected = await modelService.getParamIntersected({ + modelId: id, + tolerance: 0.1, + faceDistTol: 0.1, + bodyDistTol: 0.1, + }); + return intersected!; + } catch (err) { + console.log('eder 加载交接数据失败', err); + } + } + const [jsonData, intersectData, fittingFromAuxiliary] = await Promise.all([ + getModelJson(modelId), + getIntersectedData(modelId), + getFittingDataFromAuxiliary({ modelId }), + ]); + + dispatch(actionSetSplitOrderData({ + intersectData: intersectData, + jsonData: jsonData, + fittingFromAuxiliary: fittingFromAuxiliary, + })); + return { + jsonData, + intersectData, + fittingFromAuxiliary + } + } +} \ No newline at end of file diff --git a/pages/appPage/src/util/customModelRecorder.ts b/pages/appPage/src/util/customModelRecorder.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c9d33959fd27bed7af3892d3d7e4701ed764d70 --- /dev/null +++ b/pages/appPage/src/util/customModelRecorder.ts @@ -0,0 +1,120 @@ +import { getCustomModelAddedEvent, getCustomModelDeleteEvent, getCustomModelUpdateEvent } from "./vmapi"; +import { EventEmitter } from 'eventemitter3'; + +enum EChangedType { + Added = 'added', + Deleted = 'deleted', + Updated = 'updated' +} + +type IChangedElements = Record; + +const emitter = new EventEmitter(); +const changedEvent = Symbol('changed'); +const changedDocument = new Map(); +let isStart: boolean = false; + +function transactChange(id: string, type: EChangedType) { + const changeQueue = changedDocument.get(id); + if (changeQueue) { + changeQueue.push(type); + } else { + changedDocument.set(id, [type]); + } +} + +function startRecord() { + if (isStart) { + return; + } + isStart = true; + const handleCustomModelAdded = (elementIds: IDP.DB.Types.ElementId[]) => { + elementIds.forEach(({ id }) => { + transactChange(id, EChangedType.Added); + }); + emitter.emit(changedEvent); + } + const handleCustomModelUpdate = (elementIds: IDP.DB.Types.ElementId[]) => { + elementIds.forEach(({ id }) => { + transactChange(id, EChangedType.Updated); + }); + emitter.emit(changedEvent); + } + const handleCustomModelDelete = (elementIds: IDP.DB.Types.ElementId[]) => { + elementIds.forEach(({ id }) => { + transactChange(id, EChangedType.Deleted); + }); + emitter.emit(changedEvent); + } + getCustomModelAddedEvent().on(handleCustomModelAdded); + getCustomModelUpdateEvent().on(handleCustomModelUpdate); + getCustomModelDeleteEvent().on(handleCustomModelDelete); +}; + + +function flush(callback: (changed: IChangedElements) => void) { + const changed = getChanged(); + callback(changed); + changedDocument.clear(); +} + +function getChanged(): IChangedElements { + const changed: IChangedElements = { + added: [], + deleted: [], + updated: [] + } + + changedDocument.forEach((changedQueue, id) => { + if (!changedQueue.length) { + return; + } + const length = changedQueue.length; + if (length === 1) { + changed[changedQueue[0]].push(id); + return; + } + const first = changedQueue[0]; + const last = changedQueue[length - 1]; + const middle = changedQueue.slice(1, -1); + if (first === EChangedType.Added) { + // 新增的模型最后仍然存在 + if (last !== EChangedType.Deleted) { + changed[EChangedType.Added].push(id); + } + return; + } + if (first === EChangedType.Updated) { + if (last === EChangedType.Deleted) { + changed[EChangedType.Deleted].push(id); + } else { + changed[EChangedType.Updated].push(id); + } + return; + } + if (first === EChangedType.Deleted) { + if (last === EChangedType.Deleted) { + changed[EChangedType.Deleted].push(id); + } else { + const isUpdated = [...middle, ...last].includes(EChangedType.Updated); + if (isUpdated) { + changed[EChangedType.Updated].push(id); + } + } + return; + } + }); + + return changed; +} + +function onChange(func: () => void) { + emitter.on(changedEvent, func); +} + +export default { + startRecord, + flush, + onChange, + getChanged +} \ No newline at end of file diff --git a/pages/appPage/src/util/vmapi.ts b/pages/appPage/src/util/vmapi.ts index 4376b0696792f64a5dc34193166ccc0abb718e1a..1eef304da27f0bbf533443fe67f35ec6608b63a5 100644 --- a/pages/appPage/src/util/vmapi.ts +++ b/pages/appPage/src/util/vmapi.ts @@ -1,12 +1,11 @@ import { slave } from '../salve'; import { - BomService, - ExportService, - FittingDesignService, - FopOrderService, + EventService, ExportService, FittingDesignService, CustomModelService, IGetTopModelsLiteInfoAsyncParameters, DesignService, BomService, + FopOrderService } from '@manycore/pages-vm-api'; import { IFittingDesignDataV2, IGrooveDataV2, IHoleDataV2 } from '@manycore/custom-sdk'; + /** * 自定义属性数据 */ @@ -89,6 +88,23 @@ export const deleteDesignDataAsync = async (ids: string[]): Promise => { return slave.getService(FittingDesignService)!.deleteDesignDataAsync(ids); }; +export const getTopModelsLiteInfoAsync = async (option: IGetTopModelsLiteInfoAsyncParameters) => { + return slave.getService(CustomModelService)!.getTopModelsLiteInfoAsync(option); +}; + +export const getCustomModelByModelIdAsync = async (id: string) => { + return slave.getService(CustomModelService)!.getCustomModelByModelIdAsync(id); +}; + +export const saveDesign = async () => { + return slave.getService(DesignService)!.save(); +}; + +export const getCustomModelAddedEvent = () => slave.getService(EventService)!.customModelAdded; +export const getCustomModelUpdateEvent = () => slave.getService(EventService)!.customModelUpdate; +export const getCustomModelDeleteEvent = () => slave.getService(EventService)!.customModelDelete; +export const getDesignSavedEvent = () => slave.getService(EventService)!.designSaved; +export const getOrderModelUpdateEvent = () => slave.getService(EventService)!.orderModelUpdate; export const createMaterialsAsync = async (option: any) => { return slave.getService(BomService)!.createMaterialsAsync(option); }; diff --git a/pages/appPage/src/views/App.tsx b/pages/appPage/src/views/App.tsx index 94617889ac8ccfb8b7473b8bd85a1826b4377e7c..6d87cc3670b7b4d9bcec87ee1be673874fcbc00e 100644 --- a/pages/appPage/src/views/App.tsx +++ b/pages/appPage/src/views/App.tsx @@ -2,10 +2,12 @@ import { Provider } from 'react-redux'; import { store } from '../store'; import './global.scss'; import Main from './main'; +import { CustomModelListener } from './listener'; function App() { return ( +
); diff --git a/pages/appPage/src/views/header/index.module.scss b/pages/appPage/src/views/header/index.module.scss new file mode 100644 index 0000000000000000000000000000000000000000..a19f2def595d1b04f1e5ce4369d83967595468c5 --- /dev/null +++ b/pages/appPage/src/views/header/index.module.scss @@ -0,0 +1,14 @@ +.headerContainer { + position: relative; + + .headerButtonGroup { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + + :not(:first-child) { + margin-left: 10px; + } + } +} \ No newline at end of file diff --git a/pages/appPage/src/views/header/index.tsx b/pages/appPage/src/views/header/index.tsx index f2b815aff60176a90373fda62fd8a69688816fa1..3b40d720dbf247c7873c2e3156c24ec56d03125b 100644 --- a/pages/appPage/src/views/header/index.tsx +++ b/pages/appPage/src/views/header/index.tsx @@ -1,3 +1,78 @@ +import Button from "antd/es/button"; +import { useEffect, useState } from "react"; +import { useDispatch, useStore } from "react-redux"; +import { getApplication } from "../../core/app"; +import { DetectionService, ModelViewerService } from "@manycore/custom-sdk"; +import message from "antd/es/message"; +import style from './index.module.scss'; +import { saveDesign } from "../../util"; +import { actionInitSplitDataAsync } from "../../util/actionHelper"; + +const DEFAULT_PASS_STATE = false; export function Header() { - return
小程序演示
; + const dispatch = useDispatch(); + const store = useStore(); + + const [isPass, setIsPass] = useState(DEFAULT_PASS_STATE); + const [loading, setLoading] = useState(false) + const viewModelById = store.getState().viewedModel.viewedModelId; + + useEffect(() => { + setIsPass(DEFAULT_PASS_STATE); + }, [viewModelById]) + + /** 开启检测相关 */ + useEffect(() => { + const detectionService = getApplication().getService(DetectionService); + // 设置检测面板 + detectionService.setDetectionUI({ + message: '模型数据更新提示', + description: '设计方案中的模型数据已更新,建议完成模型数据更新后继续操作', + defaultPosition: { + x: window.innerWidth - 372, + y: 12 + } + }); + // 开启检测 + detectionService.enableDetection(); + // 监听检测结果 + detectionService.onAfterDetect((detectResult) => { + const { productId, result } = detectResult; + const tips = result + ? `产品:${productId}检测通过` + : `产品:${productId}检测未通过,请检查是否保存方案/获取最新产品数据`; + message.info(tips); + if (productId === store.getState().viewedModel.viewedModelId) { + setIsPass(result); + } + }); + }, []); + + const handleRefresh = async () => { + try { + if (!viewModelById) { + return; + } + setLoading(true); + await saveDesign(); + const app = getApplication(); + // 刷新展示数据 + await app.getService(ModelViewerService).refreshModel(); + // 重新获取交界面、JSON等 + await actionInitSplitDataAsync(dispatch, store.getState)(viewModelById); + message.success('刷新成功'); + } catch (err) { + message.error('刷新失败'); + } finally { + setLoading(false); + } + } + + return
+ 小程序演示 + {viewModelById && + + + } +
; } diff --git a/pages/appPage/src/views/leftPanel/index.tsx b/pages/appPage/src/views/leftPanel/index.tsx index e380503a6ad17a02afc26ed888ddf9668f895c9e..74cdd8c88da0defb3eaf3651507d97193ca81177 100644 --- a/pages/appPage/src/views/leftPanel/index.tsx +++ b/pages/appPage/src/views/leftPanel/index.tsx @@ -1,29 +1,32 @@ -import { ITopParamModelList, ModelService } from '@manycore/custom-sdk'; -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import { getApplication } from '../../core/app'; import Spin from 'antd/es/spin'; import style from './index.module.scss'; import { Card } from '../../components/Card'; -import { connect } from 'react-redux'; +import { connect, useDispatch, useStore } from 'react-redux'; import { actionUpdateViewed } from '../../store/viewed/action'; import { actionSetSplitOrderData } from '../../store/splitOrderData/action'; import { initialState as splitInitState } from '../../store/splitOrderData/reducers'; import { actionUpdateSelected } from '../../store/selection/action'; import { initialState as selectionInitState } from '../../store/selection/reducers'; import { MiniAppSelectModelService } from '@manycore/custom-miniapp-sdk'; +import { actionInitModelListAsync } from '../../util/actionHelper'; +import customModelRecorder from '../../util/customModelRecorder'; +import { getDesignSavedEvent, getOrderModelUpdateEvent } from '../../util'; +import { debounce } from 'lodash'; +import { ModelViewerService } from '@manycore/custom-sdk'; interface IProps { + models?: { id: string; name: string }[]; + modelPicMap: Map; updateActiveModel: (id: string) => void; activeModelId?: string; } -const modelService = getApplication().getService(ModelService); const DEFAULT_LOADING_IMG = '//qhstaticssl.kujiale.com/image/png/1701690031959/A52587539A84579724C2E87B59176BD3.png'; function LeftPanel(props: IProps) { - const { activeModelId, updateActiveModel } = props; - const [models, setModels] = useState(); - const [modelPic, setModelPic] = useState>(new Map()); + const { activeModelId, updateActiveModel, models, modelPicMap } = props; useEffect(() => { const selectedService = @@ -35,55 +38,61 @@ function LeftPanel(props: IProps) { }); }, []); + const dispatch = useDispatch(); + const store = useStore(); + useEffect(() => { - const getAllTopModelsList = async () => { - let num = 1; - const pageSize = 20; - let models: ITopParamModelList[] = []; - while (true) { - const { hasMore, result } = await modelService.getTopParamModels({ - pageNum: num, - pageSize, - }); - models.push(...result); - if (hasMore) { - num++; - } else { - break; - } - } - return models; - }; + actionInitModelListAsync(dispatch, store.getState)(); + }, []); + - getAllTopModelsList().then((models) => { - setModels(models); + useEffect(() => { + // 保存自动刷新左侧列表 + const handleModelChanged = debounce(() => { + customModelRecorder.flush(async ({ + added, deleted, updated + }) => { + if (added.length === 0 && deleted.length === 0 && updated.length === 0) { + return; + } + try { + // 刷新产品列表 + 缩略图 + await actionInitModelListAsync(dispatch, store.getState)([...added, ...deleted, ...updated]); - models.forEach(async (m) => { - const [selectedModelImgData] = await modelService.getParamModelPhotoById(m.id); - setModelPic((prev) => { - const newModelPicMap = new Map(prev.entries()); - newModelPicMap.set(m.id, selectedModelImgData.imgData); - return newModelPicMap; - }); + if (deleted.length) { + // 当前拆单展示的模型被删除,需要将当前展示对象设置成空 + const viewedModelId = store.getState().viewedModel.viewedModelId; + if (viewedModelId && deleted.includes(viewedModelId)) { + dispatch(actionUpdateViewed({ viewedModelId: undefined })); + const app = getApplication(); + await app.getService(ModelViewerService).refreshModel(); + } + } + } catch (err) { + } finally { + } }); - }); - }, []); + }, 1000); + customModelRecorder.startRecord(); + getDesignSavedEvent().on(handleModelChanged); + getOrderModelUpdateEvent().on(handleModelChanged); + }, []) - const handleViewModel = (model: ITopParamModelList) => { - updateActiveModel(model.id); + const handleViewModel = (id: string) => { + updateActiveModel(id); }; return models === undefined ? ( ) : (
- {models?.map((model) => ( + {models?.map(({ id, name }) => ( handleViewModel(model)} - active={model.id === activeModelId} - img={modelPic.get(model.id) || DEFAULT_LOADING_IMG} - title={model.name} + key={id} + onClick={() => handleViewModel(id)} + active={id === activeModelId} + img={modelPicMap.get(id) || DEFAULT_LOADING_IMG} + title={name} /> ))}
@@ -94,6 +103,8 @@ export default connect( (state) => { return { activeModelId: state.viewedModel.viewedModelId, + models: state.modelList.modelList, + modelPicMap: state.modelList.modelPicMap }; }, (dispatch, props) => { @@ -107,7 +118,7 @@ export default connect( viewedModelId: id, }) ); - }, + } }; } )(LeftPanel); diff --git a/pages/appPage/src/views/listener/index.tsx b/pages/appPage/src/views/listener/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..9aa83661e570133fc98775ff2751edc19c8e8e51 --- /dev/null +++ b/pages/appPage/src/views/listener/index.tsx @@ -0,0 +1,136 @@ +import style from './index.module.scss'; +import Button from 'antd/es/button/button'; +import Message from 'antd/es/message'; +import { useEffect, useState } from 'react'; +import { getCustomModelAddedEvent, getCustomModelDeleteEvent, getCustomModelUpdateEvent, getDesignSavedEvent, getOrderModelUpdateEvent, saveDesign } from '../../util'; +import { debounce } from 'lodash'; +import customModelRecorder from '../../util/customModelRecorder'; +import { useDispatch, useStore } from 'react-redux'; +import { actionInitModelListAsync, actionInitSplitDataAsync } from '../../util/actionHelper'; +import { getApplication } from '../../core/app'; +import { FittingViewerService, ModelViewerService } from '@manycore/custom-sdk'; +import { actionUpdateViewed } from '../../store/viewed/action'; + +// export function CustomModelListener() { +// const [changed, setChanged] = useState(false); +// const [loading, setLoading] = useState(false); +// const dispatch = useDispatch(); +// const store = useStore(); + +// useEffect(() => { +// customModelRecorder.startRecord(); +// customModelRecorder.onChange(() => { +// setChanged(true); +// }); + +// function checkRecordEmpty() { +// const currentChanged = customModelRecorder.getChanged(); +// if (currentChanged.added.length === 0 && currentChanged.deleted.length === 0 && currentChanged.updated.length === 0) { +// setChanged(false); +// } +// } + +// const handleModelChanged = debounce(() => { +// customModelRecorder.flush(async ({ +// added, deleted, updated +// }) => { +// if (added.length === 0 && deleted.length === 0 && updated.length === 0) { +// checkRecordEmpty(); +// return; +// } +// try { +// // 说明有模型变化,需要针对性清除孔槽、重新获取JSON等等可能会影响到拆单的操作 +// setLoading(true); +// const viewedModelId = store.getState().viewedModel.viewedModelId; +// const app = getApplication(); + +// // 刷新产品列表 + 缩略图 +// await actionInitModelListAsync(dispatch, store.getState)([...added, ...deleted, ...updated]); +// if (added.length) { +// // 新增: 1、刷新产品列表 2、其他影响拆单数据刷新 +// } +// if (deleted.length) { +// // 删除: 1、刷新产品列表 2、移除被删除模型的拆单数据 3、其他影响拆单数据刷新 +// deleted.forEach(delId => { +// // TODO: 清除这些被删除的拆单数据 +// }); + +// // 当前拆单展示的模型被删除,需要将当前展示对象设置成空 +// if (viewedModelId && deleted.includes(viewedModelId)) { +// dispatch(actionUpdateViewed({ viewedModelId: undefined })); +// await app.getService(ModelViewerService).refreshModel(); +// } + +// } +// if (updated.length) { +// // 变化:1、清除变化模型的“缓存”数据(JSON、交界面) 2、重新获取JSON和交界面 3、其他影响拆单数据刷新 +// updated.forEach(updateId => { +// // TODO: 处理这些被更新的拆单数据 +// }); + +// // 当前拆单展示的模型更新,需要将当前展示数据进行还原刷新 +// if (viewedModelId && updated.includes(viewedModelId)) { +// // 清空临时孔槽、交界面数据 +// await app.getService(FittingViewerService).clearFitting(); +// await app.getService(FittingViewerService).clearHardware(); +// // 刷新展示数据 +// await app.getService(ModelViewerService).refreshModel(); +// // 重新获取交界面、JSON等 +// await actionInitSplitDataAsync(dispatch, store.getState)(viewedModelId); +// } +// } +// checkRecordEmpty(); +// Message.success('刷新拆单数据成功'); +// } catch (err) { +// Message.error('刷新拆单数据失败'); +// console.error(err); +// } finally { +// setLoading(false); +// } +// }); +// }, 1000); + +// getDesignSavedEvent().on(handleModelChanged); +// getOrderModelUpdateEvent().on(handleModelChanged); +// }, []); + +// const refresh = () => { +// setLoading(true); +// saveDesign(); +// } + +// return changed ?
+// 模型数据发生变化,请保存方案或者点击下方按钮刷新拆单数据 +// +//
: null; +// } + +export function CustomModelListener() { + const [changed, setChanged] = useState(false); + const [loading, setLoading] = useState(false); + const dispatch = useDispatch(); + const store = useStore(); + + useEffect(() => { + // const handleModelChanged = debounce(() => { + // customModelRecorder.flush(async ({ + // added, deleted, updated + // }) => { + // if (added.length === 0 && deleted.length === 0 && updated.length === 0) { + // return; + // } + // try { + // // 刷新产品列表 + 缩略图 + // await actionInitModelListAsync(dispatch, store.getState)([...added, ...deleted, ...updated]); + // } catch (err) { + // } finally { + // } + // }); + // }, 1000); + // customModelRecorder.startRecord(); + // getDesignSavedEvent().on(handleModelChanged); + // getOrderModelUpdateEvent().on(handleModelChanged); + }, []); + + return null; +} \ No newline at end of file diff --git a/pages/appPage/src/views/main/index.tsx b/pages/appPage/src/views/main/index.tsx index 33276b8d96167cfd38ec5dfd090764ba081680fa..32c54216f39fb51f31b66cdc41869be43af33a19 100644 --- a/pages/appPage/src/views/main/index.tsx +++ b/pages/appPage/src/views/main/index.tsx @@ -1,5 +1,4 @@ import { - DetectionService, ECameraMoveDirection, EElementType, FittingDesignService, @@ -10,7 +9,6 @@ import { ModelViewerSelectionV2Service, ModelViewerService, } from '@manycore/custom-sdk'; -import message from 'antd/es/message'; import { castArray } from 'lodash'; import { useCallback, useEffect } from 'react'; import { connect } from 'react-redux'; @@ -108,30 +106,6 @@ export function Main(props: IMainProps) { }); }, []); - /** 开启检测相关 */ - useEffect(() => { - const detectionService = getApplication().getService(DetectionService); - // 设置检测面板 - detectionService.setDetectionUI({ - message: '模型数据更新提示', - description: '设计方案中的模型数据已更新,建议完成模型数据更新后继续操作', - defaultPosition: { - x: window.innerWidth - 372, - y: 12 - } - }); - // 开启检测 - detectionService.enableDetection(); - // 监听检测结果 - detectionService.onAfterDetect((detectResult) => { - const { productId, result } = detectResult; - const tips = result - ? `产品:${productId}检测通过` - : `产品:${productId}检测未通过,请检查是否保存方案/获取最新产品数据`; - message.info(tips); - }); - }, []); - return ( { private init = async (id: string) => { // 准备拆单数据 - const [jsonData, intersected, fittingFromAuxiliary, [fittingDataV2]] = await Promise.all([ - getModelJson(id), - this.getIntersected({ modelId: id }), - getFittingDataFromAuxiliary({ modelId: id }), - findDesignDataAsync([id]), - ]); - + const [fittingDataV2] = await findDesignDataAsync([id]); store.dispatch( actionSetSplitOrderData({ - intersectData: intersected, - jsonData: jsonData, - fittingFromAuxiliary: fittingFromAuxiliary, fittingDesignDataV2: fittingDataV2, }) ); - // 将fittingDesign渲染到场景中 fittingDataV2?.fittingDesign.forEach((fittingData) => { getApplication().getService(FittingViewerService).addFitting(fittingData); }); - }; - private getIntersected = async (option: IGetModelIntersectedOption) => { - const modelService = getApplication().getService(ModelService); - try { - const intersected = await modelService.getParamIntersected({ - ...option, - tolerance: option.tolerance ?? 0.1, - faceDistTol: option.faceDistTol ?? 0.1, - bodyDistTol: option.bodyDistTol ?? 0.1, - }); - return intersected!; - } catch (err) { - console.log('eder 加载交接数据失败', err); - } + actionInitSplitDataAsync(store.dispatch as Dispatch, store.getState)(id); }; render() { diff --git a/yarn.lock b/yarn.lock index be89a0ac8daa21f6118d4b9dfc768ac2d75aa567..0c976d55369b4c295f7a177b42ab6028f964af62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1242,7 +1242,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.14.6" resolved "https://registry.nlark.com/@babel/runtime/download/@babel/runtime-7.14.6.tgz#535203bc0892efc7dec60bdc27b2ecf6e409062d" integrity sha1-U1IDvAiS78fexgvcJ7Ls9uQJBi0= @@ -1256,6 +1256,13 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/runtime@^7.15.4": + version "7.25.7" + resolved "https://r.cnpmjs.org/@babel/runtime/-/runtime-7.25.7.tgz#7ffb53c37a8f247c8c4d335e89cdf16a2e0d0fb6" + integrity sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.10.4", "@babel/template@^7.14.5", "@babel/template@^7.3.3": version "7.14.5" resolved "https://registry.nlark.com/@babel/template/download/@babel/template-7.14.5.tgz?cache=0&sync_timestamp=1623280386138&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Ftemplate%2Fdownload%2F%40babel%2Ftemplate-7.14.5.tgz#a9bc9d8b33354ff6e55a9c60d1109200a68974f4" @@ -1908,9 +1915,9 @@ "@types/node" "*" "@types/hoist-non-react-statics@^3.3.0": - version "3.3.1" - resolved "https://registry.nlark.com/@types/hoist-non-react-statics/download/@types/hoist-non-react-statics-3.3.1.tgz?cache=0&sync_timestamp=1621241339435&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fhoist-non-react-statics%2Fdownload%2F%40types%2Fhoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" - integrity sha1-ESSq/lEYy1kZd66xzqrtEHDrA58= + version "3.3.5" + resolved "https://r.cnpmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz#dab7867ef789d87e2b4b0003c9d65c49cc44a494" + integrity sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg== dependencies: "@types/react" "*" hoist-non-react-statics "^3.3.0" @@ -2009,10 +2016,10 @@ dependencies: "@types/react" "*" -"@types/react-redux@^7.1.16": - version "7.1.18" - resolved "https://registry.nlark.com/@types/react-redux/download/@types/react-redux-7.1.18.tgz#2bf8fd56ebaae679a90ebffe48ff73717c438e04" - integrity sha1-K/j9Vuuq5nmpDr/+SP9zcXxDjgQ= +"@types/react-redux@^7.1.20": + version "7.1.34" + resolved "https://r.cnpmjs.org/@types/react-redux/-/react-redux-7.1.34.tgz#83613e1957c481521e6776beeac4fd506d11bd0e" + integrity sha512-GdFaVjEbYv4Fthm2ZLvj1VSCedV7TqE5y1kNwnjSdBOTXuRSgowux6J8TAct15T3CKBr63UMk+2CO7ilRhyrAQ== dependencies: "@types/hoist-non-react-statics" "^3.3.0" "@types/react" "*" @@ -6312,8 +6319,8 @@ hmac-drbg@^1.0.1: hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: version "3.3.2" - resolved "https://registry.nlark.com/hoist-non-react-statics/download/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" - integrity sha1-7OCsr3HWLClpwuxZ/v9CpLGoW0U= + resolved "https://r2.cnpmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" + integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== dependencies: react-is "^16.7.0" @@ -8107,10 +8114,10 @@ merge2@^1.3.0: resolved "https://registry.npm.taobao.org/merge2/download/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha1-Q2iJL4hekHRVpv19xVwMnUBJkK4= -message-lite@0.0.1: - version "0.0.1" - resolved "https://r2.cnpmjs.org/message-lite/-/message-lite-0.0.1.tgz#c8235ffc005edc467299a4f57596add5fbb40fcd" - integrity sha512-QO2EY/qGWFaFI4szED2y1f5Gb86IksUQ9XcNKLoSsNeH4gp2v9IuNcxgDo/e8RgHtHPBqO2XEee9UnTP+aYnzg== +message-lite@0.10.5-alpha.2: + version "0.10.5-alpha.2" + resolved "https://r.cnpmjs.org/message-lite/-/message-lite-0.10.5-alpha.2.tgz#dd54d05e7d2229e5f805bef7248ac12411f6258b" + integrity sha512-1sb83h6yKlzt3tmX9bIzGJxM1is7OU2Tcnpje9o/OPcfmNYJasvERHK/mwL3gdwJpAS0/Pi8pYMsIZUXW/XmSg== methods@~1.1.2: version "1.1.2" @@ -10509,12 +10516,12 @@ react-error-overlay@^6.0.9: resolved "https://registry.nlark.com/react-error-overlay/download/react-error-overlay-6.0.9.tgz?cache=0&sync_timestamp=1618847933355&other_urls=https%3A%2F%2Fregistry.nlark.com%2Freact-error-overlay%2Fdownload%2Freact-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" integrity sha1-PHQwEMk1lgjDdezWvHbzXZOZWwo= -react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.1: +react-is@^16.7.0, react-is@^16.8.1: version "16.13.1" resolved "https://registry.nlark.com/react-is/download/react-is-16.13.1.tgz?cache=0&sync_timestamp=1626193121951&other_urls=https%3A%2F%2Fregistry.nlark.com%2Freact-is%2Fdownload%2Freact-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha1-eJcppNw23imZ3BVt1sHZwYzqVqQ= -react-is@^17.0.1: +react-is@^17.0.1, react-is@^17.0.2: version "17.0.2" resolved "https://registry.nlark.com/react-is/download/react-is-17.0.2.tgz?cache=0&sync_timestamp=1626193121951&other_urls=https%3A%2F%2Fregistry.nlark.com%2Freact-is%2Fdownload%2Freact-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha1-5pHUqOnHiTZWVVOas3J2Kw77VPA= @@ -10525,16 +10532,16 @@ react-is@^18.2.0: integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== react-redux@^7.2.1: - version "7.2.4" - resolved "https://registry.nlark.com/react-redux/download/react-redux-7.2.4.tgz#1ebb474032b72d806de2e0519cd07761e222e225" - integrity sha1-HrtHQDK3LYBt4uBRnNB3YeIi4iU= + version "7.2.9" + resolved "https://r.cnpmjs.org/react-redux/-/react-redux-7.2.9.tgz#09488fbb9416a4efe3735b7235055442b042481d" + integrity sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ== dependencies: - "@babel/runtime" "^7.12.1" - "@types/react-redux" "^7.1.16" + "@babel/runtime" "^7.15.4" + "@types/react-redux" "^7.1.20" hoist-non-react-statics "^3.3.2" loose-envify "^1.4.0" prop-types "^15.7.2" - react-is "^16.13.1" + react-is "^17.0.2" react-refresh@^0.8.3: version "0.8.3" @@ -10640,9 +10647,9 @@ redent@^3.0.0: strip-indent "^3.0.0" redux@^4.0.0, redux@^4.0.5: - version "4.1.0" - resolved "https://registry.nlark.com/redux/download/redux-4.1.0.tgz?cache=0&sync_timestamp=1619286844146&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fredux%2Fdownload%2Fredux-4.1.0.tgz#eb049679f2f523c379f1aff345c8612f294c88d4" - integrity sha1-6wSWefL1I8N58a/zRchhLylMiNQ= + version "4.2.1" + resolved "https://r.cnpmjs.org/redux/-/redux-4.2.1.tgz#c08f4306826c49b5e9dc901dee0452ea8fce6197" + integrity sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w== dependencies: "@babel/runtime" "^7.9.2"