Properties

Methods

Array Methods

Dwg_Entity_* Methods

Dwg_Entity_BLOCK_HEADER Methods

Dwg_Entity_HATCH Methods

Dwg_Entity_MLINE Methods

Dwg_Entity_MTEXT Methods

Dwg_Entity_POLYLINE_2D Methods

Dwg_Entity_TABLE Methods

Dwg_Entity_TEXT Methods

Dwg_Object Methods

Dwg_Object_Entity Methods

Dwg_Object_Object Methods

Dynamic API Methods

GetAll Methods

Handle Conversion Methods

Object Conversion Methods

Properties

instance: LibreDwgEx

Methods

  • Converts Dwg_Data instance to DwgDatabase instance. DwgDatabase instance doesn't depend on Dwg_Data instance any more after conversion. So you can call function dwg_free to free memory occupied by Dwg_Data.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns DwgDatabase

    Returns the converted DwgDatabase instance.

  • Frees the whole DWG. all tables, sections, objects, ...

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns void

  • Parameters

    • fileContent: string | ArrayBuffer
    • fileType: number

    Returns undefined | number

  • Converts DwgDatabase instance to svg string.

    Parameters

    Returns string

    Returns the converted svg string.

Array Methods

  • Converts one C++ double array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ double array.

    • size: number

      The size of C++ double array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ double array.

  • Converts one C++ hatch definition line array to one JavaScript hatch definition line array.

    Parameters

    • ptr: number

      Pointer to C++ hatch definition line array.

    • size: number

      The size of C++ hatch definition line array.

    Returns Dwg_HATCH_DefLine[]

    Returns one JavaScript hatch definition line array from the specified C++ hatch definition line array.

  • Converts one C++ hatch path array to one JavaScript hatch path array.

    Parameters

    • ptr: number

      Pointer to C++ hatch path array.

    • size: number

      The size of C++ hatch path array.

    Returns Dwg_HATCH_Path[]

    Returns one JavaScript hatch path array from the specified C++ hatch path array.

  • Converts one C++ int16 array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ int16 array.

    • size: number

      The size of C++ int16 array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ int16 array.

  • Converts one C++ int32 array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ int32 array.

    • size: number

      The size of C++ int32 array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ int32 array.

  • Converts one C++ int64 array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ int64 array.

    • size: number

      The size of C++ int64 array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ int64 array.

  • Converts one C++ line type array to one JavaScript line type array.

    Parameters

    • ptr: number

      Pointer to C++ line type array.

    • size: number

      The size of C++ line type array.

    Returns Dwg_LTYPE_Dash[]

    Returns one JavaScript line type array from the specified C++ line type array.

  • Converts one C++ mline vertex array to one JavaScript mline vertex array.

    Parameters

    • ptr: number

      Pointer to C++ mline vertex array.

    • size: number

      The size of C++ mline vertex array.

    Returns Dwg_MLINE_Vertex[]

    Returns one JavaScript mline vertex array from the specified C++ mline vertex array.

  • Converts one C++ 2d point array to one JavaScript 2d point array.

    Parameters

    • ptr: number

      Pointer to C++ 2d point array.

    • size: number

      The size of C++ 2 point array.

    Returns DwgPoint2D[]

    Returns one JavaScript 2d point array from the specified C++ 2d point array.

  • Converts one C++ 3d point array to one JavaScript 3d point array.

    Parameters

    • ptr: number

      Pointer to C++ 3d point array.

    • size: number

      The size of C++ 3d point array.

    Returns DwgPoint3D[]

    Returns one JavaScript 3d point array from the specified C++ 3d point array.

  • Converts one C++ 4d point array to one JavaScript 4d point array.

    Parameters

    • ptr: number

      Pointer to C++ 4d point array.

    • size: number

      The size of C++ 4d point array.

    Returns DwgPoint4D[]

    Returns one JavaScript 4d point array from the specified C++ 4d point array.

  • Converts one C++ signed char array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ signed char array.

    • size: number

      The size of C++ signed char array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ signed char array.

  • Converts one C++ table cell array to one JavaScript table cell array.

    Parameters

    • ptr: number

      Pointer to C++ table cell array.

    • size: number

      The size of C++ table cell array.

    Returns Dwg_TABLE_Cell[]

    Returns one JavaScript table cell array from the specified C++ table cell array.

  • Converts one C++ unsigned int16 array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ unsigned int16 array.

    • size: number

      The size of C++ unsigned int16 array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ unsigned int16 array.

  • Converts one C++ unsigned int32 array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ unsigned int32 array.

    • size: number

      The size of C++ unsigned int32 array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ unsigned int32 array.

  • Converts one C++ unsigned int64 array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ unsigned int64 array.

    • size: number

      The size of C++ unsigned int64 array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ unsigned int64 array.

  • Converts one C++ unsigned char array to one JavaScript number array.

    Parameters

    • ptr: number

      Pointer to C++ unsigned char array.

    • size: number

      The size of C++ unsigned char array.

    Returns number[]

    Returns one JavaScript number array from the specified C++ unsigned char array.

