This project has moved. For the latest updates, please go here.

Finding Center of all Circles

Nov 22, 2016 at 2:43 AM
Hi Daniel Carvajal,

First of all let me thank you for providing this library publicly free to use. It is going to solve one my major CAD problem and save lots of time. Thank you very much in advance.

Now my background, I am not full time coder, I am Application engineer uses CAD/CAM software and I am first time using C# with VS specially for netdxf.

To start with this, can you help on some basic example. My main concern is here to
  1. Open DXF file ( :) a obvious step)
  2. Read all circles (If possible than with specified diameters)
  3. Get center coordinates of all coordinates
  4. Get them out in text
Nov 23, 2016 at 6:06 PM
Got to the source code and download it. There you will find a project called TestDxfDocument it is full of samples that I use mainly for testing purposes, and they are not ordered in any special way, dig a little bit into them.

Nov 24, 2016 at 3:12 PM
Edited Nov 24, 2016 at 5:50 PM
Hi Daniel,

I tried and could atleast store centers of all circle in one Vecotr3. Now got stuck up with sorting. I want to sort them on X and than Y. Can you guide me in that?

Sorry if I sound silly, but your help will be appreciated.
public void btnOpen_Click(object sender, EventArgs e)
            string fNme;
            bool isBinary;
            DxfVersion DxfVer;
            string DxfVerStr;
            int TsHolesCnt;
            openFileDialog.Filter = "DXF Files (*.dxf)|*.dxf";
            DialogResult OpnDxf = openFileDialog.ShowDialog();
            if (OpnDxf == DialogResult.OK)
                fNme = openFileDialog.FileName;
                txtPath.Text = fNme;
                DxfDocument TsFile = DxfDocument.Load(fNme);
                DxfVer = DxfDocument.CheckDxfFileVersion(fNme, out isBinary);
                DxfVerStr = DxfVer.ToString();
                TsHolesCnt = TsFile.Circles.Count;
                lblCnt.Text = TsHolesCnt.ToString();
                var TsCircles = TsFile.Circles;

                List<Vector3> TsXYZCenters = new List<Vector3>();
                foreach (var obj in TsCircles)


Nov 27, 2016 at 6:35 PM
That kind of question lies outside the usage of the library and you will find better and more detailed information if you dig a little bit around the web. Specially look for how to use the Sort method of a List and its overloads.