dxfjs / writer

A JavaScript dxf generator written in TypeScript.

Home Page:https://dxf.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Header setvariable function

DeepankarGupta13 opened this issue · comments

initially I was trying to set units to meter by
dxf.header.setVariable('$INSUNITS', 6); // units to meter
but the above code was not working

the below one worked but can we simplify this to the above one. the above one looks better and simple I think.
dxf.header.setVariable('$INSUNITS', { 70: 6 }); // units to meter

Hi

Actually for setting the units there is a better way.

import { DxfWriter, Units } from '@tarikjabiri/dxf';

const dxf = new DxfWriter();
dxf.setUnits(Units.Meters);

And for the other variables you should define them like the below you mentioned

You can define a helper function that can do that by passing to it your dxf instance and a value if you use it often

thanks

this is not in the docs should I add this by creating a new element in nav header?

As you like, if you have time