AutoCAD Civil 3D COM API has IAeccSurfaceBreaklines:: Remove method to remove Surface Breaklines. In the ‘ActiveX API Reference’ document we see this –
IAeccSurfaceBreaklines:: Remove Method - > Removes an item from the collection, specified by index or object reference.
HRESULT Remove( [in] VARIANT varIndex);
One of our Civil 3D application developers friend recently asked me ‘how do we use object reference in Remove()’ ? That prompted me to dig deeper in this and I find we can only use index in the Remove() and it doesn’t work with object reference. By the time we update the Civil 3D ActiveX API reference document on this, I thought it would be useful to you all if I share this information here in IM DevBlog.
Here is the VB.NET code snippet showing usage of COM API Remove(index) –
If(oTinSurface.Breaklines.Count > 0)
' Remove() Breakline using COM API
ed.WriteMessage(vbCrLf + "Breakline Removed ! " )
In Civil 3D .NET API we have the equivalent RemoveAt(int) and here is C# .NET code snippet –
// Get the TIN Surface
TinSurface tinSurface = surfaceId.GetObject(OpenMode.ForWrite) as TinSurface;
// Lets try to Remove Breakline using RemoveAt(int)
// rebuild the surface
Hope this is useful to you!