各横断抽出ラインには、その横断抽出ラインに基づいた横断のコレクションが含まれています。個々の横断は Section 型のオブジェクトによって表され、横断上のサーフェスの統計情報を取得するメソッドを備えています。
Autodesk.Civil.DatabaseServices.Section と Autodesk.AutoCAD.DatabaseServices.Section との間で名前が混乱する可能性があることに注意してください。この問題は、コード内でクラス名を完全に限定するか、次のようなエイリアス ステートメントを使用して参照の混乱を解消することによって、解決することができます。
using Section = Autodesk.Civil.DatabaseServices.Section;
次の例では、Alignment の最初の SampleLineGroup を取得し、SampleLineGroup 内の SampleLines を繰り返し、次に各 Section ( SampleLine上の)を繰り返します。 Section の標高情報を出力し、更新モードを設定します。
// Use Centerline (1)
Alignment alignment = null;
foreach (ObjectId alignmentId in _civildoc.GetAlignmentIds())
{
Alignment a = ts.GetObject(alignmentId, OpenMode.ForRead) as Alignment;
if (a.Name == "Centerline (1)") { alignment = a; break; }
}
// Get the first sample line group, SLG-1:
SampleLineGroup sampleLineGroup = ts.GetObject(alignment.GetSampleLineGroupIds()[0], OpenMode.ForRead) as SampleLineGroup;
foreach (ObjectId sampleLineId in sampleLineGroup.GetSampleLineIds())
{
SampleLine sampleLine = ts.GetObject(sampleLineId, OpenMode.ForRead) as SampleLine;
foreach ( ObjectId sectionId in sampleLine.GetSectionIds()){
Section section = ts.GetObject(sectionId, OpenMode.ForWrite) as Section;
_editor.WriteMessage("Section {0} elevation max: {1} min: {2}\n", section.Name, section.MaximumElevation, section.MinmumElevation);
// set the section update mode:
section.UpdateMode = SectionUpdateType.Dynamic;
}
}