Files
speckle-sharp-connectors/Converters/Revit/Speckle.Converters.RevitShared/Extensions/ParameterExtensions.cs
T
Dimitrie Stefanescu 6d3eb88b20 Dimitrie/cnx 430 re evaluate parameters (#255)
* wip

* feat(dui3): simpler parameter extraction logic + parameter definitions

* chore: refactoring

* wip

* feat(revit): removes parameter definition handler from context stack and relies on DI

cc oguzhan, we'll need to refactor a few things with this in mind

* chore: adds comments

* feat: comments and logging

* feat(revit): WIP adds setting for null/empty param sending, and other refactors

* feat: respects setting in extraction logic

* chore(dui3): adds extra comments

* Fix build errors

* feat: removes dead code

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
2024-09-23 16:45:49 +00:00

36 lines
866 B
C#

using Autodesk.Revit.DB;
namespace Speckle.Converters.RevitShared.Extensions;
[Obsolete("Will be removed in the near future")]
public static class ParameterExtensions
{
/// <summary>
/// Shared parameters use a GUID to be uniquely identified
/// Other parameters use a BuiltInParameter enum
/// </summary>
/// <param name="rp"></param>
/// <returns></returns>
public static string GetInternalName(this DB.Parameter rp)
{
if (rp.IsShared)
{
return rp.GUID.ToString();
}
var def = (InternalDefinition)rp.Definition;
if (def.BuiltInParameter == BuiltInParameter.INVALID)
{
return def.Name;
}
return def.BuiltInParameter.ToString();
}
public static BuiltInParameter? GetBuiltInParameter(this Parameter rp)
{
var def = rp.Definition as InternalDefinition;
return def?.BuiltInParameter;
}
}