欢迎来到我的博客
Civil 3D开发与应用,欢迎加入QQ群:484124761
AutoCAD开发,欢迎加入QQ群:193522571

Civil 3d中获取要素线FeatureLine对应的平面曲线

如题

对于没有相交要素线自动添加的高程点的要素线,

下面的代码可以正常工作,

如果有自动添加的高程点,

下面的代码有问题,

如果过滤掉自动添加的高程点尚未找到解决方法。

 

/// <summary>
/// 获取要素线对应的平面曲线
/// </summary>
/// <param name="fl">要素线</param>
/// <returns>高程为0的Polyline2d</returns>
public static Polyline2d GetPolyline2d(this FeatureLine fl)
{
    var pts = fl.GetPoints(FeatureLinePointType.AllPoints);
    DoubleCollection doubles = new DoubleCollection();
    for (int i = 0; i < pts.Count; i++)
    {
        try
        {
            doubles.Add(fl.GetBulge(i));
        }
        catch (System.Exception ex)
        {
            doubles.Add(0);

        }
    }
    return new Polyline2d(Poly2dType.SimplePoly, pts, 0, fl.Closed, 0, 0, doubles);
}

 

posted @ 2024-03-21 09:54  david96007  阅读(39)  评论(0编辑  收藏  举报