[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
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 fields pt1 and pt2 of custom entities
public dwgInFields(filter: IMcDbDwgFiler): boolean {
this.pt1 = filter.readPoint("pt1").val;
this.pt2 = filter.readPoint("pt2").val;
return true;
}
//Write data fields pt1 and pt2 for custom entities
public dwgOutFields(filter: IMcDbDwgFiler): boolean {
filter.writePoint("pt1", this.pt1);
filter.writePoint("pt2", this.pt2);
return true;
}
}Table of contents
Constructors
Methods
- getType
- readDouble
- readLong
- readPoint
- readPoints
- readString
- writeDouble
- writeLong
- writePoint
- writePoints
- writeString
Constructors
constructor
• new IMcDbDwgFiler(type)
constructor
Parameters
| Name | Type | Description |
|---|---|---|
| Type | [MxCADCloneType] (../enums/2d. MxCADCloneType. md) | Clone Type |
Methods
getType
▸ getType(): MxCADCloneType
Retrieve the type information of the object
Returns
Clone type
readDouble
▸ Abstract readDouble(name): Object
Read a floating-point number from an open DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | Floating Point Number Name |
Returns
Object
Whether ret successfully obtained | val floating-point value
| Name | Type |
|---|---|
ret | boolean |
val | number |
readLong
▸ Abstract readLong(name): Object
Read a long integer from the opened DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | string | Long integer name |
Returns
Object
Whether ret successfully obtained | val long integer value
| Name | Type |
|---|---|
ret | boolean |
val | number |
readPoint
▸ Abstract readPoint(name): Object
Read a point object from an open DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | Point Object Name |
Returns
Object
Whether ret successfully obtained | val point object array
| Name | Type |
|---|---|
ret | boolean |
val | McGePoint3d |
readPoints
▸ readPoints(name): Object
Read a set of point objects from an open DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | Point Object Array Name |
Returns
Object
Whether ret successfully obtained | val point object array
| Name | Type |
|---|---|
ret | boolean |
val | McGePoint3d[] |
readString
▸ Abstract readString(name): Object
Read a string from an open DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | String Name |
Returns
Object
Did ret successfully obtain the | val string value
| Name | Type |
|---|---|
ret | boolean |
val | string |
writeDouble
▸ Abstract writeDouble(name, val): void
Write a floating-point number to an opened DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | Floating Point Number Name |
| Val | number | Floating point numerical value |
Returns
void
writeLong
▸ Abstract writeLong(name, val): void
Write a long integer to an opened DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | string | Long integer name |
| Val | number | long integer value |
Returns
void
writePoint
▸ Abstract writePoint(name, val): void
Write a point object to an opened DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | Point 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
| Name | Type | Description |
|---|---|---|
| Name | String | Point Object Array Name |
| Vals | McGePoint3d (2d. McGePoint3d. md) | Point Object Array |
Returns
void
writeString
▸ Abstract writeString(name, val): void
Write a string to an opened DWG file.
Parameters
| Name | Type | Description |
|---|---|---|
| Name | String | String Name |
| Val | string | string value |
Returns
void
