AutoCAD Civil 3D 2013 .NET API has exposed the COGO Points (CogoPoint) and associated functionalities which enables us creating, updating or removing COGO Points. In next few series of posts I am going to share some basics of COGO Points and related .NET API which are new in Civil 3D 2013. In this post we will see how to create a Civil 3D COGO Point at a specified location.
For those, who didn't have to deal with COGO Points earlier, some basics of COGO Points : COGO is short form of "Coordinate Geometry". COGO Points in Civil 3D are more complex than AutoCAD points, which have only coordinate data. A CogoPoint object, in addition to a location, also has properties such as a unique ID number, name, raw (field) description, and full (expanded) description.
Here is a C# code snippet which demonstrates creation of Civil 3D COGO Point at a specified location :
// Select the location for COGO Point
PromptPointOptions ppo = new PromptPointOptions("\nSelect the location to Create a COGO Point :");
PromptPointResult ppr = ed.GetPoint(ppo);
if (ppr.Status != PromptStatus.OK)
return;
Point3d location = ppr.Value;
//start a transaction
using (Transaction trans = db.TransactionManager.StartTransaction())
{
// All points in a document are held in a CogoPointCollection object
// We can access CogoPointCollection through the CivilDocument.CogoPoints property
CogoPointCollection cogoPoints = CivilApplication.ActiveDocument.CogoPoints;
// Adds a new CogoPoint at the given location with the specified description information
ObjectId pointId = cogoPoints.Add(location, "Survey Point");
CogoPoint cogoPoint = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
// Set Some Properties
cogoPoint.PointName = "Survey_Base_Point";
cogoPoint.RawDescription = "This is Survey Base Point";
trans.Commit();
Hope this helps!