View Categories

Get the wall breakline elevation

1 min read

Motivation #

To create a wall breakline, you need two elements: the scaffolding polyline (or 3D polyline) and the breakline itself. However, Civil 3D does not display the breakline elevation—only the elevation of the scaffolding polyline is shown. This can lead to confusion, making you wonder, “Why is my TIN surface elevation not matching what I defined?”

API to Read the Breakline Elevation #

Breakline elevation data is only accessible using the .NET API coupled with COM API access. Below is an example demonstrating how to retrieve this information. Special thanks to all contributors in this discussion.

    [CommandMethod(nameof(CmdSurf_WallBreaklineDump))]
        public void CmdSurf_WallBreaklineDump()
        {
            Document aDoc = Application.DocumentManager.MdiActiveDocument;
            Database db = aDoc.Database;
            Editor ed = aDoc.Editor;


            using OpenCloseTransaction tr = db.TransactionManager.StartOpenCloseTransaction();

            var surfaceId = CivilApplication.ActiveDocument.GetSurfaceIds()[0];
            TinSurface surf = tr.GetObject(surfaceId, OpenMode.ForRead) as TinSurface;
            dynamic oSurf = surf.AcadObject;
            for (int i = 0; i < oSurf.Breaklines.Count; i++)
            {
                dynamic brkSet = oSurf.Breaklines.Item(i);
                if (brkSet.Type == 3)
                {
                    dynamic ents = brkSet.BreaklineEntities;
                    dynamic elevs = brkSet.Elevations;
                    for (int j = 0; j < ents.Length; j++)
                    {
                        dynamic ent = ents[j];
                        dynamic elevData = elevs[j];
                        ed.WriteMessage("\nEntity: " + ent.EntityName);
                        for (int k = 0; k < elevData.Length; k++)
                        {
                            double elev = elevData[k];  //here's the meat
                            ed.WriteMessage("\n - Vertex (" + k + ") Elev: " + elev.ToString("F2"));
                        }
                    }
                }
            }
            tr.Commit();
        }

Here’s another example

        [CommandMethod(nameof(ComSurfaceRetrieval))]
        public void ComSurfaceRetrieval()
        {
            var aeccApp = new AeccApplication();


            aeccApp.Init((AcadApplication)Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication);
            AeccDocument doc = (AeccDocument)aeccApp.ActiveDocument;
            AeccTinSurface aeccSurface = (AeccTinSurface)doc.Surfaces[0];
            for (int i = 0; i < aeccSurface.Breaklines.Count; i++)
            {
               
                var breaklines = aeccSurface.Breaklines.Item(i);
                var elevations = (object[])breaklines.Elevations;
                var bbEntities = (object[])breaklines.BreaklineEntities;
                for (int j = 0; j < elevations.Length; j++)
                {
                    var elevation = (double[])elevations[j];
                    for (int k = 0; k < elevation.Length; k++)
                    {
                        
                    }
                }
               
            }

        }

Powered by BetterDocs