C3D-0094 · READ-ONLY: locate the General Curve Label Style collection [FIND-GENERAL-CURVE] done
Reflects LabelStylesRoot to find the real API path to the General Curve Label Style collection shown in Toolspace, and lists the styles it contains. No changes.
C# payload
// READ-ONLY. Find the API path to the GENERAL Curve Label Style collection (Toolspace shows it
// above Parcel Curve Label Style). LabelStylesRoot has no GeneralLabelStyles member, so reflect
// the real surface of LabelStylesRoot and drill into whatever holds curve styles.
// Nothing is modified.
var civil = CivilApplication.ActiveDocument;
Func<Func<string>, string> safe = f => { try { return f(); } catch (System.Exception ex) { return "<" + ex.GetType().Name + ">"; } };
var root = civil.Styles.LabelStyles;
var rt = root.GetType();
Log("=== " + rt.FullName + " ===");
foreach (var pr in rt.GetProperties()) {
Log(" " + pr.PropertyType.Name + " " + pr.Name);
}
// drill one level: anything whose name mentions General
Log("");
foreach (var pr in rt.GetProperties()) {
if (pr.Name.ToUpper().IndexOf("GENERAL") < 0) continue;
Log("=== drilling " + pr.Name + " ===");
object sub = null;
try { sub = pr.GetValue(root, null); } catch (System.Exception ex) { Log(" " + ex.Message); continue; }
if (sub == null) { Log(" <null>"); continue; }
var st = sub.GetType();
Log(" type " + st.FullName);
foreach (var p2 in st.GetProperties()) {
Log(" " + p2.PropertyType.Name + " " + p2.Name);
if (p2.Name.ToUpper().IndexOf("CURVE") < 0) continue;
try {
var coll = p2.GetValue(sub, null) as System.Collections.IEnumerable;
if (coll == null) continue;
foreach (object o in coll) {
var oid = (ObjectId)o;
var s = Tx.GetObject(oid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (s != null) Log(" style: " + safe(() => s.Name));
}
} catch (System.Exception ex) { Log(" " + ex.Message); }
}
}
Result
Log
=== Autodesk.Civil.DatabaseServices.Styles.LabelStylesRoot ===
LabelStyleCollection GeneralShapeLabelStyles
LabelStyleCollection GeneralLinkLabelStyles
LabelStyleCollection GeneralMarkerLabelStyles
LabelStyleCollection GeneralCurveLabelStyles
LabelStyleCollection GeneralLineLabelStyles
LabelStyleCollection GeneralNoteLabelStyles
LabelStylesProjectionRoot ProjectionLabelStyles
LabelStylesPointRoot PointLabelStyles
LabelStylesMatchLineRoot MatchLineLabelStyles
LabelStylesViewFrameRoot ViewFrameLabelStyles
LabelStylesIntersectionRoot IntersectionLabelStyles
LabelStylesSampleLineRoot SampleLineLabelStyles
LabelStylesSectionViewRoot SectionViewLabelStyles
LabelStylesCatchmentRoot CatchmentLabelStyles
LabelStylesStructureRoot StructureLabelStyles
LabelStylesPipeRoot PipeLabelStyles
LabelStylesSectionRoot SectionLabelStyles
LabelStylesProfileViewRoot ProfileViewLabelStyles
LabelStylesProfileRoot ProfileLabelStyles
LabelStylesParcelRoot ParcelLabelStyles
LabelStylesSurfaceRoot SurfaceLabelStyles
LabelStylesAlignmentRoot AlignmentLabelStyles
LabelStyleDefault DefaultLabelStyle
Boolean AutoDelete
Boolean IsDisposed
IntPtr UnmanagedObject
=== drilling GeneralShapeLabelStyles ===
type Autodesk.Civil.DatabaseServices.Styles.LabelStyleCollection
ExpressionCollection Expressions
LabelStyleDefault DefaultLabelStyle
ObjectId Item
ObjectId Item
Int32 Count
Boolean AutoDelete
Boolean IsDisposed
IntPtr UnmanagedObject
=== drilling GeneralLinkLabelStyles ===
type Autodesk.Civil.DatabaseServices.Styles.LabelStyleCollection
ExpressionCollection Expressions
LabelStyleDefault DefaultLabelStyle
ObjectId Item
ObjectId Item
Int32 Count
Boolean AutoDelete
Boolean IsDisposed
IntPtr UnmanagedObject
=== drilling GeneralMarkerLabelStyles ===
type Autodesk.Civil.DatabaseServices.Styles.LabelStyleCollection
ExpressionCollection Expressions
LabelStyleDefault DefaultLabelStyle
ObjectId Item
ObjectId Item
Int32 Count
Boolean AutoDelete
Boolean IsDisposed
IntPtr UnmanagedObject
=== drilling GeneralCurveLabelStyles ===
type Autodesk.Civil.DatabaseServices.Styles.LabelStyleCollection
ExpressionCollection Expressions
LabelStyleDefault DefaultLabelStyle
ObjectId Item
ObjectId Item
Int32 Count
Boolean AutoDelete
Boolean IsDisposed
IntPtr UnmanagedObject
=== drilling GeneralLineLabelStyles ===
type Autodesk.Civil.DatabaseServices.Styles.LabelStyleCollection
ExpressionCollection Expressions
LabelStyleDefault DefaultLabelStyle
ObjectId Item
ObjectId Item
Int32 Count
Boolean AutoDelete
Boolean IsDisposed
IntPtr UnmanagedObject
=== drilling GeneralNoteLabelStyles ===
type Autodesk.Civil.DatabaseServices.Styles.LabelStyleCollection
ExpressionCollection Expressions
LabelStyleDefault DefaultLabelStyle
ObjectId Item
ObjectId Item
Int32 Count
Boolean AutoDelete
Boolean IsDisposed
IntPtr UnmanagedObjectNotes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.