当前位置: 首页>>代码示例>>C#>>正文


C# Autodesk.get_Element方法代码示例

本文整理汇总了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;
        }
开发者ID:AMEE,项目名称:revit,代码行数:55,代码来源:CreateWallsUnderBeams.cs


注:本文中的Autodesk.get_Element方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。