AutoCAD Civil 3D Help: Adding a Boundary

添加一个Boundary


一个boundary是一个闭合的多边形,它可以影响到其内的三角形的可见性。

一个曲面的所有boundary存储在Surface.BoundariesDefinition集合中。Boundary本质上是通过一个AutoCAD元素来定义的,比如一个闭合的polyline或一个多边形。该元素的高度在裁切曲面三角形方面不起作用,所以你既可以2D元素,也可以用3D元素。该元素也可以包括曲线,但boundary总是包含line。line的嵌入方式通过mid-ordinate距离来定义,mid-ordinate是曲线和那些用于模拟曲线的line间的最大距离。

You can add boundaries to a surface with its BoundariesDefinition.AddBoundaries() method. There are three overloads of this method that take one of these to define the new boundaries:

你可以通过一个曲面的BoundariesDefinition.AddBoundaries()方法为它添加boundary。该方法有3个重载方法。

  1. an ObjectIdCollection包括一个既存的polyline,polygon或parcel
  2. a Point2dCollection
  3. a Point3dCollection

该方法也指定了boundry的类型(data clip、outer、hide或show)、决定是否使用non-destructive的breakline、以及mid-ordinate距离的值。该值决定了line怎样嵌入曲线中。

下面的例子提示用户选择一个三角网曲面和一个polyline,该polyline被添加到该曲面的boundary集合中。注意,这个曲面在添加boundary之后必须进行re-built。通过.NET API对一个曲面的boundary进行编辑的时候,Civil 3D不会显示re-build图标。

[CommandMethod("AddSurfaceBoundary")]
public void AddSurfaceBoundary()
{
    using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
    {
        // Prompt the user to select a surface and a polyline
        ObjectId surfaceId = promptForEntity("Select the surface to add a boundary to", typeof(TinSurface));
        ObjectId polyId = promptForEntity("Select the object to use as a boundary", typeof(Polyline));

        // The boundary or boundaries must be added to an ObjectIdCollection for the AddBoundaries method:
        ObjectId[] boundaries = { polyId };
        TinSurface oSurface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface;

        try
        {
            oSurface.BoundariesDefinition.AddBoundaries(new ObjectIdCollection(boundaries), 100, Autodesk.Civil.Land.SurfaceBoundaryType.Outer, true);
            oSurface.Rebuild();
        }

        catch (System.Exception e)
        {
            editor.WriteMessage("Failed to add the boundary: {0}", e.Message);
        }

        // commit the transaction
        ts.Commit();
    }
}

父主题:

使用曲面

results matching ""

    No results matching ""