Skip to content

mxcad_2d API 文档 / 2d / MxCADWorldDraw

Class: MxCADWorldDraw

2d.MxCADWorldDraw

在 AutoCAD 中实现自定义的绘图逻辑,例如绘制图形、标注、符号等。

Example

ts
  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

NameTypeDescription
lPtrWorldDrawnumber传递指向绘图设备的指针

Properties

imp

imp: any

内部对象实现

Accessors

layerId

get layerId(): McObjectId

Returns

McObjectId

set layerId(val): void

设置或获取当前使用的图层

Parameters

NameTypeDescription
valMcObjectId图层id

Returns

void


lineTypeId

get lineTypeId(): McObjectId

Returns

McObjectId

set lineTypeId(val): void

设置或获取当前使用的线型id

Parameters

NameTypeDescription
valMcObjectId线型id

Returns

void


lineTypeScale

get lineTypeScale(): number

Returns

number

set lineTypeScale(val): void

设置或获取当前使用的线型比例

Parameters

NameTypeDescription
valnumber线型比例

Returns

void


lineWeight

get lineWeight(): LineWeight

Returns

LineWeight

set lineWeight(val): void

设置或获取当前使用的线重

Parameters

NameTypeDescription
valLineWeight使用的线重

Returns

void


trueColor

get trueColor(): McCmColor

Returns

McCmColor

set trueColor(val): void

设置或获取颜色

Parameters

NameTypeDescription
valMcCmColor颜色对象(McCmColor)

Returns

void

Methods

drawEntity

drawEntity(entity): void

绘制实例对象

Parameters

NameType
entityMcDbEntity

Returns

void


drawOsnapEntity

drawOsnapEntity(entity): void

绘制一个用于捕捉使用的对象.

Parameters

NameType
entityMcDbEntity

Returns

void


getDatabase

getDatabase(): McDbDatabase

返回worddraw当前绘制的数据库。

Returns

McDbDatabase


getType

getType(): MxCADWorldDrawType

得到worddraw type

Returns

MxCADWorldDrawType


initType

initType(type): void

初始化worddraw type

Parameters

NameType
typeMxCADWorldDrawType

Returns

void


setupForEntity

setupForEntity(entity): boolean

使Draw对象使用使用entity的属性

Parameters

NameType
entityMcDbEntity

Returns

boolean