Author Topic: How can I assign all Cogo Points to an array?  (Read 1265 times)

0 Members and 1 Guest are viewing this topic.

ekoneo

  • Newt
  • Posts: 66
How can I assign all Cogo Points to an array?
« on: April 24, 2014, 03:13:32 AM »
Anybody know that assigning all cogo points to an array?
Such as MyCogoARRAY.
Then I want to use that array MyCogoARRAY[5] that returning 5th cogo point's number or other properties.
Are there any way to do that?

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: How can I assign all Cogo Points to an array?
« Reply #1 on: April 24, 2014, 08:59:49 AM »
Code - C#: [Select]
  1.             CivilDocument civdoc = CivilApplication.ActiveDocument;
  2.             Document doc = acadApp.DocumentManager.MdiActiveDocument;
  3.             Editor ed = doc.Editor;
  4.             Database db = doc.Database;
  5.            
  6.             using (Transaction tr = db.TransactionManager.StartTransaction())
  7.             {
  8.                 PointGroup pg = (PointGroup)civdoc.PointGroups["_All Points"].GetObject(OpenMode.ForRead);
  9.                 uint[] pointnums = pg.GetPointNumbers();
  10.                 //the array of Point #'s is not in any particular order, so convert to List & Sort...requires a using for Linq
  11.                 List<uint> ptlist = pointnums.ToList<uint>();
  12.                 ptlist.Sort();
  13.                 //if  an array is really needed instead of the now sorted List, convert back to an array
  14.                 pointnums = ptlist.ToArray();
  15.                 tr.Commit();
  16.              }
  17.  

ekoneo

  • Newt
  • Posts: 66
Re: How can I assign all Cogo Points to an array?
« Reply #2 on: April 24, 2014, 10:05:13 AM »
Thanks again thanks thousands of thanks Jeff_M;
It works..
Thank you..