diff --git a/CadRevealComposer.Exe/CommandLineOptions.cs b/CadRevealComposer.Exe/CommandLineOptions.cs index aaee79b5..db5e20dd 100644 --- a/CadRevealComposer.Exe/CommandLineOptions.cs +++ b/CadRevealComposer.Exe/CommandLineOptions.cs @@ -122,6 +122,13 @@ public class CommandLineOptions )] public DirectoryInfo? DevPrimitiveCacheFolder { get; init; } = null; + [Option( + longName: "NoPrioritySectors", + Required = false, + HelpText = "Disable creating priority sectors for this model. Priority Sectors are not supported by reveal without Echo modifications." + )] + public bool NoPrioritySectors { get; set; } + public static void AssertValidOptions(CommandLineOptions options) { // Validate DataAttributes diff --git a/CadRevealComposer.Exe/Program.cs b/CadRevealComposer.Exe/Program.cs index 2f1101b9..e1901d08 100644 --- a/CadRevealComposer.Exe/Program.cs +++ b/CadRevealComposer.Exe/Program.cs @@ -48,7 +48,8 @@ private static int RunOptionsAndReturnExitCode(CommandLineOptions options) new ModelId(options.ModelId), new RevisionId(options.RevisionId), new InstancingThreshold(options.InstancingThreshold), - new TemplateCountLimit(options.TemplateCountLimit) + new TemplateCountLimit(options.TemplateCountLimit), + options.NoPrioritySectors ); if (options.NodeNameExcludeRegex != null) diff --git a/CadRevealComposer/CadRevealComposerRunner.cs b/CadRevealComposer/CadRevealComposerRunner.cs index a06f12d5..05fbc4d3 100644 --- a/CadRevealComposer/CadRevealComposerRunner.cs +++ b/CadRevealComposer/CadRevealComposerRunner.cs @@ -165,13 +165,17 @@ ComposerParameters composerParameters // First split into normal sectors for the entire model var normalSectors = PerformSectorSplitting(allPrimitives, composerParameters, sectorIdGenerator); - // Then split into prioritized sectors, these are loaded on demand based on metadata in the Hierarchy database - var prioritizedSectors = PerformPrioritizedSectorSplitting(allPrimitives, sectorIdGenerator, rootSectorId); + IReadOnlyCollection prioritizedSectors = []; + if (!modelParameters.NoPrioritySectors) + { + // Then split into prioritized sectors, these are loaded on demand based on metadata in the Hierarchy database + prioritizedSectors = PerformPrioritizedSectorSplitting(allPrimitives, sectorIdGenerator, rootSectorId); + } var allSectors = normalSectors.Concat(prioritizedSectors).OrderBy(x => x.SectorId).ToArray(); Console.WriteLine( - $"Split into {normalSectors.Length} sectors and {prioritizedSectors.Length} prioritized sectors in {stopwatch.Elapsed}" + $"Split into {normalSectors.Length} sectors and {prioritizedSectors.Count} prioritized sectors in {stopwatch.Elapsed}" ); stopwatch.Restart(); @@ -241,7 +245,7 @@ uint rootSectorId return RemapPrioritizedSectorsRootSectorId(prioritizedSectors, rootSectorId); } - private static List GetTreeIndexToSectorIdDict(InternalSector[] sectors) + private static List GetTreeIndexToSectorIdDict(IReadOnlyCollection sectors) { var sectorIdToTreeIndex = new HashSet(); foreach (var sector in sectors) diff --git a/CadRevealComposer/Configuration/ModelParameters.cs b/CadRevealComposer/Configuration/ModelParameters.cs index d8e0ae41..5f5bb39d 100644 --- a/CadRevealComposer/Configuration/ModelParameters.cs +++ b/CadRevealComposer/Configuration/ModelParameters.cs @@ -13,7 +13,8 @@ public record ModelParameters( ModelId ModelId, RevisionId RevisionId, InstancingThreshold InstancingThreshold, - TemplateCountLimit TemplateCountLimit + TemplateCountLimit TemplateCountLimit, + bool NoPrioritySectors ); public record ProjectId(long Value);