Author Topic: How can I renumber points with CommandLine by SendStringToExecute command?  (Read 1552 times)

0 Members and 1 Guest are viewing this topic.

ekoneo

  • Newt
  • Posts: 66
I try to renumber points by using commandline.

Code: [Select]
for (int i = 0; i < 10; i++)
                        {
                            acDoc.SendStringToExecute("._AECCSELECTANDEDITPOINTNUMBERS ", true, false, false);
                            acDoc.SendStringToExecute("Numbers", true, false, false);
                            acDoc.SendStringToExecute(i+"", true, false, false);
                            acDoc.SendStringToExecute("100", true, false, false);
                            acDoc.SendStringToExecute("\n", true, false, false);
                         }
                        acDoc.SendStringToExecute("._zoom _all ", true, false, false);

But I get some errors.
1-) "Generic Integer" validation error
2-) I can not add 100 to each points.

How can I renumber using for cycle?    :ugly:    :kewl:
« Last Edit: April 10, 2014, 09:03:36 AM by ekoneo »

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
What version of Civil3d are you using?
« Last Edit: April 10, 2014, 09:30:06 AM by Jeff_M »

ekoneo

  • Newt
  • Posts: 66
Civil 3d 2010 and civil 3d 2014

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
This code works in C3D2013 & 2014.
Code - C#: [Select]
  1.         public void renumpnts()
  2.         {
  3.             CivilDocument civdoc = CivilApplication.ActiveDocument;
  4.             using (AcDb.Transaction tr = AcDb.HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
  5.             {
  6.                 for (uint i = 1; i < 11; i++)
  7.                 {
  8.                     if (!civdoc.CogoPoints.Contains(i))
  9.                         continue;
  10.                     CogoPoint pt = (CogoPoint)civdoc.CogoPoints.GetPointByPointNumber(i).GetObject(AcDb.OpenMode.ForWrite);
  11.                     pt.Renumber(i + 100, PointNumberResolveType.Overwrite);
  12.                 }
  13.                 tr.Commit();
  14.             }            
  15.         }
  16.  

2010 is similar except you must use the COM Interops.