Skip to content

Commit 94a5918

Browse files
committed
allow to use more categories in RDQ
1 parent 6bb4ed5 commit 94a5918

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

sources/RevitDBExplorer/Domain/RevitDatabaseQuery/Parser/Commands/CategoryCmdDefinition.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,31 @@
99

1010
namespace RevitDBExplorer.Domain.RevitDatabaseQuery.Parser.Commands
1111
{
12-
internal class CategoryCmdDefinition : ICommandDefinition, INeedInitialization, IOfferArgumentAutocompletion
12+
internal class CategoryCmdDefinition : ICommandDefinition, INeedInitializationWithDocument, IOfferArgumentAutocompletion
1313
{
1414
private static readonly AutocompleteItem AutocompleteItem = new AutocompleteItem("c: ", "c:[category]", "select elements of given category", AutocompleteItemGroups.Commands);
1515
private readonly DataBucket<CategoryCmdArgument> dataBucket = new DataBucket<CategoryCmdArgument>(0.59);
1616

1717

18-
public void Init()
18+
public void Init(Document document)
1919
{
20-
var allFilterableCategories = ParameterFilterUtilities.GetAllFilterableCategories();
20+
dataBucket.Clear();
21+
22+
var categories = document.Settings.Categories;
2123

22-
foreach (ElementId categoryId in allFilterableCategories)
24+
foreach (Category category in categories)
2325
{
24-
var category = (BuiltInCategory)categoryId.Value();
25-
var label = LabelUtils.GetLabelFor(category);
26+
var builtInCategory = category.BuiltInCategory;
27+
28+
var label = LabelUtils.GetLabelFor(builtInCategory);
2629

27-
var strCategory = category.ToString();
30+
var strCategory = builtInCategory.ToString();
2831

29-
if (!Category.IsBuiltInCategoryValid(category))
32+
if (!Category.IsBuiltInCategoryValid(builtInCategory))
3033
{
3134
continue;
3235
}
33-
dataBucket.Add(new AutocompleteItem(strCategory, strCategory, label), new CategoryCmdArgument(category), label, strCategory);
36+
dataBucket.Add(new AutocompleteItem(strCategory, strCategory, label), new CategoryCmdArgument(builtInCategory), label, strCategory);
3437
}
3538

3639
dataBucket.Rebuild();

0 commit comments

Comments
 (0)