Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public abstract class AutocadSendBaseBinding : ISendBinding
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IAppIdleManager _idleManager;
private readonly ISendOperationManagerFactory _sendOperationManagerFactory;
private readonly IConfigStore _configStore;

/// <summary>
/// Used internally to aggregate the changed objects' id. Note we're using a concurrent dictionary here as the expiry check method is not thread safe, and this was causing problems. See:
Expand All @@ -53,7 +54,8 @@ protected AutocadSendBaseBinding(
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler,
IAppIdleManager idleManager,
ISendOperationManagerFactory sendOperationManagerFactory
ISendOperationManagerFactory sendOperationManagerFactory,
IConfigStore configStore
)
{
_store = store;
Expand All @@ -64,6 +66,7 @@ ISendOperationManagerFactory sendOperationManagerFactory
_topLevelExceptionHandler = topLevelExceptionHandler;
_idleManager = idleManager;
_sendOperationManagerFactory = sendOperationManagerFactory;
_configStore = configStore;
Parent = parent;
Commands = new SendBindingUICommands(parent);

Expand Down Expand Up @@ -151,6 +154,11 @@ private void OnObjectChanged(DBObject dbObject) =>

private void OnChangeChangedObjectIds(DBObject dBObject)
{
if (_configStore.GetConnectorConfig().DisableCache)
{
return;
}

ChangedObjectIds.Add(dBObject.GetSpeckleApplicationId());
_idleManager.SubscribeToIdle(nameof(RunExpirationChecks), async () => await RunExpirationChecks());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.Settings;
using Speckle.Converters.Autocad;
using Speckle.Converters.Common;

Expand All @@ -25,7 +26,8 @@ public AutocadSendBinding(
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler,
IAppIdleManager appIdleManager,
ISendOperationManagerFactory sendOperationManagerFactory
ISendOperationManagerFactory sendOperationManagerFactory,
IConfigStore configStore
)
: base(
store,
Expand All @@ -36,16 +38,15 @@ ISendOperationManagerFactory sendOperationManagerFactory
threadContext,
topLevelExceptionHandler,
appIdleManager,
sendOperationManagerFactory
sendOperationManagerFactory,
configStore
)
{
_autocadConversionSettingsFactory = autocadConversionSettingsFactory;
}

protected override void InitializeSettings(IServiceProvider serviceProvider)
{
protected override void InitializeSettings(IServiceProvider serviceProvider) =>
serviceProvider
.GetRequiredService<IConverterSettingsStore<AutocadConversionSettings>>()
.Initialize(_autocadConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.Settings;
using Speckle.Converters.Autocad;
using Speckle.Converters.Civil3dShared;
using Speckle.Converters.Common;
Expand All @@ -29,7 +30,8 @@ public Civil3dSendBinding(
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler,
IAppIdleManager appIdleManager,
ISendOperationManagerFactory sendOperationManagerFactory
ISendOperationManagerFactory sendOperationManagerFactory,
IConfigStore configStore
)
: base(
store,
Expand All @@ -40,7 +42,8 @@ ISendOperationManagerFactory sendOperationManagerFactory
threadContext,
topLevelExceptionHandler,
appIdleManager,
sendOperationManagerFactory
sendOperationManagerFactory,
configStore
)
{
_civil3dConversionSettingsFactory = civil3dConversionSettingsFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.Settings;
using Speckle.Converters.Autocad;
using Speckle.Converters.Common;
using Speckle.Converters.Plant3dShared;
Expand All @@ -29,7 +30,8 @@ public Plant3dSendBinding(
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler,
IAppIdleManager appIdleManager,
ISendOperationManagerFactory sendOperationManagerFactory
ISendOperationManagerFactory sendOperationManagerFactory,
IConfigStore configStore
)
: base(
store,
Expand All @@ -40,7 +42,8 @@ ISendOperationManagerFactory sendOperationManagerFactory
threadContext,
topLevelExceptionHandler,
appIdleManager,
sendOperationManagerFactory
sendOperationManagerFactory,
configStore
)
{
_plant3dConversionSettingsFactory = plant3dConversionSettingsFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
private readonly ParameterUpdater _parameterUpdater;
private bool _isDocChangedSubscribed;
private EventHandler<Autodesk.Revit.DB.Events.DocumentChangedEventArgs>? _documentChangedHandler;
private readonly ConnectorConfig _config;
private readonly IConfigStore _configStore;

/// <summary>
/// Used internally to aggregate the changed objects' id. Note we're using a concurrent dictionary here as the expiry check method is not thread safe, and this was causing problems. See:
Expand Down Expand Up @@ -87,7 +87,7 @@ IConfigStore configStore
_threadContext = threadContext;
_sendOperationManagerFactory = sendOperationManagerFactory;
_parameterUpdater = parameterUpdater;
_config = configStore.GetConnectorConfig();
_configStore = configStore;

Commands = new SendBindingUICommands(bridge);
// TODO expiry events
Expand All @@ -105,8 +105,10 @@ IConfigStore configStore

private void OnModelCardsChanged(ModelCardsChangedEventArgs e)
{
var config = _configStore.GetConnectorConfig();
if (
!_config.DocumentChangeListeningDisabled
!config.DocumentChangeListeningDisabled
&& !config.DisableCache
&& e.ModelCards.Count > 0
&& e.ModelCards.Any(m => m.TypeDiscriminator == nameof(SenderModelCard))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public sealed class RhinoSendBinding : ISendBinding
private readonly IAppIdleManager _idleManager;
private readonly ISendOperationManagerFactory _sendOperationManagerFactory;
private readonly RhinoLayerHelper _rhinoLayerHelper;
private readonly IConfigStore _configStore;

/// <summary>
/// Used internally to aggregate the changed objects' id. Objects in this list will be reconverted.
Expand Down Expand Up @@ -69,7 +70,8 @@ public RhinoSendBinding(
IRhinoConversionSettingsFactory rhinoConversionSettingsFactory,
ITopLevelExceptionHandler topLevelExceptionHandler,
ISendOperationManagerFactory sendOperationManagerFactory,
RhinoLayerHelper rhinoLayerHelper
RhinoLayerHelper rhinoLayerHelper,
IConfigStore configStore
)
{
_store = store;
Expand All @@ -83,6 +85,7 @@ RhinoLayerHelper rhinoLayerHelper
_topLevelExceptionHandler = topLevelExceptionHandler;
_sendOperationManagerFactory = sendOperationManagerFactory;
_rhinoLayerHelper = rhinoLayerHelper;
_configStore = configStore;
Commands = new SendBindingUICommands(parent); // POC: Commands are tightly coupled with their bindings, at least for now, saves us injecting a factory.
PreviousUnitSystem = RhinoDoc.ActiveDoc?.ModelUnitSystem ?? UnitSystem.None;
SubscribeToRhinoEvents();
Expand Down Expand Up @@ -340,6 +343,14 @@ private async Task RunExpirationChecks()
return;
}

if (_configStore.GetConnectorConfig().DisableCache)
{
ChangedObjectIds = new();
ChangedObjectIdsInGroupsOrLayers = new();
ChangedMaterialIndexes = new();
return;
}

// Invalidate any objects whose materials have changed
if (!ChangedMaterialIndexes.IsEmpty)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public sealed class TeklaSendBinding : ISendBinding
private readonly ToSpeckleSettingsManager _toSpeckleSettingsManager;
private readonly Events _events;
private readonly ISendOperationManagerFactory _sendOperationManagerFactory;
private readonly IConfigStore _configStore;

private ConcurrentDictionary<string, byte> ChangedObjectIds { get; set; } = new();

Expand All @@ -48,7 +49,8 @@ public TeklaSendBinding(
ILogger<TeklaSendBinding> logger,
ITeklaConversionSettingsFactory teklaConversionSettingsFactory,
ToSpeckleSettingsManager toSpeckleSettingsManager,
ISendOperationManagerFactory sendOperationManagerFactory
ISendOperationManagerFactory sendOperationManagerFactory,
IConfigStore configStore
)
{
_store = store;
Expand All @@ -61,6 +63,7 @@ ISendOperationManagerFactory sendOperationManagerFactory
Commands = new SendBindingUICommands(parent);
_toSpeckleSettingsManager = toSpeckleSettingsManager;
_sendOperationManagerFactory = sendOperationManagerFactory;
_configStore = configStore;

_model = new Model();
_events = new Events();
Expand All @@ -76,6 +79,11 @@ private void SubscribeToTeklaEvents()
// subscribes the all changes in a modelobject
private void OnModelObjectChanged(List<ChangeData> changes)
{
if (_configStore.GetConnectorConfig().DisableCache)
{
return;
}

foreach (var change in changes)
{
if (change.Object is { } modelObj)
Expand Down