From 0dc9eade30343e23dfff4fa67a7540833d2d0978 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 10:51:01 -0300 Subject: [PATCH 01/14] - Update Colors --- CHANGELOG.md | 7 + Directory.Build.props | 2 +- ricaun.Revit.DB.Shape.Tests/Color_Tests.cs | 49 +- .../ricaun.Revit.DB.Shape.Tests.csproj | 1 + ricaun.Revit.DB.Shape/Colors.cs | 1116 +++++++++++++---- 5 files changed, 884 insertions(+), 291 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ab2e72..45b1203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.3.2] / 2024-06-14 +### Features +- Update Colors using the `System.Windows.Media.Colors` as reference. +### Tests +- Test all color names in `System.Windows.Media.Colors` with `Colors`. + ## [0.3.1] / 2024-01-09 - 2024-04-13 ### Features - Support Revit 2025 @@ -59,6 +65,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Create Project `ricaun.Revit.DB` [vNext]: ../../compare/0.1.0...HEAD +[0.3.2]: ../../compare/0.3.1...0.3.2 [0.3.1]: ../../compare/0.3.0...0.3.1 [0.3.0]: ../../compare/0.2.0...0.3.0 [0.2.0]: ../../compare/0.1.0...0.2.0 diff --git a/Directory.Build.props b/Directory.Build.props index 019e2bb..7b49a55 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.1 + 0.3.2-alpha 2024 2025 true diff --git a/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs b/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs index bdea37a..f65b55e 100644 --- a/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs @@ -1,6 +1,7 @@ using Autodesk.Revit.DB; using NUnit.Framework; using ricaun.Revit.DB.Shape.Tests.Utils; +using System.Collections.Generic; namespace ricaun.Revit.DB.Shape.Tests { @@ -14,22 +15,44 @@ public class Color_Tests Color blue = new Color(0, 0, 255); Color magenta = new Color(255, 0, 255); Color white = new Color(255, 255, 255); - Color darkgray = new Color(65, 65, 65); + Color blackgray = new Color(65, 65, 65); Color gray = new Color(128, 128, 128); + private static Dictionary GetMediaColors() + { + var result = new Dictionary(); + foreach (var property in typeof(System.Windows.Media.Colors).GetProperties()) + { + if (property.Name == "Transparent") continue; + if (property.GetValue(null) is System.Windows.Media.Color color) + result.Add(property.Name, color); + } + return result; + } + [Test] public void Colors_Tests() { - Assert.IsTrue(Colors.Black.ColorEquals(black)); - Assert.IsTrue(Colors.Red.ColorEquals(red)); - Assert.IsTrue(Colors.Yellow.ColorEquals(yellow)); - Assert.IsTrue(Colors.Green.ColorEquals(green)); - Assert.IsTrue(Colors.Cyan.ColorEquals(cyan)); - Assert.IsTrue(Colors.Blue.ColorEquals(blue)); - Assert.IsTrue(Colors.Magenta.ColorEquals(magenta)); - Assert.IsTrue(Colors.White.ColorEquals(white)); - Assert.IsTrue(Colors.DarkGray.ColorEquals(darkgray)); - Assert.IsTrue(Colors.Gray.ColorEquals(gray)); + var colorsType = typeof(Colors); + var count = colorsType.GetProperties().Length; + var mediaColors = GetMediaColors(); + + System.Console.WriteLine($"Colors: {count} \tMedia.Colors: {mediaColors.Count}"); + + foreach (var color in mediaColors) + { + var name = color.Key; + var expectedColor = new Color(color.Value.R, color.Value.G, color.Value.B); + if (colorsType.GetProperty(name)?.GetValue(null) is Color colorTest) + { + Assert.IsTrue(colorTest.ColorEquals(expectedColor), + $"{name} Color ({colorTest.Red},{colorTest.Green},{colorTest.Blue}) is not equal to ({expectedColor.Red},{expectedColor.Green},{expectedColor.Blue})"); + } + else + { + Assert.Fail($"Colors.{name} not found."); + } + } } [Test] @@ -43,7 +66,7 @@ public void Colors_Index_Tests() Assert.IsTrue(Colors.Index.Color_5.ColorEquals(blue)); Assert.IsTrue(Colors.Index.Color_6.ColorEquals(magenta)); Assert.IsTrue(Colors.Index.Color_7.ColorEquals(white)); - Assert.IsTrue(Colors.Index.Color_8.ColorEquals(darkgray)); + Assert.IsTrue(Colors.Index.Color_8.ColorEquals(blackgray)); Assert.IsTrue(Colors.Index.Color_9.ColorEquals(gray)); } @@ -58,7 +81,7 @@ public void Colors_Index_Get_Tests() Assert.IsTrue(Colors.Index.Get(5).ColorEquals(blue)); Assert.IsTrue(Colors.Index.Get(6).ColorEquals(magenta)); Assert.IsTrue(Colors.Index.Get(7).ColorEquals(white)); - Assert.IsTrue(Colors.Index.Get(8).ColorEquals(darkgray)); + Assert.IsTrue(Colors.Index.Get(8).ColorEquals(blackgray)); Assert.IsTrue(Colors.Index.Get(9).ColorEquals(gray)); } diff --git a/ricaun.Revit.DB.Shape.Tests/ricaun.Revit.DB.Shape.Tests.csproj b/ricaun.Revit.DB.Shape.Tests/ricaun.Revit.DB.Shape.Tests.csproj index 9608a30..2171115 100644 --- a/ricaun.Revit.DB.Shape.Tests/ricaun.Revit.DB.Shape.Tests.csproj +++ b/ricaun.Revit.DB.Shape.Tests/ricaun.Revit.DB.Shape.Tests.csproj @@ -3,6 +3,7 @@ true + true Library AnyCPU Latest diff --git a/ricaun.Revit.DB.Shape/Colors.cs b/ricaun.Revit.DB.Shape/Colors.cs index 3f69ddb..5687436 100644 --- a/ricaun.Revit.DB.Shape/Colors.cs +++ b/ricaun.Revit.DB.Shape/Colors.cs @@ -8,46 +8,608 @@ namespace ricaun.Revit.DB.Shape public sealed class Colors { #region Colors + ///// + ///// Represents the color black with the hex value #000000. + ///// + //public static Color Black => new Color(0, 0, 0); + ///// + ///// Represents the color red with the hex value #FF0000. + ///// + //public static Color Red => new Color(255, 0, 0); + ///// + ///// Represents the color yellow with the hex value #FFFF00. + ///// + //public static Color Yellow => new Color(255, 255, 0); + ///// + ///// Represents the color green with the hex value #00FF00. + ///// + //public static Color Green => new Color(0, 255, 0); + ///// + ///// Represents the color cyan with the hex value #00FFFF. + ///// + //public static Color Cyan => new Color(0, 255, 255); + ///// + ///// Represents the color blue with the hex value #0000FF. + ///// + //public static Color Blue => new Color(0, 0, 255); + ///// + ///// Represents the color magenta with the hex value #FF00FF. + ///// + //public static Color Magenta => new Color(255, 0, 255); + ///// + ///// Represents the color white with the hex value #FFFFFF. + ///// + //public static Color White => new Color(255, 255, 255); + ///// + ///// Represents the color dark gray with the hex value #414141. + ///// + //public static Color DarkGray => new Color(65, 65, 65); + ///// + ///// Represents the color gray with the hex value #808080. + ///// + //public static Color Gray => new Color(128, 128, 128); + #endregion + #region Media Colors + /// + /// Represents the color with the hex value #F0F8FF. + /// + public static Color AliceBlue => new Color(240, 248, 255); + /// + /// Represents the color with the hex value #FAEBD7. + /// + public static Color AntiqueWhite => new Color(250, 235, 215); + /// + /// Represents the color with the hex value #00FFFF. + /// + public static Color Aqua => new Color(0, 255, 255); + /// + /// Represents the color with the hex value #7FFFD4. + /// + public static Color Aquamarine => new Color(127, 255, 212); + /// + /// Represents the color with the hex value #F0FFFF. + /// + public static Color Azure => new Color(240, 255, 255); + /// + /// Represents the color with the hex value #F5F5DC. + /// + public static Color Beige => new Color(245, 245, 220); + /// + /// Represents the color with the hex value #FFE4C4. + /// + public static Color Bisque => new Color(255, 228, 196); + /// + /// Represents the color with the hex value #000000. + /// + public static Color Black => new Color(0, 0, 0); + /// + /// Represents the color with the hex value #FFEBCD. + /// + public static Color BlanchedAlmond => new Color(255, 235, 205); + /// + /// Represents the color with the hex value #0000FF. + /// + public static Color Blue => new Color(0, 0, 255); + /// + /// Represents the color with the hex value #8A2BE2. + /// + public static Color BlueViolet => new Color(138, 43, 226); + /// + /// Represents the color with the hex value #A52A2A. + /// + public static Color Brown => new Color(165, 42, 42); + /// + /// Represents the color with the hex value #DEB887. + /// + public static Color BurlyWood => new Color(222, 184, 135); + /// + /// Represents the color with the hex value #5F9EA0. + /// + public static Color CadetBlue => new Color(95, 158, 160); + /// + /// Represents the color with the hex value #7FFF00. + /// + public static Color Chartreuse => new Color(127, 255, 0); + /// + /// Represents the color with the hex value #D2691E. + /// + public static Color Chocolate => new Color(210, 105, 30); + /// + /// Represents the color with the hex value #FF7F50. + /// + public static Color Coral => new Color(255, 127, 80); + /// + /// Represents the color with the hex value #6495ED. + /// + public static Color CornflowerBlue => new Color(100, 149, 237); + /// + /// Represents the color with the hex value #FFF8DC. + /// + public static Color Cornsilk => new Color(255, 248, 220); + /// + /// Represents the color with the hex value #DC143C. + /// + public static Color Crimson => new Color(220, 20, 60); + /// + /// Represents the color with the hex value #00FFFF. + /// + public static Color Cyan => new Color(0, 255, 255); + /// + /// Represents the color with the hex value #00008B. + /// + public static Color DarkBlue => new Color(0, 0, 139); + /// + /// Represents the color with the hex value #008B8B. + /// + public static Color DarkCyan => new Color(0, 139, 139); + /// + /// Represents the color with the hex value #B8860B. + /// + public static Color DarkGoldenrod => new Color(184, 134, 11); + /// + /// Represents the color with the hex value #A9A9A9. + /// + public static Color DarkGray => new Color(169, 169, 169); + /// + /// Represents the color with the hex value #006400. + /// + public static Color DarkGreen => new Color(0, 100, 0); + /// + /// Represents the color with the hex value #BDB76B. + /// + public static Color DarkKhaki => new Color(189, 183, 107); + /// + /// Represents the color with the hex value #8B008B. + /// + public static Color DarkMagenta => new Color(139, 0, 139); + /// + /// Represents the color with the hex value #556B2F. + /// + public static Color DarkOliveGreen => new Color(85, 107, 47); + /// + /// Represents the color with the hex value #FF8C00. + /// + public static Color DarkOrange => new Color(255, 140, 0); + /// + /// Represents the color with the hex value #9932CC. + /// + public static Color DarkOrchid => new Color(153, 50, 204); + /// + /// Represents the color with the hex value #8B0000. + /// + public static Color DarkRed => new Color(139, 0, 0); + /// + /// Represents the color with the hex value #E9967A. + /// + public static Color DarkSalmon => new Color(233, 150, 122); + /// + /// Represents the color with the hex value #8FBC8F. + /// + public static Color DarkSeaGreen => new Color(143, 188, 143); + /// + /// Represents the color with the hex value #483D8B. + /// + public static Color DarkSlateBlue => new Color(72, 61, 139); + /// + /// Represents the color with the hex value #2F4F4F. + /// + public static Color DarkSlateGray => new Color(47, 79, 79); + /// + /// Represents the color with the hex value #00CED1. + /// + public static Color DarkTurquoise => new Color(0, 206, 209); + /// + /// Represents the color with the hex value #9400D3. + /// + public static Color DarkViolet => new Color(148, 0, 211); + /// + /// Represents the color with the hex value #FF1493. + /// + public static Color DeepPink => new Color(255, 20, 147); + /// + /// Represents the color with the hex value #00BFFF. + /// + public static Color DeepSkyBlue => new Color(0, 191, 255); + /// + /// Represents the color with the hex value #696969. + /// + public static Color DimGray => new Color(105, 105, 105); + /// + /// Represents the color with the hex value #1E90FF. + /// + public static Color DodgerBlue => new Color(30, 144, 255); + /// + /// Represents the color with the hex value #B22222. + /// + public static Color Firebrick => new Color(178, 34, 34); + /// + /// Represents the color with the hex value #FFFAF0. + /// + public static Color FloralWhite => new Color(255, 250, 240); + /// + /// Represents the color with the hex value #228B22. + /// + public static Color ForestGreen => new Color(34, 139, 34); + /// + /// Represents the color with the hex value #FF00FF. + /// + public static Color Fuchsia => new Color(255, 0, 255); + /// + /// Represents the color with the hex value #DCDCDC. + /// + public static Color Gainsboro => new Color(220, 220, 220); + /// + /// Represents the color with the hex value #F8F8FF. + /// + public static Color GhostWhite => new Color(248, 248, 255); + /// + /// Represents the color with the hex value #FFD700. + /// + public static Color Gold => new Color(255, 215, 0); + /// + /// Represents the color with the hex value #DAA520. + /// + public static Color Goldenrod => new Color(218, 165, 32); + /// + /// Represents the color with the hex value #808080. + /// + public static Color Gray => new Color(128, 128, 128); + /// + /// Represents the color with the hex value #008000. + /// + public static Color Green => new Color(0, 128, 0); + /// + /// Represents the color with the hex value #ADFF2F. + /// + public static Color GreenYellow => new Color(173, 255, 47); + /// + /// Represents the color with the hex value #F0FFF0. + /// + public static Color Honeydew => new Color(240, 255, 240); + /// + /// Represents the color with the hex value #FF69B4. + /// + public static Color HotPink => new Color(255, 105, 180); + /// + /// Represents the color with the hex value #CD5C5C. + /// + public static Color IndianRed => new Color(205, 92, 92); + /// + /// Represents the color with the hex value #4B0082. + /// + public static Color Indigo => new Color(75, 0, 130); + /// + /// Represents the color with the hex value #FFFFF0. + /// + public static Color Ivory => new Color(255, 255, 240); + /// + /// Represents the color with the hex value #F0E68C. + /// + public static Color Khaki => new Color(240, 230, 140); + /// + /// Represents the color with the hex value #E6E6FA. + /// + public static Color Lavender => new Color(230, 230, 250); + /// + /// Represents the color with the hex value #FFF0F5. + /// + public static Color LavenderBlush => new Color(255, 240, 245); + /// + /// Represents the color with the hex value #7CFC00. + /// + public static Color LawnGreen => new Color(124, 252, 0); + /// + /// Represents the color with the hex value #FFFACD. + /// + public static Color LemonChiffon => new Color(255, 250, 205); + /// + /// Represents the color with the hex value #ADD8E6. + /// + public static Color LightBlue => new Color(173, 216, 230); + /// + /// Represents the color with the hex value #F08080. + /// + public static Color LightCoral => new Color(240, 128, 128); + /// + /// Represents the color with the hex value #E0FFFF. + /// + public static Color LightCyan => new Color(224, 255, 255); + /// + /// Represents the color with the hex value #FAFAD2. + /// + public static Color LightGoldenrodYellow => new Color(250, 250, 210); + /// + /// Represents the color with the hex value #D3D3D3. + /// + public static Color LightGray => new Color(211, 211, 211); + /// + /// Represents the color with the hex value #90EE90. + /// + public static Color LightGreen => new Color(144, 238, 144); + /// + /// Represents the color with the hex value #FFB6C1. + /// + public static Color LightPink => new Color(255, 182, 193); + /// + /// Represents the color with the hex value #FFA07A. + /// + public static Color LightSalmon => new Color(255, 160, 122); + /// + /// Represents the color with the hex value #20B2AA. + /// + public static Color LightSeaGreen => new Color(32, 178, 170); + /// + /// Represents the color with the hex value #87CEFA. + /// + public static Color LightSkyBlue => new Color(135, 206, 250); + /// + /// Represents the color with the hex value #778899. + /// + public static Color LightSlateGray => new Color(119, 136, 153); + /// + /// Represents the color with the hex value #B0C4DE. + /// + public static Color LightSteelBlue => new Color(176, 196, 222); + /// + /// Represents the color with the hex value #FFFFE0. + /// + public static Color LightYellow => new Color(255, 255, 224); + /// + /// Represents the color with the hex value #00FF00. + /// + public static Color Lime => new Color(0, 255, 0); + /// + /// Represents the color with the hex value #32CD32. + /// + public static Color LimeGreen => new Color(50, 205, 50); + /// + /// Represents the color with the hex value #FAF0E6. + /// + public static Color Linen => new Color(250, 240, 230); + /// + /// Represents the color with the hex value #FF00FF. + /// + public static Color Magenta => new Color(255, 0, 255); + /// + /// Represents the color with the hex value #800000. + /// + public static Color Maroon => new Color(128, 0, 0); + /// + /// Represents the color with the hex value #66CDAA. + /// + public static Color MediumAquamarine => new Color(102, 205, 170); + /// + /// Represents the color with the hex value #0000CD. + /// + public static Color MediumBlue => new Color(0, 0, 205); + /// + /// Represents the color with the hex value #BA55D3. + /// + public static Color MediumOrchid => new Color(186, 85, 211); + /// + /// Represents the color with the hex value #9370DB. + /// + public static Color MediumPurple => new Color(147, 112, 219); + /// + /// Represents the color with the hex value #3CB371. + /// + public static Color MediumSeaGreen => new Color(60, 179, 113); + /// + /// Represents the color with the hex value #7B68EE. + /// + public static Color MediumSlateBlue => new Color(123, 104, 238); + /// + /// Represents the color with the hex value #00FA9A. + /// + public static Color MediumSpringGreen => new Color(0, 250, 154); + /// + /// Represents the color with the hex value #48D1CC. + /// + public static Color MediumTurquoise => new Color(72, 209, 204); + /// + /// Represents the color with the hex value #C71585. + /// + public static Color MediumVioletRed => new Color(199, 21, 133); + /// + /// Represents the color with the hex value #191970. + /// + public static Color MidnightBlue => new Color(25, 25, 112); + /// + /// Represents the color with the hex value #F5FFFA. + /// + public static Color MintCream => new Color(245, 255, 250); + /// + /// Represents the color with the hex value #FFE4E1. + /// + public static Color MistyRose => new Color(255, 228, 225); + /// + /// Represents the color with the hex value #FFE4B5. + /// + public static Color Moccasin => new Color(255, 228, 181); + /// + /// Represents the color with the hex value #FFDEAD. + /// + public static Color NavajoWhite => new Color(255, 222, 173); + /// + /// Represents the color with the hex value #000080. + /// + public static Color Navy => new Color(0, 0, 128); + /// + /// Represents the color with the hex value #FDF5E6. + /// + public static Color OldLace => new Color(253, 245, 230); + /// + /// Represents the color with the hex value #808000. + /// + public static Color Olive => new Color(128, 128, 0); + /// + /// Represents the color with the hex value #6B8E23. + /// + public static Color OliveDrab => new Color(107, 142, 35); + /// + /// Represents the color with the hex value #FFA500. + /// + public static Color Orange => new Color(255, 165, 0); + /// + /// Represents the color with the hex value #FF4500. + /// + public static Color OrangeRed => new Color(255, 69, 0); + /// + /// Represents the color with the hex value #DA70D6. + /// + public static Color Orchid => new Color(218, 112, 214); + /// + /// Represents the color with the hex value #EEE8AA. + /// + public static Color PaleGoldenrod => new Color(238, 232, 170); + /// + /// Represents the color with the hex value #98FB98. + /// + public static Color PaleGreen => new Color(152, 251, 152); + /// + /// Represents the color with the hex value #AFEEEE. + /// + public static Color PaleTurquoise => new Color(175, 238, 238); + /// + /// Represents the color with the hex value #DB7093. + /// + public static Color PaleVioletRed => new Color(219, 112, 147); + /// + /// Represents the color with the hex value #FFEFD5. + /// + public static Color PapayaWhip => new Color(255, 239, 213); + /// + /// Represents the color with the hex value #FFDAB9. + /// + public static Color PeachPuff => new Color(255, 218, 185); + /// + /// Represents the color with the hex value #CD853F. + /// + public static Color Peru => new Color(205, 133, 63); + /// + /// Represents the color with the hex value #FFC0CB. + /// + public static Color Pink => new Color(255, 192, 203); + /// + /// Represents the color with the hex value #DDA0DD. + /// + public static Color Plum => new Color(221, 160, 221); + /// + /// Represents the color with the hex value #B0E0E6. + /// + public static Color PowderBlue => new Color(176, 224, 230); + /// + /// Represents the color with the hex value #800080. + /// + public static Color Purple => new Color(128, 0, 128); + /// + /// Represents the color with the hex value #FF0000. + /// + public static Color Red => new Color(255, 0, 0); + /// + /// Represents the color with the hex value #BC8F8F. + /// + public static Color RosyBrown => new Color(188, 143, 143); + /// + /// Represents the color with the hex value #4169E1. + /// + public static Color RoyalBlue => new Color(65, 105, 225); + /// + /// Represents the color with the hex value #8B4513. + /// + public static Color SaddleBrown => new Color(139, 69, 19); + /// + /// Represents the color with the hex value #FA8072. + /// + public static Color Salmon => new Color(250, 128, 114); + /// + /// Represents the color with the hex value #F4A460. + /// + public static Color SandyBrown => new Color(244, 164, 96); + /// + /// Represents the color with the hex value #2E8B57. + /// + public static Color SeaGreen => new Color(46, 139, 87); + /// + /// Represents the color with the hex value #FFF5EE. + /// + public static Color SeaShell => new Color(255, 245, 238); + /// + /// Represents the color with the hex value #A0522D. + /// + public static Color Sienna => new Color(160, 82, 45); + /// + /// Represents the color with the hex value #C0C0C0. + /// + public static Color Silver => new Color(192, 192, 192); + /// + /// Represents the color with the hex value #87CEEB. + /// + public static Color SkyBlue => new Color(135, 206, 235); + /// + /// Represents the color with the hex value #6A5ACD. + /// + public static Color SlateBlue => new Color(106, 90, 205); + /// + /// Represents the color with the hex value #708090. + /// + public static Color SlateGray => new Color(112, 128, 144); + /// + /// Represents the color with the hex value #FFFAFA. + /// + public static Color Snow => new Color(255, 250, 250); + /// + /// Represents the color with the hex value #00FF7F. + /// + public static Color SpringGreen => new Color(0, 255, 127); + /// + /// Represents the color with the hex value #4682B4. + /// + public static Color SteelBlue => new Color(70, 130, 180); + /// + /// Represents the color with the hex value #D2B48C. + /// + public static Color Tan => new Color(210, 180, 140); /// - /// Represents the color black with the hex value #000000. + /// Represents the color with the hex value #008080. /// - public static Color Black { get; } = new Color(0, 0, 0); + public static Color Teal => new Color(0, 128, 128); /// - /// Represents the color red with the hex value #FF0000. + /// Represents the color with the hex value #D8BFD8. /// - public static Color Red { get; } = new Color(255, 0, 0); + public static Color Thistle => new Color(216, 191, 216); /// - /// Represents the color yellow with the hex value #FFFF00. + /// Represents the color with the hex value #FF6347. /// - public static Color Yellow { get; } = new Color(255, 255, 0); + public static Color Tomato => new Color(255, 99, 71); /// - /// Represents the color green with the hex value #00FF00. + /// Represents the color with the hex value #40E0D0. /// - public static Color Green { get; } = new Color(0, 255, 0); + public static Color Turquoise => new Color(64, 224, 208); /// - /// Represents the color cyan with the hex value #00FFFF. + /// Represents the color with the hex value #EE82EE. /// - public static Color Cyan { get; } = new Color(0, 255, 255); + public static Color Violet => new Color(238, 130, 238); /// - /// Represents the color blue with the hex value #0000FF. + /// Represents the color with the hex value #F5DEB3. /// - public static Color Blue { get; } = new Color(0, 0, 255); + public static Color Wheat => new Color(245, 222, 179); /// - /// Represents the color magenta with the hex value #FF00FF. + /// Represents the color with the hex value #FFFFFF. /// - public static Color Magenta { get; } = new Color(255, 0, 255); + public static Color White => new Color(255, 255, 255); /// - /// Represents the color white with the hex value #FFFFFF. + /// Represents the color with the hex value #F5F5F5. /// - public static Color White { get; } = new Color(255, 255, 255); + public static Color WhiteSmoke => new Color(245, 245, 245); /// - /// Represents the color dark gray with the hex value #414141. + /// Represents the color with the hex value #FFFF00. /// - public static Color DarkGray { get; } = new Color(65, 65, 65); + public static Color Yellow => new Color(255, 255, 0); /// - /// Represents the color gray with the hex value #808080. + /// Represents the color with the hex value #9ACD32. /// - public static Color Gray { get; } = new Color(128, 128, 128); + public static Color YellowGreen => new Color(154, 205, 50); #endregion #region AutoCAD Colors /// @@ -67,1027 +629,1027 @@ public static Color Get(byte index) /// /// Represents the color black with the hex value #000000. /// - public static Color Color_0 { get; } = new Color(0, 0, 0); + public static Color Color_0 => new Color(0, 0, 0); /// /// Represents the color red with the hex value #FF0000. /// - public static Color Color_1 { get; } = new Color(255, 0, 0); + public static Color Color_1 => new Color(255, 0, 0); /// /// Represents the color yellow with the hex value #FFFF00. /// - public static Color Color_2 { get; } = new Color(255, 255, 0); + public static Color Color_2 => new Color(255, 255, 0); /// /// Represents the color green with the hex value #00FF00. /// - public static Color Color_3 { get; } = new Color(0, 255, 0); + public static Color Color_3 => new Color(0, 255, 0); /// /// Represents the color cyan with the hex value #00FFFF. /// - public static Color Color_4 { get; } = new Color(0, 255, 255); + public static Color Color_4 => new Color(0, 255, 255); /// /// Represents the color blue with the hex value #0000FF. /// - public static Color Color_5 { get; } = new Color(0, 0, 255); + public static Color Color_5 => new Color(0, 0, 255); /// /// Represents the color magenta with the hex value #FF00FF. /// - public static Color Color_6 { get; } = new Color(255, 0, 255); + public static Color Color_6 => new Color(255, 0, 255); /// /// Represents the color white with the hex value #FFFFFF. /// - public static Color Color_7 { get; } = new Color(255, 255, 255); + public static Color Color_7 => new Color(255, 255, 255); /// - /// Represents the color dark gray with the hex value #414141. + /// Represents the color black gray with the hex value #414141. /// - public static Color Color_8 { get; } = new Color(65, 65, 65); + public static Color Color_8 => new Color(65, 65, 65); /// /// Represents the color gray with the hex value #808080. /// - public static Color Color_9 { get; } = new Color(128, 128, 128); + public static Color Color_9 => new Color(128, 128, 128); /// /// Represents the color with the hex value #FF0000. /// - public static Color Color_10 { get; } = new Color(255, 0, 0); + public static Color Color_10 => new Color(255, 0, 0); /// /// Represents the color with the hex value #FFAAAA. /// - public static Color Color_11 { get; } = new Color(255, 170, 170); + public static Color Color_11 => new Color(255, 170, 170); /// /// Represents the color with the hex value #BD0000. /// - public static Color Color_12 { get; } = new Color(189, 0, 0); + public static Color Color_12 => new Color(189, 0, 0); /// /// Represents the color with the hex value #BD7E7E. /// - public static Color Color_13 { get; } = new Color(189, 126, 126); + public static Color Color_13 => new Color(189, 126, 126); /// /// Represents the color with the hex value #810000. /// - public static Color Color_14 { get; } = new Color(129, 0, 0); + public static Color Color_14 => new Color(129, 0, 0); /// /// Represents the color with the hex value #815656. /// - public static Color Color_15 { get; } = new Color(129, 86, 86); + public static Color Color_15 => new Color(129, 86, 86); /// /// Represents the color with the hex value #680000. /// - public static Color Color_16 { get; } = new Color(104, 0, 0); + public static Color Color_16 => new Color(104, 0, 0); /// /// Represents the color with the hex value #684545. /// - public static Color Color_17 { get; } = new Color(104, 69, 69); + public static Color Color_17 => new Color(104, 69, 69); /// /// Represents the color with the hex value #4F0000. /// - public static Color Color_18 { get; } = new Color(79, 0, 0); + public static Color Color_18 => new Color(79, 0, 0); /// /// Represents the color with the hex value #4F3535. /// - public static Color Color_19 { get; } = new Color(79, 53, 53); + public static Color Color_19 => new Color(79, 53, 53); /// /// Represents the color with the hex value #FF3F00. /// - public static Color Color_20 { get; } = new Color(255, 63, 0); + public static Color Color_20 => new Color(255, 63, 0); /// /// Represents the color with the hex value #FFBFAA. /// - public static Color Color_21 { get; } = new Color(255, 191, 170); + public static Color Color_21 => new Color(255, 191, 170); /// /// Represents the color with the hex value #BD2E00. /// - public static Color Color_22 { get; } = new Color(189, 46, 0); + public static Color Color_22 => new Color(189, 46, 0); /// /// Represents the color with the hex value #BD8D7E. /// - public static Color Color_23 { get; } = new Color(189, 141, 126); + public static Color Color_23 => new Color(189, 141, 126); /// /// Represents the color with the hex value #811F00. /// - public static Color Color_24 { get; } = new Color(129, 31, 0); + public static Color Color_24 => new Color(129, 31, 0); /// /// Represents the color with the hex value #816056. /// - public static Color Color_25 { get; } = new Color(129, 96, 86); + public static Color Color_25 => new Color(129, 96, 86); /// /// Represents the color with the hex value #681900. /// - public static Color Color_26 { get; } = new Color(104, 25, 0); + public static Color Color_26 => new Color(104, 25, 0); /// /// Represents the color with the hex value #684E45. /// - public static Color Color_27 { get; } = new Color(104, 78, 69); + public static Color Color_27 => new Color(104, 78, 69); /// /// Represents the color with the hex value #4F1300. /// - public static Color Color_28 { get; } = new Color(79, 19, 0); + public static Color Color_28 => new Color(79, 19, 0); /// /// Represents the color with the hex value #4F3B35. /// - public static Color Color_29 { get; } = new Color(79, 59, 53); + public static Color Color_29 => new Color(79, 59, 53); /// /// Represents the color with the hex value #FF7F00. /// - public static Color Color_30 { get; } = new Color(255, 127, 0); + public static Color Color_30 => new Color(255, 127, 0); /// /// Represents the color with the hex value #FFD4AA. /// - public static Color Color_31 { get; } = new Color(255, 212, 170); + public static Color Color_31 => new Color(255, 212, 170); /// /// Represents the color with the hex value #BD5E00. /// - public static Color Color_32 { get; } = new Color(189, 94, 0); + public static Color Color_32 => new Color(189, 94, 0); /// /// Represents the color with the hex value #BD9D7E. /// - public static Color Color_33 { get; } = new Color(189, 157, 126); + public static Color Color_33 => new Color(189, 157, 126); /// /// Represents the color with the hex value #814000. /// - public static Color Color_34 { get; } = new Color(129, 64, 0); + public static Color Color_34 => new Color(129, 64, 0); /// /// Represents the color with the hex value #816B56. /// - public static Color Color_35 { get; } = new Color(129, 107, 86); + public static Color Color_35 => new Color(129, 107, 86); /// /// Represents the color with the hex value #683400. /// - public static Color Color_36 { get; } = new Color(104, 52, 0); + public static Color Color_36 => new Color(104, 52, 0); /// /// Represents the color with the hex value #685645. /// - public static Color Color_37 { get; } = new Color(104, 86, 69); + public static Color Color_37 => new Color(104, 86, 69); /// /// Represents the color with the hex value #4F2700. /// - public static Color Color_38 { get; } = new Color(79, 39, 0); + public static Color Color_38 => new Color(79, 39, 0); /// /// Represents the color with the hex value #4F4235. /// - public static Color Color_39 { get; } = new Color(79, 66, 53); + public static Color Color_39 => new Color(79, 66, 53); /// /// Represents the color with the hex value #FFBF00. /// - public static Color Color_40 { get; } = new Color(255, 191, 0); + public static Color Color_40 => new Color(255, 191, 0); /// /// Represents the color with the hex value #FFEAAA. /// - public static Color Color_41 { get; } = new Color(255, 234, 170); + public static Color Color_41 => new Color(255, 234, 170); /// /// Represents the color with the hex value #BD8D00. /// - public static Color Color_42 { get; } = new Color(189, 141, 0); + public static Color Color_42 => new Color(189, 141, 0); /// /// Represents the color with the hex value #BDAD7E. /// - public static Color Color_43 { get; } = new Color(189, 173, 126); + public static Color Color_43 => new Color(189, 173, 126); /// /// Represents the color with the hex value #816000. /// - public static Color Color_44 { get; } = new Color(129, 96, 0); + public static Color Color_44 => new Color(129, 96, 0); /// /// Represents the color with the hex value #817656. /// - public static Color Color_45 { get; } = new Color(129, 118, 86); + public static Color Color_45 => new Color(129, 118, 86); /// /// Represents the color with the hex value #684E00. /// - public static Color Color_46 { get; } = new Color(104, 78, 0); + public static Color Color_46 => new Color(104, 78, 0); /// /// Represents the color with the hex value #685F45. /// - public static Color Color_47 { get; } = new Color(104, 95, 69); + public static Color Color_47 => new Color(104, 95, 69); /// /// Represents the color with the hex value #4F3B00. /// - public static Color Color_48 { get; } = new Color(79, 59, 0); + public static Color Color_48 => new Color(79, 59, 0); /// /// Represents the color with the hex value #4F4935. /// - public static Color Color_49 { get; } = new Color(79, 73, 53); + public static Color Color_49 => new Color(79, 73, 53); /// /// Represents the color with the hex value #FFFF00. /// - public static Color Color_50 { get; } = new Color(255, 255, 0); + public static Color Color_50 => new Color(255, 255, 0); /// /// Represents the color with the hex value #FFFFAA. /// - public static Color Color_51 { get; } = new Color(255, 255, 170); + public static Color Color_51 => new Color(255, 255, 170); /// /// Represents the color with the hex value #BDBD00. /// - public static Color Color_52 { get; } = new Color(189, 189, 0); + public static Color Color_52 => new Color(189, 189, 0); /// /// Represents the color with the hex value #BDBD7E. /// - public static Color Color_53 { get; } = new Color(189, 189, 126); + public static Color Color_53 => new Color(189, 189, 126); /// /// Represents the color with the hex value #818100. /// - public static Color Color_54 { get; } = new Color(129, 129, 0); + public static Color Color_54 => new Color(129, 129, 0); /// /// Represents the color with the hex value #818156. /// - public static Color Color_55 { get; } = new Color(129, 129, 86); + public static Color Color_55 => new Color(129, 129, 86); /// /// Represents the color with the hex value #686800. /// - public static Color Color_56 { get; } = new Color(104, 104, 0); + public static Color Color_56 => new Color(104, 104, 0); /// /// Represents the color with the hex value #686845. /// - public static Color Color_57 { get; } = new Color(104, 104, 69); + public static Color Color_57 => new Color(104, 104, 69); /// /// Represents the color with the hex value #4F4F00. /// - public static Color Color_58 { get; } = new Color(79, 79, 0); + public static Color Color_58 => new Color(79, 79, 0); /// /// Represents the color with the hex value #4F4F35. /// - public static Color Color_59 { get; } = new Color(79, 79, 53); + public static Color Color_59 => new Color(79, 79, 53); /// /// Represents the color with the hex value #BFFF00. /// - public static Color Color_60 { get; } = new Color(191, 255, 0); + public static Color Color_60 => new Color(191, 255, 0); /// /// Represents the color with the hex value #EAFFAA. /// - public static Color Color_61 { get; } = new Color(234, 255, 170); + public static Color Color_61 => new Color(234, 255, 170); /// /// Represents the color with the hex value #8DBD00. /// - public static Color Color_62 { get; } = new Color(141, 189, 0); + public static Color Color_62 => new Color(141, 189, 0); /// /// Represents the color with the hex value #ADBD7E. /// - public static Color Color_63 { get; } = new Color(173, 189, 126); + public static Color Color_63 => new Color(173, 189, 126); /// /// Represents the color with the hex value #608100. /// - public static Color Color_64 { get; } = new Color(96, 129, 0); + public static Color Color_64 => new Color(96, 129, 0); /// /// Represents the color with the hex value #768156. /// - public static Color Color_65 { get; } = new Color(118, 129, 86); + public static Color Color_65 => new Color(118, 129, 86); /// /// Represents the color with the hex value #4E6800. /// - public static Color Color_66 { get; } = new Color(78, 104, 0); + public static Color Color_66 => new Color(78, 104, 0); /// /// Represents the color with the hex value #5F6845. /// - public static Color Color_67 { get; } = new Color(95, 104, 69); + public static Color Color_67 => new Color(95, 104, 69); /// /// Represents the color with the hex value #3B4F00. /// - public static Color Color_68 { get; } = new Color(59, 79, 0); + public static Color Color_68 => new Color(59, 79, 0); /// /// Represents the color with the hex value #494F35. /// - public static Color Color_69 { get; } = new Color(73, 79, 53); + public static Color Color_69 => new Color(73, 79, 53); /// /// Represents the color with the hex value #7FFF00. /// - public static Color Color_70 { get; } = new Color(127, 255, 0); + public static Color Color_70 => new Color(127, 255, 0); /// /// Represents the color with the hex value #D4FFAA. /// - public static Color Color_71 { get; } = new Color(212, 255, 170); + public static Color Color_71 => new Color(212, 255, 170); /// /// Represents the color with the hex value #5EBD00. /// - public static Color Color_72 { get; } = new Color(94, 189, 0); + public static Color Color_72 => new Color(94, 189, 0); /// /// Represents the color with the hex value #9DBD7E. /// - public static Color Color_73 { get; } = new Color(157, 189, 126); + public static Color Color_73 => new Color(157, 189, 126); /// /// Represents the color with the hex value #408100. /// - public static Color Color_74 { get; } = new Color(64, 129, 0); + public static Color Color_74 => new Color(64, 129, 0); /// /// Represents the color with the hex value #6B8156. /// - public static Color Color_75 { get; } = new Color(107, 129, 86); + public static Color Color_75 => new Color(107, 129, 86); /// /// Represents the color with the hex value #346800. /// - public static Color Color_76 { get; } = new Color(52, 104, 0); + public static Color Color_76 => new Color(52, 104, 0); /// /// Represents the color with the hex value #566845. /// - public static Color Color_77 { get; } = new Color(86, 104, 69); + public static Color Color_77 => new Color(86, 104, 69); /// /// Represents the color with the hex value #274F00. /// - public static Color Color_78 { get; } = new Color(39, 79, 0); + public static Color Color_78 => new Color(39, 79, 0); /// /// Represents the color with the hex value #424F35. /// - public static Color Color_79 { get; } = new Color(66, 79, 53); + public static Color Color_79 => new Color(66, 79, 53); /// /// Represents the color with the hex value #3FFF00. /// - public static Color Color_80 { get; } = new Color(63, 255, 0); + public static Color Color_80 => new Color(63, 255, 0); /// /// Represents the color with the hex value #BFFFAA. /// - public static Color Color_81 { get; } = new Color(191, 255, 170); + public static Color Color_81 => new Color(191, 255, 170); /// /// Represents the color with the hex value #2EBD00. /// - public static Color Color_82 { get; } = new Color(46, 189, 0); + public static Color Color_82 => new Color(46, 189, 0); /// /// Represents the color with the hex value #8DBD7E. /// - public static Color Color_83 { get; } = new Color(141, 189, 126); + public static Color Color_83 => new Color(141, 189, 126); /// /// Represents the color with the hex value #1F8100. /// - public static Color Color_84 { get; } = new Color(31, 129, 0); + public static Color Color_84 => new Color(31, 129, 0); /// /// Represents the color with the hex value #608156. /// - public static Color Color_85 { get; } = new Color(96, 129, 86); + public static Color Color_85 => new Color(96, 129, 86); /// /// Represents the color with the hex value #196800. /// - public static Color Color_86 { get; } = new Color(25, 104, 0); + public static Color Color_86 => new Color(25, 104, 0); /// /// Represents the color with the hex value #4E6845. /// - public static Color Color_87 { get; } = new Color(78, 104, 69); + public static Color Color_87 => new Color(78, 104, 69); /// /// Represents the color with the hex value #134F00. /// - public static Color Color_88 { get; } = new Color(19, 79, 0); + public static Color Color_88 => new Color(19, 79, 0); /// /// Represents the color with the hex value #3B4F35. /// - public static Color Color_89 { get; } = new Color(59, 79, 53); + public static Color Color_89 => new Color(59, 79, 53); /// /// Represents the color with the hex value #00FF00. /// - public static Color Color_90 { get; } = new Color(0, 255, 0); + public static Color Color_90 => new Color(0, 255, 0); /// /// Represents the color with the hex value #AAFFAA. /// - public static Color Color_91 { get; } = new Color(170, 255, 170); + public static Color Color_91 => new Color(170, 255, 170); /// /// Represents the color with the hex value #00BD00. /// - public static Color Color_92 { get; } = new Color(0, 189, 0); + public static Color Color_92 => new Color(0, 189, 0); /// /// Represents the color with the hex value #7EBD7E. /// - public static Color Color_93 { get; } = new Color(126, 189, 126); + public static Color Color_93 => new Color(126, 189, 126); /// /// Represents the color with the hex value #008100. /// - public static Color Color_94 { get; } = new Color(0, 129, 0); + public static Color Color_94 => new Color(0, 129, 0); /// /// Represents the color with the hex value #568156. /// - public static Color Color_95 { get; } = new Color(86, 129, 86); + public static Color Color_95 => new Color(86, 129, 86); /// /// Represents the color with the hex value #006800. /// - public static Color Color_96 { get; } = new Color(0, 104, 0); + public static Color Color_96 => new Color(0, 104, 0); /// /// Represents the color with the hex value #456845. /// - public static Color Color_97 { get; } = new Color(69, 104, 69); + public static Color Color_97 => new Color(69, 104, 69); /// /// Represents the color with the hex value #004F00. /// - public static Color Color_98 { get; } = new Color(0, 79, 0); + public static Color Color_98 => new Color(0, 79, 0); /// /// Represents the color with the hex value #354F35. /// - public static Color Color_99 { get; } = new Color(53, 79, 53); + public static Color Color_99 => new Color(53, 79, 53); /// /// Represents the color with the hex value #00FF3F. /// - public static Color Color_100 { get; } = new Color(0, 255, 63); + public static Color Color_100 => new Color(0, 255, 63); /// /// Represents the color with the hex value #AAFFBF. /// - public static Color Color_101 { get; } = new Color(170, 255, 191); + public static Color Color_101 => new Color(170, 255, 191); /// /// Represents the color with the hex value #00BD2E. /// - public static Color Color_102 { get; } = new Color(0, 189, 46); + public static Color Color_102 => new Color(0, 189, 46); /// /// Represents the color with the hex value #7EBD8D. /// - public static Color Color_103 { get; } = new Color(126, 189, 141); + public static Color Color_103 => new Color(126, 189, 141); /// /// Represents the color with the hex value #00811F. /// - public static Color Color_104 { get; } = new Color(0, 129, 31); + public static Color Color_104 => new Color(0, 129, 31); /// /// Represents the color with the hex value #568160. /// - public static Color Color_105 { get; } = new Color(86, 129, 96); + public static Color Color_105 => new Color(86, 129, 96); /// /// Represents the color with the hex value #006819. /// - public static Color Color_106 { get; } = new Color(0, 104, 25); + public static Color Color_106 => new Color(0, 104, 25); /// /// Represents the color with the hex value #45684E. /// - public static Color Color_107 { get; } = new Color(69, 104, 78); + public static Color Color_107 => new Color(69, 104, 78); /// /// Represents the color with the hex value #004F13. /// - public static Color Color_108 { get; } = new Color(0, 79, 19); + public static Color Color_108 => new Color(0, 79, 19); /// /// Represents the color with the hex value #354F3B. /// - public static Color Color_109 { get; } = new Color(53, 79, 59); + public static Color Color_109 => new Color(53, 79, 59); /// /// Represents the color with the hex value #00FF7F. /// - public static Color Color_110 { get; } = new Color(0, 255, 127); + public static Color Color_110 => new Color(0, 255, 127); /// /// Represents the color with the hex value #AAFFD4. /// - public static Color Color_111 { get; } = new Color(170, 255, 212); + public static Color Color_111 => new Color(170, 255, 212); /// /// Represents the color with the hex value #00BD5E. /// - public static Color Color_112 { get; } = new Color(0, 189, 94); + public static Color Color_112 => new Color(0, 189, 94); /// /// Represents the color with the hex value #7EBD9D. /// - public static Color Color_113 { get; } = new Color(126, 189, 157); + public static Color Color_113 => new Color(126, 189, 157); /// /// Represents the color with the hex value #008140. /// - public static Color Color_114 { get; } = new Color(0, 129, 64); + public static Color Color_114 => new Color(0, 129, 64); /// /// Represents the color with the hex value #56816B. /// - public static Color Color_115 { get; } = new Color(86, 129, 107); + public static Color Color_115 => new Color(86, 129, 107); /// /// Represents the color with the hex value #006834. /// - public static Color Color_116 { get; } = new Color(0, 104, 52); + public static Color Color_116 => new Color(0, 104, 52); /// /// Represents the color with the hex value #456856. /// - public static Color Color_117 { get; } = new Color(69, 104, 86); + public static Color Color_117 => new Color(69, 104, 86); /// /// Represents the color with the hex value #004F27. /// - public static Color Color_118 { get; } = new Color(0, 79, 39); + public static Color Color_118 => new Color(0, 79, 39); /// /// Represents the color with the hex value #354F42. /// - public static Color Color_119 { get; } = new Color(53, 79, 66); + public static Color Color_119 => new Color(53, 79, 66); /// /// Represents the color with the hex value #00FFBF. /// - public static Color Color_120 { get; } = new Color(0, 255, 191); + public static Color Color_120 => new Color(0, 255, 191); /// /// Represents the color with the hex value #AAFFEA. /// - public static Color Color_121 { get; } = new Color(170, 255, 234); + public static Color Color_121 => new Color(170, 255, 234); /// /// Represents the color with the hex value #00BD8D. /// - public static Color Color_122 { get; } = new Color(0, 189, 141); + public static Color Color_122 => new Color(0, 189, 141); /// /// Represents the color with the hex value #7EBDAD. /// - public static Color Color_123 { get; } = new Color(126, 189, 173); + public static Color Color_123 => new Color(126, 189, 173); /// /// Represents the color with the hex value #008160. /// - public static Color Color_124 { get; } = new Color(0, 129, 96); + public static Color Color_124 => new Color(0, 129, 96); /// /// Represents the color with the hex value #568176. /// - public static Color Color_125 { get; } = new Color(86, 129, 118); + public static Color Color_125 => new Color(86, 129, 118); /// /// Represents the color with the hex value #00684E. /// - public static Color Color_126 { get; } = new Color(0, 104, 78); + public static Color Color_126 => new Color(0, 104, 78); /// /// Represents the color with the hex value #45685F. /// - public static Color Color_127 { get; } = new Color(69, 104, 95); + public static Color Color_127 => new Color(69, 104, 95); /// /// Represents the color with the hex value #004F3B. /// - public static Color Color_128 { get; } = new Color(0, 79, 59); + public static Color Color_128 => new Color(0, 79, 59); /// /// Represents the color with the hex value #354F49. /// - public static Color Color_129 { get; } = new Color(53, 79, 73); + public static Color Color_129 => new Color(53, 79, 73); /// /// Represents the color with the hex value #00FFFF. /// - public static Color Color_130 { get; } = new Color(0, 255, 255); + public static Color Color_130 => new Color(0, 255, 255); /// /// Represents the color with the hex value #AAFFFF. /// - public static Color Color_131 { get; } = new Color(170, 255, 255); + public static Color Color_131 => new Color(170, 255, 255); /// /// Represents the color with the hex value #00BDBD. /// - public static Color Color_132 { get; } = new Color(0, 189, 189); + public static Color Color_132 => new Color(0, 189, 189); /// /// Represents the color with the hex value #7EBDBD. /// - public static Color Color_133 { get; } = new Color(126, 189, 189); + public static Color Color_133 => new Color(126, 189, 189); /// /// Represents the color with the hex value #008181. /// - public static Color Color_134 { get; } = new Color(0, 129, 129); + public static Color Color_134 => new Color(0, 129, 129); /// /// Represents the color with the hex value #568181. /// - public static Color Color_135 { get; } = new Color(86, 129, 129); + public static Color Color_135 => new Color(86, 129, 129); /// /// Represents the color with the hex value #006868. /// - public static Color Color_136 { get; } = new Color(0, 104, 104); + public static Color Color_136 => new Color(0, 104, 104); /// /// Represents the color with the hex value #456868. /// - public static Color Color_137 { get; } = new Color(69, 104, 104); + public static Color Color_137 => new Color(69, 104, 104); /// /// Represents the color with the hex value #004F4F. /// - public static Color Color_138 { get; } = new Color(0, 79, 79); + public static Color Color_138 => new Color(0, 79, 79); /// /// Represents the color with the hex value #354F4F. /// - public static Color Color_139 { get; } = new Color(53, 79, 79); + public static Color Color_139 => new Color(53, 79, 79); /// /// Represents the color with the hex value #00BFFF. /// - public static Color Color_140 { get; } = new Color(0, 191, 255); + public static Color Color_140 => new Color(0, 191, 255); /// /// Represents the color with the hex value #AAEAFF. /// - public static Color Color_141 { get; } = new Color(170, 234, 255); + public static Color Color_141 => new Color(170, 234, 255); /// /// Represents the color with the hex value #008DBD. /// - public static Color Color_142 { get; } = new Color(0, 141, 189); + public static Color Color_142 => new Color(0, 141, 189); /// /// Represents the color with the hex value #7EADBD. /// - public static Color Color_143 { get; } = new Color(126, 173, 189); + public static Color Color_143 => new Color(126, 173, 189); /// /// Represents the color with the hex value #006081. /// - public static Color Color_144 { get; } = new Color(0, 96, 129); + public static Color Color_144 => new Color(0, 96, 129); /// /// Represents the color with the hex value #567681. /// - public static Color Color_145 { get; } = new Color(86, 118, 129); + public static Color Color_145 => new Color(86, 118, 129); /// /// Represents the color with the hex value #004E68. /// - public static Color Color_146 { get; } = new Color(0, 78, 104); + public static Color Color_146 => new Color(0, 78, 104); /// /// Represents the color with the hex value #455F68. /// - public static Color Color_147 { get; } = new Color(69, 95, 104); + public static Color Color_147 => new Color(69, 95, 104); /// /// Represents the color with the hex value #003B4F. /// - public static Color Color_148 { get; } = new Color(0, 59, 79); + public static Color Color_148 => new Color(0, 59, 79); /// /// Represents the color with the hex value #35494F. /// - public static Color Color_149 { get; } = new Color(53, 73, 79); + public static Color Color_149 => new Color(53, 73, 79); /// /// Represents the color with the hex value #007FFF. /// - public static Color Color_150 { get; } = new Color(0, 127, 255); + public static Color Color_150 => new Color(0, 127, 255); /// /// Represents the color with the hex value #AAD4FF. /// - public static Color Color_151 { get; } = new Color(170, 212, 255); + public static Color Color_151 => new Color(170, 212, 255); /// /// Represents the color with the hex value #005EBD. /// - public static Color Color_152 { get; } = new Color(0, 94, 189); + public static Color Color_152 => new Color(0, 94, 189); /// /// Represents the color with the hex value #7E9DBD. /// - public static Color Color_153 { get; } = new Color(126, 157, 189); + public static Color Color_153 => new Color(126, 157, 189); /// /// Represents the color with the hex value #004081. /// - public static Color Color_154 { get; } = new Color(0, 64, 129); + public static Color Color_154 => new Color(0, 64, 129); /// /// Represents the color with the hex value #566B81. /// - public static Color Color_155 { get; } = new Color(86, 107, 129); + public static Color Color_155 => new Color(86, 107, 129); /// /// Represents the color with the hex value #003468. /// - public static Color Color_156 { get; } = new Color(0, 52, 104); + public static Color Color_156 => new Color(0, 52, 104); /// /// Represents the color with the hex value #455668. /// - public static Color Color_157 { get; } = new Color(69, 86, 104); + public static Color Color_157 => new Color(69, 86, 104); /// /// Represents the color with the hex value #00274F. /// - public static Color Color_158 { get; } = new Color(0, 39, 79); + public static Color Color_158 => new Color(0, 39, 79); /// /// Represents the color with the hex value #35424F. /// - public static Color Color_159 { get; } = new Color(53, 66, 79); + public static Color Color_159 => new Color(53, 66, 79); /// /// Represents the color with the hex value #003FFF. /// - public static Color Color_160 { get; } = new Color(0, 63, 255); + public static Color Color_160 => new Color(0, 63, 255); /// /// Represents the color with the hex value #AABFFF. /// - public static Color Color_161 { get; } = new Color(170, 191, 255); + public static Color Color_161 => new Color(170, 191, 255); /// /// Represents the color with the hex value #002EBD. /// - public static Color Color_162 { get; } = new Color(0, 46, 189); + public static Color Color_162 => new Color(0, 46, 189); /// /// Represents the color with the hex value #7E8DBD. /// - public static Color Color_163 { get; } = new Color(126, 141, 189); + public static Color Color_163 => new Color(126, 141, 189); /// /// Represents the color with the hex value #001F81. /// - public static Color Color_164 { get; } = new Color(0, 31, 129); + public static Color Color_164 => new Color(0, 31, 129); /// /// Represents the color with the hex value #566081. /// - public static Color Color_165 { get; } = new Color(86, 96, 129); + public static Color Color_165 => new Color(86, 96, 129); /// /// Represents the color with the hex value #001968. /// - public static Color Color_166 { get; } = new Color(0, 25, 104); + public static Color Color_166 => new Color(0, 25, 104); /// /// Represents the color with the hex value #454E68. /// - public static Color Color_167 { get; } = new Color(69, 78, 104); + public static Color Color_167 => new Color(69, 78, 104); /// /// Represents the color with the hex value #00134F. /// - public static Color Color_168 { get; } = new Color(0, 19, 79); + public static Color Color_168 => new Color(0, 19, 79); /// /// Represents the color with the hex value #353B4F. /// - public static Color Color_169 { get; } = new Color(53, 59, 79); + public static Color Color_169 => new Color(53, 59, 79); /// /// Represents the color with the hex value #0000FF. /// - public static Color Color_170 { get; } = new Color(0, 0, 255); + public static Color Color_170 => new Color(0, 0, 255); /// /// Represents the color with the hex value #AAAAFF. /// - public static Color Color_171 { get; } = new Color(170, 170, 255); + public static Color Color_171 => new Color(170, 170, 255); /// /// Represents the color with the hex value #0000BD. /// - public static Color Color_172 { get; } = new Color(0, 0, 189); + public static Color Color_172 => new Color(0, 0, 189); /// /// Represents the color with the hex value #7E7EBD. /// - public static Color Color_173 { get; } = new Color(126, 126, 189); + public static Color Color_173 => new Color(126, 126, 189); /// /// Represents the color with the hex value #000081. /// - public static Color Color_174 { get; } = new Color(0, 0, 129); + public static Color Color_174 => new Color(0, 0, 129); /// /// Represents the color with the hex value #565681. /// - public static Color Color_175 { get; } = new Color(86, 86, 129); + public static Color Color_175 => new Color(86, 86, 129); /// /// Represents the color with the hex value #000068. /// - public static Color Color_176 { get; } = new Color(0, 0, 104); + public static Color Color_176 => new Color(0, 0, 104); /// /// Represents the color with the hex value #454568. /// - public static Color Color_177 { get; } = new Color(69, 69, 104); + public static Color Color_177 => new Color(69, 69, 104); /// /// Represents the color with the hex value #00004F. /// - public static Color Color_178 { get; } = new Color(0, 0, 79); + public static Color Color_178 => new Color(0, 0, 79); /// /// Represents the color with the hex value #35354F. /// - public static Color Color_179 { get; } = new Color(53, 53, 79); + public static Color Color_179 => new Color(53, 53, 79); /// /// Represents the color with the hex value #3F00FF. /// - public static Color Color_180 { get; } = new Color(63, 0, 255); + public static Color Color_180 => new Color(63, 0, 255); /// /// Represents the color with the hex value #BFAAFF. /// - public static Color Color_181 { get; } = new Color(191, 170, 255); + public static Color Color_181 => new Color(191, 170, 255); /// /// Represents the color with the hex value #2E00BD. /// - public static Color Color_182 { get; } = new Color(46, 0, 189); + public static Color Color_182 => new Color(46, 0, 189); /// /// Represents the color with the hex value #8D7EBD. /// - public static Color Color_183 { get; } = new Color(141, 126, 189); + public static Color Color_183 => new Color(141, 126, 189); /// /// Represents the color with the hex value #1F0081. /// - public static Color Color_184 { get; } = new Color(31, 0, 129); + public static Color Color_184 => new Color(31, 0, 129); /// /// Represents the color with the hex value #605681. /// - public static Color Color_185 { get; } = new Color(96, 86, 129); + public static Color Color_185 => new Color(96, 86, 129); /// /// Represents the color with the hex value #190068. /// - public static Color Color_186 { get; } = new Color(25, 0, 104); + public static Color Color_186 => new Color(25, 0, 104); /// /// Represents the color with the hex value #4E4568. /// - public static Color Color_187 { get; } = new Color(78, 69, 104); + public static Color Color_187 => new Color(78, 69, 104); /// /// Represents the color with the hex value #13004F. /// - public static Color Color_188 { get; } = new Color(19, 0, 79); + public static Color Color_188 => new Color(19, 0, 79); /// /// Represents the color with the hex value #3B354F. /// - public static Color Color_189 { get; } = new Color(59, 53, 79); + public static Color Color_189 => new Color(59, 53, 79); /// /// Represents the color with the hex value #7F00FF. /// - public static Color Color_190 { get; } = new Color(127, 0, 255); + public static Color Color_190 => new Color(127, 0, 255); /// /// Represents the color with the hex value #D4AAFF. /// - public static Color Color_191 { get; } = new Color(212, 170, 255); + public static Color Color_191 => new Color(212, 170, 255); /// /// Represents the color with the hex value #5E00BD. /// - public static Color Color_192 { get; } = new Color(94, 0, 189); + public static Color Color_192 => new Color(94, 0, 189); /// /// Represents the color with the hex value #9D7EBD. /// - public static Color Color_193 { get; } = new Color(157, 126, 189); + public static Color Color_193 => new Color(157, 126, 189); /// /// Represents the color with the hex value #400081. /// - public static Color Color_194 { get; } = new Color(64, 0, 129); + public static Color Color_194 => new Color(64, 0, 129); /// /// Represents the color with the hex value #6B5681. /// - public static Color Color_195 { get; } = new Color(107, 86, 129); + public static Color Color_195 => new Color(107, 86, 129); /// /// Represents the color with the hex value #340068. /// - public static Color Color_196 { get; } = new Color(52, 0, 104); + public static Color Color_196 => new Color(52, 0, 104); /// /// Represents the color with the hex value #564568. /// - public static Color Color_197 { get; } = new Color(86, 69, 104); + public static Color Color_197 => new Color(86, 69, 104); /// /// Represents the color with the hex value #27004F. /// - public static Color Color_198 { get; } = new Color(39, 0, 79); + public static Color Color_198 => new Color(39, 0, 79); /// /// Represents the color with the hex value #42354F. /// - public static Color Color_199 { get; } = new Color(66, 53, 79); + public static Color Color_199 => new Color(66, 53, 79); /// /// Represents the color with the hex value #BF00FF. /// - public static Color Color_200 { get; } = new Color(191, 0, 255); + public static Color Color_200 => new Color(191, 0, 255); /// /// Represents the color with the hex value #EAAAFF. /// - public static Color Color_201 { get; } = new Color(234, 170, 255); + public static Color Color_201 => new Color(234, 170, 255); /// /// Represents the color with the hex value #8D00BD. /// - public static Color Color_202 { get; } = new Color(141, 0, 189); + public static Color Color_202 => new Color(141, 0, 189); /// /// Represents the color with the hex value #AD7EBD. /// - public static Color Color_203 { get; } = new Color(173, 126, 189); + public static Color Color_203 => new Color(173, 126, 189); /// /// Represents the color with the hex value #600081. /// - public static Color Color_204 { get; } = new Color(96, 0, 129); + public static Color Color_204 => new Color(96, 0, 129); /// /// Represents the color with the hex value #765681. /// - public static Color Color_205 { get; } = new Color(118, 86, 129); + public static Color Color_205 => new Color(118, 86, 129); /// /// Represents the color with the hex value #4E0068. /// - public static Color Color_206 { get; } = new Color(78, 0, 104); + public static Color Color_206 => new Color(78, 0, 104); /// /// Represents the color with the hex value #5F4568. /// - public static Color Color_207 { get; } = new Color(95, 69, 104); + public static Color Color_207 => new Color(95, 69, 104); /// /// Represents the color with the hex value #3B004F. /// - public static Color Color_208 { get; } = new Color(59, 0, 79); + public static Color Color_208 => new Color(59, 0, 79); /// /// Represents the color with the hex value #49354F. /// - public static Color Color_209 { get; } = new Color(73, 53, 79); + public static Color Color_209 => new Color(73, 53, 79); /// /// Represents the color with the hex value #FF00FF. /// - public static Color Color_210 { get; } = new Color(255, 0, 255); + public static Color Color_210 => new Color(255, 0, 255); /// /// Represents the color with the hex value #FFAAFF. /// - public static Color Color_211 { get; } = new Color(255, 170, 255); + public static Color Color_211 => new Color(255, 170, 255); /// /// Represents the color with the hex value #BD00BD. /// - public static Color Color_212 { get; } = new Color(189, 0, 189); + public static Color Color_212 => new Color(189, 0, 189); /// /// Represents the color with the hex value #BD7EBD. /// - public static Color Color_213 { get; } = new Color(189, 126, 189); + public static Color Color_213 => new Color(189, 126, 189); /// /// Represents the color with the hex value #810081. /// - public static Color Color_214 { get; } = new Color(129, 0, 129); + public static Color Color_214 => new Color(129, 0, 129); /// /// Represents the color with the hex value #815681. /// - public static Color Color_215 { get; } = new Color(129, 86, 129); + public static Color Color_215 => new Color(129, 86, 129); /// /// Represents the color with the hex value #680068. /// - public static Color Color_216 { get; } = new Color(104, 0, 104); + public static Color Color_216 => new Color(104, 0, 104); /// /// Represents the color with the hex value #684568. /// - public static Color Color_217 { get; } = new Color(104, 69, 104); + public static Color Color_217 => new Color(104, 69, 104); /// /// Represents the color with the hex value #4F004F. /// - public static Color Color_218 { get; } = new Color(79, 0, 79); + public static Color Color_218 => new Color(79, 0, 79); /// /// Represents the color with the hex value #4F354F. /// - public static Color Color_219 { get; } = new Color(79, 53, 79); + public static Color Color_219 => new Color(79, 53, 79); /// /// Represents the color with the hex value #FF00BF. /// - public static Color Color_220 { get; } = new Color(255, 0, 191); + public static Color Color_220 => new Color(255, 0, 191); /// /// Represents the color with the hex value #FFAAEA. /// - public static Color Color_221 { get; } = new Color(255, 170, 234); + public static Color Color_221 => new Color(255, 170, 234); /// /// Represents the color with the hex value #BD008D. /// - public static Color Color_222 { get; } = new Color(189, 0, 141); + public static Color Color_222 => new Color(189, 0, 141); /// /// Represents the color with the hex value #BD7EAD. /// - public static Color Color_223 { get; } = new Color(189, 126, 173); + public static Color Color_223 => new Color(189, 126, 173); /// /// Represents the color with the hex value #810060. /// - public static Color Color_224 { get; } = new Color(129, 0, 96); + public static Color Color_224 => new Color(129, 0, 96); /// /// Represents the color with the hex value #815676. /// - public static Color Color_225 { get; } = new Color(129, 86, 118); + public static Color Color_225 => new Color(129, 86, 118); /// /// Represents the color with the hex value #68004E. /// - public static Color Color_226 { get; } = new Color(104, 0, 78); + public static Color Color_226 => new Color(104, 0, 78); /// /// Represents the color with the hex value #68455F. /// - public static Color Color_227 { get; } = new Color(104, 69, 95); + public static Color Color_227 => new Color(104, 69, 95); /// /// Represents the color with the hex value #4F003B. /// - public static Color Color_228 { get; } = new Color(79, 0, 59); + public static Color Color_228 => new Color(79, 0, 59); /// /// Represents the color with the hex value #4F3549. /// - public static Color Color_229 { get; } = new Color(79, 53, 73); + public static Color Color_229 => new Color(79, 53, 73); /// /// Represents the color with the hex value #FF007F. /// - public static Color Color_230 { get; } = new Color(255, 0, 127); + public static Color Color_230 => new Color(255, 0, 127); /// /// Represents the color with the hex value #FFAAD4. /// - public static Color Color_231 { get; } = new Color(255, 170, 212); + public static Color Color_231 => new Color(255, 170, 212); /// /// Represents the color with the hex value #BD005E. /// - public static Color Color_232 { get; } = new Color(189, 0, 94); + public static Color Color_232 => new Color(189, 0, 94); /// /// Represents the color with the hex value #BD7E9D. /// - public static Color Color_233 { get; } = new Color(189, 126, 157); + public static Color Color_233 => new Color(189, 126, 157); /// /// Represents the color with the hex value #810040. /// - public static Color Color_234 { get; } = new Color(129, 0, 64); + public static Color Color_234 => new Color(129, 0, 64); /// /// Represents the color with the hex value #81566B. /// - public static Color Color_235 { get; } = new Color(129, 86, 107); + public static Color Color_235 => new Color(129, 86, 107); /// /// Represents the color with the hex value #680034. /// - public static Color Color_236 { get; } = new Color(104, 0, 52); + public static Color Color_236 => new Color(104, 0, 52); /// /// Represents the color with the hex value #684556. /// - public static Color Color_237 { get; } = new Color(104, 69, 86); + public static Color Color_237 => new Color(104, 69, 86); /// /// Represents the color with the hex value #4F0027. /// - public static Color Color_238 { get; } = new Color(79, 0, 39); + public static Color Color_238 => new Color(79, 0, 39); /// /// Represents the color with the hex value #4F3542. /// - public static Color Color_239 { get; } = new Color(79, 53, 66); + public static Color Color_239 => new Color(79, 53, 66); /// /// Represents the color with the hex value #FF003F. /// - public static Color Color_240 { get; } = new Color(255, 0, 63); + public static Color Color_240 => new Color(255, 0, 63); /// /// Represents the color with the hex value #FFAABF. /// - public static Color Color_241 { get; } = new Color(255, 170, 191); + public static Color Color_241 => new Color(255, 170, 191); /// /// Represents the color with the hex value #BD002E. /// - public static Color Color_242 { get; } = new Color(189, 0, 46); + public static Color Color_242 => new Color(189, 0, 46); /// /// Represents the color with the hex value #BD7E8D. /// - public static Color Color_243 { get; } = new Color(189, 126, 141); + public static Color Color_243 => new Color(189, 126, 141); /// /// Represents the color with the hex value #81001F. /// - public static Color Color_244 { get; } = new Color(129, 0, 31); + public static Color Color_244 => new Color(129, 0, 31); /// /// Represents the color with the hex value #815660. /// - public static Color Color_245 { get; } = new Color(129, 86, 96); + public static Color Color_245 => new Color(129, 86, 96); /// /// Represents the color with the hex value #680019. /// - public static Color Color_246 { get; } = new Color(104, 0, 25); + public static Color Color_246 => new Color(104, 0, 25); /// /// Represents the color with the hex value #68454E. /// - public static Color Color_247 { get; } = new Color(104, 69, 78); + public static Color Color_247 => new Color(104, 69, 78); /// /// Represents the color with the hex value #4F0013. /// - public static Color Color_248 { get; } = new Color(79, 0, 19); + public static Color Color_248 => new Color(79, 0, 19); /// /// Represents the color with the hex value #4F353B. /// - public static Color Color_249 { get; } = new Color(79, 53, 59); + public static Color Color_249 => new Color(79, 53, 59); /// /// Represents the color with the hex value #333333. /// - public static Color Color_250 { get; } = new Color(51, 51, 51); + public static Color Color_250 => new Color(51, 51, 51); /// /// Represents the color with the hex value #505050. /// - public static Color Color_251 { get; } = new Color(80, 80, 80); + public static Color Color_251 => new Color(80, 80, 80); /// /// Represents the color with the hex value #696969. /// - public static Color Color_252 { get; } = new Color(105, 105, 105); + public static Color Color_252 => new Color(105, 105, 105); /// /// Represents the color with the hex value #828282. /// - public static Color Color_253 { get; } = new Color(130, 130, 130); + public static Color Color_253 => new Color(130, 130, 130); /// /// Represents the color with the hex value #BEBEBE. /// - public static Color Color_254 { get; } = new Color(190, 190, 190); + public static Color Color_254 => new Color(190, 190, 190); /// /// Represents the color with the hex value #FFFFFF. /// - public static Color Color_255 { get; } = new Color(255, 255, 255); + public static Color Color_255 => new Color(255, 255, 255); } #endregion } From 89598b384ff467283e553ecb99ebb156bd1934cd Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 11:26:33 -0300 Subject: [PATCH 02/14] Update `MaterialUtils` and `GraphicsStyleUtils` with default 9 colors --- CHANGELOG.md | 2 + ricaun.Revit.DB.Shape.Tests/Color_Tests.cs | 6 +- .../LineColorCreate_Tests.cs | 44 +++++++-------- .../MaterialCreate_Tests.cs | 41 ++++++-------- ricaun.Revit.DB.Shape/Colors.cs | 44 +-------------- ricaun.Revit.DB.Shape/GraphicsStyleUtils.cs | 53 ++++++++++++------ ricaun.Revit.DB.Shape/MaterialUtils.cs | 55 ++++++++++++------- 7 files changed, 117 insertions(+), 128 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45b1203..94afdbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [0.3.2] / 2024-06-14 ### Features - Update Colors using the `System.Windows.Media.Colors` as reference. +- Update `MaterialUtils` and `GraphicsStyleUtils` with default 9 colors. ### Tests - Test all color names in `System.Windows.Media.Colors` with `Colors`. +- Test all 9 colors in `MaterialUtils` and `GraphicsStyleUtils`. ## [0.3.1] / 2024-01-09 - 2024-04-13 ### Features diff --git a/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs b/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs index f65b55e..7123795 100644 --- a/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs @@ -10,7 +10,7 @@ public class Color_Tests Color black = new Color(0, 0, 0); Color red = new Color(255, 0, 0); Color yellow = new Color(255, 255, 0); - Color green = new Color(0, 255, 0); + Color lime = new Color(0, 255, 0); Color cyan = new Color(0, 255, 255); Color blue = new Color(0, 0, 255); Color magenta = new Color(255, 0, 255); @@ -61,7 +61,7 @@ public void Colors_Index_Tests() Assert.IsTrue(Colors.Index.Color_0.ColorEquals(black)); Assert.IsTrue(Colors.Index.Color_1.ColorEquals(red)); Assert.IsTrue(Colors.Index.Color_2.ColorEquals(yellow)); - Assert.IsTrue(Colors.Index.Color_3.ColorEquals(green)); + Assert.IsTrue(Colors.Index.Color_3.ColorEquals(lime)); Assert.IsTrue(Colors.Index.Color_4.ColorEquals(cyan)); Assert.IsTrue(Colors.Index.Color_5.ColorEquals(blue)); Assert.IsTrue(Colors.Index.Color_6.ColorEquals(magenta)); @@ -76,7 +76,7 @@ public void Colors_Index_Get_Tests() Assert.IsTrue(Colors.Index.Get(0).ColorEquals(black)); Assert.IsTrue(Colors.Index.Get(1).ColorEquals(red)); Assert.IsTrue(Colors.Index.Get(2).ColorEquals(yellow)); - Assert.IsTrue(Colors.Index.Get(3).ColorEquals(green)); + Assert.IsTrue(Colors.Index.Get(3).ColorEquals(lime)); Assert.IsTrue(Colors.Index.Get(4).ColorEquals(cyan)); Assert.IsTrue(Colors.Index.Get(5).ColorEquals(blue)); Assert.IsTrue(Colors.Index.Get(6).ColorEquals(magenta)); diff --git a/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs b/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs index ebec9d8..e830a8e 100644 --- a/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs @@ -1,36 +1,32 @@ -using NUnit.Framework; +using Autodesk.Revit.DB; +using NUnit.Framework; using ricaun.Revit.DB.Shape.Tests.Utils; +using System.Collections.Generic; namespace ricaun.Revit.DB.Shape.Tests { public class LineColorCreate_Tests : OneTimeOpenDocumentTransactionTest { [Test] - public void CreateLineColorWhite() + public void CreateLineColors() { - var graphicsStyle = GraphicsStyleUtils.CreateLineColorWhite(document); - Assert.IsNotNull(graphicsStyle); - } + var colors = new Dictionary() { + { Colors.White, GraphicsStyleUtils.CreateLineColorWhite(document)}, + { Colors.Red, GraphicsStyleUtils.CreateLineColorRed(document)}, + { Colors.Green, GraphicsStyleUtils.CreateLineColorGreen(document)}, + { Colors.Blue, GraphicsStyleUtils.CreateLineColorBlue(document)}, + { Colors.Yellow, GraphicsStyleUtils.CreateLineColorYellow(document)}, + { Colors.Cyan, GraphicsStyleUtils.CreateLineColorCyan(document)}, + { Colors.Magenta, GraphicsStyleUtils.CreateLineColorMagenta(document)}, + { Colors.Black, GraphicsStyleUtils.CreateLineColorBlack(document)}, + { Colors.Gray, GraphicsStyleUtils.CreateLineColorGray(document)}, + }; - [Test] - public void CreateLineColorRed() - { - var graphicsStyle = GraphicsStyleUtils.CreateLineColorRed(document); - Assert.IsNotNull(graphicsStyle); - } - - [Test] - public void CreateLineColorGreen() - { - var graphicsStyle = GraphicsStyleUtils.CreateLineColorGreen(document); - Assert.IsNotNull(graphicsStyle); - } - - [Test] - public void CreateLineColorBlue() - { - var graphicsStyle = GraphicsStyleUtils.CreateLineColorBlue(document); - Assert.IsNotNull(graphicsStyle); + foreach (var color in colors) + { + Assert.IsNotNull(color.Value); + Assert.IsTrue(color.Value.GraphicsStyleCategory.LineColor.ColorEquals(color.Key)); + } } [Test] diff --git a/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs b/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs index ddcf4f1..171514e 100644 --- a/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using ricaun.Revit.DB.Shape.Tests.Utils; using System; +using System.Collections.Generic; namespace ricaun.Revit.DB.Shape.Tests { @@ -66,31 +67,25 @@ public void CreateMaterial_GetColorWithTransparency(int transparency) } [Test] - public void CreateMaterialWhite() + public void CreateMaterialColors() { - var material = MaterialUtils.CreateMaterialWhite(document); - Assert.IsNotNull(material); - } + var colors = new Dictionary() { + { Colors.White, MaterialUtils.CreateMaterialWhite(document)}, + { Colors.Red, MaterialUtils.CreateMaterialRed(document)}, + { Colors.Green, MaterialUtils.CreateMaterialGreen(document)}, + { Colors.Blue, MaterialUtils.CreateMaterialBlue(document)}, + { Colors.Yellow, MaterialUtils.CreateMaterialYellow(document)}, + { Colors.Cyan, MaterialUtils.CreateMaterialCyan(document)}, + { Colors.Magenta, MaterialUtils.CreateMaterialMagenta(document)}, + { Colors.Black, MaterialUtils.CreateMaterialBlack(document)}, + { Colors.Gray, MaterialUtils.CreateMaterialGray(document)}, + }; - [Test] - public void CreateMaterialRed() - { - var material = MaterialUtils.CreateMaterialRed(document); - Assert.IsNotNull(material); - } - - [Test] - public void CreateMaterialGreen() - { - var material = MaterialUtils.CreateMaterialGreen(document); - Assert.IsNotNull(material); - } - - [Test] - public void CreateMaterialBlue() - { - var material = MaterialUtils.CreateMaterialBlue(document); - Assert.IsNotNull(material); + foreach (var color in colors) + { + Assert.IsNotNull(color.Value); + Assert.IsTrue(color.Value.Color.ColorEquals(color.Key)); + } } [Test] diff --git a/ricaun.Revit.DB.Shape/Colors.cs b/ricaun.Revit.DB.Shape/Colors.cs index 5687436..e1bda40 100644 --- a/ricaun.Revit.DB.Shape/Colors.cs +++ b/ricaun.Revit.DB.Shape/Colors.cs @@ -7,48 +7,6 @@ namespace ricaun.Revit.DB.Shape /// public sealed class Colors { - #region Colors - ///// - ///// Represents the color black with the hex value #000000. - ///// - //public static Color Black => new Color(0, 0, 0); - ///// - ///// Represents the color red with the hex value #FF0000. - ///// - //public static Color Red => new Color(255, 0, 0); - ///// - ///// Represents the color yellow with the hex value #FFFF00. - ///// - //public static Color Yellow => new Color(255, 255, 0); - ///// - ///// Represents the color green with the hex value #00FF00. - ///// - //public static Color Green => new Color(0, 255, 0); - ///// - ///// Represents the color cyan with the hex value #00FFFF. - ///// - //public static Color Cyan => new Color(0, 255, 255); - ///// - ///// Represents the color blue with the hex value #0000FF. - ///// - //public static Color Blue => new Color(0, 0, 255); - ///// - ///// Represents the color magenta with the hex value #FF00FF. - ///// - //public static Color Magenta => new Color(255, 0, 255); - ///// - ///// Represents the color white with the hex value #FFFFFF. - ///// - //public static Color White => new Color(255, 255, 255); - ///// - ///// Represents the color dark gray with the hex value #414141. - ///// - //public static Color DarkGray => new Color(65, 65, 65); - ///// - ///// Represents the color gray with the hex value #808080. - ///// - //public static Color Gray => new Color(128, 128, 128); - #endregion #region Media Colors /// /// Represents the color with the hex value #F0F8FF. @@ -639,7 +597,7 @@ public static Color Get(byte index) /// public static Color Color_2 => new Color(255, 255, 0); /// - /// Represents the color green with the hex value #00FF00. + /// Represents the color lime with the hex value #00FF00. /// public static Color Color_3 => new Color(0, 255, 0); /// diff --git a/ricaun.Revit.DB.Shape/GraphicsStyleUtils.cs b/ricaun.Revit.DB.Shape/GraphicsStyleUtils.cs index a6f8a64..dc05ce7 100644 --- a/ricaun.Revit.DB.Shape/GraphicsStyleUtils.cs +++ b/ricaun.Revit.DB.Shape/GraphicsStyleUtils.cs @@ -28,42 +28,63 @@ public static Category CreateCategoryLines(Document document, string name) return subCategory; } + + #region Colors /// /// Create LineColor Category and return GraphicsStyleType.Projection. /// /// /// - public static GraphicsStyle CreateLineColorWhite(Document document) - { - return CreateLineColor(document, Colors.White); - } + public static GraphicsStyle CreateLineColorWhite(Document document) => CreateLineColor(document, Colors.White); /// /// Create LineColor Category and return GraphicsStyleType.Projection. /// /// /// - public static GraphicsStyle CreateLineColorGreen(Document document) - { - return CreateLineColor(document, Colors.Green); - } + public static GraphicsStyle CreateLineColorGreen(Document document) => CreateLineColor(document, Colors.Green); /// /// Create LineColor Category and return GraphicsStyleType.Projection. /// /// /// - public static GraphicsStyle CreateLineColorRed(Document document) - { - return CreateLineColor(document, Colors.Red); - } + public static GraphicsStyle CreateLineColorRed(Document document) => CreateLineColor(document, Colors.Red); /// /// Create LineColor Category and return GraphicsStyleType.Projection. /// /// /// - public static GraphicsStyle CreateLineColorBlue(Document document) - { - return CreateLineColor(document, Colors.Blue); - } + public static GraphicsStyle CreateLineColorBlue(Document document) => CreateLineColor(document, Colors.Blue); + /// + /// Create LineColor Category and return GraphicsStyleType.Projection. + /// + /// + /// + public static GraphicsStyle CreateLineColorYellow(Document document) => CreateLineColor(document, Colors.Yellow); + /// + /// Create LineColor Category and return GraphicsStyleType.Projection. + /// + /// + /// + public static GraphicsStyle CreateLineColorCyan(Document document) => CreateLineColor(document, Colors.Cyan); + /// + /// Create LineColor Category and return GraphicsStyleType.Projection. + /// + /// + /// + public static GraphicsStyle CreateLineColorMagenta(Document document) => CreateLineColor(document, Colors.Magenta); + /// + /// Create LineColor Category and return GraphicsStyleType.Projection. + /// + /// + /// + public static GraphicsStyle CreateLineColorGray(Document document) => CreateLineColor(document, Colors.Gray); + /// + /// Create LineColor Category and return GraphicsStyleType.Projection. + /// + /// + /// + public static GraphicsStyle CreateLineColorBlack(Document document) => CreateLineColor(document, Colors.Black); +#endregion /// /// Create LineColor Category and return GraphicsStyleType.Projection. /// diff --git a/ricaun.Revit.DB.Shape/MaterialUtils.cs b/ricaun.Revit.DB.Shape/MaterialUtils.cs index 5eb1197..c016692 100644 --- a/ricaun.Revit.DB.Shape/MaterialUtils.cs +++ b/ricaun.Revit.DB.Shape/MaterialUtils.cs @@ -92,45 +92,62 @@ public static Material CreateMaterial(Document document, ColorWithTransparency c return CreateMaterial(document, (byte)color.GetRed(), (byte)color.GetGreen(), (byte)color.GetBlue(), (byte)color.GetTransparency()); } + #region Colors /// /// CreateMaterialWhite /// /// /// - public static Material CreateMaterialWhite(Document document) - { - return CreateMaterial(document, Colors.White); - } - + public static Material CreateMaterialWhite(Document document) => CreateMaterial(document, Colors.White); /// /// CreateMaterialRed /// /// /// - public static Material CreateMaterialRed(Document document) - { - return CreateMaterial(document, Colors.Red); - } - + public static Material CreateMaterialRed(Document document) => CreateMaterial(document, Colors.Red); /// /// CreateMaterialGreen /// /// /// - public static Material CreateMaterialGreen(Document document) - { - return CreateMaterial(document, Colors.Green); - } - + public static Material CreateMaterialGreen(Document document) => CreateMaterial(document, Colors.Green); /// /// CreateMaterialBlue /// /// /// - public static Material CreateMaterialBlue(Document document) - { - return CreateMaterial(document, Colors.Blue); - } + public static Material CreateMaterialBlue(Document document) => CreateMaterial(document, Colors.Blue); + /// + /// CreateMaterialYellow + /// + /// + /// + public static Material CreateMaterialYellow(Document document) => CreateMaterial(document, Colors.Yellow); + /// + /// CreateMaterialCyan + /// + /// + /// + public static Material CreateMaterialCyan(Document document) => CreateMaterial(document, Colors.Cyan); + /// + /// CreateMaterialMagenta + /// + /// + /// + public static Material CreateMaterialMagenta(Document document) => CreateMaterial(document, Colors.Magenta); + /// + /// CreateMaterialGray + /// + /// + /// + public static Material CreateMaterialGray(Document document) => CreateMaterial(document, Colors.Gray); + /// + /// CreateMaterialBlack + /// + /// + /// + public static Material CreateMaterialBlack(Document document) => CreateMaterial(document, Colors.Black); + #endregion /// /// FindMaterial From 1268b164eed5fe1e598856bcf04cafecba0dcd29 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 11:27:33 -0300 Subject: [PATCH 03/14] Version beta --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7b49a55..71cd1ec 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-alpha + 0.3.2-beta 2024 2025 true From 94d5a19dfd63a2995b919a4d11d9bc5200785d94 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 13:53:44 -0300 Subject: [PATCH 04/14] Add `ColorExtension` and tests --- CHANGELOG.md | 3 + Directory.Build.props | 2 +- ricaun.Revit.DB.Shape.Tests/Color_Tests.cs | 62 ++++++++- .../LineColorCreate_Tests.cs | 1 + .../MaterialCreate_Tests.cs | 1 + .../Utils/ColorExtension.cs | 52 +++---- .../Extensions/ColorExtension.cs | 130 ++++++++++++++++++ ricaun.Revit.DB.Shape/XYZUtils.cs | 2 +- 8 files changed, 223 insertions(+), 30 deletions(-) create mode 100644 ricaun.Revit.DB.Shape/Extensions/ColorExtension.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 94afdbe..ccf113f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Features - Update Colors using the `System.Windows.Media.Colors` as reference. - Update `MaterialUtils` and `GraphicsStyleUtils` with default 9 colors. +- Add `ColorExtension` with `ColorEquals`, `Lerp`, `ToColor` and `ToColorWithTransparency`. +- Add `ColorExtension` with `ToHex` for `Color` and `ColorWithTransparency` ### Tests - Test all color names in `System.Windows.Media.Colors` with `Colors`. - Test all 9 colors in `MaterialUtils` and `GraphicsStyleUtils`. +- Test for `ColorExternsion` ## [0.3.1] / 2024-01-09 - 2024-04-13 ### Features diff --git a/Directory.Build.props b/Directory.Build.props index 71cd1ec..2ee2d33 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-beta + 0.3.2-rc 2024 2025 true diff --git a/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs b/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs index 7123795..c1578b4 100644 --- a/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/Color_Tests.cs @@ -1,6 +1,7 @@ using Autodesk.Revit.DB; using NUnit.Framework; using ricaun.Revit.DB.Shape.Tests.Utils; +using ricaun.Revit.DB.Shape.Extensions; using System.Collections.Generic; namespace ricaun.Revit.DB.Shape.Tests @@ -45,7 +46,7 @@ public void Colors_Tests() var expectedColor = new Color(color.Value.R, color.Value.G, color.Value.B); if (colorsType.GetProperty(name)?.GetValue(null) is Color colorTest) { - Assert.IsTrue(colorTest.ColorEquals(expectedColor), + Assert.IsTrue(colorTest.ColorEquals(expectedColor), $"{name} Color ({colorTest.Red},{colorTest.Green},{colorTest.Blue}) is not equal to ({expectedColor.Red},{expectedColor.Green},{expectedColor.Blue})"); } else @@ -93,7 +94,64 @@ public void Colors_Index_Get_All_Tests() Assert.IsNotNull(Colors.Index.Get((byte)i)); } } - } + [Test] + public void ColorExtension_ColorEquals_Tests() + { + for (int i = 0; i < 256; i++) + { + var color = Colors.Index.Get((byte)i); + Assert.IsTrue(color.ColorEquals(color)); + + var colorT = color.ToColorWithTransparency(); + Assert.IsTrue(colorT.ColorEquals(colorT)); + Assert.IsTrue(colorT.ColorEquals(color)); + Assert.IsTrue(color.ColorEquals(colorT)); + + var colorT100 = color.ToColorWithTransparency(100); + Assert.IsFalse(colorT.ColorEquals(colorT100)); + Assert.IsFalse(colorT100.ColorEquals(colorT)); + + var _color = colorT.ToColor(); + Assert.IsTrue(color.ColorEquals(_color)); + } + } + + [Test] + public void ColorExtension_Lerp_Tests() + { + var color = Colors.Black.Lerp(Colors.Gray, 0.5); + var colorExpected = new Color(64, 64, 64); + Assert.IsTrue(color.ColorEquals(colorExpected)); + } + + [Test] + public void ColorExtension_ToHex_Tests() + { + var tests = new Dictionary() + { + { "#000000", Colors.Black }, + { "#FF0000", Colors.Red }, + { "#008000", Colors.Green }, + { "#00FF00", Colors.Lime }, + { "#0000FF", Colors.Blue }, + { "#FFFF00", Colors.Yellow }, + { "#00FFFF", Colors.Cyan }, + { "#FF00FF", Colors.Magenta }, + { "#808080", Colors.Gray }, + { "#FFFFFF", Colors.White }, + }; + + foreach (var test in tests) + { + Assert.AreEqual(test.Key, test.Value.ToHex()); + } + + foreach (var test in tests) + { + Assert.AreEqual(test.Key, test.Value.ToColorWithTransparency().ToHex()); + } + } + } } \ No newline at end of file diff --git a/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs b/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs index e830a8e..c8ae523 100644 --- a/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/LineColorCreate_Tests.cs @@ -1,6 +1,7 @@ using Autodesk.Revit.DB; using NUnit.Framework; using ricaun.Revit.DB.Shape.Tests.Utils; +using ricaun.Revit.DB.Shape.Extensions; using System.Collections.Generic; namespace ricaun.Revit.DB.Shape.Tests diff --git a/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs b/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs index 171514e..a3ba058 100644 --- a/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/MaterialCreate_Tests.cs @@ -2,6 +2,7 @@ using Autodesk.Revit.DB; using NUnit.Framework; using ricaun.Revit.DB.Shape.Tests.Utils; +using ricaun.Revit.DB.Shape.Extensions; using System; using System.Collections.Generic; diff --git a/ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs b/ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs index 1484f5f..9171db3 100644 --- a/ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs +++ b/ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs @@ -1,30 +1,30 @@ -using Autodesk.Revit.DB; +//using Autodesk.Revit.DB; -namespace ricaun.Revit.DB.Shape.Tests.Utils -{ - public static class ColorExtension - { - public static bool ColorEquals(this Color colorA, Color colorB) - { - return colorA.Red == colorB.Red && colorA.Green == colorB.Green && colorA.Blue == colorB.Blue; - } +//namespace ricaun.Revit.DB.Shape.Tests.Utils +//{ +// public static class ColorExtension +// { +// public static bool ColorEquals(this Color colorA, Color colorB) +// { +// return colorA.Red == colorB.Red && colorA.Green == colorB.Green && colorA.Blue == colorB.Blue; +// } - public static bool ColorEquals(this Color colorA, ColorWithTransparency colorB) - { - return colorA.Red == colorB.GetRed() && colorA.Green == colorB.GetGreen() && colorA.Blue == colorB.GetBlue(); - } +// public static bool ColorEquals(this Color colorA, ColorWithTransparency colorB) +// { +// return colorA.Red == colorB.GetRed() && colorA.Green == colorB.GetGreen() && colorA.Blue == colorB.GetBlue(); +// } - public static bool ColorEquals(this ColorWithTransparency colorA, Color colorB) - { - return colorB.ColorEquals(colorA); - } +// public static bool ColorEquals(this ColorWithTransparency colorA, Color colorB) +// { +// return colorB.ColorEquals(colorA); +// } - public static bool ColorEquals(this ColorWithTransparency colorA, ColorWithTransparency colorB) - { - return colorA.GetRed() == colorB.GetRed() && - colorA.GetGreen() == colorB.GetGreen() && - colorA.GetBlue() == colorB.GetBlue() && - colorA.GetTransparency() == colorB.GetTransparency(); - } - } -} \ No newline at end of file +// public static bool ColorEquals(this ColorWithTransparency colorA, ColorWithTransparency colorB) +// { +// return colorA.GetRed() == colorB.GetRed() && +// colorA.GetGreen() == colorB.GetGreen() && +// colorA.GetBlue() == colorB.GetBlue() && +// colorA.GetTransparency() == colorB.GetTransparency(); +// } +// } +//} \ No newline at end of file diff --git a/ricaun.Revit.DB.Shape/Extensions/ColorExtension.cs b/ricaun.Revit.DB.Shape/Extensions/ColorExtension.cs new file mode 100644 index 0000000..669b002 --- /dev/null +++ b/ricaun.Revit.DB.Shape/Extensions/ColorExtension.cs @@ -0,0 +1,130 @@ +using Autodesk.Revit.DB; + +namespace ricaun.Revit.DB.Shape.Extensions +{ + /// + /// ColorExtension + /// + public static class ColorExtension + { + /// + /// Linearly interpolates between colors a and b by t. + /// + /// + /// + /// + public static Color Lerp(this Color colorA, Color colorB, double t) + { + byte r = (byte)(colorA.Red + (colorB.Red - colorA.Red) * t); + byte g = (byte)(colorA.Green + (colorB.Green - colorA.Green) * t); + byte b = (byte)(colorA.Blue + (colorB.Blue - colorA.Blue) * t); + return new Color(r, g, b); + } + + /// + /// ToColorWithTransparency + /// + /// + /// + /// + public static ColorWithTransparency ToColorWithTransparency(this Color color, byte alpha = byte.MaxValue) + { + if (color is null) return null; + var colorWithTransparency = new ColorWithTransparency(color.Red, color.Green, color.Blue, alpha); + return colorWithTransparency; + } + + /// + /// ToColor + /// + /// + /// + public static Color ToColor(this ColorWithTransparency colorWithTransparency) + { + if (colorWithTransparency is null) return null; + var color = new Color( + (byte)colorWithTransparency.GetRed(), + (byte)colorWithTransparency.GetGreen(), + (byte)colorWithTransparency.GetBlue()); + return color; + } + + #region Equals + /// + /// ColorEquals RGB + /// + /// + /// + public static bool ColorEquals(this Color colorA, Color colorB) + { + return colorA.Red == colorB.Red && colorA.Green == colorB.Green && colorA.Blue == colorB.Blue; + } + /// + /// ColorEquals RGB only the transparency is not compared. + /// + /// + /// + public static bool ColorEquals(this Color colorA, ColorWithTransparency colorB) + { + return colorA.Red == colorB.GetRed() && colorA.Green == colorB.GetGreen() && colorA.Blue == colorB.GetBlue(); + } + /// + /// ColorEquals RGB only the transparency is not compared. + /// + /// + /// + public static bool ColorEquals(this ColorWithTransparency colorA, Color colorB) + { + return colorB.ColorEquals(colorA); + } + /// + /// ColorEquals RGB and Transparency + /// + /// + /// + public static bool ColorEquals(this ColorWithTransparency colorA, ColorWithTransparency colorB) + { + return colorA.GetRed() == colorB.GetRed() && + colorA.GetGreen() == colorB.GetGreen() && + colorA.GetBlue() == colorB.GetBlue() && + colorA.GetTransparency() == colorB.GetTransparency(); + } + #endregion + + /// + /// Convert to #RRGGBB in hex format + /// + /// + /// + public static string ToHex(this Color color) + { + return ToHex(color.Red, color.Green, color.Blue); + } + + /// + /// Convert to #RRGGBB or #AARRGGBB in hex format + /// + /// + /// + public static string ToHex(this ColorWithTransparency color) + { + return ToHex((byte)color.GetRed(), (byte)color.GetGreen(), (byte)color.GetBlue(), (byte)color.GetTransparency()); + } + + /// + /// Convert to #RRGGBB or #AARRGGBB + /// + /// + /// + /// + /// + /// + public static string ToHex(byte red, byte green, byte blue, byte alpha = byte.MaxValue) + { + if (alpha == byte.MaxValue) + return string.Format("#{0:X2}{1:X2}{2:X2}", red, green, blue); + + return string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", alpha, red, green, blue); + } + } +} diff --git a/ricaun.Revit.DB.Shape/XYZUtils.cs b/ricaun.Revit.DB.Shape/XYZUtils.cs index 75a3b99..4c3f12f 100644 --- a/ricaun.Revit.DB.Shape/XYZUtils.cs +++ b/ricaun.Revit.DB.Shape/XYZUtils.cs @@ -18,7 +18,7 @@ public static class XYZUtils /// /// /// - public static bool IsAlmostParallelTo(this XYZ value, XYZ source, double tolerance = Tolerance) + public static bool IsAlmostParallelTo(XYZ value, XYZ source, double tolerance = Tolerance) { return Math.Abs(value.DotProduct(source)) >= 1.0 - tolerance; } From c9385591660da31e9d6749e08fe2a44df0222062 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 14:03:40 -0300 Subject: [PATCH 05/14] Update `MaterialColorName` to use `ToHex` --- .../Utils/ColorExtension.cs | 30 ------------------- ricaun.Revit.DB.Shape/MaterialUtils.cs | 7 ++--- 2 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs diff --git a/ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs b/ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs deleted file mode 100644 index 9171db3..0000000 --- a/ricaun.Revit.DB.Shape.Tests/Utils/ColorExtension.cs +++ /dev/null @@ -1,30 +0,0 @@ -//using Autodesk.Revit.DB; - -//namespace ricaun.Revit.DB.Shape.Tests.Utils -//{ -// public static class ColorExtension -// { -// public static bool ColorEquals(this Color colorA, Color colorB) -// { -// return colorA.Red == colorB.Red && colorA.Green == colorB.Green && colorA.Blue == colorB.Blue; -// } - -// public static bool ColorEquals(this Color colorA, ColorWithTransparency colorB) -// { -// return colorA.Red == colorB.GetRed() && colorA.Green == colorB.GetGreen() && colorA.Blue == colorB.GetBlue(); -// } - -// public static bool ColorEquals(this ColorWithTransparency colorA, Color colorB) -// { -// return colorB.ColorEquals(colorA); -// } - -// public static bool ColorEquals(this ColorWithTransparency colorA, ColorWithTransparency colorB) -// { -// return colorA.GetRed() == colorB.GetRed() && -// colorA.GetGreen() == colorB.GetGreen() && -// colorA.GetBlue() == colorB.GetBlue() && -// colorA.GetTransparency() == colorB.GetTransparency(); -// } -// } -//} \ No newline at end of file diff --git a/ricaun.Revit.DB.Shape/MaterialUtils.cs b/ricaun.Revit.DB.Shape/MaterialUtils.cs index c016692..27c0f5f 100644 --- a/ricaun.Revit.DB.Shape/MaterialUtils.cs +++ b/ricaun.Revit.DB.Shape/MaterialUtils.cs @@ -16,13 +16,10 @@ public static class MaterialUtils /// /// /// - /// Color {alpha}{red}{blue}{green} in hexa + /// 'Color RRGGBB' or 'Color AARRGGBB' public static string MaterialColorName(byte red, byte green, byte blue, byte alpha = byte.MaxValue) { - if (alpha == byte.MaxValue) - return string.Format("Color {0:X2}{1:X2}{2:X2}", red, green, blue); - - return string.Format("Color {0:X2}{1:X2}{2:X2}{3:X2}", alpha, red, green, blue); + return string.Format("Color {0}", Extensions.ColorExtension.ToHex(red, green, blue, alpha).Trim('#')); } /// From 6749723203c432242b563deb15a3dae8fa6ade19 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 14:21:52 -0300 Subject: [PATCH 06/14] Update package description --- ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj | 3 ++- ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj | 3 ++- ricaun.Revit.DB/ricaun.Revit.DB.csproj | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj b/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj index 4d73cf2..45486c5 100644 --- a/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj +++ b/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj @@ -77,7 +77,8 @@ ricaun Luiz Henrique Cassettari - $(PackageId) + Revit API DB library for Quaternion. + revit;revitapi;dotnet $([System.DateTime]::Now.ToString('yyyy')) diff --git a/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj b/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj index f8c95cb..a92e0be 100644 --- a/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj +++ b/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj @@ -77,7 +77,8 @@ ricaun Luiz Henrique Cassettari - $(PackageId) + Revit API DB library for Shapes. + revit;revitapi;dotnet $([System.DateTime]::Now.ToString('yyyy')) diff --git a/ricaun.Revit.DB/ricaun.Revit.DB.csproj b/ricaun.Revit.DB/ricaun.Revit.DB.csproj index 8be88bc..782d0ba 100644 --- a/ricaun.Revit.DB/ricaun.Revit.DB.csproj +++ b/ricaun.Revit.DB/ricaun.Revit.DB.csproj @@ -84,7 +84,8 @@ ricaun Luiz Henrique Cassettari - $(PackageId) + Revit API DB library collection. + revit;revitapi;dotnet $([System.DateTime]::Now.ToString('yyyy')) From 258b140edabca561d757da84d8db363c08dd4119 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 14:32:25 -0300 Subject: [PATCH 07/14] release rc.1 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2ee2d33..6ef9f6d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-rc + 0.3.2-rc.1 2024 2025 true From d79dd2adb06b4b6978cf5b171b0b220e29dde75f Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 14:35:12 -0300 Subject: [PATCH 08/14] Add multiple target version --- Directory.Build.props | 2 +- .../ricaun.Revit.DB.Quaternion.csproj | 14 ++++++++++++-- ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj | 14 ++++++++++++-- ricaun.Revit.DB/ricaun.Revit.DB.csproj | 14 ++++++++++++-- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 6ef9f6d..156d645 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-rc.1 + 0.3.2-rc.2 2024 2025 true diff --git a/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj b/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj index 45486c5..2a5b10d 100644 --- a/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj +++ b/ricaun.Revit.DB.Quaternion/ricaun.Revit.DB.Quaternion.csproj @@ -13,14 +13,24 @@ - net46;net8.0-windows + net46;net47;net48;net8.0-windows - + 2017 + + + 2019 + + + + + 2021 + + 2025 diff --git a/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj b/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj index a92e0be..a2b9a79 100644 --- a/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj +++ b/ricaun.Revit.DB.Shape/ricaun.Revit.DB.Shape.csproj @@ -13,14 +13,24 @@ - net46;net8.0-windows + net46;net47;net48;net8.0-windows - + 2017 + + + 2019 + + + + + 2021 + + 2025 diff --git a/ricaun.Revit.DB/ricaun.Revit.DB.csproj b/ricaun.Revit.DB/ricaun.Revit.DB.csproj index 782d0ba..1d19ed5 100644 --- a/ricaun.Revit.DB/ricaun.Revit.DB.csproj +++ b/ricaun.Revit.DB/ricaun.Revit.DB.csproj @@ -20,14 +20,24 @@ - net46;net8.0-windows + net46;net47;net48;net8.0-windows - + 2017 + + + 2019 + + + + + 2021 + + 2025 From d8bde071b92336e3cbf116c8d85270a559cab47f Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 15:49:23 -0300 Subject: [PATCH 09/14] Update `CreateBoxLines` with `graphicsStyleId` --- CHANGELOG.md | 3 ++- Directory.Build.props | 2 +- ricaun.Revit.DB.Shape/ShapeCreator.cs | 23 +++++++++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf113f..50e3823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [0.3.2] / 2024-06-14 -### Features +### Shapes - Update Colors using the `System.Windows.Media.Colors` as reference. - Update `MaterialUtils` and `GraphicsStyleUtils` with default 9 colors. - Add `ColorExtension` with `ColorEquals`, `Lerp`, `ToColor` and `ToColorWithTransparency`. - Add `ColorExtension` with `ToHex` for `Color` and `ColorWithTransparency` +- Update `CreateBoxLines` with `graphicsStyleId` ### Tests - Test all color names in `System.Windows.Media.Colors` with `Colors`. - Test all 9 colors in `MaterialUtils` and `GraphicsStyleUtils`. diff --git a/Directory.Build.props b/Directory.Build.props index 156d645..e576d89 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-rc.2 + 0.3.2-rc.3 2024 2025 true diff --git a/ricaun.Revit.DB.Shape/ShapeCreator.cs b/ricaun.Revit.DB.Shape/ShapeCreator.cs index 0025c07..d7b2cf3 100644 --- a/ricaun.Revit.DB.Shape/ShapeCreator.cs +++ b/ricaun.Revit.DB.Shape/ShapeCreator.cs @@ -21,11 +21,12 @@ public static class ShapeCreator /// /// The center point of the box. /// The scale size of the box. + /// The ID of the graphics style to use for the lines. If not specified, the lines will use the default graphics style. /// An array of lines representing the edges of the 3D box. - public static Line[] CreateBoxLines(XYZ center, double scaleRadius) + public static Line[] CreateBoxLines(XYZ center, double scaleRadius, ElementId graphicsStyleId = null) { var scaleXYZ = new XYZ(scaleRadius, scaleRadius, scaleRadius); - return CreateBoxLines(center - scaleXYZ, center + scaleXYZ); + return CreateBoxLines(center - scaleXYZ, center + scaleXYZ, graphicsStyleId); } /// @@ -33,9 +34,10 @@ public static Line[] CreateBoxLines(XYZ center, double scaleRadius) /// /// The minimum point of the box. This point defines the lower corner of the box. /// The maximum point of the box. This point defines the upper corner of the box. + /// The ID of the graphics style to use for the lines. If not specified, the lines will use the default graphics style. /// An array of lines representing the edges of the 3D box. /// Ignore Lines with distance too short. - public static Line[] CreateBoxLines(XYZ min, XYZ max) + public static Line[] CreateBoxLines(XYZ min, XYZ max, ElementId graphicsStyleId = null) { // Create an array to store the lines Line[] lines = new Line[12]; @@ -55,18 +57,23 @@ public static Line[] CreateBoxLines(XYZ min, XYZ max) // Create the lines for each edge of the cube using a for loop for (int i = 0; i < 4; i++) { - lines[i] = CreateBound(vertices[i], vertices[(i + 1) % 4]); - lines[i + 4] = CreateBound(vertices[i], vertices[i + 4]); - lines[i + 8] = CreateBound(vertices[i + 4], vertices[(i + 1) % 4 + 4]); + lines[i] = CreateBound(vertices[i], vertices[(i + 1) % 4], graphicsStyleId); + lines[i + 4] = CreateBound(vertices[i], vertices[i + 4], graphicsStyleId); + lines[i + 8] = CreateBound(vertices[i + 4], vertices[(i + 1) % 4 + 4], graphicsStyleId); } return lines.OfType().ToArray(); } - private static Line CreateBound(XYZ point1, XYZ point2) + private static Line CreateBound(XYZ point1, XYZ point2, ElementId graphicsStyleId = null) { try { - return Line.CreateBound(point1, point2); + var line = Line.CreateBound(point1, point2); + + if (graphicsStyleId is not null) + line.SetGraphicsStyleId(graphicsStyleId); + + return line; } catch { } return null; From b321a7270d391d188a4d553e38019622354c3a72 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 16:12:10 -0300 Subject: [PATCH 10/14] Add `CreateLines` in `ShapeCreator` --- CHANGELOG.md | 1 + Directory.Build.props | 2 +- ricaun.Revit.DB.Shape/ShapeCreator.cs | 58 ++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50e3823..0967f6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add `ColorExtension` with `ColorEquals`, `Lerp`, `ToColor` and `ToColorWithTransparency`. - Add `ColorExtension` with `ToHex` for `Color` and `ColorWithTransparency` - Update `CreateBoxLines` with `graphicsStyleId` +- Add `CreateLines` in `ShapeCreator` ### Tests - Test all color names in `System.Windows.Media.Colors` with `Colors`. - Test all 9 colors in `MaterialUtils` and `GraphicsStyleUtils`. diff --git a/Directory.Build.props b/Directory.Build.props index e576d89..35b57a8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-rc.3 + 0.3.2-rc.4 2024 2025 true diff --git a/ricaun.Revit.DB.Shape/ShapeCreator.cs b/ricaun.Revit.DB.Shape/ShapeCreator.cs index d7b2cf3..261387e 100644 --- a/ricaun.Revit.DB.Shape/ShapeCreator.cs +++ b/ricaun.Revit.DB.Shape/ShapeCreator.cs @@ -15,7 +15,59 @@ public static class ShapeCreator /// Default Sides for Prisms and Pyramids. /// internal const int Sides = 3; - #region Box + + #region Lines + /// + /// Creates an array of objects from a collection of points. + /// + /// A collection of points to create lines from. + /// + /// A boolean value indicating whether the lines should form a closed loop. + /// If true, an additional line will be created from the last point back to the first point. + /// + /// + /// An array of objects representing the lines created from the specified points. + /// + public static Line[] CreateLines(IEnumerable points, bool closed) + { + return CreateLines(points, null, closed); + } + /// + /// Creates an array of objects from a collection of points. + /// + /// A collection of points to create lines from. + /// + /// An optional representing the graphics style to apply to the lines. + /// If null, the default graphics style will be used. + /// + /// + /// A boolean value indicating whether the lines should form a closed loop. + /// If true, an additional line will be created from the last point back to the first point. + /// + /// + /// An array of objects representing the lines created from the specified points. + /// + public static Line[] CreateLines(IEnumerable points, ElementId graphicsStyleId = null, bool closed = false) + { + var lines = new List(); + var pointsArray = points.ToArray(); + + for (int i = 0; i < pointsArray.Length - 1; i++) + { + var line = CreateBound(pointsArray[i], pointsArray[i + 1], graphicsStyleId); + if (line is not null) + lines.Add(line); + } + + if (closed) + { + var line = CreateBound(pointsArray[0], pointsArray[pointsArray.Length - 1], graphicsStyleId); + if (line is not null) + lines.Add(line); + } + + return lines.ToArray(); + } /// /// Creates an array of lines representing the edges of a 3D box with the specified minimum and maximum points. /// @@ -64,7 +116,7 @@ public static Line[] CreateBoxLines(XYZ min, XYZ max, ElementId graphicsStyleId return lines.OfType().ToArray(); } - private static Line CreateBound(XYZ point1, XYZ point2, ElementId graphicsStyleId = null) + internal static Line CreateBound(XYZ point1, XYZ point2, ElementId graphicsStyleId = null) { try { @@ -78,6 +130,8 @@ private static Line CreateBound(XYZ point1, XYZ point2, ElementId graphicsStyleI catch { } return null; } + #endregion + #region Box /// /// Creates a 3D box with the specified center and size. /// From d6575d5791eda3cbb54ee2bbb9c9b7274c53d7f3 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 16:31:14 -0300 Subject: [PATCH 11/14] Test `MaterialId` and `GraphicsStyleId`. --- CHANGELOG.md | 1 + .../Shape_BoxLine_Tests.cs | 15 +++++++++ .../Shape_Box_Tests.cs | 31 +++++++++++++++++++ .../Utils/ElementIdUtils.cs | 10 ++++++ 4 files changed, 57 insertions(+) create mode 100644 ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0967f6f..1db5fa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Test all color names in `System.Windows.Media.Colors` with `Colors`. - Test all 9 colors in `MaterialUtils` and `GraphicsStyleUtils`. - Test for `ColorExternsion` +- Test `MaterialId` and `GraphicsStyleId`. ## [0.3.1] / 2024-01-09 - 2024-04-13 ### Features diff --git a/ricaun.Revit.DB.Shape.Tests/Shape_BoxLine_Tests.cs b/ricaun.Revit.DB.Shape.Tests/Shape_BoxLine_Tests.cs index 312d13a..0705a3d 100644 --- a/ricaun.Revit.DB.Shape.Tests/Shape_BoxLine_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/Shape_BoxLine_Tests.cs @@ -1,5 +1,6 @@ using Autodesk.Revit.DB; using NUnit.Framework; +using ricaun.Revit.DB.Shape.Tests.Utils; namespace ricaun.Revit.DB.Shape.Tests { @@ -15,6 +16,20 @@ public void CreateBoxLines() Assert.AreEqual(12, lines.Length); } + [Test] + public void CreateBoxLines_GraphicsStyleId() + { + var scale = 1.0; + var center = XYZ.Zero; + + var lines = ShapeCreator.CreateBoxLines(center, scale, ElementIdUtils.GraphicsStyleId); + + foreach (var line in lines) + { + Assert.AreEqual(ElementIdUtils.GraphicsStyleId, line.GraphicsStyleId); + } + } + [Test] public void CreateBoxLines_MinMax() { diff --git a/ricaun.Revit.DB.Shape.Tests/Shape_Box_Tests.cs b/ricaun.Revit.DB.Shape.Tests/Shape_Box_Tests.cs index 1218633..228d2fc 100644 --- a/ricaun.Revit.DB.Shape.Tests/Shape_Box_Tests.cs +++ b/ricaun.Revit.DB.Shape.Tests/Shape_Box_Tests.cs @@ -1,5 +1,6 @@ using Autodesk.Revit.DB; using NUnit.Framework; +using ricaun.Revit.DB.Shape.Extensions; using ricaun.Revit.DB.Shape.Tests.Utils; namespace ricaun.Revit.DB.Shape.Tests @@ -17,6 +18,36 @@ public void CreateBox() AssertUtils.Box(solid, center, scale); } + [Test] + public void CreateBox_MaterialId() + { + var scale = 1.0; + var center = XYZ.Zero; + + Solid solid = ShapeCreator.CreateBox(center, scale, ElementIdUtils.MaterialId); + + Assert.AreEqual(ElementIdUtils.MaterialId, solid.GetMaterialId()); + + foreach (var face in solid.GetFaces()) + { + Assert.AreEqual(ElementIdUtils.MaterialId, face.MaterialElementId); + } + } + + [Test] + public void CreateBox_GraphicsStyleId() + { + var scale = 1.0; + var center = XYZ.Zero; + + Solid solid = ShapeCreator.CreateBox(center, scale, graphicsStyleId: ElementIdUtils.GraphicsStyleId); + + foreach (var face in solid.GetFaces()) + { + Assert.AreEqual(ElementIdUtils.GraphicsStyleId, face.GraphicsStyleId); + } + } + [Test] public void CreateBox_MinMax() { diff --git a/ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs b/ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs new file mode 100644 index 0000000..e0893fe --- /dev/null +++ b/ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs @@ -0,0 +1,10 @@ +using Autodesk.Revit.DB; + +namespace ricaun.Revit.DB.Shape.Tests.Utils +{ + public static class ElementIdUtils + { + public static ElementId MaterialId => new ElementId(BuiltInCategory.OST_Materials); + public static ElementId GraphicsStyleId => new ElementId(BuiltInCategory.OST_Lines); + } +} \ No newline at end of file From 14dad9aee9c0f57e4bc37b8f733b6c97b220239f Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 16:37:40 -0300 Subject: [PATCH 12/14] Test `CreateLines` with `closed` and `GraphicsStyleId` --- CHANGELOG.md | 1 + .../Shape_Lines_Tests.cs | 46 +++++++++++++++++++ .../Utils/ElementIdUtils.cs | 3 ++ 3 files changed, 50 insertions(+) create mode 100644 ricaun.Revit.DB.Shape.Tests/Shape_Lines_Tests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1db5fa0..64eea75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Test all 9 colors in `MaterialUtils` and `GraphicsStyleUtils`. - Test for `ColorExternsion` - Test `MaterialId` and `GraphicsStyleId`. +- Test `CreateLines` with `closed` and `GraphicsStyleId`. ## [0.3.1] / 2024-01-09 - 2024-04-13 ### Features diff --git a/ricaun.Revit.DB.Shape.Tests/Shape_Lines_Tests.cs b/ricaun.Revit.DB.Shape.Tests/Shape_Lines_Tests.cs new file mode 100644 index 0000000..920c59c --- /dev/null +++ b/ricaun.Revit.DB.Shape.Tests/Shape_Lines_Tests.cs @@ -0,0 +1,46 @@ +using Autodesk.Revit.DB; +using NUnit.Framework; +using ricaun.Revit.DB.Shape.Tests.Utils; + +namespace ricaun.Revit.DB.Shape.Tests +{ + public class Shape_Lines_Tests + { + private static readonly XYZ[] _points = new[] + { + new XYZ(0, 0, 0), + new XYZ(1, 0, 0), + new XYZ(1, 1, 0), + new XYZ(0, 1, 0), + new XYZ(0, 0, 1), + new XYZ(1, 0, 1), + new XYZ(1, 1, 1), + new XYZ(0, 1, 1), + }; + + [Test] + public void CreateLines() + { + var lines = ShapeCreator.CreateLines(_points); + Assert.AreEqual(_points.Length - 1, lines.Length); + } + + [Test] + public void CreateLines_Closed() + { + var lines = ShapeCreator.CreateLines(_points, true); + Assert.AreEqual(_points.Length, lines.Length); + } + + [Test] + public void CreateLines_GraphicsStyleId() + { + var lines = ShapeCreator.CreateLines(_points, ElementIdUtils.GraphicsStyleId); + + foreach (var line in lines) + { + Assert.AreEqual(ElementIdUtils.GraphicsStyleId, line.GraphicsStyleId); + } + } + } +} \ No newline at end of file diff --git a/ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs b/ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs index e0893fe..8db1854 100644 --- a/ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs +++ b/ricaun.Revit.DB.Shape.Tests/Utils/ElementIdUtils.cs @@ -2,6 +2,9 @@ namespace ricaun.Revit.DB.Shape.Tests.Utils { + /// + /// Use this ElementId only outside a document context. + /// public static class ElementIdUtils { public static ElementId MaterialId => new ElementId(BuiltInCategory.OST_Materials); From f2f877eb9b59dd2442cd7ca63835b006badfb56d Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 16:38:17 -0300 Subject: [PATCH 13/14] Update rc.5 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 35b57a8..50cfedd 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-rc.4 + 0.3.2-rc.5 2024 2025 true From 7355a39da29b9e42cc4c868334359f7337401565 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Fri, 14 Jun 2024 17:09:57 -0300 Subject: [PATCH 14/14] Release 0.3.2 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 50cfedd..393c417 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.3.2-rc.5 + 0.3.2 2024 2025 true