Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add structural settings support #282

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -113,6 +114,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)
{
}
}
Loading