Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

DXF file modification/editing. #407

Open
rspardeshi opened this issue Aug 22, 2022 · 5 comments
Open

DXF file modification/editing. #407

rspardeshi opened this issue Aug 22, 2022 · 5 comments
Labels

Comments

@rspardeshi
Copy link

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
Copy link
Owner

haplokuon commented Aug 22, 2022

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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

@my88480
Copy link

my88480 commented Apr 20, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants