Skip to content

Commit

Permalink
Merge pull request #282 from SergeyNefyodov/dev-structural-settings
Browse files Browse the repository at this point in the history
Add structural settings support
  • Loading branch information
Nice3point authored Sep 2, 2024
2 parents e4c330e + 0874b48 commit 31fe617
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/RevitLookup/Core/ComponentModel/DescriptorMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
using Autodesk.Revit.DB.Macros;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.DB.Plumbing;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.DB.Visual;
using Autodesk.Revit.UI;
using Autodesk.Windows;
Expand Down Expand Up @@ -114,6 +115,7 @@ public static Descriptor FindDescriptor(object obj, Type type)
MEPSystem value when type is null || type == typeof(MEPSystem) => new MepSystemDescriptor(value),
BasePoint value when type is null || type == typeof(BasePoint) => new BasePointDescriptor(value),
InternalOrigin value when type is null || type == typeof(InternalOrigin) => new InternalOriginDescriptor(value),
StructuralSettings value when type is null || type == typeof(StructuralSettings) => new StructuralSettingsDescriptor(value),
CurveElement value when type is null || type == typeof(CurveElement) => new CurveElementDescriptor(value),
DatumPlane value when type is null || type == typeof(DatumPlane) => new DatumPlaneDescriptor(value),
Part value when type is null || type == typeof(Part) => new PartDescriptor(value),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2003-2024 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.

using System.Reflection;
using Autodesk.Revit.DB.Structure;

namespace RevitLookup.Core.ComponentModel.Descriptors;

public class StructuralSettingsDescriptor(StructuralSettings structuralSettings) : ElementDescriptor(structuralSettings)
{
public override Func<IVariants> Resolve(Document context, string target, ParameterInfo[] parameters)
{
return target switch
{
nameof(StructuralSettings.GetStructuralSettings) => ResolveGet,
_ => null
};

IVariants ResolveGet()
{
return Variants.Single(StructuralSettings.GetStructuralSettings(structuralSettings.Document));
}
}

public override void RegisterExtensions(IExtensionManager manager)
{
}
}

0 comments on commit 31fe617

Please sign in to comment.