dxfjs / writer

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

dimStyle.DIMTXSTY It would be better to provide a reasonable default value. #74

Open FishOrBear opened 1 year ago

FishOrBear commented 1 year ago
dimStyle.DIMTXSTY = "16";//Equal to the default Dimstyle handle. Without it, the annotation style will not be correctly displayed.

what do you think

tarikjabiri commented 1 year ago

yeah but not sure if it will be convenient for everyone, thus the DIMSTYLE is customizable one can set the values they need.

tarikjabiri commented 1 year ago

This is set to standard style handle by default, not sure what is the problem can you provide an example so I can see the problem

FishOrBear commented 1 year ago

dxf.zip

image

image

This is the dxf file I generated. The only difference between them is the default style. When no default inherited style is specified, the dimension text disappears.

Because the dxf we write may not provide all dimstyle values, it would be better to give the default inherited style.

tarikjabiri commented 1 year ago

Using the latest version 2.8.1 you do it like this

// Customize the dimStyleStandard
dxf.document.dimStyleStandard.DIMTXT = 16 // The text height
const dim = dxf.addLinearDim(point3d(), point3d(200, 0), {
  offset: 10,
  styleName: dxf.document.dimStyleStandard.name
});

Also you can use the header variables to customize the look of the dimensions

dxf.setVariable('$DIMTXT', { 40: 10 }); // The text height
dxf.setVariable('$DIMASZ', { 40: 10 }); // Dimensioning arrow size