Skip to content
On this page

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

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