Skip to content

[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/MxCADWorldDraw

Class: MxCADWorldDraw

2d.MxCADWorldDraw

Implement custom drawing logic in AutoCAD, such as drawing graphics, annotations, symbols, etc.

Example

ts
  import { McDbCustomEntity, McGePoint3d, MxCADWorldDraw, McDbPolyline } from "mxcad";
//Custom Entity Class Inherits McDbCCustoms Entity
  class McDbTestLineCustomEntity extends McDbCustomEntity {
//Define two point objects, pt1 and pt2, within the entity
       private pt1: McGePoint3d = new McGePoint3d();
       private pt2: McGePoint3d = new McGePoint3d();
//Draw custom entities
       public worldDraw(draw: MxCADWorldDraw): void {
//Construct a new polyline object pl
           let pl= new McDbPolyline()
//PL adds new point objects
           pl.addVertexAt(this.pt1)
           pl.addVertexAt(this.pt2)
           pl.addVertexAt(new McGePoint3d())
//Draw PL polylines
           draw.drawEntity(pl);
       }
  }

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new MxCADWorldDraw(lPtrWorldDraw)

Constructor function

Parameters

NameTypeDescription
LPtrWorldDrawnumberPass a pointer to the drawing device

Properties

imp

imp: any

Internal object implementation

Accessors

layerId

get layerId(): McObjectId

Returns

McObjectId

set layerId(val): void

Set or retrieve the currently used layer

Parameters

NameTypeDescription
Val[McObjectid] (2d. McObjectid. md)Layer ID

Returns

void


lineTypeId

get lineTypeId(): McObjectId

Returns

McObjectId

set lineTypeId(val): void

Set or retrieve the current line type ID being used

Parameters

NameTypeDescription
Val[McObjectid] (2d. McObjectid. md)Linetype ID

Returns

void


lineTypeScale

get lineTypeScale(): number

Returns

number

set lineTypeScale(val): void

Set or retrieve the current line type scale used

Parameters

NameTypeDescription
ValnumberLine type ratio

Returns

void


lineWeight

get lineWeight(): LineWeight

Returns

LineWeight

set lineWeight(val): void

Set or retrieve the current line weight being used

Parameters

NameTypeDescription
Val[LineWeight] (../enums/2d. McDb. LineWeight. md)Used line weight

Returns

void


trueColor

get trueColor(): McCmColor

Returns

McCmColor

set trueColor(val): void

Set or retrieve colors

Parameters

NameTypeDescription
Val[McCMColor] (2d. McCmColor. md)Color Object (McCMColor)

Returns

void

Methods

drawEntity

drawEntity(entity): void

Draw instance objects

Parameters

NameType
entityMcDbEntity

Returns

void


drawOsnapEntity

drawOsnapEntity(entity): void

Draw an object for capturing and using

Parameters

NameType
entityMcDbEntity

Returns

void


getDatabase

getDatabase(): McDbDatabase

Return the database currently being drawn by worddraw.

Returns

McDbDatabase


getType

getType(): MxCADWorldDrawType

Obtain worddraw type

Returns

MxCADWorldDrawType


initType

initType(type): void

Initialize worddraw type

Parameters

NameType
typeMxCADWorldDrawType

Returns

void


setupForEntity

setupForEntity(entity): boolean

Make Draw objects use entity properties

Parameters

NameType
entityMcDbEntity

Returns

boolean