Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can I do this? (My own CogoPointCollection)

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
joantopo
381 Views, 3 Replies

Can I do this? (My own CogoPointCollection)

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.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
3 REPLIES 3
Message 2 of 4
zrobert
in reply to: joantopo

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.

Message 3 of 4
joantopo
in reply to: zrobert

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.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
Message 4 of 4
zrobert
in reply to: joantopo

I'm glad that I help.

Cheers...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report