By Augusto Goncalves (@augustomaia)
The Civil 3D Styles collection is big, really big. Under CivilDocument.Styles we can read most of the information, but it can be tricky to dig it. This post show how to read Profile Geometry Points, as shown at the image below, for Alignment Label Set style.
The basic idea for this code is to get the LabelSetStyles, then the collection of AlignmentLabelSetItem, filter by ProfileGeometryPoint and, finally, get the dictionary containing the ProfilePointType and a boolean that indicates if is checked or not. Note the dictionary will only show checked items (true) and, if is not checked, it's not on the dictionary (so no false items on the dictionary).
[CommandMethod("labelStyleTest")] public static void CmdLabelStyleTest() { CivilDocument civilDoc = CivilApplication.ActiveDocument; Database db = Application.DocumentManager.MdiActiveDocument.Database; using (Transaction trans = db.TransactionManager.StartTransaction()) { ObjectId alignLblSetStyleId = civilDoc.Styles.LabelSetStyles. AlignmentLabelSetStyles["Major and Minor only"]; // or other name here AlignmentLabelSetStyle alignlblsetstyle = trans.GetObject( alignLblSetStyleId, OpenMode.ForRead) as AlignmentLabelSetStyle; foreach (AlignmentLabelSetItem lblSetItem in alignlblsetstyle) { // let's only treat Profile Geometry Point if (lblSetItem.LabelStyleType != LabelStyleType.AlignmentProfileGeometryPoint) continue; // this dictionary list should contain all marked (true) Dictionary<Autodesk.Civil.ProfilePointType, bool> list = lblSetItem.GetLabeledProfileGeometryPoints(); } } }