I´m trying to create a new instance of class "CogoPointCollection" but Visual Studio say me that CogoPointCollection doesn´t have a defined builders.
public static CogoPointCollection Get_CogoPointColl(ObjectIdCollection IdColl) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Database db = Application.DocumentManager.MdiActiveDocument.Database; Autodesk.Civil.ApplicationServices.CivilDocument civDoc = default(Autodesk.Civil.ApplicationServices.CivilDocument); civDoc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument; CogoPointCollection CogoPointColl = new CogoPointCollection(); foreach (ObjectId pointId in IdColl) { CogoPoint CP = pointId.GetObject(OpenMode.ForRead) as CogoPoint; double X = CP.Easting; double Y = CP.Northing; double Z = CP.Elevation; Autodesk.AutoCAD.Geometry.Point3d point = new Autodesk.AutoCAD.Geometry.Point3d(X, Y, Z); CogoPointColl.Add(point); } }
Can I create my own CogoPointCollection or it´s only to get CogoPoint Collection in Database?
Thank you.
Solved! Go to Solution.
Solved by zrobert. Go to Solution.
You can't create instance of CogoPointCollection class.
But, you can create simple ObjectIdCollection or ObjectId[] to hold ObjectId's
of your CogoPoints objects, and then you can create CogoPoint objects from this Id's
inside of Transaction.
Another way is to create generic list to hold CogoPoint objects:
var cogoPointCollection = new List<CogoPoint>();
and then add CogoPoints to list inside of your loop:
cogoPointCollection.Add(point);
After that, you can iterate through this collection and do things on CogoPoint objects.
Just remember that object created inside of transaction, live as long as live transaction.
Ok. I undestand it now.
I always use List for all. This time I´m going to use a List too.
I want to compare location cogopoints from Group Point versus location vertex of breaklines.
Thank you.