By Augusto Goncalves (@augustomaia)
This is a quick sample code on how call StationOffsetLabel.Create method for all Alignments on each Station increment interval. Note it's using the first StationOffsetLabelStyle and first MarkerStyle from the respective style collections.
[CommandMethod("addStationOffsetLabel")] public static void CmdAddStationOffsetLabel() { CivilDocument civilDoc = CivilApplication.ActiveDocument; Database db = Application.DocumentManager.MdiActiveDocument.Database; using (Transaction trans = db.TransactionManager.StartTransaction()) { foreach (ObjectId alignId in civilDoc.GetSitelessAlignmentIds()) { Alignment align = trans.GetObject(alignId, OpenMode.ForRead) as Alignment; for (double s = align.StartingStation; s < align.EndingStation; s+= align.StationIndexIncrement) { double easting = 0; double northing = 0; align.PointLocation(s, 0, ref easting, ref northing); Point2d p = new Point2d(easting, northing); StationOffsetLabel.Create( alignId, civilDoc.Styles.LabelStyles.AlignmentLabelStyles.StationOffsetLabelStyles[0], civilDoc.Styles.MarkerStyles[0], p); } } trans.Commit(); } }