mxcad_2d API 文档 / 2d / MxCADWorldDraw
Class: MxCADWorldDraw
2d.MxCADWorldDraw
在 AutoCAD 中实现自定义的绘图逻辑,例如绘制图形、标注、符号等。
Example
import { McDbCustomEntity, McGePoint3d, MxCADWorldDraw, McDbPolyline } from "mxcad";
// 自定义实体类 继承 McDbCustomEntity
class McDbTestLineCustomEntity extends McDbCustomEntity {
// 定义实体内 pt1、pt2 两个点对象
private pt1: McGePoint3d = new McGePoint3d();
private pt2: McGePoint3d = new McGePoint3d();
// 绘制自定义实体
public worldDraw(draw: MxCADWorldDraw): void {
// 构造一个新多段线对象pl
let pl= new McDbPolyline()
// pl新增点对象
pl.addVertexAt(this.pt1)
pl.addVertexAt(this.pt2)
pl.addVertexAt(new McGePoint3d())
// 绘制pl多段线
draw.drawEntity(pl);
}
}
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new MxCADWorldDraw(lPtrWorldDraw
)
构造函数
Parameters
Name | Type | Description |
---|---|---|
lPtrWorldDraw | number | 传递指向绘图设备的指针 |
Properties
imp
• imp: any
内部对象实现
Accessors
layerId
• get
layerId(): McObjectId
Returns
• set
layerId(val
): void
设置或获取当前使用的图层
Parameters
Name | Type | Description |
---|---|---|
val | McObjectId | 图层id |
Returns
void
lineTypeId
• get
lineTypeId(): McObjectId
Returns
• set
lineTypeId(val
): void
设置或获取当前使用的线型id
Parameters
Name | Type | Description |
---|---|---|
val | McObjectId | 线型id |
Returns
void
lineTypeScale
• get
lineTypeScale(): number
Returns
number
• set
lineTypeScale(val
): void
设置或获取当前使用的线型比例
Parameters
Name | Type | Description |
---|---|---|
val | number | 线型比例 |
Returns
void
lineWeight
• get
lineWeight(): LineWeight
Returns
• set
lineWeight(val
): void
设置或获取当前使用的线重
Parameters
Name | Type | Description |
---|---|---|
val | LineWeight | 使用的线重 |
Returns
void
trueColor
• get
trueColor(): McCmColor
Returns
• set
trueColor(val
): void
设置或获取颜色
Parameters
Name | Type | Description |
---|---|---|
val | McCmColor | 颜色对象(McCmColor) |
Returns
void
Methods
drawEntity
▸ drawEntity(entity
): void
绘制实例对象
Parameters
Name | Type |
---|---|
entity | McDbEntity |
Returns
void
drawOsnapEntity
▸ drawOsnapEntity(entity
): void
绘制一个用于捕捉使用的对象.
Parameters
Name | Type |
---|---|
entity | McDbEntity |
Returns
void
getDatabase
▸ getDatabase(): McDbDatabase
返回worddraw当前绘制的数据库。
Returns
getType
▸ getType(): MxCADWorldDrawType
得到worddraw type
Returns
initType
▸ initType(type
): void
初始化worddraw type
Parameters
Name | Type |
---|---|
type | MxCADWorldDrawType |
Returns
void
setupForEntity
▸ setupForEntity(entity
): boolean
使Draw对象使用使用entity的属性
Parameters
Name | Type |
---|---|
entity | McDbEntity |
Returns
boolean