Dwg_Entity_* Methods

  • Returns block name of one Dwg_Entity_* instance with one block field. For example, dimension entities have one 'block' field which represents the block that contains the entities that make up the dimension picture.

    Parameters

    • ptr: number

      Pointer to one Dwg_Entity_* instance with one block field.

    • field: string

      Field name of the block.

    Returns string

    Returns block name of one Dwg_Entity_* instance.

  • Returns dimension style name of one Dwg_Entity_* instance with one dimension style field.

    Parameters

    • ptr: number

      Pointer to one Dwg_Entity_* instance.

    • field: string = 'dimstyle'

      Field name of the dimension style.

    Returns string

    Returns dimension style name of one Dwg_Entity_* instance.

Dwg_Entity_BLOCK_HEADER Methods

  • Returns block entity pointed by the specified block header.

    Parameters

    • ptr: number

      Pointer to one Dwg_Entity_BLOCK_HEADER instance.

    Returns Dwg_Entity_BLOCK

    Returns block entity pointed by the specified block header.

  • Returns preview image of the block pointed by the specified block header.

    Parameters

    • ptr: number

      Pointer to one Dwg_Entity_BLOCK_HEADER instance.

    Returns Uint8Array

    Returns preview image of the block pointed by the specified block header.

  • Returns the first entity owned by the block header or null

    Parameters

    • ptr: number

      Pointer to the block header.

    Returns number

    Returns the first entity owned by the block header or null

  • Returns the next entity owned by the block header or null.

    Parameters

    • ptr: number

      Pointer to the block header.

    • current: number

      Pointer to the current entity in the block header.

    Returns number

    Returns the next entity owned by the block header or null.

Dwg_Entity_HATCH Methods

  • Converts one C++ hatch definition line array to one JavaScript hatch definition line array.

    Parameters

    • ptr: number

      Pointer to C++ hatch definition line array.

    • size: number

      The size of C++ hatch definition line array.

    Returns Dwg_HATCH_DefLine[]

    Returns one JavaScript hatch definition line array from the specified C++ hatch definition line array.

  • Converts one C++ hatch path array to one JavaScript hatch path array.

    Parameters

    • ptr: number

      Pointer to C++ hatch path array.

    • size: number

      The size of C++ hatch path array.

    Returns Dwg_HATCH_Path[]

    Returns one JavaScript hatch path array from the specified C++ hatch path array.

Dwg_Entity_MLINE Methods

  • Converts one C++ mline vertex array to one JavaScript mline vertex array.

    Parameters

    • ptr: number

      Pointer to C++ mline vertex array.

    • size: number

      The size of C++ mline vertex array.

    Returns Dwg_MLINE_Vertex[]

    Returns one JavaScript mline vertex array from the specified C++ mline vertex array.

Dwg_Entity_MTEXT Methods

  • Returns text style name of one Dwg_Entity_MTEXT instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Entity_MTEXT instance.

    Returns string

    Returns text style name of one Dwg_Entity_MTEXT instance.

