1. 输出文档中道路名和最长边的长度
public void InterateCorridors()
{
using (var tr = db.TransactionManager.StartTransaction())
{
foreach (var id in civilDoc.CorridorCollection)
{
var corridor = id.GetObject(OpenMode.ForRead) as Corridor;
ed.WriteMessage(
$"Corridor:{corridor.Name}\nLargest posible Triangle side:{corridor.MaximumTriangleSideLength}");
}
tr.Commit();
}
}
2. 创建点样式
/// <summary>
/// 创建点样式
/// </summary>
/// <param name="ptSName"></param>
public void CreatePointStyle(string ptSName)
{
var psId = ObjectId.Null;
if (civilDoc.Styles.PointStyles.Contains(ptSName))
psId = civilDoc.Styles.PointStyles[ptSName];
else
psId = civilDoc.Styles.PointStyles.Add(ptSName);
using (var tr = db.TransactionManager.StartTransaction())
{
var ptStyle = psId.GetObject(OpenMode.ForWrite) as PointStyle;
ptStyle.Elevation = 114.6;
tr.Commit();
}
}
3. 获取线路设置
public void AlignmentSetting()
{
var sa = civilDoc.Settings.GetSettings<SettingsAlignment>();
var angleSettings = sa.Angle;
ed.WriteMessage(@"Alignment setting:
Precision: {0}
Rounding:{1}
Unit:{2}
Drop Decimal:{3}
DropZeros:{4}",
angleSettings.Precision.Value,
angleSettings.Rounding.Value,
angleSettings.Unit.Value, angleSettings.DropDecimalForWholeNumbers.Value,
angleSettings.DropLeadingZerosForDegrees.Value);
}
4. 获取线路对象线型
public void AlignmentTypeOption()
{
var ato = civilDoc.Settings
.GetSettings<SettingsCmdCreateAlignmentLayout>();
ed.WriteMessage(@"Alignment Layout Command settings :Alignment:{0}",
ato.AlignmentTypeOption.AlignmentType.Value);
}