vagran / dxf-viewer

DXF 2D viewer written in JavaScript
Mozilla Public License 2.0
278 stars 83 forks source link

Calculation Enhancements for DXF Files in Metal Laser Cutting #76

Open usama-masood-brainx opened 1 year ago

usama-masood-brainx commented 1 year ago

The purpose of this enhancement is to introduce additional calculations for DXF files in the context of Metal Laser Cutting. The proposed calculations include:

Area of Polygon: Calculating the area of a polygon defined in a DXF file is essential for estimating material usage and costs. By implementing this calculation, users will be able to quickly determine the area enclosed by the polygon, aiding in accurate material selection and cost estimation.

Minimum Cut Count: Determining the minimum number of cuts required for a given DXF file is crucial for optimizing laser cutting operations. This calculation will analyze the contours and intersections within the polygon and provide insights into the most efficient cutting paths. It will help reduce production time, minimize material waste, and enhance overall efficiency.

Cut Length: Calculating the total length of cuts required for a DXF file will provide valuable information for scheduling production and estimating laser cutting time. This calculation will sum up the lengths of all individual cuts within the polygon, assisting in workload planning and project management.

By implementing these calculations within the Metal Laser Cutting workflow, users will have access to valuable metrics that can significantly streamline their operations. These enhancements will facilitate precise material estimations, optimize cutting strategies, and improve production planning, ultimately leading to increased efficiency and reduced costs.

vagran commented 1 year ago

This sounds like an application which may be built on top of this library, which is just DXF renderer. Other problem is that currently the library discards all information about initial DXF geometry, when compiling rendering batches, so it is quite impossible to do this by current public API (there is an option to preserve parse result but it is quite low-level information to use it directly), this is a subject for future improvements. So in any case this type of functionality is out of scope of this library, and should be implemented in a particular application on top of it. For now you can proceed with your own fork of the library to gather all necessary data for calculations in your application (as I understand, you already did it). I will consider this use case in next library versions, when new API will be designed.