using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Autodesk.Revit.DB; using Autodesk.Revit.UI.Selection; namespace FWindSoft.Revit.Common { public static class RevitTools { /// /// 移除非法字符串 /// /// /// public static string RemoveForbiddenChars(this string strValue) { if (string.IsNullOrWhiteSpace(strValue)) { return strValue; } foreach (var item in RevitSetting.RvtForbiddenChars) { strValue=strValue.Replace(item, ""); } return strValue; } public static int RevitLeftPoint { get { var mainRec = RevitCore.UIApp.DrawingAreaExtents; return mainRec.Left; } } public static int RevitRightPoint { get { var mainRec = RevitCore.UIApp.DrawingAreaExtents; return mainRec.Right; } } public static int RevitTopPoint { get { var mainRec = RevitCore.UIApp.MainWindowExtents; return mainRec.Top; } } public static int RevitBottomPoint { get { var mainRec = RevitCore.UIApp.DrawingAreaExtents; return mainRec.Bottom; } } /// /// 整数转rgb /// /// /// public static Color GetColor(int intColor) { byte b = (byte)(intColor / (256 * 256)); byte g = (byte)((intColor - b * 256 * 256) / 256); byte r = (byte)(intColor - b * 256 * 256 - g * 256); return new Color(r, g, b); } /// /// rgb转整数(Revit参数使用) /// /// /// public static int GetColor(Color color) { return color.Red + color.Green * 256 + color.Blue * 256 * 256; } } }