Пример #1
0
        public static ElementType GetElementType(this Autodesk.Revit.DB.ElementType type, Document doc)
        {
            var t = new ElementType {
                Id = type.Id.IntegerValue, Name = type.Name, Guid = type.UniqueId
            };
            var pIter = type.Parameters.ForwardIterator();

            while (pIter.MoveNext())
            {
                var p  = (Parameter)pIter.Current;
                var pp = p.GetParameter(doc);
                t.Parameters.Add(pp);
            }
            return(t);
        }
Пример #2
0
        /// <summary>
        /// 获取所有构件类型
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="model"></param>
        private static void GetElemTypes(Document doc, ProjectModel model)
        {
            var types = doc.GetElements <Autodesk.Revit.DB.ElementType>();

            foreach (var t in types)
            {
                var tt = new ElementType
                {
                    Id   = t.Id.IntegerValue,
                    Guid = t.UniqueId,
                    Name = t.Name
                };
                var pIter = t.Parameters.ForwardIterator();
                while (pIter.MoveNext())
                {
                    var p = (Parameter)pIter.Current;
                    tt.Parameters.Add(p.GetParameter(doc));
                }
                model.Types.Add(tt);
            }
        }