diff --git a/LayoutFunctions/WallsLOD200/src/WallsLOD200.cs b/LayoutFunctions/WallsLOD200/src/WallsLOD200.cs index 04f5cb02..b82e4729 100644 --- a/LayoutFunctions/WallsLOD200/src/WallsLOD200.cs +++ b/LayoutFunctions/WallsLOD200/src/WallsLOD200.cs @@ -1,9 +1,5 @@ using Elements; -using System.Linq; -using Elements.Search; using Elements.Geometry; -using System.Collections.Generic; -using System.Diagnostics; namespace WallsLOD200 { @@ -45,54 +41,10 @@ public static WallsLOD200Outputs Execute(Dictionary inputModels, public static List UnifyLines(List lines) { - // Remove duplicate lines based on their hash codes - List dedupedlines = null; - + List dedupedlines = RemoveDuplicateLines(lines); // Merge collinear lines that are touching or overlapping - List mergedLines = null; - - // Create stopwatch for timing - Stopwatch stopwatch = new Stopwatch(); - - // Number of iterations - int iterations = 1; - - // Lists to store elapsed times for each method - List removeDuplicateLinesTimes = new List(); - List mergeCollinearLinesTimes = new List(); - List removeDuplicateLines2Times = new List(); - List mergeCollinearLines2Times = new List(); - - for (int i = 0; i < iterations; i++) - { - - // Timing for RemoveDuplicateLines - stopwatch.Restart(); - dedupedlines = RemoveDuplicateLines(lines); - stopwatch.Stop(); - removeDuplicateLinesTimes.Add(stopwatch.Elapsed); - - // Timing for MergeCollinearLines2 - stopwatch.Restart(); - mergedLines = MergeCollinearLines(dedupedlines); - stopwatch.Stop(); - mergeCollinearLinesTimes.Add(stopwatch.Elapsed); - } - - // Calculate min, max, and average times for each method - TimeSpan removeDuplicateLinesMin = removeDuplicateLinesTimes.Min(); - TimeSpan removeDuplicateLinesMax = removeDuplicateLinesTimes.Max(); - TimeSpan removeDuplicateLinesAverage = TimeSpan.FromTicks((long)removeDuplicateLinesTimes.Average(t => t.Ticks)); - - TimeSpan mergeCollinearLinesMin = mergeCollinearLinesTimes.Min(); - TimeSpan mergeCollinearLinesMax = mergeCollinearLinesTimes.Max(); - TimeSpan mergeCollinearLinesAverage = TimeSpan.FromTicks((long)mergeCollinearLinesTimes.Average(t => t.Ticks)); - - // Print results - Console.WriteLine($"RemoveDuplicateLines: Min - {removeDuplicateLinesMin}, Max - {removeDuplicateLinesMax}, Average - {removeDuplicateLinesAverage}"); - Console.WriteLine($"MergeCollinearLines: Min -{mergeCollinearLinesMin}, Max - {mergeCollinearLinesMax}, Average - {mergeCollinearLinesAverage}"); - Console.WriteLine($"Merged {lines.Count} Lines into {mergedLines.Count}"); + List mergedLines = MergeCollinearLines(dedupedlines); return mergedLines; }