dxfjs / writer

A JavaScript dxf generator written in TypeScript.
https://dxf.vercel.app
MIT License
83 stars 17 forks source link

support xdata #72

Closed FishOrBear closed 1 year ago

FishOrBear commented 1 year ago

For example, the extended data of the font style

1001
ACAD
1000
YouYuan
1071
34353
FishOrBear commented 1 year ago

Or we should also export more basic types, such as Entity, Or DxfDimStyle, so that users can inherit it, modify it, and expand it

tarikjabiri commented 1 year ago

Not sure I will see

FishOrBear commented 1 year ago

I suggest adding a base class for DxfObject, which all objects inherit from, like this:

import { Dxfier } from "../Internals/Dxfier";
import DxfInterface from "../Internals/Interfaces/DxfInterface";

export abstract class DxfObject implements DxfInterface {
    otherData: [number, string | number][] = [];
    dxfy(dx: Dxfier): void {
        this._dxfy(dx)
        for (let [code, value] of this.otherData)
            dx.push(code, value)
    }
    _dxfy(dx: Dxfier): void {
    }
}
tarikjabiri commented 1 year ago

See https://dxf.vercel.app/tutoriels/xdata.html