Skip to main content

KSelection

kds-plugin-document / Exports / KSelection

Interface: KSelection

酷大师选择集

代表在当前酷大师画布中选中的一组图形实体

注意: 1.酷大师选择集中的图形实体的顺序是不固定的,因此,不要依赖于选择集中的图形实体的顺序去写业务逻辑 2.酷大师选择集中只会包含酷大师图形实体类型,如KEntityType.Edge, KEntityType.Face等

The KSelection represents a set of the currently selected entities. Use the app.selection method to get a selection object. NOTE: 1.The order of entities in the set is in no particular order and should not be assumed to be in the same order as the user selected the entities. 2.Now The selection only supports operations on the following types of objects: KEntityType.Edge, KEntityType.Face, KEntityType.GroupInstance, KEntityType.Shell, KEntityType.AuxiliaryBoundedCurve, KEntityType.AuxiliaryLine, etc. Others are not supported.

Table of contents

Methods

Methods

add

add(entities): boolean

在选择集中添加图形实体

Add entities to the selection. NOTE: If the entity belongs to one conceptual curve or surface, all the edges or faces that make up the conceptual curve or surface will be added to the selection automatically.

Parameters

NameTypeDescription
entitiesKEntity[]The entities to add.

Returns

boolean

Return true if successful, else return false.

Defined in

api.d.ts:3793


addObserver

addObserver(observer): boolean

添加选择集观察者

The method is used to add an observer to the selection object.

Parameters

NameTypeDescription
observerKSelectionObserverThe observer to add.

Returns

boolean

Return true if successful, else return false.

Defined in

api.d.ts:3824


clear

clear(): boolean

清空选择集

Clear the selection.

Returns

boolean

Return true if successful, else return false.

Defined in

api.d.ts:3814


getAllEntities

getAllEntities(includeVertex?): KEntity[]

获取选择集中所有的图形实体

Get all the entities in the selection. NOTE: Only the entities of supported types are returned.

Parameters

NameType
includeVertex?boolean

Returns

KEntity[]

All the entities in the selection.

Defined in

api.d.ts:3781


remove

remove(entities): boolean

从选择集中移除图形实体

Remove entities from the selection. NOTE: If the entity belongs to one conceptual curve or surface, all the edges or faces that make up the conceptual curve or surface will be removed from the selection automatically.

Parameters

NameTypeDescription
entitiesKEntity[]The entities to add.

Returns

boolean

Return true if successful, else return false.

Defined in

api.d.ts:3805


removeObserver

removeObserver(observer): boolean

移除选择集观察者

The method is used to remove an observer from the selection object.

Parameters

NameTypeDescription
observerKSelectionObserverThe observer to remove.

Returns

boolean

Return true if successful, else return false.

Defined in

api.d.ts:3834