• Revit 二次开发 图元与参数


    学习地址:https://www.bilibili.com/video/BV1mf4y1S72o?p=3

    本章内容

    • 元素基础
    • 如何获取元素
    • 元素与元素类型
    • 元素的属性与重要方法
    • 元素参数概念与实例

    元素基础

    如何获取元素

    元素与元素类型

    元素与元素类型

    元素的几个重要的属性包括

    元素的重要方法有

    元素参数概念与实例

    参数的四种类型

    元素参数概念与实例

    功能:读取元素参数

    • 读取选中元素的参数,并且显示在TaskDialog上
    • 把元素的类型的参数信息显示出来
    • 并且获取元素的族名称
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Autodesk.Revit.UI;
    using Autodesk.Revit.DB;
    using Autodesk.Revit.ApplicationServices;
    using Autodesk.Revit.Attributes;
    using System.Windows.Forms;
    
    namespace RevitDevTV
    {
        /// <summary>
        /// 获取元素属性
        /// </summary>
        [TransactionAttribute(TransactionMode.Manual)]
        [RegenerationAttribute(RegenerationOption.Manual)]
        public class GetParameter : IExternalCommand
        {
            public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
            {
                UIDocument uiDoc = commandData.Application.ActiveUIDocument;
                Document revitDoc = uiDoc.Document;
                var eleList = uiDoc.Selection.GetElementIds().ToList();
                Element selElem = uiDoc.Document.GetElement(eleList[0]);
                ElementType type = revitDoc.GetElement(selElem.GetTypeId()) as ElementType;
                string str = "元素族名称:"+type.FamilyName+"
    "+"元素类型:"+type.Name;
                TaskDialog.Show("元素参数",str);
                return Result.Succeeded;
            }
        }
    }

  • 相关阅读:
    UVA-1623 Enter The Dragon (贪心)
    UVA-1619 Feel Good (单调队列)
    UVA-11536 Smallest Sub-Array
    UVA-1617 Laptop (贪心)
    UVA-10570 Meeting with Aliens (枚举+贪心)
    UVA-1153 Keep the Customer Satisfied (贪心)
    UVA-1614 Hell on the Markets(贪心+推理) (有待补充)
    UVA-1613 K-Graph Oddity (着色问题)
    UVA-1612 Guess (贪心)
    todo:open和fopen的区别
  • 原文地址:https://www.cnblogs.com/chenyanbin/p/13280407.html
Copyright © 2020-2023  润新知