copy layer from DXF to DXF

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

corentin
Posts: 11
Joined: 06 Apr 2009, 12:40

Re: copy layer from DXF to DXF

Post by corentin » 21 Apr 2009, 16:55

Hello Sergey.

I have tested your code, it works perfectly,but when i remove entities and layers and i save to DXF file. ( i have 4 layers)
If i open the file was been created , layers are come back. ( i have 6 layers)

to save i use the fallowing code:

Code: Select all

this->CADviewer->SaveAsDXF();
how can i do??

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: copy layer from DXF to DXF

Post by support » 21 Apr 2009, 17:35

Hello Corentin,

The following code is based on Viewer demo:

Code: Select all

        private void mmiDeleteLayer_Click(object sender, EventArgs e)
        {
            if (this.cadImage == null)
                return;
            this.cadImage.UseDoubleBuffering = false;

            for (int i = this.cadImage.Converter.GetCounts(ConvSection.Entities)-1; i>=0; i--)
            {
                CADEntity ent = (CADEntity)this.cadImage.Converter.GetSection(ConvSection.Entities).Entities[i];
                if (ent.Layer.Name == "1")
                    this.cadImage.Converter.Entities.Remove(i);
            }

            CADGroup layersSection = this.cadImage.Converter.GetSection(ConvSection.Layers);
            
            for (int i = layersSection.Entities.Count - 1; i >=0 ; i--)
            {                
                CADLayer entLayer = (CADLayer)layersSection.Entities[i];
                if (entLayer.Name == "1")
                    layersSection.Entities.Remove(i);
            }
            this.DoResize();
            SaveAsDXF(@"c:\DeleteLayer.dxf");              
        }
If it does not work with your files, please send us some of them for testing to support@cadsofttools.com.

Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply