In AutoCAD Civil 3D, Points can be selected and added to a PointGroup using either a standard (StandardPointGroupQuery object) or custom (CustomPointGroupQuery object) query. Both of these classes inherit from the PointGroupQuery base class.
Here is a C# code snippet which demonstrates how to create a PointGroup using StandardPointGroupQuery object.
//start a transaction
using (Transaction trans = db.TransactionManager.StartTransaction())
{
// Check if the pointGrpName already exists before trying to add it
ObjectId pointGrpId = civilDoc.PointGroups.Add(pointGrpName);
PointGroup pointGrp = pointGrpId.GetObject(OpenMode.ForWrite) as PointGroup;
// Build a quesry using StandardPointGroupQuery object
// Query conditions used below are specific to Civil 3D Tutorial DWG file "Points-3.dwg"
StandardPointGroupQuery standardPointGrpQry = new StandardPointGroupQuery();
// One thing to note here :
// All of the Include* properties are OR-ed together,
// and all the Exclude* properties are OR- ed together
standardPointGrpQry.IncludeNumbers = "550-560, 565-572";
standardPointGrpQry.ExcludeElevations = ">100.00";
//This method sets the query object in the point group
pointGrp.SetQuery(standardPointGrpQry);
trans.Commit();
}
Hope this is useful to you!