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!!
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
I'm passing ObjectIdCollection which contains ObjectIds of enclosed Boundaries made out of lines and Polylines.
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.
Can't find what you're looking for? Ask the community or share your knowledge.