dxfjs / writer

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

Added Solid Hatching #46

Closed DeepankarGupta13 closed 1 year ago

DeepankarGupta13 commented 1 year ago

I have added solid hatching, by changing the group code 450 to 0 I have added a variable hatchType, when set to solid will export the hatch as solid. For gradient it should be 1. Please check once before approving. It's working but I am not sure about the methodology whether it is correct or not.

HOW TO USE:

const polyline = new HatchPolylineBoundary(); polyline.add(vertex(0, 0)); polyline.add(vertex(0, 20)); polyline.add(vertex(10, 20)); polyline.add(vertex(10, 0));

const boundary = new HatchBoundaryPaths(); // Add the defined path boundary.addPolylineBoundary(polyline);

const mysolid = gradient({ hatchType: HatchType.SOLID, // firstColor: 2, // secondColor: 2, })

const hatch = dxf.addHatch(boundary, mysolid, { colorNumber: 30, });

tarikjabiri commented 1 year ago

I think this is wrong, this is confusing give me some time to investigate please.

tarikjabiri commented 1 year ago

I said this wrong because there is 2 private functions: pattern and gradient each one handle a hatch type, because of that I hard coded those values. I think this is not the correct way, sorry for the inconvenience.

DeepankarGupta13 commented 1 year ago

Okay Sir Thank You

DeepankarGupta13 commented 1 year ago

https://github.com/dxfjs/writer/issues/42#issue-1457715860