-
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.
adds a setting to send rebars as line or solid (#367)
Co-authored-by: Oğuzhan Koral <[email protected]>
- Loading branch information
1 parent
0625537
commit cac8e1b
Showing
7 changed files
with
100 additions
and
34 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
12 changes: 12 additions & 0 deletions
12
...rs/Tekla/Speckle.Connector.Tekla2024/Operations/Send/Settings/SendRebarsAsSolidSetting.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,12 @@ | ||
using Speckle.Connectors.DUI.Settings; | ||
|
||
namespace Speckle.Connector.Tekla2024.Operations.Send.Settings; | ||
|
||
public class SendRebarsAsSolidSetting(bool value) : ICardSetting | ||
{ | ||
public string? Id { get; set; } = "sendRebarsAsSolid"; | ||
public string? Title { get; set; } = "Send Rebars As Solid"; | ||
public string? Type { get; set; } = "boolean"; | ||
public object? Value { get; set; } = value; | ||
public List<string>? Enum { get; set; } | ||
} |
39 changes: 39 additions & 0 deletions
39
...rs/Tekla/Speckle.Connector.Tekla2024/Operations/Send/Settings/ToSpeckleSettingsManager.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,39 @@ | ||
using Speckle.Connectors.Common.Caching; | ||
using Speckle.Connectors.DUI.Models.Card; | ||
using Speckle.InterfaceGenerator; | ||
using Speckle.Sdk.Common; | ||
|
||
namespace Speckle.Connector.Tekla2024.Operations.Send.Settings; | ||
|
||
[GenerateAutoInterface] | ||
public class ToSpeckleSettingsManager : IToSpeckleSettingsManager | ||
{ | ||
private readonly ISendConversionCache _sendConversionCache; | ||
private readonly Dictionary<string, bool?> _sendRebarsAsSolidCache = new(); | ||
|
||
public ToSpeckleSettingsManager(ISendConversionCache sendConversionCache) | ||
{ | ||
_sendConversionCache = sendConversionCache; | ||
} | ||
|
||
public bool GetSendRebarsAsSolid(SenderModelCard modelCard) | ||
{ | ||
var value = modelCard.Settings?.First(s => s.Id == "sendRebarsAsSolid").Value as bool?; | ||
var returnValue = value != null && value.NotNull(); | ||
if (_sendRebarsAsSolidCache.TryGetValue(modelCard.ModelCardId.NotNull(), out bool? previousValue)) | ||
{ | ||
if (previousValue != returnValue) | ||
{ | ||
EvictCacheForModelCard(modelCard); | ||
} | ||
} | ||
_sendRebarsAsSolidCache[modelCard.ModelCardId] = returnValue; | ||
return returnValue; | ||
} | ||
|
||
private void EvictCacheForModelCard(SenderModelCard modelCard) | ||
{ | ||
var objectIds = modelCard.SendFilter != null ? modelCard.SendFilter.NotNull().GetObjectIds() : []; | ||
_sendConversionCache.EvictObjects(objectIds); | ||
} | ||
} |
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