mxcad API 文档 / McDbBlockTableRecord
Class: McDbBlockTableRecord
数据库的块表记录对象,实现了对图块的属性相关操作函数。
Example
// 添加图块
import { MxCpp, McDbBlockTableRecord, McDbBlockReference, McDbLine, McCmColor } from "mxcad"
let mxcad = MxCpp.getCurrentMxCAD();
let blkTable = mxcad.getDatabase().getBlockTable();
let blkRecId = blkTable.add(new McDbBlockTableRecord());
// 根据ObjectId再次得到刚刚添加的图块记录
let blkTableRecord:McDbBlockTableRecord = blkRecId.getMcDbBlockTableRecord()
// 添加两条线段再图块记录中 这里每条线段的具体属性比如开始点和结束点自行赋值
const line = new McDbLine(80, 80, 0, -80, -80, 0)
line.trueColor = new McCmColor(255, 0, 0)
const line1 = new McDbLine(-80, 80, 0, 80, -80, 0)
blkTableRecord.appendAcDbEntity(line);
blkTableRecord.appendAcDbEntity(line1);
// 设置图块的基点 一般是包围盒内的点, 可以任意指定
blkTableRecord.origin = new McGePoint3d(0,0,0);
// 实例化块参照 这里需要设置我们刚刚添加图块记录得到的ObjectId
let blkRef = new McDbBlockReference();
blkRef.blockTableRecordId = blkRecId;
// 最后设置位置 渲染图块
blkRef.position = new McGePoint3d(0,0,0);
mxcad.drawEntity(blkRef);
Hierarchy
↳
McDbBlockTableRecord
Table of contents
Constructors
Properties
Accessors
Methods
- appendAcDbEntity
- clone
- constructor_MxCADResbuf
- createExtensionDictionary
- erase
- freeTempRelationObject
- getAllEntityId
- getBoundingBox
- getDatabase
- getDatabaseIndexId
- getExtensionDictionary
- getGripPoints
- getHandle
- getImp
- getJson
- getMinMaxDrawOrder
- getObjectID
- getOwnerID
- initTempObject
- invalidBoundingBoxBuffer
- isErased
- isHaveExtensionDictionary
- isKindOf
- isNull
- moveGripPointsAt
- setJson
- tempRelationObject
- unErase
Constructors
constructor
• new McDbBlockTableRecord(imp?
)
构造函数。
Parameters
Name | Type | Description |
---|---|---|
imp? | any | 内部实现对象。 |
Overrides
Properties
imp
• imp: any
= 0
内部实现对象。
Inherited from
Accessors
dxf0
• get
dxf0(): string
获取 DXF 代码 0 的值。
Returns
string
Inherited from
McDbObject.dxf0
name
• get
name(): string
获取或设置名称。
Returns
string
• set
name(val
): void
Parameters
Name | Type |
---|---|
val | string |
Returns
void
objectName
• get
objectName(): string
获取对象名称。
Returns
string
Inherited from
McDbObject.objectName
origin
• get
origin(): McGePoint3d
图块原点
Returns
• set
origin(origin
): void
Parameters
Name | Type |
---|---|
origin | McGePoint3d |
Returns
void
Methods
appendAcDbEntity
▸ appendAcDbEntity(pEntity
): McObjectId
给图块添加对应实体
Parameters
Name | Type |
---|---|
pEntity | McDbEntity |
Returns
clone
▸ clone(): null
| McDbObject
克隆对象。
Returns
null
| McDbObject
克隆出的对象。
Inherited from
constructor_MxCADResbuf
▸ Protected
constructor_MxCADResbuf(imp
): void
Parameters
Name | Type |
---|---|
imp | any |
Returns
void
Inherited from
McDbObject.constructor_MxCADResbuf
createExtensionDictionary
▸ createExtensionDictionary(): boolean
创建对象的扩展字典数据.
Returns
boolean
Inherited from
McDbObject.createExtensionDictionary
erase
▸ erase(): boolean
删除对象。
Returns
boolean
是否删除成功。
Inherited from
freeTempRelationObject
▸ freeTempRelationObject(): void
释放临时关系对象
Returns
void
Inherited from
McDbObject.freeTempRelationObject
getAllEntityId
▸ getAllEntityId(skipDeleted?
): McObjectId
[]
获取图块中所有实体的对象ID
Parameters
Name | Type | Default value |
---|---|---|
skipDeleted | boolean | true |
Returns
getBoundingBox
▸ getBoundingBox(): Object
得到最小外包
Returns
Object
Name | Type |
---|---|
maxPt | McGePoint3d |
minPt | McGePoint3d |
ret | boolean |
getDatabase
▸ getDatabase(): McDbDatabase
得到对象所在的数据库
Returns
Inherited from
getDatabaseIndexId
▸ getDatabaseIndexId(): number
获取对象的索引ID
Returns
number
Inherited from
getExtensionDictionary
▸ getExtensionDictionary(): McDbDictionary
得到对象的扩展字典数据.
Returns
Inherited from
McDbObject.getExtensionDictionary
getGripPoints
▸ getGripPoints(): McGePoint3dArray
获取对象的控制点
Returns
Inherited from
getHandle
▸ getHandle(): string
得到对象句柄
Returns
string
Inherited from
getImp
▸ getImp(): any
获取内部实现对象。
Returns
any
内部实现对象。
Inherited from
getJson
▸ getJson(): string
获取 JSON 格式的字符串。
Returns
string
JSON 格式的字符串。
Inherited from
getMinMaxDrawOrder
▸ getMinMaxDrawOrder(): Object
返回块表记录中所有对象的最小,最大显示顺序.
Returns
Object
Name | Type |
---|---|
maxDrawOrder | number |
minDrawOrder | number |
getObjectID
▸ getObjectID(): McObjectId
获取对象 ID。
Returns
对象 ID。
Inherited from
getOwnerID
▸ getOwnerID(): number
得到对象拥用者的id
Returns
number
Inherited from
initTempObject
▸ initTempObject(imp
): void
初始化临时对象。
Parameters
Name | Type | Description |
---|---|---|
imp | any | 内部实现对象。 |
Returns
void
Inherited from
invalidBoundingBoxBuffer
▸ invalidBoundingBoxBuffer(): void
块表记录的无效边界框缓冲大小
Returns
void
isErased
▸ isErased(): boolean
对象是否已经删除
Returns
boolean
Inherited from
isHaveExtensionDictionary
▸ isHaveExtensionDictionary(): boolean
是否有扩展字典数据.
Returns
boolean
Inherited from
McDbObject.isHaveExtensionDictionary
isKindOf
▸ isKindOf(sObjectName
): boolean
Parameters
Name | Type |
---|---|
sObjectName | string |
Returns
boolean
Inherited from
isNull
▸ isNull(): any
Returns
any
Inherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex
, dXOffset
, dYOffset
, dZOffset
): any
移动对象的控制点
Parameters
Name | Type | Description |
---|---|---|
iIndex | number | 索引 |
dXOffset | number | X轴偏移量 |
dYOffset | number | Y轴偏移量 |
dZOffset | number | Z轴偏移量 |
Returns
any
Inherited from
setJson
▸ setJson(str
): boolean
设置 JSON 格式的字符串。
Parameters
Name | Type | Description |
---|---|---|
str | string | JSON 格式的字符串。 |
Returns
boolean
是否设置成功。
Inherited from
tempRelationObject
▸ tempRelationObject(): number
与对象相关的临时关系数
Returns
number
Inherited from
unErase
▸ unErase(): boolean
反删除对象。
Returns
boolean