Skip to content

Commit

Permalink
add information about Revit APIs added in 2023 version
Browse files Browse the repository at this point in the history
  • Loading branch information
NeVeSpl committed May 22, 2024
1 parent c5aaaf0 commit 6e3b4a7
Show file tree
Hide file tree
Showing 16 changed files with 384 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static ISnoopableMemberTemplate Create<TReturnType>(Expression<Func<Docum
var methodCallExpression = getter.Body as MethodCallExpression;
var memberAccessor = new MemberAccessorByFunc<TForType, TReturnType>(compiledGetter);

memberAccessor.UniqueId = $"{typeof(TForType).Name}_{getter.GetUniqueId()}";
memberAccessor.UniqueId = $"{getter.GetUniqueId()}";
memberAccessor.DefaultInvocation.Syntax = getter.ToCeSharp();

return WithCustomAC(methodCallExpression.Method.DeclaringType, methodCallExpression.Method.Name, memberAccessor, canBeUsed, kind, () => RevitDocumentationReader.GetMethodComments(methodCallExpression.Method));
Expand All @@ -56,7 +56,7 @@ public static ISnoopableMemberTemplate Create<TParam0Type, TReturnType>(Expressi
var param_0_name = getter.Parameters[2].Name;
var memberAccessor = new MemberAccessorByFuncUltra<TForType, TParam0Type, TReturnType>(compiledGetter, param_0_arguments, param_0_name);

memberAccessor.UniqueId = $"{typeof(TForType).Name}_{getter.GetUniqueId()}";
memberAccessor.UniqueId = $"{getter.GetUniqueId()}";
memberAccessor.DefaultInvocation.Syntax = getter.ToCeSharp();

return WithCustomAC(methodCallExpression.Method.DeclaringType, methodCallExpression.Method.Name, memberAccessor, canBeUsed, kind, () => RevitDocumentationReader.GetMethodComments(methodCallExpression.Method));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ namespace RevitDBExplorer.Domain.DataModel.Members
{
internal static class MemberStreamerForSystemType
{
public static bool IsSystemType(object target)
{
var type = target?.GetType();

if (target is Type { IsEnum: true } runtimeType)
{
return true;
}

return false;
}




public static IEnumerable<MemberDescriptor> Stream(SnoopableContext context, object target)
{
var type = target.GetType();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure.StructuralSections;
using RevitDBExplorer.Domain.DataModel.Accessors;
using RevitDBExplorer.Domain.DataModel.Members.Accessors;
using RevitDBExplorer.Domain.DataModel.ValueContainers.Base;

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

namespace RevitDBExplorer.Domain.DataModel.MembersTemplates.Accessors
{
internal class StructuralSectionUtils_GetStructuralElementDefinitionData : MemberAccessorTypedWithDefaultPresenter<Element>
{
protected override ReadResult Read(SnoopableContext context, Element typedObject)
{
var status = StructuralSectionUtils.GetStructuralElementDefinitionData(context.Document, typedObject.Id, out var structuralElementDefinitionData);

if (status == StructuralSectionErrorCode.Success )
{
return new ReadResult()
{
CanBeSnooped = structuralElementDefinitionData != null,
Label = Labeler.GetLabelForObject(structuralElementDefinitionData, context),
AccessorName = nameof(StructuralSectionUtils_GetStructuralElementDefinitionData),
};
}
return new ReadResult()
{
CanBeSnooped = false,
Label = status.ToString(),
AccessorName = nameof(StructuralSectionUtils_GetStructuralElementDefinitionData),
};
}


protected override IEnumerable<SnoopableObject> Snoop(SnoopableContext context, Element typedObject, IValueContainer state)
{
var status = StructuralSectionUtils.GetStructuralElementDefinitionData(context.Document, typedObject.Id, out var structuralElementDefinitionData);
yield return new SnoopableObject(context.Document, structuralElementDefinitionData);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Autodesk.Revit.DB.Structure.StructuralSections;
using RevitDBExplorer.Domain.DataModel.Members;
using RevitDBExplorer.Domain.DataModel.Members.Base;
using RevitDBExplorer.Domain.DataModel.MembersTemplates.Accessors;

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

Expand All @@ -14,7 +15,7 @@ public IEnumerable<ISnoopableMemberTemplate> GetTemplates() =>
[

MemberTemplate<FamilyInstance>.Create((doc, target) => StructuralSectionUtils.GetStructuralSection(doc, target.Id), kind: MemberKind.StaticMethod),

MemberTemplate<FamilyInstance>.WithCustomAC(typeof(StructuralSectionUtils), nameof(StructuralSectionUtils.GetStructuralElementDefinitionData), new StructuralSectionUtils_GetStructuralElementDefinitionData()),

MemberTemplate<FamilyInstance>.Create((doc, target) => AdaptiveComponentInstanceUtils.IsAdaptiveComponentInstance(target), kind: MemberKind.StaticMethod),
MemberTemplate<FamilyInstance>.Create((doc, target) => AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(target), canBeUsed: (x)=> AdaptiveComponentInstanceUtils.IsAdaptiveComponentInstance(x) , kind: MemberKind.StaticMethod),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

namespace RevitDBExplorer.Domain.Presentation
namespace RevitDBExplorer.Domain.Interactions
{
internal class DrawInRevitCommand : BaseCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

namespace RevitDBExplorer.Domain.Presentation
namespace RevitDBExplorer.Domain.Interactions
{
internal class DrawInRevitWithAVFCommand : BaseCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using RevitDBExplorer.UIComponents.Trees.Base.Items;
using RevitDBExplorer.WPF;

namespace RevitDBExplorer.Domain.Presentation
namespace RevitDBExplorer.Domain.Interactions
{
internal class FreezeCommand : BaseCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

namespace RevitDBExplorer.Domain.Presentation
namespace RevitDBExplorer.Domain.Interactions
{
internal class IsolateInRevitCommand : BaseCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

namespace RevitDBExplorer.Domain.Presentation
namespace RevitDBExplorer.Domain.Interactions
{
internal class SelectInRevitCommand : BaseCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

namespace RevitDBExplorer.Domain.Presentation
namespace RevitDBExplorer.Domain.Interactions
{
internal class ShowInRevitCommand : BaseCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md

namespace RevitDBExplorer.Domain.Presentation
namespace RevitDBExplorer.Domain.Interactions
{
internal class SnoopInNewWindowCommand : BaseCommand
{
Expand Down
Loading

0 comments on commit 6e3b4a7

Please sign in to comment.