diff --git a/sources/RevitDBExplorer/Domain/DataModel/Members/Accessors/MemberAccessorByFuncUltra.cs b/sources/RevitDBExplorer/Domain/DataModel/Members/Accessors/MemberAccessorByFuncUltra.cs index 4919b88..6c2454f 100644 --- a/sources/RevitDBExplorer/Domain/DataModel/Members/Accessors/MemberAccessorByFuncUltra.cs +++ b/sources/RevitDBExplorer/Domain/DataModel/Members/Accessors/MemberAccessorByFuncUltra.cs @@ -12,13 +12,14 @@ internal class MemberAccessorByFuncUltra get; private readonly IEnumerable param_0_arguments; + private readonly Func> param_0_arguments_provider; private readonly string param_0_Name; - - public MemberAccessorByFuncUltra(Func get, IEnumerable param_0_arguments, string param_0_Name) + + public MemberAccessorByFuncUltra(Func get, Func> param_0_arguments_provider, string param_0_Name) { this.get = get; - this.param_0_arguments = param_0_arguments; + this.param_0_arguments_provider = param_0_arguments_provider; this.param_0_Name = param_0_Name; } @@ -26,13 +27,21 @@ public MemberAccessorByFuncUltra(Func(); - var resultCollection = ExecuteResultCollection.Create(param_0_Name); + var resultCollection = ExecuteResultCollection.Create(param_0_Name); + + var arguments = param_0_arguments; + + if (arguments == null) + { + arguments = param_0_arguments_provider?.Invoke(context.Document, snoopedObject); + } - foreach (var arg in param_0_arguments) + foreach (var arg in arguments) { var result = get(context.Document, snoopedObject, arg); resultCollection.Add(arg, result); } + value.SetValueTyped(context, resultCollection); diff --git a/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberOverride.cs b/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberOverride.cs index 5ff4e43..83a5a27 100644 --- a/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberOverride.cs +++ b/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberOverride.cs @@ -41,7 +41,7 @@ public static IMemberOverride ByFunc(Expression(Expression> getter, IEnumerable param_0_arguments) + public static IMemberOverride ByFuncWithParam(Expression> getter, Func> param_0_arguments) { var compiledGetter = getter.Compile(); string syntax = getter.ToCeSharp(); diff --git a/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberTemplate.cs b/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberTemplate.cs index b422112..0c28d7e 100644 --- a/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberTemplate.cs +++ b/sources/RevitDBExplorer/Domain/DataModel/Members/Base/MemberTemplate.cs @@ -46,8 +46,8 @@ public static ISnoopableMemberTemplate Create(Expression RevitDocumentationReader.GetMethodComments(methodCallExpression.Method)); } - public static ISnoopableMemberTemplate Create(Expression> getter, - IEnumerable param_0_arguments, + public static ISnoopableMemberTemplate CreateWithParam(Expression> getter, + Func> param_0_arguments, Func canBeUsed = null, MemberKind kind = MemberKind.StaticMethod) { diff --git a/sources/RevitDBExplorer/Domain/DataModel/MembersOverrides/IndependentTag/IndependentTag.cs b/sources/RevitDBExplorer/Domain/DataModel/MembersOverrides/IndependentTag/IndependentTag.cs new file mode 100644 index 0000000..c9ff0e5 --- /dev/null +++ b/sources/RevitDBExplorer/Domain/DataModel/MembersOverrides/IndependentTag/IndependentTag.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Autodesk.Revit.DB; +using RevitDBExplorer.Domain.DataModel.Members; +using RevitDBExplorer.Domain.DataModel.Members.Base; + +// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md + +namespace RevitDBExplorer.Domain.DataModel.MembersOverrides +{ + internal class IndependentTag_Overrides : IHaveMembersOverrides + { + public IEnumerable GetOverrides() => + [ + MemberOverride.ByFuncWithParam((document, element, referenceTagged) => element.GetLeaderElbow(referenceTagged), (document, element) => element.GetTaggedReferences()), + MemberOverride.ByFuncWithParam((document, element, referenceTagged) => element.GetLeaderEnd(referenceTagged), (document, element) => element.GetTaggedReferences()), + MemberOverride.ByFuncWithParam((document, element, referenceTagged) => element.HasLeaderElbow(referenceTagged), (document, element) => element.GetTaggedReferences()), + +#if R2023_MIN + MemberOverride.ByFuncWithParam((document, element, referenceTagged) => element.IsLeaderVisible(referenceTagged), (document, element) => element.GetTaggedReferences()), +#endif + + ]; + } +} diff --git a/sources/RevitDBExplorer/Domain/DataModel/MembersTemplates/HostObject_Templates.cs b/sources/RevitDBExplorer/Domain/DataModel/MembersTemplates/HostObject_Templates.cs index 19c69f4..1328ff0 100644 --- a/sources/RevitDBExplorer/Domain/DataModel/MembersTemplates/HostObject_Templates.cs +++ b/sources/RevitDBExplorer/Domain/DataModel/MembersTemplates/HostObject_Templates.cs @@ -13,7 +13,7 @@ public IEnumerable GetTemplates() => [ MemberTemplate.Create((doc, target) => HostObjectUtils.GetTopFaces(target), kind: MemberKind.StaticMethod), MemberTemplate.Create((doc, target) => HostObjectUtils.GetBottomFaces(target), kind: MemberKind.StaticMethod), - MemberTemplate.Create((doc, target, side) => HostObjectUtils.GetSideFaces(target, side), [ShellLayerType.Interior, ShellLayerType.Exterior]), + MemberTemplate.CreateWithParam((doc, target, side) => HostObjectUtils.GetSideFaces(target, side), (doc, target) => new ShellLayerType[] {ShellLayerType.Interior, ShellLayerType.Exterior }), ]; } } \ No newline at end of file