Adding / Removing BaselineRegion using .NET API

BaselineRegion
class in Civil 3D represents a segment of a baseline, specified by alignment
stations for the start and end point. In a corridor, each baseline region uses
a single assembly type.

In AutoCAD
Civil 3D using UI tools we can add / remove BaselineRegion –

BaselineRegion01

 

New API
functions are exposed in this release to add, remove or access a BaselineRegion
in the class BaselineRegionCollection.

Here is a C#
.NET code snippet which shows how to add and remove BaselineRegion –

 

// BaselineRegionCollection.Add(string regionName, string assemblyName, double startStation, double endStation ) 
// Adds a region at the specified start and end station with the given name and assembly. 
 
// Get the BaselineRegionCollection
BaselineRegionCollection baselineRegionColl = corridor.Baselines[0].BaselineRegions;
 
// Add a new BaselineRegion
BaselineRegion baselineregion = baselineRegionColl.Add("My Added Region", "Assembly - (1)", 506.00, 1110.00);  
 
// Remove a BaselineRegion with a given Name        
baselineRegionColl.Remove("Corridor Region (2)");
 
//rebuild the corridor
corridor.Rebuild();

Once added
the newly created BaselineRegion will be shown under the Baseline –

BaselineRegion03


Comments

4 responses to “Adding / Removing BaselineRegion using .NET API”

  1. Veli V. Avatar
    Veli V.

    Hi,
    I like to know how we can create whole corridor from scratch with .NET?

  2. Hi Veli,
    In Civil 3D 2014, Corridor and related features are exposed in .NET API. We can create a corridor. Check this post –
    http://adndevblog.typepad.com/infrastructure/2013/03/create-a-corridor-with-civil3d-2014-api.html
    I would post some more relevant sample codes in the coming days, so keep watching this space.
    Thanks,
    Partha
    ADN

  3. Hi Veli,
    I just posted this on Corridor creation –
    http://adndevblog.typepad.com/infrastructure/2013/04/creating-a-civil-3d-corridor-object-using-net-api.html
    Hope this helps !
    Cheers,
    Partha

  4. Veli V. Avatar
    Veli V.

    Thank you. It help us to create corridor with .NET. We have used before COM API.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading