dxfjs / writer

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

In-block Dimension cannot be displayed #75

Open FishOrBear opened 1 year ago

FishOrBear commented 1 year ago

block.zip in autocad Double-click the edit block, save it, and it will be displayed

tarikjabiri commented 1 year ago

Please can you provide some code example

FishOrBear commented 1 year ago
        let dxf = new DxfWriter;

        let block = dxf.addBlock("test");

        let f1 = {
            x: 1524.2424242424242,
            y: -18,
            z: 1470.6390303028093
        };

        let f2 = {
            x: 1524.2424242424242,
            y: -18,
            z: 270.63903030280926,
        };

        let opt: LinearDimOptions = {
            extrusion: {
                x: 0,
                y: -1,
                z: 0
            },
            middlePoint: {
                x: 1693.1677672727274,
                y: 870.6390303028093,
                z: 18
            },
            definitionPoint: {
                x: 1693.1677672727274,
                y: -18,
                z: 870.6390303028093
            },
            angle: 270
        };

        block.addEntity(new LinearDimension(f1, f2, opt));
        block.addLine({ x: 0, y: 0, z: 0 }, { x: 100, y: 0, z: 0 });

        dxf.addInsert("test", { x: 0, y: 0, z: 0 });