ChannelCreateFromAlignment(String, ObjectId, ObjectId, TupleDouble, Double, ObjectId, ObjectId) Method

Create channel from alignment and profile with more options.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDrainageDesignMgd (in AeccDrainageDesignMgd.dll) Version: 13.9.960.0
Syntax
public static ObjectId CreateFromAlignment(
	string channelName,
	ObjectId alignmentId,
	ObjectId profileId,
	Tuple<double, double> stationRange,
	ObjectId channelStyleId,
	ObjectId layerId
)

Parameters

channelName  String
Name of the channel to be created.
alignmentId  ObjectId
Object id of the alignment used to create channel.
profileId  ObjectId
Object id of the profile used to create channel.
stationRange  TupleDouble, Double
Station range of channel's start/end station. If it's null, then no specified station range.
channelStyleId  ObjectId
Channel style object id of the channel to be created. If it's Null object id, then a default channel style is used.
layerId  ObjectId
Layer object id of the channel to be created. If it's Null object id, then a default layer is used.

Return Value

ObjectId
Object id of the channel created.
Exceptions
ExceptionCondition
BackwardCompatibilityException Thrown when getting/setting value and data is not compatible with the current version of the channel. Try to fix by upgrading the channel.
ForwardCompatibilityException Thrown when getting/setting value and data is not compatible with the current version of the channel. Try to fix by opening the drawing in a newer version of the product.
ArgumentException Thrown when:
  1. Channel name is empty.
  2. Channel name is duplicate.
  3. Channel name contains invalid character.
  4. Alignment object id is invalid.
  5. Profile object id is invalid.
  6. The profile doesn't belong to the alignment.
  7. Station range start is bigger than or equal to station range end.
  8. Channel style object id is invalid.
  9. Layer object id is invalid.
ArgumentNullException Thrown when the specified channel name string is null.
ArgumentOutOfRangeException Thrown when:
  1. Station range start is out of station range of the baseline.
  2. Station range end is out of station range of the baseline.
Example
This example shows how to create a channel from an alignment.
C#
1ObjectId alignmentId = CivilDocument.GetCivilDocument(m_Database).GetAlignmentIds()[0];
2ObjectId profileId = (alignmentId.GetObject(OpenMode.ForRead) as Alignment).GetProfileIds()[0];
3
4Tuple<double, double> stationRange = new Tuple<double, double> (100, 3000);
5ObjectId sytleId = CivilApplication.ActiveDocument.Styles.GetChannelStyles()["Standard"];
6ObjectId layerId = (m_Database.LayerTableId.GetObject(OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.LayerTable)["0"];
7
8ObjectId channelId = Channel.CreateFromAlignment("channel name", alignmentId, profileId, stationRange, sytleId, layerId);
See Also