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:
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.
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.
Solved! Go to Solution.
Solved by Partha.Sarkar. Go to Solution.
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.
SuperelevationCriticalStationType.BeginAlignment and SuperelevationCriticalStationType.EndAlignment are also critical stations, but they can’t not deleted using API.
Thanks,
Partha