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

Civil 3D 二次开发 翻转曲面高程分析颜色

不解释,直接上代码及截图。

 

[CommandMethod("RvsSEA")]
public void ReverseSurfaceElevationAnalysis()
{
    CivilDocument civilDoc = CivilApplication.ActiveDocument;

    Document doc = Application.DocumentManager.MdiActiveDocument;
    Editor ed = doc.Editor;
    PromptEntityOptions peo = new PromptEntityOptions("拾取三角网曲面");
    peo.SetRejectMessage("\n请选择三角网曲面");
    peo.AddAllowedClass(typeof(TinSurface), true);
    PromptEntityResult per = ed.GetEntity(peo);

    ObjectId surfaceId = ObjectId.Null;
    if (per.Status == PromptStatus.OK)
    {
        surfaceId = per.ObjectId;
    }
    else return;

    using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
    {

        TinSurface oSurface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface;

        SurfaceAnalysisElevationData[] analysisData = oSurface.Analysis.GetElevationData();
        

        int n = analysisData.Length;

        for (int i = 0; i < n / 2; i++)
        {
            Color tempColor = analysisData[i].Scheme;
            analysisData[i].Scheme = analysisData[n-1-i].Scheme;
            analysisData[n - 1 - i].Scheme = tempColor;
        }
        
        oSurface.Analysis.SetElevationData(analysisData);

        ts.Commit();
    }
}

之前:

 

 

翻转后:

 

 

 

posted @ 2017-06-30 08:35  david96007  阅读(1740)  评论(0编辑  收藏  举报