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: 

Erase all critical station superelevations.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
joantopo
521 Views, 2 Replies

Erase all critical station superelevations.

Hi.

 

I´m using this code snippet (in a button) to delete all critical station superelevations from selected alignment.

 

 public static void EliminaTodos_PuntosCriticosPeralte(Autodesk.AutoCAD.DatabaseServices.ObjectId identificador)
        {
            //elimina todos los puntos críticos de peralte (critical station) de una alineación para que no quede ninguno.

            try
            {

                Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
                Database db = doc.Database;
                Editor ed = doc.Editor;

                using (DocumentLock docLock = doc.LockDocument())
                {
                    using (Transaction trans = db.TransactionManager.StartTransaction())
                    {
                        Alignment align = trans.GetObject(identificador, OpenMode.ForWrite) as Alignment;


                        // get the critical station collection on the aligment.
                        SuperelevationCriticalStationCollection criteriaStationColl = align.SuperelevationCriticalStations;
                        int Total = criteriaStationColl.Count;
                        for (int i = 1; i <= Total - 2; i++)    //el primer y último pk como punto crítico de peralte no se pueden eliminar
                        {

                            //eliminamos cada vez el índice 1 porque cuando se elimina un CriticalStation automaticamente el punto siguiente toma el índice anterior,es decir, se ordena la nueva lista según su p.k
                            criteriaStationColl.RemoveAt(1);
                            
                        }

                        trans.Commit();
                    }//end using
                }//end lock

            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }

 this code works fine except one thing:

 

http://thebinarymachine.com/how-to-calculate-superelevation-in-civil-3d/

 

It says that: 

  • If the alignment doesn´t contain any superelevation data a task dialog will be displayed with the following options.

 

However if I erase all critical station superelevations with my method, then it doesn´t appear that dialog window (Calculate superelevation now) the next times.

 

In Civil 3D, there is a button to do this and I want to do the same with my button.

 

71.png

 

I want to do this, because I calculate my own critical station superelevations, but I modify default settings parameters of superelevations and they are used always that we calculate superelevations again.

 

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
2 REPLIES 2
Message 2 of 3
joantopo
in reply to: joantopo

Perhaps it is because in my method I can´t erase critical station superelevations type :

-StartAlignment.

and

-EndAlignment.

 

They can´t be never deleted.

 

But Civil 3D has that button to delete all(included those critical station superelevations) critical stations superelevation.

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 3 of 3
Partha.Sarkar
in reply to: joantopo

SuperelevationCriticalStationType.BeginAlignment and SuperelevationCriticalStationType.EndAlignment are also critical stations, but they can’t not deleted using API.

 

Thanks,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Rail Community


Autodesk Design & Make Report