さまざまな Profile.CreateByLayout() メソッドによって標高情報を含まない新規の縦断を作成できます。次に、図形を使用して縦断の垂直シェイプを指定できます。図形は、ジオメトリ要素(接線または対称放物線)です。縦断を構成するすべての図形のコレクションは、Profile.Entities コレクションに含まれています。ProfileEntityCollection クラスには、新しい図形を作成するためのすべてのメソッドも含まれています。
次の例では、線形 oAlignment に沿って新しい縦断を作成し、3 種類の図形を追加して縦断のシェイプを定義します。2 つの直線図形が各端に追加し、1 つの対称放物線を中央に追加し、それらを結合して谷の凹型を表現します。
// Illustrates creating a new profile without elevation data, then adding the elevation // via the entities collection [CommandMethod("CreateProfileNoSurface")] public void CreateProfileNoSurface() { doc = CivilApplication.ActiveDocument; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()) { // Ask the user to select an alignment PromptEntityOptions opt = new PromptEntityOptions("\nSelect an Alignment"); opt.SetRejectMessage("\nObject must be an alignment.\n"); opt.AddAllowedClass(typeof(Alignment), false); ObjectId alignID = ed.GetEntity(opt).ObjectId; Alignment oAlignment = ts.GetObject(alignID, OpenMode.ForRead) as Alignment; // use the same layer as the alignment ObjectId layerId = oAlignment.LayerId; // get the standard style and label set // these calls will fail on templates without a style named "Standard" ObjectId styleId = doc.Styles.ProfileStyles["Standard"]; ObjectId labelSetId = doc.Styles.LabelSetStyles.ProfileLabelSetStyles["Standard"]; ObjectId oProfileId = Profile.CreateByLayout("My Profile", alignID, layerId, styleId, labelSetId); // Now add the entities that define the profile. Profile oProfile = ts.GetObject(oProfileId, OpenMode.ForRead) as Profile; Point3d startPoint = new Point3d(oAlignment.StartingStation, -40, 0); Point3d endPoint = new Point3d(758.2, -70, 0); ProfileTangent oTangent1 = oProfile.Entities.AddFixedTangent(startPoint, endPoint); startPoint = new Point3d(1508.2, -60.0, 0); endPoint = new Point3d(oAlignment.EndingStation, -4.0, 0); ProfileTangent oTangent2 =oProfile.Entities.AddFixedTangent(startPoint, endPoint); oProfile.Entities.AddFreeSymmetricParabolaByLength(oTangent1.EntityId, oTangent2.EntityId, VerticalCurveType.Sag, 900.1, true); ts.Commit(); } }