mxcad_2d API 文档 / 2d / McDbGroup
Class: McDbGroup
2d.McDbGroup
组对象
Example
选择一堆对象,把他们创建到一个组中 。
let ss = new MxCADSelectionSet();
if (!await ss.userSelect("选择要做成组的对象:")) return;
if (ss.count() == 0) return;
let mxcad = MxCpp.getCurrentMxCAD();
mxcad.getDatabase().CreateGroup(ss.getIds());Hierarchy
↳
McDbGroup
Table of contents
Constructors
Properties
Accessors
Methods
- append
- appendArray
- assertObjectModification
- clear
- clone
- createExtensionDictionary
- erase
- freeTempRelationObject
- getAllEntityId
- getDatabase
- getDatabaseIndexId
- getExtensionDictionary
- getGripPoints
- getHandle
- getImp
- getJson
- getObjectID
- getOwnerID
- has
- initTempObject
- isErased
- isHaveExtensionDictionary
- isKindOf
- isNull
- moveGripPointsAt
- numEntities
- setJson
- tempRelationObject
- unErase
Constructors
constructor
• new McDbGroup(imp?)
构造函数。
Parameters
| Name | Type |
|---|---|
imp? | any |
Overrides
Properties
imp
• imp: any = 0
内部实现对象。
Inherited from
Accessors
description
• get description(): string
Returns
string
• set description(description): void
说明内容
Example
Parameters
| Name | Type |
|---|---|
description | string |
Returns
void
dxf0
• get dxf0(): string
得到对象的DXF组码的类型名,这个和AutoCAD中的DXF组码是一样。 比如直线的类型名为:McDbLine,DXF0组码值: LINE,DXF0组码值可以用来构造集时的类型过滤。
Returns
string
Inherited from
McDbObject.dxf0
isSelectable
• get isSelectable(): boolean
Returns
boolean
• set isSelectable(val): void
是否选择操作
Example
Parameters
| Name | Type |
|---|---|
val | boolean |
Returns
void
name
• get name(): string
Returns
string
• set name(name): void
组名
Example
Parameters
| Name | Type |
|---|---|
name | string |
Returns
void
objectName
• get objectName(): string
获取对象名称。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.objectName);Returns
string
返回对象名
Inherited from
McDbObject.objectName
Methods
append
▸ append(id): boolean
向组添加对象
Example
Parameters
| Name | Type |
|---|---|
id | McObjectId |
Returns
boolean
appendArray
▸ appendArray(aryId): boolean
向组添加对象数组
Example
Parameters
| Name | Type |
|---|---|
aryId | McObjectId[] |
Returns
boolean
assertObjectModification
▸ assertObjectModification(autoUndo?): number
设置对象被改变的状态,可自动触发更新显示函数,更新显示。 比如块表记录更新了,需要通知块引用更新显示,可以调用该函数。
Example
//假设obj为一个数据库对象
obj.assertObjectModification()Parameters
| Name | Type | Default value |
|---|---|---|
autoUndo | boolean | false |
Returns
number
Inherited from
McDbObject.assertObjectModification
clear
▸ clear(): boolean
清空组
Example
Returns
boolean
clone
▸ clone(): null | McDbObject
克隆对象。
Example
//假设obj为一个数据库对象
const obj_clone = obj.clone();Returns
null | McDbObject
克隆出的对象。
Inherited from
createExtensionDictionary
▸ createExtensionDictionary(): boolean
创建对象的扩展字典数据.
Example
//假设obj为一个数据库对象
const res = obj.createExtensionDictionary();Returns
boolean
Inherited from
McDbObject.createExtensionDictionary
erase
▸ erase(): boolean
删除对象。
Example
//假设obj为一个数据库对象
const res = obj.erase();
console.log(res);Returns
boolean
是否删除成功。
Inherited from
freeTempRelationObject
▸ freeTempRelationObject(): void
释放临时关系对象
Example
//假设obj为一个数据库对象
obj.freeTempRelationObject();Returns
void
Inherited from
McDbObject.freeTempRelationObject
getAllEntityId
▸ getAllEntityId(): McObjectId[]
得到组中所有对象
Example
Returns
getDatabase
▸ getDatabase(): McDbDatabase
得到对象所在的数据库
Example
//假设obj为一个数据库对象
const data = obj.getDatabase();Returns
返回数据库
Inherited from
getDatabaseIndexId
▸ getDatabaseIndexId(): number
获取对象的索引ID
Example
//假设obj为一个数据库对象
const id = obj.getDatabaseIndexId();Returns
number
Inherited from
getExtensionDictionary
▸ getExtensionDictionary(): McDbDictionary
得到对象的扩展字典数据.
Example
//假设obj为一个数据库对象
const id = obj.getOwnerID();Returns
扩展字典数据
Inherited from
McDbObject.getExtensionDictionary
getGripPoints
▸ getGripPoints(): McGePoint3dArray
获取对象的控制点
Example
//假设obj为一个数据库对象
const ptArr = obj.getGripPoints();Returns
Inherited from
getHandle
▸ getHandle(): string
得到对象句柄
Example
//假设obj为一个数据库对象
const handle = obj.getHandle();Returns
string
返回对象句柄
Inherited from
getImp
▸ getImp(): any
获取内部实现对象。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let imp = obj.getImp();Returns
any
内部实现对象。
Inherited from
getJson
▸ getJson(): string
获取 JSON 格式的字符串。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const json = obj.getJson()Returns
string
JSON 格式的字符串。
Inherited from
getObjectID
▸ getObjectID(): McObjectId
获取对象 ID。
Example
import { McDbObject } from "mxcad";
const obj = new McDbObject();
const id = obj.getObjectID();Returns
对象 ID。
Inherited from
getOwnerID
▸ getOwnerID(): number
得到对象拥用者的id
Example
//假设obj为一个数据库对象
const id = obj.getOwnerID();Returns
number
Inherited from
has
▸ has(id): boolean
组中是否有该对象
Example
Parameters
| Name | Type |
|---|---|
id | McObjectId |
Returns
boolean
initTempObject
▸ initTempObject(imp): void
初始化临时对象。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
obj.initTempObject()Parameters
| Name | Type | Description |
|---|---|---|
imp | any | 内部实现对象。 |
Returns
void
Inherited from
isErased
▸ isErased(): boolean
对象是否已经删除
Example
//假设obj为一个数据库对象
const res = obj.isErased();
console.log(res);Returns
boolean
Inherited from
isHaveExtensionDictionary
▸ isHaveExtensionDictionary(): boolean
是否有扩展字典数据.
Example
//假设obj为一个数据库对象
const res = obj.isHaveExtensionDictionary();Returns
boolean
Inherited from
McDbObject.isHaveExtensionDictionary
isKindOf
▸ isKindOf(sObjectName): boolean
判断对象类型
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); // 输出: true 或 falseParameters
| Name | Type | Description |
|---|---|---|
sObjectName | string | 类型名 |
Returns
boolean
返回对象是否是目标类型
Inherited from
isNull
▸ isNull(): any
判断是否为空对象
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.isNull()); // 输出: true 或 falseReturns
any
Inherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex, dXOffset, dYOffset, dZOffset): any
移动对象的控制点
Example
//假设obj为一个数据库对象
obj.moveGripPointsAt(1,10,10,10);Parameters
| Name | Type | Description |
|---|---|---|
iIndex | number | 索引 |
dXOffset | number | X轴偏移量 |
dYOffset | number | Y轴偏移量 |
dZOffset | number | Z轴偏移量 |
Returns
any
Inherited from
numEntities
▸ numEntities(): number
得到组中所有对象数量
Example
Returns
number
setJson
▸ setJson(str): boolean
设置 JSON 格式的字符串。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const res = obj.setJson('{"key": "value"}');
console.log(res)Parameters
| Name | Type | Description |
|---|---|---|
str | string | JSON 格式的字符串。 |
Returns
boolean
是否设置成功。
Inherited from
tempRelationObject
▸ tempRelationObject(): number
与对象相关的临时关系数
Returns
number
Inherited from
unErase
▸ unErase(): boolean
反删除对象。
Example
//假设obj为一个数据库对象
const res = obj.unErase();
console.log(res);Returns
boolean