Dwg_Entity_POLYLINE_2D Methods

  • Returns the number of points in Dwg_Entity_POLYLINE_2D.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_2D) instance.

    Returns number

    Returns the number of points in one Dwg_Entity_POLYLINE_2D.

  • Returns points in Dwg_Entity_POLYLINE_2D.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_2D) instance.

    Returns DwgPoint2D[]

    Returns points in one Dwg_Entity_POLYLINE_2D.

  • Returns vertices in Dwg_Entity_POLYLINE_2D.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object (not Dwg_Entity_POLYLINE_2D) instance.

    Returns Dwg_Entity_VERTEX_2D[]

    Returns vertices in one Dwg_Entity_POLYLINE_2D.

Dwg_Entity_TABLE Methods

  • Converts one C++ table cell array to one JavaScript table cell array.

    Parameters

    • ptr: number

      Pointer to C++ table cell array.

    • size: number

      The size of C++ table cell array.

    Returns Dwg_TABLE_Cell[]

    Returns one JavaScript table cell array from the specified C++ table cell array.

Dwg_Entity_TEXT Methods

  • Returns text style name of one Dwg_Entity_TEXT instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Entity_TEXT instance.

    Returns string

    Returns text style name of one Dwg_Entity_TEXT instance.

Dwg_Object Methods

  • Frees the object (all three structs and its fields)

    Parameters

    • obj_ptr: number

    Returns void

  • Returns the handle of one Dwg_Object instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object instance.

    Returns Dwg_Handle

    Returns the handle of one Dwg_Object instance.

Dwg_Object_Entity Methods

  • Returns color value of one Dwg_Object_Entity instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object_Entity instance.

    Returns Dwg_Color

    Returns color value of one Dwg_Object_Entity instance.

  • Returns the handle of one Dwg_Object_Entity instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object_Entity instance.

    Returns Dwg_Handle

    Returns the handle of one Dwg_Object_Entity instance.

  • Returns the owner handle of one Dwg_Object_Entity instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object_Entity instance.

    Returns Dwg_Object_Ref

    Returns the owner handle of one Dwg_Object_Entity instance.

Dwg_Object_Object Methods

  • Returns the handle of one Dwg_Object_Object instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object_Object instance.

    Returns Dwg_Handle

    Returns the handle of one Dwg_Object_Object instance.

  • Returns the owner handle of one Dwg_Object_Object instance.

    Parameters

    • ptr: number

      Pointer to one Dwg_Object_Object instance.

    Returns Dwg_Object_Ref

    Returns the owner handle of one Dwg_Object_Object instance.

Dynamic API Methods

  • The common field value getter. Used to get the value of object or entity common fields.

    Parameters

    • obj: number

      Pointer to one object or entity

    • field: string

      The name of object or entity common fields.

    Returns Dwg_Field_Value

    Returns the value of object or entity common fields.

  • Generic field value getter. Used to get the field value of one object or entity.

    Parameters

    • obj: number

      Pointer to one object or entity

    • field: string

      Field name of one object or entity

    Returns Dwg_Field_Value

    Returns the field value of one object or entity.

  • Header field value getter. Used to get the field value of dwg/dxf header.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • field: string

      Field name of header.

    Returns Dwg_Field_Value

    Returns the field value of dwg/dxf header.

  • The field of one object or entity may not be primitive type. It means one field may consist of multiple sub-fields. This method is used to get the sub-field value of those complex field.

    Parameters

    • obj: number

      Pointer to one object or entity.

    • subclass: string

      The class name of the field with complex type.

    • field: string

      The field name of one object or entit.

    Returns Dwg_Field_Value

    Returns the sub-field value of one complex field.

