[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
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
Parameters
| Name | Type | Description |
|---|---|---|
| LPtrWorldDraw | number | Pass a pointer to the drawing device |
Properties
imp
• imp: any
Internal object implementation
Accessors
layerId
• get layerId(): McObjectId
Returns
• set layerId(val): void
Set or retrieve the currently used layer
Parameters
| Name | Type | Description |
|---|---|---|
| Val | [McObjectid] (2d. McObjectid. md) | Layer ID |
Returns
void
lineTypeId
• get lineTypeId(): McObjectId
Returns
• set lineTypeId(val): void
Set or retrieve the current line type ID being used
Parameters
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| Val | number | Line type ratio |
Returns
void
lineWeight
• get lineWeight(): LineWeight
Returns
• set lineWeight(val): void
Set or retrieve the current line weight being used
Parameters
| Name | Type | Description |
|---|---|---|
| Val | [LineWeight] (../enums/2d. McDb. LineWeight. md) | Used line weight |
Returns
void
trueColor
• get trueColor(): McCmColor
Returns
• set trueColor(val): void
Set or retrieve colors
Parameters
| Name | Type | Description |
|---|---|---|
| Val | [McCMColor] (2d. McCmColor. md) | Color Object (McCMColor) |
Returns
void
Methods
drawEntity
▸ drawEntity(entity): void
Draw instance objects
Parameters
| Name | Type |
|---|---|
entity | McDbEntity |
Returns
void
drawOsnapEntity
▸ drawOsnapEntity(entity): void
Draw an object for capturing and using
Parameters
| Name | Type |
|---|---|
entity | McDbEntity |
Returns
void
getDatabase
▸ getDatabase(): McDbDatabase
Return the database currently being drawn by worddraw.
Returns
getType
▸ getType(): MxCADWorldDrawType
Obtain worddraw type
Returns
initType
▸ initType(type): void
Initialize worddraw type
Parameters
| Name | Type |
|---|---|
type | MxCADWorldDrawType |
Returns
void
setupForEntity
▸ setupForEntity(entity): boolean
Make Draw objects use entity properties
Parameters
| Name | Type |
|---|---|
entity | McDbEntity |
Returns
boolean
