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(); } }
之前:
翻转后: