"IllegalBoundary" and "Failure" Error When Adding Boundary to TIN Surface in Civil 3D

"IllegalBoundary" and "Failure" Error When Adding Boundary to TIN Surface in Civil 3D

artillis_prado4J852
Explorer Explorer
543 Views
1 Reply
Message 1 of 2

"IllegalBoundary" and "Failure" Error When Adding Boundary to TIN Surface in Civil 3D

artillis_prado4J852
Explorer
Explorer

I'm having trouble adding a boundary to a TIN Surface using the Civil 3D API. When calling TinSurface.BoundariesDefinition.AddBoundaries(), I get the error "Autodesk.Civil.SurfaceException: Failure (IllegalBoundary)". I'd like to know how to check if a boundary is valid before adding it and if there's a way to clear old or invalid boundaries. My engineering knowledge is limited, so any explanation about the possible causes of this error would be very helpful.

 

 

 

foreach (var quadPoly in listPoly)
{
    quadPoly.AddToDocument(modelSpace, acT);
    var ApplyOverkill = AutoCadUtils.EditorCommand([quadPoly.Id], "-OVERKILL", ed);

    TinSurface quadSurf1 = TinSurface
    .Create(acDb, $"QuadSurf1_{x}_{y}")
    .GetObjectForWrite<TinSurface>(acT);

    quadSurf1.PasteSurface(surf1.Id);

    try
    {
        quadSurf1.BoundariesDefinition.AddBoundaries(
            new ObjectIdCollection { quadPoly.Id },
            1,
            Autodesk.Civil.SurfaceBoundaryType.Outer,
            true);

        quadSurf1.Rebuild();

        var info = quadSurf1.GetArea();
    }
    catch (Exception ex) when (
        ex is SurfaceException ||
        ex is System.Runtime.InteropServices.SEHException)
    {}
    catch (Exception ex)
    {}
}

 

 

 

artillis_prado4J852_1-1740603058358.png

 

 

0 Likes
544 Views
1 Reply
Reply (1)
Message 2 of 2

Domzinator
Advocate
Advocate

I'm sure more experienced users can give better opinions but one thing that i have seen in my plugins is that the polylines needs to be closed, you can add that in that will ensure the polyline is closed when adding a boundary.

if (!quadPoly.Closed)
{
    quadPoly.Closed = true;
}

 

Civil 3D Certified Professional
0 Likes