how to delete layer
Moderators: SDS, support, admin
how to delete layer
hello.
I'm trying to delete a layer with the following code.
Layer was not deleted.
Am I wrong?
Layer does not have a Entitiy.
use version is 9.1.
Thank you.
I'm trying to delete a layer with the following code.
Code: Select all
var
wCadImg: TsgCADdxfImage;
wEntity: TsgDXFEntity;
wLayer: TsgDXFLayer absolute wEntity;
wGroup: TsgDXFGroup;
i: Integer;
~~~~~~~~~~~~
wGroup := wCadImg.Converter.Sections[csLayers];
for i := 0 to wGroup.Count - 1 do begin
wEntity := wGroup.Entities[i];
if (wLayer.Name = 'target layer') then begin
Break;
end;
end;
wCadImg.Converter.RemoveEntity(wLayer, True);
~~~~~~~~~~~~
Am I wrong?
Layer does not have a Entitiy.
use version is 9.1.
Thank you.
Re: how to delete layer
Hello,
The code below deletes a layer specified by name and all entities that belong to this layer:
Mikhail.
The code below deletes a layer specified by name and all entities that belong to this layer:
Code: Select all
var
Img: TsgCADImage;
...
procedure DeleteLayer(AName: string);
var
vLayer: TsgDXFLayer;
vEntity: TsgDXFEntity;
I, Count: Integer;
begin
vLayer := TsgDXFLayer(Img.Converter.Sections[csLayers].FindEntByName(AName));
if Assigned(vLayer) then
begin
Count := Img.Converter.Sections[csEntities].Count;
I := 0;
while I < Count do
begin
vEntity := Img.Converter.Sections[csEntities].Entities[i];
if vEntity.Layer = vLayer then
begin
Img.Converter.RemoveEntity(vEntity, True);
Count := Img.Converter.Counts[csEntities];
end
else
Inc(I);
end;
if Img.Converter.Sections[csLayers].RemoveEntity(vLayer) then
vLayer.Free;
end;
end;
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: how to delete layer
I was able to delete the layer in the sample code.
Thank you.
Thank you.