dxfjs / writer

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

Header setvariable function #32

Closed DeepankarGupta13 closed 1 year ago

DeepankarGupta13 commented 1 year ago

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

tarikjabiri commented 1 year ago

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

DeepankarGupta13 commented 1 year ago

thanks

DeepankarGupta13 commented 1 year ago

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

tarikjabiri commented 1 year ago

As you like, if you have time