修复bug和新增部分功能

This commit is contained in:
GG Z
2024-10-08 16:21:39 +08:00
parent 082b781808
commit b6647218be
44 changed files with 1709 additions and 1390 deletions

View File

@@ -1,4 +1,5 @@
using System.Windows;
using System.Windows.Controls.Primitives;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
@@ -52,7 +53,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_StructuralFraming), value == false);
foreach (var builtInCategory in beamCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"梁显隐"
);
@@ -73,8 +79,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_CableTray), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_CableTrayFitting), value == false);
foreach (var builtInCategory in cabletrayCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"桥架显隐"
);
@@ -95,8 +105,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_StructuralColumns), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_Columns), value == false);
foreach (var builtInCategory in columnsCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"柱显隐"
);
@@ -117,7 +131,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_Walls), value == false);
foreach (var builtInCategory in wallCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"墙显隐"
);
@@ -138,7 +157,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_Floors), value == false);
foreach (var builtInCategory in floorCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"楼板显隐"
);
@@ -159,8 +183,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_Conduit), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_ConduitFitting), value == false);
foreach (var builtInCategory in conduitCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"线管显隐"
);
@@ -181,9 +209,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_DuctCurves), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_DuctAccessory), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_DuctFitting), value == false);
foreach (var builtInCategory in mechanicalCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"暖通显隐"
);
@@ -204,10 +235,12 @@ public partial class VisibilityViewModel : ObservableObject
doc.Invoke(
_ =>
{
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_PipeCurves), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_PipeFitting), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_PipeAccessory), value == false);
uidoc.ActiveView.SetCategoryHidden(new ElementId(BuiltInCategory.OST_Sprinklers), value == false);
foreach (var builtInCategory in pipingCategory)
{
var categoryId = Category.GetCategory(doc, builtInCategory).Id;
uidoc.ActiveView.SetCategoryHidden(categoryId, value == false);
}
},
"给排水显隐"
);
@@ -244,6 +277,35 @@ public partial class VisibilityViewModel : ObservableObject
}
return true;
}
readonly BuiltInCategory[] wallCategory = [BuiltInCategory.OST_Walls];
readonly BuiltInCategory[] beamCategory = [BuiltInCategory.OST_StructuralFraming];
readonly BuiltInCategory[] floorCategory = [BuiltInCategory.OST_Floors];
readonly BuiltInCategory[] columnsCategory = [
BuiltInCategory.OST_StructuralColumns,
BuiltInCategory.OST_Columns];
readonly BuiltInCategory[] mechanicalCategory = [
BuiltInCategory.OST_DuctCurves,
BuiltInCategory.OST_DuctAccessory,
BuiltInCategory.OST_DuctFitting,
BuiltInCategory.OST_DuctInsulations,
BuiltInCategory.OST_DuctTerminal,
BuiltInCategory.OST_FlexDuctCurves,
BuiltInCategory.OST_PlaceHolderDucts,BuiltInCategory.OST_MechanicalEquipment];
readonly BuiltInCategory[] pipingCategory = [
BuiltInCategory.OST_PipeCurves,
BuiltInCategory.OST_PipeFitting,
BuiltInCategory.OST_PipeAccessory,
BuiltInCategory.OST_PipeInsulations,
BuiltInCategory.OST_Sprinklers,
BuiltInCategory.OST_FlexPipeCurves,
BuiltInCategory.OST_PlaceHolderPipes,
BuiltInCategory.OST_PlumbingFixtures];
readonly BuiltInCategory[] cabletrayCategory = [
BuiltInCategory.OST_CableTray,
BuiltInCategory.OST_CableTrayFitting,];
readonly BuiltInCategory[] conduitCategory = [
BuiltInCategory.OST_Conduit,
BuiltInCategory.OST_ConduitFitting,];
private void UpdateCheckedState(Document doc)
{
@@ -251,14 +313,14 @@ public partial class VisibilityViewModel : ObservableObject
{
return;
}
WallChecked = GetCheckedStatue(doc, BuiltInCategory.OST_Walls);
BeamChecked = GetCheckedStatue(doc, BuiltInCategory.OST_StructuralFraming);
FloorChecked = GetCheckedStatue(doc, BuiltInCategory.OST_Floors);
ColumnChecked = GetCheckedStatue(doc, BuiltInCategory.OST_StructuralColumns, BuiltInCategory.OST_Columns);
MechanicalChecked = GetCheckedStatue(doc, BuiltInCategory.OST_DuctCurves, BuiltInCategory.OST_DuctAccessory, BuiltInCategory.OST_DuctFitting);
PlumbingChecked = GetCheckedStatue(doc, BuiltInCategory.OST_PipeCurves, BuiltInCategory.OST_PipeFitting, BuiltInCategory.OST_PipeAccessory, BuiltInCategory.OST_Sprinklers);
CableTrayChecked = GetCheckedStatue(doc, BuiltInCategory.OST_CableTray, BuiltInCategory.OST_CableTrayFitting);
ConduitChecked = GetCheckedStatue(doc, BuiltInCategory.OST_Conduit, BuiltInCategory.OST_ConduitFitting);
WallChecked = GetCheckedStatue(doc, wallCategory);
BeamChecked = GetCheckedStatue(doc, beamCategory);
FloorChecked = GetCheckedStatue(doc, floorCategory);
ColumnChecked = GetCheckedStatue(doc, columnsCategory);
MechanicalChecked = GetCheckedStatue(doc, mechanicalCategory);
PlumbingChecked = GetCheckedStatue(doc, pipingCategory);
CableTrayChecked = GetCheckedStatue(doc, cabletrayCategory);
ConduitChecked = GetCheckedStatue(doc, conduitCategory);
}
[RelayCommand]