-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #361 from specklesystems/dimitrie/cnx-634-some-ele…
…ments-are-received-as-generic-models-ignoring Dimitrie/cnx 634 some elements are received as generic models ignoring
- Loading branch information
Showing
5 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...it/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/RailingTopLevelConverterToSpeckle.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Speckle.Converters.Common; | ||
using Speckle.Converters.RevitShared.Helpers; | ||
using Speckle.Converters.RevitShared.Settings; | ||
using Speckle.Converters.RevitShared.ToSpeckle; | ||
|
||
namespace Speckle.Converters.Revit2023.ToSpeckle.TopLevel; | ||
|
||
[NameAndRankValue(nameof(DBA.Railing), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] | ||
public class RailingTopLevelConverterToSpeckle : BaseTopLevelConverterToSpeckle<DBA.Railing, SOBR.RevitElement> | ||
{ | ||
private readonly DisplayValueExtractor _displayValueExtractor; | ||
private readonly IConverterSettingsStore<RevitConversionSettings> _converterSettings; | ||
|
||
public RailingTopLevelConverterToSpeckle( | ||
DisplayValueExtractor displayValueExtractor, | ||
IConverterSettingsStore<RevitConversionSettings> converterSettings | ||
) | ||
{ | ||
_displayValueExtractor = displayValueExtractor; | ||
_converterSettings = converterSettings; | ||
} | ||
|
||
public override SOBR.RevitElement Convert(DBA.Railing target) | ||
{ | ||
string family = target.Document.GetElement(target.GetTypeId()) is DB.FamilySymbol symbol | ||
? symbol.FamilyName | ||
: "no family"; | ||
string category = target.Category?.Name ?? "no category"; | ||
var displayValue = _displayValueExtractor.GetDisplayValue(target); | ||
|
||
var topRail = _converterSettings.Current.Document.GetElement(target.TopRail); | ||
var topRailDisplayValue = _displayValueExtractor.GetDisplayValue(topRail); | ||
|
||
displayValue.AddRange(topRailDisplayValue); | ||
|
||
SOBR.RevitElement speckleElement = | ||
new() | ||
{ | ||
type = target.Name, | ||
category = category, | ||
family = family, | ||
displayValue = displayValue | ||
}; | ||
|
||
speckleElement["units"] = _converterSettings.Current.SpeckleUnits; | ||
|
||
return speckleElement; | ||
} | ||
} |