haplokuon / netDxf

.net dxf Reader-Writer
MIT License
981 stars 400 forks source link

DXF file modification/editing. #407

Open rspardeshi opened 2 years ago

rspardeshi commented 2 years ago

Hi Haplokuon,

Is it possible to update, edit, or alter the DXF file data using netDxf ? I want to select a particular Polyline and wish to delete that polyline from the selected DXF file.

thanks, Rahul Pardeshi.

haplokuon commented 2 years ago

Yes, the the purpose of this library is being able to create, modify, and read DXF files. You just need to load your file, remove the entity, and save it again.

rspardeshi commented 2 years ago

Hi Haplokuon,

thanks, I am studying netDXF library and successfully created one tool using it. Now I want to select a particular Polyline and wish to delete that polyline from the selected DXF file. Could you please provide me any example or reference matching my task?

haplokuon commented 2 years ago

I cannot tell you how to find a particular entity in the drawing you must know how to find it. You will have to decide if it has a particular color, if it is inside a unique layer, if it is by its geometry,...; although the most efficient way is by its handle.

DxfObject o = doc.GetObjectByHandle("");
doc.Entities.Remove(o as EntityObject);
rspardeshi commented 1 year ago

thanks for the advice... it's constructive for my development.

my88480 commented 1 year ago

List allOuterContourEnts = DxfDoc.Entities.Polylines2D.Where(e => e.Layer.Name.Equals("0")).ToList(); DxfDoc.Entities.Remove(allOuterContourEnts);