IParamModelLite 接口
interface IParamModelLite
对定制参数化模型进行精简处理后的结果 CustomModel @vm-type CustomModel
属性
category
category: number;
当前模型所处的真分类信息
id
readonly id: string;
模型的唯一标识ID 如果模型是从方案当中获取至的,则为模型在方案中的ID,非方案模型,将会随机生成ID
string
isHidden
isHidden?: boolean;
此字段只有当模型从工具场景中获取,才具有意义 当前模型在工具当中的显示与隐 藏状态;如果为true,则表示为隐藏状态
isRoot
isRoot?: boolean;
当前模型是否为root节点,如果是,则为true
legal
readonly legal?: boolean;
当前模型是否是合法(隐藏)模型
boolean
modelType
modelType?: EParamModelType;
模型类型,仅为从方案中获取模型才具备意义
EParamModelType
类型: EParamModelType
productId
readonly productId?: string;
商品ID,即商品后台的商品ID
size
readonly size: Number3;
当前尺寸信息
Number3
类型: Number3
toolType
toolType?: EToolType;
当前模型所处的定制行业线
类型: EToolType
type
type: ECustomModelType;
定制模型类型,在 基础上进行了细分
ECustomModelType
类型: ECustomModelType
version
readonly version: number;
模型版本信息
number
方法
appendAccessory
appendAccessory(accessory: this): void;
向当前模型中,添加一个非原生模型;一般会使用在添加五金
参数:
-
accessory: this待添加的模型
返回值: void
appendChild
appendChild(child: this): void;
向当前模型中,添加一个子模型;一般会向包裹层当中,添加子模型;另外,五金配件,也必须使用此方法添加
参数:
-
child: this待添加的模型
返回值: void
clone
clone(): this;
模型的复制,返回一个新的ParamModel对象
返回值: this
deserialize
deserialize(model: string): this;
将一个序列化之后的模型,进行反序列化操作
参数:
model: string
返回值: this
dispose
dispose(): void;
将当前模型与父级模型断开联系 可以更直接的理解为:删除当前模型 > 针对clone()后的对象,作dispose()操作,将不会产生任何作用
返回值: void
forceUpdate
forceUpdate(update?: boolean): void;
刷新某个模型,此API仅适用于反向对接的模型: 当前某个模型在后台更新了,但用户方案中,存储的仍然是之前的版本,调用此方法后,会自动将当前模型更新成后台最新的版本。 > 需要注意的是,此方法会导致更新后,模型ID存在变化 > 模型中,添加的appendChild或addAccessory等参数,可能会失效不起作用
参数:
update: boolean
返回值: void
getAccessory
getAccessory(): this[];
获取当前模型下的所有非原生模型 说明一下:非原生模型可以大致理解为:在方案当中,手动生成一个模型,添加到其他模型上;与之对应子模型可以理解为原生模型,即参数 化编辑中自带的模型
返回值: this[]
getBzProperty
getBzProperty(name: string, namespace?: string): IBzParamModelLiteProperty | undefined;
获取用户自定义属性
参数:
-
name: string属性名称
-
namespace: string命名空间(当不传时,即表示当前小程序下的命名空间,格式如下:miniapp-${appId})
返回值: IBzParamModelLiteProperty | undefined
getChannel
getChannel(): IParamModelLiteChannel | undefined;
获取模型取渠道
返回值: IParamModelLiteChannel | undefined
getChild
getChild(): this[];
获取当前模型的所有子模型
返回值: this[]
getElementId
getElementId(): ElementId | undefined;
获取设计对象id
返回值: ElementId | undefined
getFloorplanRelation
getFloorplanRelation(): Readonly<IFloorplanRelation> | undefined;
获取户型关系
返回值: Readonly<IFloorplanRelation> | undefined
getName
getName(): string;
获取当前模型名称
返回值: string
getParam
getParam(name: string): IParamModelLiteParam | undefined;
获取当前模型中的参数信息(参数即在参数化编辑中的信息)
参数:
-
name: string参数名称
返回值: IParamModelLiteParam | undefined
示例
m.getParam('W') 获取模型的宽度信息
getParent
getParent(): this | undefined;
查找当前模型的父节点
返回值: this | undefined
getPlankPathAsync
getPlankPathAsync(): Promise<IParamModelLitePlankPath | undefined>;
获取当前模型中的板件轮廓信息
返回值: Promise<IParamModelLitePlankPath | undefined>
getPosition
getPosition(): Number3;
获取当前模型的坐标信息 Number3 相对父模型坐标,如果为顶层模型,则为世界坐标
返回值: Number3