Skip to content
On this page

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

Class: IMcDbDwgFiler

2d.IMcDbDwgFiler

Used for handling read and write operations of AutoCAD DWG files. This interface provides a set of methods that allow developers to read and write DWG files in the AutoCAD plugin.

Example

ts
import { McDbCustomEntity, IMcDbDwgFiler } 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();
//Read the data field pt1 of the custom entity pt2
       public dwgInFields(filter: IMcDbDwgFiler): boolean {
           this.pt1 = filter.readPoint("pt1").val;
           this.pt2 = filter.readPoint("pt2").val;
           return true;
       } 
//Write the data field pt1 to the custom entity pt2
       public dwgOutFields(filter: IMcDbDwgFiler): boolean {
           filter.writePoint("pt1", this.pt1);
           filter.writePoint("pt2", this.pt2);
           return true;
       }
  }

Table of contents

Constructors

Methods

Constructors

constructor

new IMcDbDwgFiler(type)

Constructor function

Parameters

NameTypeDescription
Type[MxCADCloneType] (../enums/2d. MxCADCloneType. md)Clone Type

Methods

getType

getType(): MxCADCloneType

Retrieve the type information of the object

Returns

MxCADCloneType

Clone type


readDouble

Abstract readDouble(name): Object

Read a floating-point number from an open DWG file.

Parameters

NameTypeDescription
NameStringFloating Point Number Name

Returns

Object

Whether ret successfully obtained | val floating-point value

NameType
retboolean
valnumber

readLong

Abstract readLong(name): Object

Read a long integer from the opened DWG file.

Parameters

NameTypeDescription
NamestringLong integer name

Returns

Object

Whether ret successfully obtained | val long integer value

NameType
retboolean
valnumber

readPoint

Abstract readPoint(name): Object

Read a point object from an open DWG file.

Parameters

NameTypeDescription
NameStringPoint Object Name

Returns

Object

Whether ret successfully obtained | val point object array

NameType
retboolean
valMcGePoint3d

readPoints

readPoints(name): Object

Read a set of point objects from an open DWG file.

Parameters

NameTypeDescription
NameStringPoint Object Array Name

Returns

Object

Whether ret successfully obtained | val point object array

NameType
retboolean
valMcGePoint3d[]

readString

Abstract readString(name): Object

Read a string from an open DWG file.

Parameters

NameTypeDescription
NameStringString Name

Returns

Object

Did ret successfully obtain the | val string value

NameType
retboolean
valstring

writeDouble

Abstract writeDouble(name, val): void

Write a floating-point number to an opened DWG file.

Parameters

NameTypeDescription
NameStringFloating Point Number Name
ValnumberFloating point numerical value

Returns

void


writeLong

Abstract writeLong(name, val): void

Write a long integer to an opened DWG file.

Parameters

NameTypeDescription
NamestringLong integer name
Valnumberlong integer value

Returns

void


writePoint

Abstract writePoint(name, val): void

Write a point object to an opened DWG file.

Parameters

NameTypeDescription
NameStringPoint Object Name
Val[McGePoint3d] (2d. McGePoint3d. md)Point Object

Returns

void


writePoints

writePoints(name, vals): void

Write a set of point objects to an opened DWG file.

Parameters

NameTypeDescription
NameStringPoint Object Array Name
ValsMcGePoint3d (2d. McGePoint3d. md)Point Object Array

Returns

void


writeString

Abstract writeString(name, val): void

Write a string to an opened DWG file.

Parameters

NameTypeDescription
NameStringString Name
Valstringstring value

Returns

void