KDesign
kds-plugin-document / Exports / KDesign
Interface: KDesign
KDesign 代表酷大师方案数据。从这里我们可以调用酷大师的各种建模命令,如拉伸、扫掠、布尔等,对方案数据进行修改
The KDesign class is the interface to a KuDaShi model, and from here you can use the model-level methods to start getting information and making changes. NOTE: The entity you are operating must be in active definition, or an Error will be shrew.
Table of contents
Methods
- abortOperation
- activateEditPath
- activateGroupInstance
- addArc
- addAuxiliaryBoundedCurve
- addAuxiliaryLine
- addCircle
- addEdges
- addFaceHoles
- addFaces
- addRoundCorner
- adjustMaterialMapping
- alignShells
- assignDecorationMaterialForEntities
- assignMaterialForEntities
- assignMaterialForFaces
- assignMaterialForGroupInstance
- boolean
- breakGroup
- breakGroupReference
- brushDecorationMaterialToEntities
- bulkCopyGroupInstances
- clearMaterial
- commitOperation
- copyAuxiliaryCurves
- copyFaces
- copyGroupInstances
- createEmptyGroupInstance
- createInstanceFromAnotherProject
- createInstanceFromExternalResources
- createShellFromMesh
- deactivateGroupInstance
- editMaterialParamsOfFace
- enterExpressMode
- executeRequest
- exitExpressMode
- faceSplitByFace
- faceSplitByGroup
- fillet
- findGroupInstancesByAppKey
- findGroupInstancesByResource
- flipFace
- getActiveGroupDefinition
- getDesignId
- getEditPath
- getEditPathsToGroupInstance
- getFacePavingGroupByFace
- getMaterialOfFace
- getMaterialOfInstance
- getMaterialParamsOfFace
- getShortestPath
- getText3dParams
- getTopGroupDefinition
- getYunDesignInfo
- inflateFaces
- isShellSolid
- loadMaterial
- makeGroup
- mergeFaces
- moveAuxiliaryMiddlePoint
- moveAuxiliaryVertex
- moveEdge
- moveFace
- moveVertices
- offset
- pullPushFace
- removeAuxiliaryCurve
- removeEdge
- removeEdges
- removeFaces
- removeGroupInstance
- reparentGroupInstance
- save
- saveInstanceAsLibraryProject
- setEdgesSoft
- setSoftEdgesVisible
- setVerticesSoft
- shareModel
- splitEdge
- startOperation
- sweepFollowCurves
- sweepFollowEdges
- thickenFaces
- toggleEntitiesVisible
- toggleGroupInstancesVisible
- transformActiveGroupDefinition
- transformAuxiliaryCurves
- transformGroupInstances
- transformShells
- transformVertices
- uploadMaterial
Methods
abortOperation
▸ abortOperation(): void
提前终止一个 undo/redo 的会话 在一个 startOperation 和一个 abortOperation 之间的所有建模操作,都会被 undo 掉,并不会被放到一个 undo/redo 步骤中
The method is used to abort the current operation started with the startOperation method. It is normally called from inside of a rescue clause to cancel an operation if something goes wrong. NOTE: If not in operation, an error will be threw.
Returns
void
Defined in
api.d.ts:1980
activateEditPath
▸ activateEditPath(editPath
): HostPromise
<{ isSuccess
: boolean
}>
设置编辑路径。 编辑路径:
- 从顶层组实例开始,依次为直接包含关系;
- 路径为空表示跳转到顶层编辑状态(完全退出组编辑状态)。
Activate the edit path. Edit path: Start from the top-level groupInstance, sequentially representing direct containment relationships; An empty path indicates a transition to the top-level edit state (completely exiting the group edit state).
Parameters
Name | Type | Description |
---|---|---|
editPath | KGroupInstance [] | The edit path. |
Returns
HostPromise
<{ isSuccess
: boolean
}>
Return an object that contains success flag.
Defined in
api.d.ts:2057
activateGroupInstance
▸ activateGroupInstance(groupInstance
): HostPromise
<{ isSuccess
: boolean
}>
激活一个成组实例。 激活后的成组实例的组定义(KGroupDefinition),即成为当前的活跃成组 (KDesign.getActiveGroupDefinition 的返回值) 这相当于酷大师用户界面上的“进入组编辑”功能
The method is used to activate the group instance. When we activate the input group instance, the groupDefinition got by the KDesign.getActiveGroupDefinition method is the group definition for this input group instance, so anything we do is to edit it. NOTE: we can only activate the group instance in the active group definition, or an Error will be shrew.
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | The input group instance to activate. |
Returns
HostPromise
<{ isSuccess
: boolean
}>
Return an object that contains success flag.
Defined in
api.d.ts:2041
addArc
▸ addArc(arc
, numSegments?
): Object
向当前成组中加入一条圆弧线段 如果圆弧线段和现有的某些边围成了一个封闭的面,则会创建出一个新的面。这个新的面会和已有的面互相分割 numSegments 表示这条圆弧线段将由多少段直线段来表达
The method is used to add an arc curve segment to the active group definition. The area surrounded by edges will automatically generate faces, and at the same time, the generated faces will merged with other intersecting faces.
Parameters
Name | Type | Description |
---|---|---|
arc | KArc3d | The input arc. |
numSegments? | number | the number of line segments the arc is represented by |
Returns
Object
Return an object that contains added edges which define the arc if successful, otherwise return null.
Name | Type |
---|---|
addedEdges | KEdge [] |
Defined in
api.d.ts:1507
addAuxiliaryBoundedCurve
▸ addAuxiliaryBoundedCurve(boundedCurve
, numSegments?
): Object
向当前成组中添加一条参考线段。 如果参考线段是圆弧,则 numSegments 表示这条圆弧线段将由多少段直线段来表达
The method is used to create an auxiliary bounded curve to the active group definition by the input 3D bounded curve.
Parameters
Name | Type |
---|---|
boundedCurve | KBoundedCurve3d |
numSegments? | number |
Returns
Object
Return an object that contains added bounded auxiliary curve if successful, otherwise return null.
Name | Type |
---|---|
addedCurve | KAuxiliaryBoundedCurve |
Defined in
api.d.ts:1540
addAuxiliaryLine
▸ addAuxiliaryLine(line
): Object
向当前成组中添加一条参考直线
The method is used to create an auxiliary Line to the active group definition by the input 3D line.
Parameters
Name | Type | Description |
---|---|---|
line | KLine3d | The input 3D line. |
Returns
Object
Return an object that contains added auxiliary Line if successful, otherwise return null.
Name | Type |
---|---|
addedAuxiliaryLine | KAuxiliaryLine |
Defined in
api.d.ts:1529
addCircle
▸ addCircle(circle
, numSegments?
): Object
向当前成组中加入一个整圆围成的面,这个新的面会和已有的面互相分割 numSegments 表示这个圆将由多少段直线段来表达
The method is used to add a circle curve segment to the active group definition. The area surrounded by edges will automatically generate faces, and at the same time, the generated faces will merged with other intersecting faces.
Parameters
Name | Type | Description |
---|---|---|
circle | KCircle3d | The input circle. |
numSegments? | number | the number of line segments the circle is represented by |
Returns
Object
Return an object that contains added edges which define the circle if successful, otherwise return null.
Name | Type |
---|---|
addedEdges | KEdge [] |
Defined in
api.d.ts:1519
addEdges
▸ addEdges(points
): Object
向当前活跃成组中添加造型边 传入的一组几何点,代表依次相连的一组造型边。这些造型边中如果有封闭的部分,那封闭的区域将自动形成造型面。这些造型面将和场景中原有的面互相分割 注意:
- 传入的所有几何点都必须在一个平面上,否则本方法不起作用,会返回 null
- 如果传入的几何点里,最后一个点和第一个点不重合,则会自动在最后一个点和第一个点之间加上一条边
The method is used to add a set of connected edges to the active group definition by the input points. The area surrounded by edges will automatically generate faces, and at the same time, the generated faces will merged with other intersecting faces. NOTE: 1.All the input Points should be on one surface (e.g., a plane), or null will be returned. 2. The edge will be added from the last point to the first point if the two points are not equal.
Parameters
Name | Type | Description |
---|---|---|
points | KPoint3d [] | The input points. |
Returns
Object
Return an object that contains added edges if successful, otherwise return null.
Name | Type |
---|---|
addedEdges | KEdge [] |
Defined in
api.d.ts:1472
addFaceHoles
▸ addFaceHoles(faces
, loopsPerFace
): Object
在每个Face上添加相应的内环。内环数据的第一维对应每个Face,第二维对应每个Face的一个内环,第三维对应每个内环上的点。
Create inner loops (represented by polygons) on each input face.
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | The faces to add inner loops |
loopsPerFace | KPoint3d [][][] | The polygons of inner loops on each face. |
Returns
Object
Name | Type |
---|---|
errorFaces | number [] |
errorLoops | number [][] |
isSuccess | boolean |
Defined in
api.d.ts:1568
addFaces
▸ addFaces(outerLoops
): Object
添加一组造型面到当前成组中,添加的造型面将和现有的造型面互相分割。
输入参数是一个二维数组,第一维表示每个面的外轮廓,第二维表示每个外轮廓上的顶点位置。 对入参的要求和addEdges()类似:
- 传入的所有几何点都必须在同一平面上,否则不会生成一个面,整个方法会返回null。
- 如果传入的外轮廓最后一个点和第一个点不重合,则会自动在最后一个点和第一个点之间加上一条边。
通常,这个方法用来向酷大师中添加一组网格面。
The method will add a set of faces to the active group definition by the input points. The generated faces will be merged with other intersecting faces. The input parameter is two-dimensional points array. We can make one-dimensional points array to represent a face, and then we can group multiple one-dimensional points array to two-dimensional points array. NOTE: 1.All the input Points which represent a face should be on one surface (e.g., a plane), or null will be returned. 2. The edge will be added from the last point to the first point which are in one face if the two points are not equal.
Parameters
Name | Type | Description |
---|---|---|
outerLoops | KPoint3d [][] | The two-dimensional points. |
Returns
Object
Return an object that contains added edges if successful, otherwise return null.
Name | Type |
---|---|
addedEdges | KEdge [] |
Defined in
api.d.ts:1494
addRoundCorner
▸ addRoundCorner(edge1
, edge2
, distance
, approxCount?
): Object
对一个单独的面,在其两条边,edge1 和 edge2 之间,加一个圆弧的倒角 distance 表示倒角圆弧的半径 approxCount 表示这条倒角的圆弧将由多少段直线段来表达
The method is used to create a round corner by the input edges and round distance to the active group definition.
Parameters
Name | Type | Description |
---|---|---|
edge1 | KEdge | The first edge. |
edge2 | KEdge | The second edge. |
distance | number | The round distance. |
approxCount? | number | How many segments to draw. |
Returns
Object
Return an object that contains added edges which define the round corner if successful, otherwise return null.
Name | Type |
---|---|
addedEdges | KEdge [] |
Defined in
api.d.ts:1555
adjustMaterialMapping
▸ adjustMaterialMapping(mappingType
, originPt
, dx
, dy
, faceGroup?
, face?
): boolean
编辑材质连续或者连续面的映射属性
The method is used to edit uv mapping for facegroup or continuousface.
Parameters
Name | Type | Description |
---|---|---|
mappingType | number | 0: none, 1: cube, 2: plane, 3: sphere, 4: cylinder |
originPt | KPoint3d | origin of ccs for uvmapping computation |
dx | KVector3d | dx of ccs for uvmapping computation |
dy | KVector3d | dy of ccs for uvmapping computation |
faceGroup? | KFacePavingGroup | the facegroup to be edit params, undefined if continuousface to be edit. |
face? | KFace | the continuousface to be edit params, undefined if facegroup to be edit. |
Returns
boolean
Return edit mapping params success flag.
Defined in
api.d.ts:2247
alignShells
▸ alignShells(shells
, transform
, datumLine
, targetCurve
, mirrorToRightSide?
): Object
Align the shells with a discrete target curve.
参考线段和目标曲线的长度比决定了物体形变的比例尺,参考线段的方向、物体本身的朝向、世界坐标系三者共同决定了物体的局部参照系, 物体的局部参考系+比例尺+目标曲线的Frenet参考系,决定了空间映射关系。简单理解就是,参考线段决定了物体的什么位置对齐目标曲线。
参数mirrorToRightSide用来控制空间映射过程中,是否要把物体按目标曲线的Frenet标架的XZ平面做镜像。
注:如果需要被变形的整体由多个成组组成,则需要单独对每个成组进行操作。 如果需要被变形的整体包含了同一个成组的多个实例,则需要调用者首先对这几个成组实例所指向的成组做深度拷贝,保证被变形的整体中一个成组只有一个实例。
This method implemments a similar funciton as the shape bender plugin of Sketchup.
Parameters
Name | Type | Description |
---|---|---|
shells | KShell [] | a list of shells in the same gorup definition to be aligned. |
transform | KMatrix4 | the transformation from the model space of the shells to the model space of the datum and target curve. |
datumLine | KLineSegment3d | a datum line segment determining the scale and direction of the alignment. |
targetCurve | KPolylineCurve3d | a polyline the shells will be aligned with. |
mirrorToRightSide? | boolean | whether put the bended shells on the right side of the target curve. |
Returns
Object
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:2373
assignDecorationMaterialForEntities
▸ assignDecorationMaterialForEntities(entities
, obsBrandGoodId
): boolean
给一组面赋硬装材质
The method is used to assign decoration material for faces.
Parameters
Name | Type | Description |
---|---|---|
entities | KFace [] | the faces to be assigned decoration material. |
obsBrandGoodId | string | id of decoration material. |
Returns
boolean
Return assign material success flag.
Defined in
api.d.ts:2205
assignMaterialForEntities
▸ assignMaterialForEntities(entities
, materialId
, bgId?
, pattern?
, params?
): boolean
给一组面或者组赋材质,可以设置铺贴方式、铺贴参数 entities仅支持KFace或者KGroupInstance
The method is used to assign material for faces or group instances.
Parameters
Name | Type | Description |
---|---|---|
entities | KEntity [] | the faces or group instances to be assigned material |
materialId | string | material id |
bgId? | string | material bg id. The default value is undefined. |
pattern? | number | material pattern. The default value is undefined. |
params? | KMaterialParams | material pavingparams. The default value is undefined. |
Returns
boolean
Return assign material success flag.
Defined in
api.d.ts:2194
assignMaterialForFaces
▸ assignMaterialForFaces(faces
, materialId
, bgId?
, originVertexs?
, vertUVs?
): boolean
Deprecated
此 API 仅供酷大师内部开发团队使用 给一组面赋材质 可通过originVertexs 和 vertexUVs 来指定材质铺贴的uv
The method is used to assign material for a group of faces.
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | the faces to be assigned material |
materialId | string | material id |
bgId? | string | material bg id. The default value is undefined. |
originVertexs? | KVertex [] | - |
vertUVs? | KPoint2d [] | the uv for the vertex, the num must be matched with vertexes. The default value is a default pavingparams. |
Returns
boolean
Return assign material success flag.
Defined in
api.d.ts:2135
assignMaterialForGroupInstance
▸ assignMaterialForGroupInstance(groupInstance
, materialId
, bgId?
): boolean
Deprecated
此 API 仅供酷大师内部开发团队使用 给一个成组实例赋材质
The method is used to assign material for group instance.
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | the group instance to be assigned material |
materialId | string | material id |
bgId? | string | material bg id. The default value is undefined. |
Returns
boolean
Return assign material success flag.
Defined in
api.d.ts:2148
boolean
▸ boolean(subject
, tool
, type
, coplanarFacesUnion?
): Object
将两个成组实例做布尔运算 (交、并、差),生成一个新的成组实例 输入的两个成组实例 (subject & tool) 必须是实体。即:所有的面围合起来形成一个封闭的实体 (真实世界中能存在的物体) 从拓扑结构上说,一个实体,里面的每一条造型边,有且仅有两个相邻面
The method is used to make boolean operation of the two group instances.
Parameters
Name | Type | Description |
---|---|---|
subject | KGroupInstance | The subject instance. |
tool | KGroupInstance | The tool instance. |
type | KBooleanType | The boolean type. |
coplanarFacesUnion? | boolean | - |
Returns
Object
Return an object that contains new instances if successful, otherwise return null.
Name | Type |
---|---|
newInstances | KGroupInstance [] |
Defined in
api.d.ts:1798
breakGroup
▸ breakGroup(groupInstance
): Object
将一个成组实例解组
The method is used to break the group into individual entities, such as shells, group instances, auxiliary curves.
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | The group instance to break. |
Returns
Object
Return an object that contains shells, group instances, auxiliary curves if successful, otherwise return null.
Name | Type |
---|---|
auxiliaryCurves | KAuxiliaryCurve [] |
groupInstances | KGroupInstance [] |
shells | KShell [] |
Defined in
api.d.ts:1937
breakGroupReference
▸ breakGroupReference(groupInstance
): HostPromise
<{ isSuccess
: boolean
}>
Deep copy the group definition of the input group instance, so that the sharing of the source group definition from the input group instance will be broken, and the input group instance becomes individual. This API is implemented as async since we may copy the external group.
深拷贝输入成组实例指向的成组,使得输入成组实例引用一个全新的成组,从而达到一种“断开实例链接”的效果。
注:1. 目前这个接口做的成组深拷贝只会拷贝对应的成组,它的子成组实例所指向的成组是仍旧不变的,也就是仍旧是共享的。 2. 这个接口是异步的。3. 拷贝出来的拓扑对象的id和原对象是一样的。
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | the group instance will be deep copied. |
Returns
HostPromise
<{ isSuccess
: boolean
}>
Defined in
api.d.ts:2386
brushDecorationMaterialToEntities
▸ brushDecorationMaterialToEntities(entities
, pavingDesignId
, bgId?
): boolean
Deprecated
此 API 仅供酷大师内部开发团队使用 给一组面根据paving designid进行材质刷
The method is used to brush decoration material to faces by pavingdesignid.
Parameters
Name | Type | Description |
---|---|---|
entities | KFace [] | the faces to be brushed decoration material. |
pavingDesignId | string | the paving designid for brush. |
bgId? | string |
Returns
boolean
Return brush material success flag.
Defined in
api.d.ts:2218
bulkCopyGroupInstances
▸ bulkCopyGroupInstances(groupInstances
, matricesForEachInstance
): Object
拷贝一组成组实例,每一个成组实例,都按照matricesForEachInstance中的一个matrices 数组指定的位姿,拷贝多次 目前酷大师官方的“外景设计”插件,用这个 API 来实现“随机种树”功能
The method is used to copy each group multile times with different matrices.
Parameters
Name | Type | Description |
---|---|---|
groupInstances | KGroupInstance [] | The group instances to copy. |
matricesForEachInstance | KMatrix4 [][] | The transformation matrices for each group instance, and matrices are based in current activated groupDefinition. |
Returns
Object
Return an object that contains added group instances if successful, otherwise return null.
Name | Type |
---|---|
addedInstances | KGroupInstance [] |
Defined in
api.d.ts:1903
clearMaterial
▸ clearMaterial(entities
): boolean
删除面或者组材质 entities仅支持KFace或者KGroupInstance
The method is used to clear material of faces or group instances.
Parameters
Name | Type | Description |
---|---|---|
entities | KEntity [] | the faces or group instances to be clear material |
Returns
boolean
Return clear material success flag.
Defined in
api.d.ts:2258
commitOperation
▸ commitOperation(): void
提交一个 undo/redo 的会话 在一个 startOperation 和一个 commitOperation 之间的所有建模操作,都会被放到一个 undo/redo 步骤中
The method is used to commit an operation for undo. It is normally called at the end of a method to commit the operation that the method performs. NOTE: If not in operation, an error will be threw.
Returns
void
Defined in
api.d.ts:1968
copyAuxiliaryCurves
▸ copyAuxiliaryCurves(auxiliaryCurves
, matrix?
): Object
拷贝一组参考线
The method is used to copy the auxiliary curves.
Parameters
Name | Type | Description |
---|---|---|
auxiliaryCurves | KAuxiliaryCurve [] | The auxiliary curves to copy. |
matrix? | KMatrix4 | The transformation matrix. The default value is an identity matrix. |
Returns
Object
Return an object that contains added auxiliary curves if successful, otherwise return null.
Name | Type |
---|---|
addedCurves | KAuxiliaryCurve [] |
Defined in
api.d.ts:1914
copyFaces
▸ copyFaces(faces
, matrix?
, beCopyToInstance?
): Object
拷贝一组造型面 如果 beCopyToInstance 为 true,则会将拷贝出的造型面加到一个新的成组内,不会与当前成组中现有的造型面发生相交、分割 如果 beCopyToInstance 为 false,则会将拷贝出的造型面加到当前活跃成组内,它们会与当前成组中现有的造型面发生相交、分割
The method is used to copy the faces.
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | The faces to copy. |
matrix? | KMatrix4 | The transformation matrix. The default value is an identity matrix. |
beCopyToInstance? | boolean | The copied faces will merged with other intersecting faces if false and added shells will be returned, or the new faces will be grouped and added instance will be return. The default value is false. |
Returns
Object
Return an object that contains added shells and instance if successful, otherwise return null.
Name | Type |
---|---|
addedInstance? | KGroupInstance |
addedShells | KShell [] |
Defined in
api.d.ts:1880
copyGroupInstances
▸ copyGroupInstances(groupInstances
, matrix?
): Object
拷贝生成一组新的成组实例
The method is used to copy the group instances.
Parameters
Name | Type | Description |
---|---|---|
groupInstances | KGroupInstance [] | The group instances to copy. |
matrix? | KMatrix4 | The transformation matrix in current activated groupDefinition. The default value is an identity matrix. |
Returns
Object
Return an object that contains added group instances if successful, otherwise return null.
Name | Type |
---|---|
addedInstances | KGroupInstance [] |
Defined in
api.d.ts:1891
createEmptyGroupInstance
▸ createEmptyGroupInstance(): Object
创建一个空的成组实例
The method is used to create empty group instance.
Returns
Object
Return an object that contains added instance if successful, otherwise return null.
Name | Type |
---|---|
addedInstance | KGroupInstance |
Defined in
api.d.ts:2026
createInstanceFromAnotherProject
▸ createInstanceFromAnotherProject(projectId
): HostPromise
<{ newInstance
: KGroupInstance
}>
导入方案创建成组模型
Parameters
Name | Type | Description |
---|---|---|
projectId | string | project id |
Returns
HostPromise
<{ newInstance
: KGroupInstance
}>
the newInstance or undefined.
Defined in
api.d.ts:2437
createInstanceFromExternalResources
▸ createInstanceFromExternalResources(resourceId
, box
, pluginId?
): HostPromise
<{ newInstance
: KGroupInstance
}>
为一个插件外部模型生成一个成组实例 resourceId 是外部模型唯一标识符。可阅读《酷大师插件开发教程》中的《酷大师插件官方定义消息》部分
The method is used to create the group instance from external resources. The type of the group definition for this group instance is Xref.
Parameters
Name | Type | Description |
---|---|---|
resourceId | string | The resource id, the resource is used to create group instances. |
box | KBoundingBox3d | The box which represents the bounding box of the xref groupDefinition. |
pluginId? | string | The plugin id. If no provided, the current plugin will be used. |
Returns
HostPromise
<{ newInstance
: KGroupInstance
}>
Return an object that contains new instances if successful, otherwise return null.
Defined in
api.d.ts:2081
createShellFromMesh
▸ createShellFromMesh(mesh
): Object
从一个网格数据,生成一个造型壳体 (shell) 目前这个 API 被用于酷大师官方插件“外景设计”中的“地形生成”功能
The method is used to create a continuous shell from a mesh
Parameters
Name | Type | Description |
---|---|---|
mesh | KMesh | The input mesh. |
Returns
Object
Return an object that contains new shell information if successful, otherwise return null.
Name | Type |
---|---|
newShell | KShell |
Defined in
api.d.ts:2017
deactivateGroupInstance
▸ deactivateGroupInstance(): HostPromise
<{ isSuccess
: boolean
}>
反激活一个成组实例 这相当于酷大师用户界面上的“退出组编辑”功能
The method is used to deactivate the final group instance in the activated instance path.
Returns
HostPromise
<{ isSuccess
: boolean
}>
Return an object that contains success flag.
Defined in
api.d.ts:2067
editMaterialParamsOfFace
▸ editMaterialParamsOfFace(face
, materialId
, bgId?
, pattern?
, params?
): boolean
编辑一个面的软装材质属性
The method is used to edit material for face.
Parameters
Name | Type |
---|---|
face | KFace |
materialId | string |
bgId? | string |
pattern? | number |
params? | KMaterialParams |
Returns
boolean
Return edit material success flag.
Defined in
api.d.ts:2232
enterExpressMode
▸ enterExpressMode(groupInstance
): HostPromise
<{ isSuccess
: boolean
}>
make group to be express mode.
使组进入快速模式
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | the group to be express mode |
Returns
HostPromise
<{ isSuccess
: boolean
}>
false if the group instance is in express mode, otherwise returns true.
Defined in
api.d.ts:2417
executeRequest
▸ executeRequest(request
): HostPromise
<any
>
internal use only.
Parameters
Name | Type |
---|---|
request | string |
Returns
HostPromise
<any
>
Defined in
api.d.ts:2305
exitExpressMode
▸ exitExpressMode(groupInstance
): HostPromise
<{ isSuccess
: boolean
}>
Load the data of the group instance and exit its express mode.
退出成组的快速模式。
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | the group instance which needs to exit the express mode. |
Returns
HostPromise
<{ isSuccess
: boolean
}>
false if the group instance is not in express mode, otherwise returns true.
Defined in
api.d.ts:2407
faceSplitByFace
▸ faceSplitByFace(sourceFaces
, toolFaces
): Object
用一组 toolFaces 去分割一组 sourceFaces toolFaces 和 sourceFaces 都必须在当前活跃的成组中
The method is used to split the source faces by the tool faces. NOTE: source faces and tool faces must be both in the active group definition.
Parameters
Name | Type | Description |
---|---|---|
sourceFaces | KFace [] | The faces to be split. |
toolFaces | KFace [] | The faces to be used to split the sourceFaces. |
Returns
Object
Return an object that contains the changed shells if successful, otherwise return null.
Name | Type |
---|---|
modifiedShells | KShell [] |
Defined in
api.d.ts:1993
faceSplitByGroup
▸ faceSplitByGroup(sourceFaces
, tool
): Object
用一个 tool 成组实例里包含的造型面,去分割 sourceFaces tool 成组实例和 sourceFaces 都必须在当前活跃的成组中
The method is used to split the source faces by group instance. NOTE: the source faces and the group instance must be both in the active group definition.
Parameters
Name | Type | Description |
---|---|---|
sourceFaces | KFace [] | The faces to be split. |
tool | KGroupInstance | The sub group instance to be used to split the sourceFaces. |
Returns
Object
Return an object that contains the changed shells if successful, otherwise return null.
Name | Type |
---|---|
modifiedShells | KShell [] |
Defined in
api.d.ts:2006
fillet
▸ fillet(edges
, radiuses
, stripeCount
, smoothTransit?
): Object
Create fillets for the input edges. 对一组边做倒圆角操作。
Parameters
Name | Type | Description |
---|---|---|
edges | KEdge [] | The edges to create fillets. 需要被倒圆角的边 |
radiuses | number [] | The radius of each fillet(edge blend). 每条边的倒角半径。 |
stripeCount | number | The numbner of segments of the fillet face. 倒角面分段数。 |
smoothTransit? | boolean | Whether round the common vertex where three or more fillet edges join, default is true. 是否在顶点处光滑过渡。 |
Returns
Object
A map from the edge to its resultant fillet faces. 返回一个原始边到倒角面的映射。
Name | Type |
---|---|
edges | KEdge [] |
filletsPerEdge | KFace [][] |
isSuccess | boolean |
Defined in
api.d.ts:2279
findGroupInstancesByAppKey
▸ findGroupInstancesByAppKey(appKey
): KGroupInstance
[]
通过plugin app key查找该类型的所有外部模型。
Find out all group instances of this plugin application. Empty array will be returned if the app key is invalid or without any group instance of this kind of plugin app.
Parameters
Name | Type | Description |
---|---|---|
appKey | string | : the plugin application key |
Returns
Defined in
api.d.ts:2314
findGroupInstancesByResource
▸ findGroupInstancesByResource(appKey
, resource
): KGroupInstance
[]
通过plugin app key和resource key查找该类型的相同模型的所有外部模型实例。
Find out all group instances of this plugin application by resource. If there are more than one instances then they will share the same model, it means all those instances will be changed once the resource model changed.
Parameters
Name | Type | Description |
---|---|---|
appKey | string | : the plugin application key |
resource | string | : resource key of this kind of plugin app |
Returns
Defined in
api.d.ts:2325
flipFace
▸ flipFace(face
): Object
翻转面
The method is used to flip face.
Parameters
Name | Type | Description |
---|---|---|
face | KFace | The face to be flipped. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1822
getActiveGroupDefinition
▸ getActiveGroupDefinition(): KGroupDefinition
获取当前的活跃成组,即正在编辑的成组
Get the active group definition.
Returns
The active group definition.
Defined in
api.d.ts:1455
getDesignId
▸ getDesignId(): HostPromise
<string
>
获取方案 id
如果此方案是从酷大师网站的“开始建模”按钮打开的,那它还没有一个方案id。调用此方法会导致此方案保存,并生成一个id
Get the design id. NOTE: If the design has not design id, it will trigger the design to save and generate an id.
Returns
HostPromise
<string
>
The design id.
Defined in
api.d.ts:1407
getEditPath
▸ getEditPath(): KGroupInstance
[]
获取当前处于组编辑状态的成组实例的路径 (从顶层成组一直到当前激活成组实例的路径,路径中的每一个元素都是一个KGroupInstance)
The method is used to get the path of the editing group instance.
Returns
Return the path of the editing group instance, return empty path if the root group definition is editing.
Defined in
api.d.ts:2090
getEditPathsToGroupInstance
▸ getEditPathsToGroupInstance(groupInstance
): KGroupInstance
[][]
获取组实例的编辑路径(从顶层起始,不包含给定组实例)
Get the edit paths of the groupInstance (starting from the top level, excluding the given groupInstance)
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | the groupInstance |
Returns
KGroupInstance
[][]
the edit paths
Defined in
api.d.ts:2100
getFacePavingGroupByFace
▸ getFacePavingGroupByFace(face
): KFacePavingGroup
获得该面所在的材质连续对象
The method is used to get face paving group of face.
Parameters
Name | Type | Description |
---|---|---|
face | KFace | the face to face paving group |
Returns
Return face paving group if the face has it.
Defined in
api.d.ts:2268
getMaterialOfFace
▸ getMaterialOfFace(face
, parentDefinition?
): Object
获取给定面的材质信息
The method is used to get material id of face.
Parameters
Name | Type | Description |
---|---|---|
face | KFace | - |
parentDefinition? | KGroupDefinition | the parent definition of face, input when if the face is not in current space |
Returns
Object
Return material type, and materialId bgid if the face has.
Name | Type |
---|---|
bgId | string |
materialId | string |
materialType | KMaterialType |
Defined in
api.d.ts:2159
getMaterialOfInstance
▸ getMaterialOfInstance(instance
): Object
获取给定组的材质信息
The method is used to get material id of group instance.
Parameters
Name | Type | Description |
---|---|---|
instance | KGroupInstance | the face to get material |
Returns
Object
Return material type, and materialId bgid if the face has.
Name | Type |
---|---|
bgId | string |
materialId | string |
materialType | KMaterialType |
Defined in
api.d.ts:2169
getMaterialParamsOfFace
▸ getMaterialParamsOfFace(face
): KMaterialParams
获取给定面的软装材质属性
The method is used to get material params of face.
Parameters
Name | Type |
---|---|
face | KFace |
Returns
Return material params if the face has texture material
Defined in
api.d.ts:2179
getShortestPath
▸ getShortestPath(faces
, matrix
): HostPromise
<{ curve
: KBoundedCurve3d
; normal
: KVector3d
; point
: KPoint3d
}[]>
根据一组面生成最短路径
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | The faces to be used to generate the shortest path |
matrix | KMatrix4 | Transform matrix |
Returns
HostPromise
<{ curve
: KBoundedCurve3d
; normal
: KVector3d
; point
: KPoint3d
}[]>
Return an object that contains shortest path info
Defined in
api.d.ts:2299
getText3dParams
▸ getText3dParams(groupInstance
): HostPromise
<{ materials?
: { bottom?
: { bgid?
: string
; materialId?
: string
} ; side?
: { bgid?
: string
; materialId?
: string
} ; top?
: { bgid?
: string
; materialId?
: string
} } ; text
: string
; textProfiles
: { inners
: KLineSegment3d
[][] ; outer
: KLineSegment3d
[] }[][] ; thickness
: number
}>
Get the profiles, text, thickness and materialIds of Text3d
获取酷大师3D文字的轮廓、文字、厚度和顶底侧材质
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | the groupInstance of Text3d |
Returns
HostPromise
<{ materials?
: { bottom?
: { bgid?
: string
; materialId?
: string
} ; side?
: { bgid?
: string
; materialId?
: string
} ; top?
: { bgid?
: string
; materialId?
: string
} } ; text
: string
; textProfiles
: { inners
: KLineSegment3d
[][] ; outer
: KLineSegment3d
[] }[][] ; thickness
: number
}>
faceLoops for each word which has more than one faceLoop, text, thickness and materialIds
Defined in
api.d.ts:2457
getTopGroupDefinition
▸ getTopGroupDefinition(): KGroupDefinition
获取方案顶层的成组
Get the top group definition.
Returns
The top group definition.
Defined in
api.d.ts:1446
getYunDesignInfo
▸ getYunDesignInfo(): Object
获取新自由造型方案对应的云图方案的design id及level id
Get the design id and level id of the yun design corresponding to the new freestyle.
Returns
Object
The design id and level id.
Name | Type |
---|---|
designId | string |
levelId | string |
Defined in
api.d.ts:1416
inflateFaces
▸ inflateFaces(faces
, doubleSide?
, height?
, volume?
, resolution?
, smooth?
): HostPromise
<{ face
: KFace
; resultFaces
: KFace
[] }[]>
Inflate faces
对面进行膨胀变形
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | faces to inflate |
doubleSide? | boolean | default false. true to inflate on both sides of each face, false to inflate on front side of each face |
height? | number | default 500. main height of inflate |
volume? | number | default 70. volume of the uplift part which is above the main part in percentage form |
resolution? | number | default 80. resolution of inflate |
smooth? | boolean | default true. whether smooth the result |
Returns
HostPromise
<{ face
: KFace
; resultFaces
: KFace
[] }[]>
the map record of inflate face and result faces
Defined in
api.d.ts:2477
isShellSolid
▸ isShellSolid(shell
): boolean
检测壳是否是实体
do check if the shell is a solid body
Parameters
Name | Type |
---|---|
shell | KShell |
Returns
boolean
Defined in
api.d.ts:2493
loadMaterial
▸ loadMaterial(materialId
): HostPromise
<{ isSuccess
: boolean
}>
Deprecated
此 API 仅供酷大师内部开发团队使用 加载一个材质,材质id为酷大师内部材质库的材质id
Load and cache the material if it is first time used.
Parameters
Name | Type | Description |
---|---|---|
materialId | string | The id of the material. |
Returns
HostPromise
<{ isSuccess
: boolean
}>
Defined in
api.d.ts:2110
makeGroup
▸ makeGroup(faces
, groupInstances
, auxiliaryCurves
): Object
将一组造型面/成组实例/参考线成组。这将生成一个新的成组定义 (KGroupDefinition)和一个新的成组实例 (KGroupInstance) 新生成的成组实例就是 addedInstance
The method is used to make the faces, group instances, auxiliary curves to a group.
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | The faces to make to the group. |
groupInstances | KGroupInstance [] | The group instances to make to the group. |
auxiliaryCurves | KAuxiliaryCurve [] | The auxiliary curves to make to the group. |
Returns
Object
Return an object that contains the added instance if successful, otherwise return null.
Name | Type |
---|---|
addedInstance | KGroupInstance |
Defined in
api.d.ts:1927
mergeFaces
▸ mergeFaces(subjects
, tools
): Object
对两组面做布尔并操作
The method is used to merge (boolean union) one collection of faces with another collection of faces.
Parameters
Name | Type | Description |
---|---|---|
subjects | KFace [] | The subject faces to merge with the tool faces. |
tools | KFace [] | The tool faces |
Returns
Object
Return an object which contains the modified shells if successful, otherwise return null.
Name | Type |
---|---|
modifiedShells | KShell [] |
Defined in
api.d.ts:1601
moveAuxiliaryMiddlePoint
▸ moveAuxiliaryMiddlePoint(auxiliaryCurve
, targetPosition
): Object
移动参考圆弧的中点 (用起点、中点、终点三点定义圆弧)
The method is used to move the auxiliary middle point to the target position.
Parameters
Name | Type | Description |
---|---|---|
auxiliaryCurve | KAuxiliaryBoundedCurve | The auxiliary bounded curve to move. |
targetPosition | KPoint3d | The target position. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1705
moveAuxiliaryVertex
▸ moveAuxiliaryVertex(auxiliaryVertex
, targetPosition
): Object
移动参考线顶点
The method is used to move the auxiliary vertex to the target position.
Parameters
Name | Type | Description |
---|---|---|
auxiliaryVertex | KAuxiliaryVertex | The auxiliary vertex to move. |
targetPosition | KPoint3d | The target position. |
Returns
Object
Return an object that contains moved auxiliary bounded curves if successful, otherwise return null.
Name | Type |
---|---|
movedCurves | KAuxiliaryBoundedCurve [] |
Defined in
api.d.ts:1694
moveEdge
▸ moveEdge(edge
, moveVector
): Object
Deprecated
此 API 已过时,请使用transformVertices 移动一条边
The method is used to move the edge.
Parameters
Name | Type | Description |
---|---|---|
edge | KEdge | The edge to move. |
moveVector | KVector3d | The move vector. |
Returns
Object
Return an object that contains modified shells if successful, otherwise return null.
Name | Type |
---|---|
modifiedShells | KShell [] |
Defined in
api.d.ts:1732
moveFace
▸ moveFace(face
, moveVector
, loftFlag?
): Object
Deprecated
此 API 已过时,请使用transformVertices 移动一个面
The method is used to move the face.
Parameters
Name | Type | Description |
---|---|---|
face | KFace | The face to move. |
moveVector | KVector3d | The move vector. |
loftFlag? | boolean | The loft flag. |
Returns
Object
Return an object that contains modified shells if successful, otherwise return null.
Name | Type |
---|---|
modifiedShells | KShell [] |
Defined in
api.d.ts:1745
moveVertices
▸ moveVertices(vertices
, moveVectors
, propagateContinuousEdge?
): Object
Deprecated
此 API 已过时,请使用transformVertices 移动一组顶点
The method is used to move the vertices.
Parameters
Name | Type | Description |
---|---|---|
vertices | KVertex [] | An array of vertices to move. |
moveVectors | KVector3d [] | An array of vectors to apply. |
propagateContinuousEdge? | boolean | A flag to specify whether the soft vertices of a continuous edge will be moved according to the movements of the start and end vertices of that continuous edge. If this flag is true, then the given movements of the soft vertices will be ignored if they have. |
Returns
Object
Return an object that contains modified shells if successful, otherwise return null.
Name | Type |
---|---|
modifiedShells | KShell [] |
Defined in
api.d.ts:1720
offset
▸ offset(face
, halfEdge
, moveVector
): Object
将造型面的轮廓进行偏移 halfEdge 是进行偏移的基准边,moveVector是偏移的方向,两者共同决定面的轮廓是放大偏移还是缩小偏移
The method is used to offset the contour of the face. NOTE: The moveVector must be perpendicular to the normal of the face and the halfEdge, or null will be returned.
Parameters
Name | Type | Description |
---|---|---|
face | KFace | The face to offset. |
halfEdge | KHalfEdge | The halfEdge to reference. |
moveVector | KVector3d | The move vector. |
Returns
Object
Return an object that contains added edges if successful, otherwise return null.
Name | Type |
---|---|
addedEdges | KEdge [] |
Defined in
api.d.ts:1812
pullPushFace
▸ pullPushFace(face
, distance
, separator
): Object
拉伸命令:推/拉一个面,以创建或修改一个 3D 造型 如果 copy 为 true,则会保持原始 face 不变,而在推/拉的终止位置新生成一个 face (相当于在酷大师里手工执行推/拉命令时,按住ctrl键)
The method is used to perform a push/pull on a face.
Parameters
Name | Type | Description |
---|---|---|
face | KFace | The face to push/pull. |
distance | number | The distance to push/pull the face. |
separator | boolean | Create a new push/pull starting face if true, do not create a push/pull starting face if false. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1759
removeAuxiliaryCurve
▸ removeAuxiliaryCurve(auxiliaryCurve
): Object
删除参考线
The method is used to remove auxiliary curve from the active group definition.
Parameters
Name | Type | Description |
---|---|---|
auxiliaryCurve | KAuxiliaryCurve | The auxiliary curve to remove. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1621
removeEdge
▸ removeEdge(edge
): Object
从当前成组中删除一条边
The method is used to remove an edge from the active group definition.
Parameters
Name | Type | Description |
---|---|---|
edge | KEdge | The edge to remove. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1578
removeEdges
▸ removeEdges(edges
): Object
从当前成组中删除一组边 如果某条边属于一个连续边,则整条连续边都会被删除
The method is used to remove a list of edges from the active group definition. If an edge is in continuous edge group, the whole continuouse edge group will be removed.
Parameters
Name | Type | Description |
---|---|---|
edges | KEdge [] | The edges to remove. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1590
removeFaces
▸ removeFaces(faces
): Object
删除一组面
The method is used to remove faces from the active group definition.
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | The faces to remove. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1611
removeGroupInstance
▸ removeGroupInstance(groupInstance
): Object
删除成组实例
Remove group instance from the active group definition.
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | The group instance to remove. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1631
reparentGroupInstance
▸ reparentGroupInstance(occurence
, targetPath
): HostPromise
<{ isSuccess
: boolean
}>
Reparent a group instance from its current path to the target path.
修改一个子成组的父成组节点。
Parameters
Name | Type | Description |
---|---|---|
occurence | KGroupInstance [] | the full path of the sub group instance, which is the sub group instance itself and all its parents. |
targetPath | KGroupInstance [] | path of the the target group instnace where the sub group instance will be reparented to. if you want to reparent the sub group instance to root group definition, set this parameter as empty array. |
Returns
HostPromise
<{ isSuccess
: boolean
}>
Defined in
api.d.ts:2397
save
▸ save(): HostPromise
<boolean
>
保存方案
Save the design. NOTE: If the design is not saved, it will trigger the design to save.
Returns
HostPromise
<boolean
>
True if successful, or false.
Defined in
api.d.ts:1437
saveInstanceAsLibraryProject
▸ saveInstanceAsLibraryProject(groupInstance
, access
): HostPromise
<{ image
: string
; projectId
: string
}>
保存模型为一个方案
save a instance as a project.
Parameters
Name | Type | Description |
---|---|---|
groupInstance | KGroupInstance | the groupInstance |
access | number | the type of the library project, 0: public, 1: enterprise, 2: private. |
Returns
HostPromise
<{ image
: string
; projectId
: string
}>
projectId: the projectId, image: the image of groupInstance.
Defined in
api.d.ts:2447
setEdgesSoft
▸ setEdgesSoft(edges
, isSoft
): Object
设置一组边的软化信息,true为软化边,false为非软化边
Set the edges to be soft. If you want to set the edge one by one, you can use the setIsSoft method in KEdge. A soft edge will cause the connected faces to be treated as a surface. This means that if you select one face it will also select all faces connected with soft edges. A soft edge will also appear hidden.
Parameters
Name | Type | Description |
---|---|---|
edges | KEdge [] | The edges to set. |
isSoft | boolean | The soft value. |
Returns
Object
Return true if successful, otherwise return false.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1657
setSoftEdgesVisible
▸ setSoftEdgesVisible(softEdges
, isVisible
): Object
Deprecated
酷大师内置的建模命令造出的软化边默认为不可见。请只在代码调试等特殊情况下使用这个 API 设置一组软化边的可见性,true为可见,false为不可见。
Set the soft edges visibility.
Parameters
Name | Type | Description |
---|---|---|
softEdges | KEdge [] | The edges to set. |
isVisible | boolean | The visible value. |
Returns
Object
Return true if successful, otherwise return false.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1669
setVerticesSoft
▸ setVerticesSoft(vertices
, isSoft
): Object
设置一组顶点的软化信息,true为软化顶点,false为非软化顶点
Set the vertex to be soft. If you want to set the vertex one by one, you can use the setIsSoft method in KVertex. A soft vertex will cause the connected edges to be treated as a curve. This means that if you select one edge it will also select all edges connected with soft vertices.
Parameters
Name | Type | Description |
---|---|---|
vertices | KVertex [] | - |
isSoft | boolean | The soft value. |
Returns
Object
Return true if it is a soft vertex, otherwise return false.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1683
shareModel
▸ shareModel(): HostPromise
<string
>
保存并分享方案,返回分享链接。 Save and share the project, return a sharing link.
如果此方案是从酷大师网站的“开始建模”按钮打开的,那它无法生成分享链接。
Returns
HostPromise
<string
>
The sharing url.
Defined in
api.d.ts:1427
splitEdge
▸ splitEdge(edge
, points
): Object
使用一组点,打断一条边
The method is used to split an edge into two or more distinct edges by the input points. NOTE: the input points must be points that are on the edge.
Parameters
Name | Type | Description |
---|---|---|
edge | KEdge | The group instance to split. |
points | KPoint3d [] | The input points whose locations are along the edge. |
Returns
Object
Return an object that contains added edges if successful, otherwise return null.
Name | Type |
---|---|
addedEdges | KEdge [] |
Defined in
api.d.ts:1643
startOperation
▸ startOperation(configurations?
): void
开启一个批量操作的会话。 在一个 startOperation 和一个 commitOperation 之间的所有建模操作,都会被放到一个 undo/redo 步骤中; 同时配置参数还可以控制是否只有在这个会话结束后才刷新视图。
The method is used to notify KuDaShi that a new operation (which can be undone) is starting. NOTE: If already in operation, an error will be threw.
Parameters
Name | Type | Description |
---|---|---|
configurations? | number | a config number each bit represents one single option. so far we only support one option BULK_OP_LOCK_FLUSH, by default BULK_OP_LOCK_FLUSH is turned on. 批量操作的一些配置选项,每一位代表一个开关;目前我们只支持一个开关-是否只在会话结束后刷新视图,默认是打开这个开关的。 |
Returns
void
Defined in
api.d.ts:1956
sweepFollowCurves
▸ sweepFollowCurves(contour
, path
): Object
扫掠命令:将一个不带洞的平面轮廓(contour),沿一条路径(path),扫掠生成一个 3d 造型(addedShells) 同上,只不过路径可以是一组参考线段
The method is used to create a shape by making the face follow along an array of auxiliary bounded curves. NOTE: The method will remove the face that the contour belongs to.
Parameters
Name | Type | Description |
---|---|---|
contour | KLoop | The face's contour. |
path | KAuxiliaryBoundedCurve [] | An array of auxiliary bounded curves to follow. |
Returns
Object
Return an object that contains success flag and added shells.
Name | Type |
---|---|
addedShells | KShell [] |
isSuccess | boolean |
Defined in
api.d.ts:1784
sweepFollowEdges
▸ sweepFollowEdges(contour
, path
): Object
扫掠命令:将一个不带洞的平面轮廓(contour),沿一条路径(path),扫掠生成一个 3d 造型(addedShells)
The method is used to create a shape by making the face follow along an array of edges. NOTE: The method will remove the face that the contour belongs to.
Parameters
Name | Type | Description |
---|---|---|
contour | KLoop | The face's contour. |
path | KEdge [] | An array of edges to follow. |
Returns
Object
Return an object that contains success flag and added shells.
Name | Type |
---|---|
addedShells | KShell [] |
isSuccess | boolean |
Defined in
api.d.ts:1771
thickenFaces
▸ thickenFaces(faces
, thickness
): Object
Extrude the faces with a given thickness value.
This API is added to gain performance for a special case while the whole group instance is an extrusion. If the current group definition does not satisfy the extrusion standard or not all of the extrusions will be thickened, then normal pull push will be executed.
Parameters
Name | Type | Description |
---|---|---|
faces | KFace [] | All the top faces of each extrusion or all the bottom faces, otherwise normal pull push will be executed. |
thickness | number | The extrusion distance. |
Returns
Object
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:2429
toggleEntitiesVisible
▸ toggleEntitiesVisible(groupInstances
, shells
, faces
, edges
, auxiliaryCurves
, isVisible
): Object
显示或者隐藏组实例、壳、面、边和参考线。仅用于特定场合,限制条件如下:
Turn on/off the visibility of group instances, shells, faces, edges and auxiliaryCurves. Constraints as below:
1. the entities can be/not be in the current editing group definition (CheckUtils.CheckOperatingGroupInstanceInDefinition is false);
2. this operation is not a undo/redo transaction. it will not cause the design to be dirty as well.
3. will clear selection
Parameters
Name | Type | Description |
---|---|---|
groupInstances | KGroupInstance [] | the group instances |
shells | KShell [] | - |
faces | KFace [] | the faces |
edges | KEdge [] | - |
auxiliaryCurves | KAuxiliaryCurve [] | the auxiliaryCurves |
isVisible | boolean | : True is turning to be visible, and vice versa |
Returns
Object
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:2353
toggleGroupInstancesVisible
▸ toggleGroupInstancesVisible(groupInstances
, isVisible
): Object
显示或者隐藏模型实例。仅用于特定场合,限制条件如下:
Turn on/off the visibility of group instances. Constraints as below:
1. the group instances can be/not be in the current editing group definition (CheckUtils.CheckOperatingGroupInstanceInDefinition is false);
2. this operation is not a undo/redo transaction. it will not cause the design to be dirty as well.
3. will clear selection
Parameters
Name | Type | Description |
---|---|---|
groupInstances | KGroupInstance [] | |
isVisible | boolean | : True is turning to be visible, and vice versa |
Returns
Object
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:2338
transformActiveGroupDefinition
▸ transformActiveGroupDefinition(matrix
): Object
将当前活跃成组里面的所有东西(造型面、成组实例、参考线等)一起旋转/移动/缩放
The method is used to transform the active group definition.
Parameters
Name | Type | Description |
---|---|---|
matrix | KMatrix4 | The transformation matrix. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1832
transformAuxiliaryCurves
▸ transformAuxiliaryCurves(auxiliaryCurves
, matrix
): Object
移动/旋转/缩放 一组参考线
The method is used to transform the auxiliary Curves.
Parameters
Name | Type | Description |
---|---|---|
auxiliaryCurves | KAuxiliaryCurve [] | The auxiliary Curves to transform. |
matrix | KMatrix4 | The transformation matrix. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1865
transformGroupInstances
▸ transformGroupInstances(groupInstances
, matrix
): Object
移动/旋转/缩放 某一个成组实例
The method is used to transform the group instances.
Parameters
Name | Type | Description |
---|---|---|
groupInstances | KGroupInstance [] | The group instances to transform. |
matrix | KMatrix4 | The transformation matrix. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1854
transformShells
▸ transformShells(shells
, matrix
): Object
移动/旋转/缩放 一组造型壳体 (shells)
The method is used to transform the shells.
Parameters
Name | Type | Description |
---|---|---|
shells | KShell [] | The shells to transform. |
matrix | KMatrix4 | The transformation matrix. |
Returns
Object
Return an object that contains success flag.
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:1843
transformVertices
▸ transformVertices(vertices
, matrix
): Object
平移/旋转/缩放 一组造型顶点。与这些造型顶点相连的造型边/造型面也会一起移动
Parameters
Name | Type | Description |
---|---|---|
vertices | KVertex [] | vertices to be transformed |
matrix | KMatrix4 | transform matrix |
Returns
Object
Return an object that contains success flag
Name | Type |
---|---|
isSuccess | boolean |
Defined in
api.d.ts:2289
uploadMaterial
▸ uploadMaterial(imageSrc
, imgWidth
, imgHeight
, cb?
): HostPromise
<{ brandGoodId
: string
; materialId
: string
; message?
: string
; previewImage
: string
}>
上传文件生成材质,如果生成成功则返回材质ID
Parameters
Name | Type | Description |
---|---|---|
imageSrc | string | The picture to be uploaded, transformed to string |
imgWidth | number | The width of the material |
imgHeight | number | The height of the material |
cb? | (hitRuleName : string ) => boolean | - |
Returns
HostPromise
<{ brandGoodId
: string
; materialId
: string
; message?
: string
; previewImage
: string
}>
Defined in
api.d.ts:2118