本文整理汇总了C#中Autodesk.get_Element方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.get_Element方法的具体用法?C# Autodesk.get_Element怎么用?C# Autodesk.get_Element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autodesk
的用法示例。
在下文中一共展示了Autodesk.get_Element方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginCreate
/// <summary>
/// Create the walls which along and under the path of the selected beams
/// </summary>
/// <param name="project"> A reference of current document</param>
/// <returns>true if there is no error in process; otherwise, false.</returns>
Boolean BeginCreate(Autodesk.Revit.DB.Document project)
{
// Begin to create walls along and under each beam
for (int i = 0; i < m_beamCollection.Count; i++)
{
// Get each selected beam.
FamilyInstance m = m_beamCollection[i] as FamilyInstance;
if (null == m)
{
m_errorInformation = "The program should not go here.";
return false;
}
// Get the analytical model of the beam,
// the wall will be created using this model line as path.
AnalyticalModel model = m.GetAnalyticalModel();
if (null == model)
{
m_errorInformation = "The beam should have analytical model.";
return false;
}
// Get the level using the beam's reference level
Autodesk.Revit.DB.ElementId levelId = m.get_Parameter(BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsElementId();
m_level = project.get_Element(levelId) as Level;
if (null == m_level)
{
m_errorInformation = "The program should not go here.";
return false;
}
Transaction t = new Transaction(project, Guid.NewGuid().GetHashCode().ToString());
t.Start();
Wall createdWall = project.Create.NewWall(model.GetCurve(), m_selectedWallType,
m_level, 10, 0, true, m_isStructural);
if (null == createdWall)
{
m_errorInformation = "Can not create the walls";
return false;
}
// Modify some parameters of the created wall to make it look better.
Double offset = model.GetCurve().get_EndPoint(0).Z - m_level.Elevation;
createdWall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(levelId);
createdWall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(offset - 3000 / 304.8);
createdWall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(levelId);
t.Commit();
}
return true;
}