Coding


Visualization of Filled Areas


The DXFReaderNET Component can be used to identify closed figures within the drawing and efficiently determine their filled areas. By visualizing these filled areas, we can better understand the spatial distribution and distinguish between different regions of interest. This capability is particularly useful in architectural and mechanical designs where identifying material usage or void spaces is essential.

C#

private void ShowFilledAreas(DXFReaderNETControl myDXF)
        {


            List<EntityObject> externalContour = MathHelper.ExternalContour(myDXF.DXF.Entities);

            List<EntityObject> allEntities = new List<EntityObject>();
            foreach (EntityObject entity in myDXF.DXF.Entities)
            {
                if (!externalContour.Contains(entity))
                    allEntities.Add(entity);
            }

            List<LwPolyline> lws = dxfReaderNETControl1.EntitiesToLwPolylines(allEntities);

            List<EntityObject> BoundaryOutermost = new List<EntityObject>();
            foreach (LwPolyline l in lws)
            {

                BoundaryOutermost.Add(l);
            }

            EntityObject myEnt = myDXF.AddGradientHatch(HatchGradientPatternType.Cylinder, externalContour,
BoundaryOutermost, 140, 180, 30, true);
 

        }


 


Warning!
All samples, data, places and images in this section are only for tutorial scope. They are fictitious and may not correspond to real cases.

Any similarities to actual persons or places is merely coincidental.

To evaluate all code samples you need to download and install the DXFReader.NET Compoonent first.