Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding Boundary Definition to TIN Surface in Civil 3D

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
heyimsp12
402 Views, 4 Replies

Adding Boundary Definition to TIN Surface in Civil 3D

Hi,

I'm trying to create a new TIN surface and add definitions for Breaklines and Boundary using following lines of code and constantly running into error: "Invalid input for breaklines". Not sure why.

 

 

 

public void CreateTinSurface(ObjectIdCollection BoundaryIdCollection)
        {
            var ed = Application.DocumentManager.MdiActiveDocument.Editor;
            var db = Application.DocumentManager.MdiActiveDocument.Database;
            var civilDoc = CivilApplication.ActiveDocument;

            using (var trans = db.TransactionManager.StartTransaction())
            {
                try
                {
                    //Select a surface style 
                    ObjectId styleId = civilDoc.Styles.SurfaceStyles[1];

                    if (styleId == null | BoundaryIdCollection == null)
                        throw new Exception("Either Style Id or BoundarySet is empty.");

                    //Creating an empty TIN Surface
                    ObjectId surfaceId = TinSurface.Create("TIN_Surface_From_boundary", styleId);

                    TinSurface surface = (TinSurface)trans.GetObject(surfaceId, OpenMode.ForWrite);

                    //Add Breaklines to the surface
                    //Next line is where I get error thrown.
                    SurfaceDefinitionBreaklines surfaceBreaklines = surface.BreaklinesDefinition;
                    //surfaceBreaklines.AddNonDestructiveBreaklines(BoundaryIdCollection, 1.0);
                    surfaceBreaklines.AddProximityBreaklines(BoundaryIdCollection, 1.0);

                    //Access the Boundaries Definition object from the Surface Object
                    SurfaceDefinitionBoundaries surfaceboundaries = surface.BoundariesDefinition;
                    //Next line is where I get error thrown.
                    surfaceboundaries.AddBoundaries(BoundaryIdCollection, 1.0, Autodesk.Civil.SurfaceBoundaryType.Outer, true);
                                    
                }
                catch (Exception ex)
                {
                    Application.ShowAlertDialog("Error creating Tin surface.");
                }
                trans.Commit(); //End transaction
            }
        }

 

 

 

Need help!!

Labels (3)
4 REPLIES 4
Message 2 of 5
Jeff_M
in reply to: heyimsp12

What object types are you passing for the breaklines?
Jeff_M, also a frequent Swamper
EESignature
Message 3 of 5
heyimsp12
in reply to: Jeff_M

I'm passing ObjectIdCollection which contains ObjectIds of enclosed Boundaries made out of lines and Polylines.

Message 4 of 5
Jeff_M
in reply to: heyimsp12

Use the AddStandardBreaklines since the surface is empty. ProximityBreaklines use the nearest triangle vertex to get the elevation for the breaklines. An empty surface has no triangles to use. In the C3D editor you can do this, but I believe C3D catches the error and uses the Standard breakline option.

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 5
heyimsp12
in reply to: Jeff_M

Thanks @Jeff_M
This worked like a charm.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report