GetAll Methods

  • Returns all of block objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of block objects in Dwg_Data instance.

  • Returns all of block header objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of block header objects in Dwg_Data instance.

  • Returns all of dimension style objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of dimension style objects in Dwg_Data instance.

  • Returns all of entities in the model space. Each item in returned array is one Dwg_Object pointer (Dwg_Object*).

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of entities in the model space.

  • Returns all of objects in Dwg_Data instance with the specified type.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • type: Dwg_Object_Type

      Object type.

    Returns number[]

    Returns all of objects with the specified type.

  • Returns all of image entities in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of image entities in Dwg_Data instance.

  • Returns all of image definition objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of image definition objects in Dwg_Data instance.

  • Returns all of layer objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of layer objects in Dwg_Data instance.

  • Returns all of layout objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of layout objects in Dwg_Data instance.

  • Returns all of line type objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of line type objects in Dwg_Data instance.

  • Returns all of lwpolyline entities in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of lwpolyline entities in Dwg_Data instance.

  • Returns all of objects in Dwg_Data instance with the specified type.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • type: Dwg_Object_Type

      Object type.

    Returns number[]

    Returns all of objects with the specified type.

  • Returns all of 2d polyline entities in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of 2d polyline entities in Dwg_Data instance.

  • Returns all of 3d polyline entities in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of 3d polyline entities in Dwg_Data instance.

  • Returns all of text style objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of text style objects in Dwg_Data instance.

  • Returns all of 2d vertex objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of 2d vertex objects in Dwg_Data instance.

  • Returns all of 3d vertex objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of 3d vertex objects in Dwg_Data instance.

  • Returns all of viewport objects in Dwg_Data instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    Returns number[]

    Returns all of viewport objects in Dwg_Data instance.

Handle Conversion Methods

  • Returns object (such as line type, layer name, dimension style, and etc.) name by its handle.

    Parameters

    • ref_ptr: number

      Pointer to Dwg_Object_Ref instance.

    Returns string

    Returns object name by its handle.

  • Gets an object by its handle.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • ref_ptr: number

      Pointer to Dwg_Object_Ref instance.

    Returns number

    Returns the object whose handle is equal to the given handle.

  • Gets an object given its handle and relative base object.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • ref_ptr: number

      Pointer to Dwg_Object_Ref instance.

    • obj_ptr: number

      Pointer to the relative base object (Dwg_Object instance).

    Returns number

    Returns the object given its handle and relative base object.

  • Gets an object by its handle without warning message.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • ref_ptr: number

      Pointer to Dwg_Object_Ref instance.

    Returns number

    Returns the object whose handle is equal to the given handle.

  • Resolves handle absref value to Dwg_Object instance.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • absref: bigint

      Handle absref value.

    Returns number

    Returns the object with the given handle absref value.

  • Resolves handle absref value to Dwg_Object instance without warning message.

    Parameters

    • data: number

      Pointer to Dwg_Data instance.

    • absref: bigint

      Handle absref value.

    Returns number

    Returns the object with the given handle absref value.

  • Sets ref->absolute_ref from the specified obj for a subsequent dwg_resolve_handle

    Parameters

    • ref_ptr: number

      Pointer to Dwg_Object_Ref instance.

    • obj_ptr: number

      Pointer to Dwg_Object instance.

    Returns number

    Returns 1 if set absref value correctly. Otherwise, return 0.

Object Conversion Methods

  • Converts Dwg_Object_* instance to Dwg_Object instance.

    Parameters

    • obj_generic_ptr: number

      Pointer to Dwg_Object_* instance.

    Returns number

    Returns one pointer to Dwg_Object instance.

  • Converts Dwg_Object_Object instance to Dwg_Object instance.

    Parameters

    • obj_obj_ptr: number

    Returns number

    Returns one pointer to Dwg_Object instance.

  • Converts Dwg_Object instance to Dwg_Object_Entity instance.

    Parameters

    • obj_ptr: number

      Pointer to Dwg_Object instance.

    Returns number

    Returns one pointer to Dwg_Object_Entity instance.

  • Gets Dwg_Entity_* instance (such as Dwg_Entity_LINE, Dwg_Entity_SPLINE, and etc.) from Dwg_Object instance.

    Parameters

    • obj_ptr: number

      Pointer to Dwg_Object instance.

    Returns number

    Returns one pointer to Dwg_Object_Object_TIO_Ptr instance.

  • Converts Dwg_Object instance to Dwg_Object_Object instance.

    Parameters

    • obj_ptr: number

      Pointer to Dwg_Object instance.

    Returns number

    Returns one pointer to Dwg_Object_Object instance.

  • Gets Dwg_Object_* instance (such as Dwg_Entity_LAYER, Dwg_Entity_STYLE, and etc.) from Dwg_Object instance.

    Parameters

    • obj_ptr: number

      Pointer to Dwg_Object instance.

    Returns number

    Returns one pointer to Dwg_Object_Object_TIO_Ptr instance.