123456789101112131415161718192021222324252627282930 |
- using Autodesk.Revit.DB;
- using FWindSoft.Revit.Common;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FWindSoft.Revit
- {
- public static class ElementTypeExtension
- {
- /// <summary>
- /// 复制增加图元类型
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="elementType"></param>
- /// <param name="strName"></param>
- /// <returns></returns>
- public static T DuplicateT<T>(this ElementType elementType, string strName) where T : ElementType
- {
- if (strName.Length > 128)
- {
- strName = strName.Substring(0, 127);
- }
- strName = RevitTools.RemoveForbiddenChars(strName);
- return elementType.Duplicate(strName) as T;
- }
- }
- }
|