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

Rhino interfaces for testing #3523

Merged
merged 34 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a999afd
add root converter with fallback and tests
adamhathcock Jun 17, 2024
82eb811
proper references
adamhathcock Jun 17, 2024
b51b3e4
Converters work
adamhathcock Jun 17, 2024
edb7bb1
fmt
adamhathcock Jun 17, 2024
b82368b
added test!
adamhathcock Jun 17, 2024
055c077
fmt
adamhathcock Jun 17, 2024
b8f11d7
One converter to rhino interfaces
adamhathcock Jun 17, 2024
34760f5
more converters done
adamhathcock Jun 18, 2024
91d2336
more converters done!
adamhathcock Jun 18, 2024
1b1e2d6
even more converters
adamhathcock Jun 18, 2024
835c19f
more conversions
adamhathcock Jun 18, 2024
f30f28b
more top level converters
adamhathcock Jun 19, 2024
e69f0e5
all rhino types converted
adamhathcock Jun 19, 2024
1b7baea
Merge branch 'dui3/alpha' into revit-fallback
adamhathcock Jun 19, 2024
70d1156
doing Rhino loading and testing
adamhathcock Jun 19, 2024
ec52f41
Merge remote-tracking branch 'origin/revit-fallback' into rhino-inter…
adamhathcock Jun 19, 2024
dbb02a8
type moving around
adamhathcock Jun 19, 2024
409022d
update and use interfaces
adamhathcock Jun 19, 2024
a88d0f7
using clean up
adamhathcock Jun 19, 2024
64b8efa
Merge remote-tracking branch 'origin/dui3/alpha' into rhino-interfaces
adamhathcock Jun 19, 2024
f9cfe6c
clean up
adamhathcock Jun 19, 2024
f019f7c
Change reflection
adamhathcock Jun 20, 2024
69cb953
update host api and add tests
adamhathcock Jun 20, 2024
90f2b08
add no build for tests
adamhathcock Jun 20, 2024
23a8211
Merge branch 'dui3/alpha' into rhino-interfaces
adamhathcock Jun 20, 2024
e11de9e
revert for circular dependency
adamhathcock Jun 20, 2024
a20127b
to host fixes
adamhathcock Jun 20, 2024
2d1629b
Merge branch 'dui3/alpha' into rhino-interfaces
adamhathcock Jun 20, 2024
63d3016
update host apis and lock files
adamhathcock Jun 20, 2024
b6a191d
fmt
adamhathcock Jun 20, 2024
449b396
fixes curves!
adamhathcock Jun 20, 2024
079ad97
Merge branch 'dui3/alpha' into rhino-interfaces
adamhathcock Jun 21, 2024
83a4a61
fmt
adamhathcock Jun 21, 2024
1283458
vertexes aren't nullable
adamhathcock Jun 24, 2024
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
6 changes: 5 additions & 1 deletion Build/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ namespace Build;
public static class Consts
{
public static readonly string[] Solutions = { "DUI3-DX.slnf" };
public static readonly string[] TestProjects = { "Speckle.Converters.Revit2023.Tests" };
public static readonly string[] TestProjects =
{
"Speckle.Converters.Revit2023.Tests",
"Speckle.Converters.Common.Tests"
};

public static readonly InstallerProject[] InstallerManifests =
{
Expand Down
2 changes: 1 addition & 1 deletion Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ IEnumerable<string> GetFiles(string d)

foreach (var file in GetFiles($"**/{t}.csproj"))
{
Run("dotnet", $"test {file} -c Release --no-restore --verbosity=normal");
Run("dotnet", $"test {file} -c Release --no-build --no-restore --verbosity=normal");
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,6 @@
"resolved": "13.0.2",
"contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA=="
},
"Speckle.Revit2023.Interfaces": {
"type": "Transitive",
"resolved": "0.1.1-preview.0.24",
"contentHash": "BSVpOUJc9g6ISrw8GxvtkglTlITpHEDYNOhxv1ZPbckBsI0yO36JiphhQV4q57ERqD9PpCozUJkVhlCaxWeS6A=="
},
"SQLitePCLRaw.bundle_e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
Expand Down Expand Up @@ -431,8 +426,7 @@
"type": "Project",
"dependencies": {
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Objects": "[2.0.999-local, )",
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.24, )"
"Speckle.Objects": "[2.0.999-local, )"
}
},
"speckle.converters.common.dependencyinjection": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@
"resolved": "13.0.2",
"contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA=="
},
"Speckle.Revit2023.Interfaces": {
"type": "Transitive",
"resolved": "0.1.1-preview.0.24",
"contentHash": "BSVpOUJc9g6ISrw8GxvtkglTlITpHEDYNOhxv1ZPbckBsI0yO36JiphhQV4q57ERqD9PpCozUJkVhlCaxWeS6A=="
},
"SQLitePCLRaw.bundle_e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
Expand Down Expand Up @@ -487,8 +482,7 @@
"type": "Project",
"dependencies": {
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Objects": "[2.0.999-local, )",
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.24, )"
"Speckle.Objects": "[2.0.999-local, )"
}
},
"speckle.converters.common.dependencyinjection": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,18 @@
},
"Speckle.Revit2023.Api": {
"type": "Transitive",
"resolved": "0.1.1-preview.0.24",
"contentHash": "hPRXbyvgmealdPPWTxjHbpBRTsyt67DddoIs09M0n319eHh/eONnPC+SgBzJmmB834TtzzayMVk06S1cMT0Iow==",
"resolved": "0.1.1-preview.0.27",
"contentHash": "lYsz0dkPIHKJKbly8jyL4zGx7BNgYViw8hE3SKuP10InSF/zkcZoPJ3Zz9SEDTYVB4a7tm185a/z64Ti3IFReg==",
"dependencies": {
"Mapster": "7.3.0",
"Speckle.Revit.API": "2023.0.0",
"Speckle.Revit2023.Interfaces": "0.1.1-preview.0.24"
"Speckle.Revit2023.Interfaces": "0.1.1-preview.0.27"
}
},
"Speckle.Revit2023.Interfaces": {
"type": "Transitive",
"resolved": "0.1.1-preview.0.24",
"contentHash": "BSVpOUJc9g6ISrw8GxvtkglTlITpHEDYNOhxv1ZPbckBsI0yO36JiphhQV4q57ERqD9PpCozUJkVhlCaxWeS6A=="
"resolved": "0.1.1-preview.0.27",
"contentHash": "/tVBpS/NsqtQtA90X3zeW4grMaELS+i0J9PqZwdxYBMmB8rzoYCzbBME7KoxIXQK1FHILKeJv2AHGWkgg1c+rg=="
},
"SQLitePCLRaw.bundle_e_sqlite3": {
"type": "Transitive",
Expand Down Expand Up @@ -514,8 +514,7 @@
"type": "Project",
"dependencies": {
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Objects": "[2.0.999-local, )",
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.24, )"
"Speckle.Objects": "[2.0.999-local, )"
}
},
"speckle.converters.common.dependencyinjection": {
Expand All @@ -529,7 +528,7 @@
"type": "Project",
"dependencies": {
"Speckle.Converters.Common": "[2.0.999-local, )",
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.24, )"
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.27, )"
}
},
"speckle.converters.revit2023.dependencyinjection": {
Expand All @@ -538,7 +537,7 @@
"Speckle.Converters.Common": "[2.0.999-local, )",
"Speckle.Converters.Common.DependencyInjection": "[2.0.999-local, )",
"Speckle.Converters.Revit2023": "[2.0.999-local, )",
"Speckle.Revit2023.Api": "[0.1.1-preview.0.24, )"
"Speckle.Revit2023.Api": "[0.1.1-preview.0.27, )"
}
},
"Speckle.Core": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Speckle.Converters.Common;
using Speckle.ProxyGenerator;

namespace Speckle.Connectors.Revit.DependencyInjection;

public class ProxyMapper : IProxyMapper
{
public Type? GetMappedTypeFromHostType(Type type) => ProxyMap.GetMappedTypeFromHostType(type);

public Type? GetMappedTypeFromProxyType(Type type) => ProxyMap.GetMappedTypeFromProxyType(type);

public Type? GetHostTypeFromMappedType(Type type) => ProxyMap.GetHostTypeFromMappedType(type);

public object CreateProxy(Type type, object toWrap) => ProxyMap.CreateProxy(type, toWrap);

public T CreateProxy<T>(object toWrap) => ProxyMap.CreateProxy<T>(toWrap);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ namespace Speckle.Connectors.Rhino7.Bindings;

public class RhinoSelectionBinding : ISelectionBinding
{
private readonly RhinoIdleManager _idleManager;
private readonly IRhinoIdleManager _idleManager;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private const string SELECTION_EVENT = "setSelection";

public string Name => "selectionBinding";
public IBridge Parent { get; }

public RhinoSelectionBinding(
RhinoIdleManager idleManager,
IRhinoIdleManager idleManager,
IBridge parent,
ITopLevelExceptionHandler topLevelExceptionHandler
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ public sealed class RhinoSendBinding : ISendBinding
public IBridge Parent { get; }

private readonly DocumentModelStore _store;
private readonly RhinoIdleManager _idleManager;
private readonly IRhinoIdleManager _idleManager;
private readonly IUnitOfWorkFactory _unitOfWorkFactory;
private readonly List<ISendFilter> _sendFilters;
private readonly SendOperation<RhinoObject> _sendOperation;
private readonly CancellationManager _cancellationManager;
private readonly RhinoSettings _rhinoSettings;

Expand All @@ -40,10 +39,9 @@ public sealed class RhinoSendBinding : ISendBinding

public RhinoSendBinding(
DocumentModelStore store,
RhinoIdleManager idleManager,
IRhinoIdleManager idleManager,
IBridge parent,
IEnumerable<ISendFilter> sendFilters,
SendOperation<RhinoObject> sendOperation,
IUnitOfWorkFactory unitOfWorkFactory,
RhinoSettings rhinoSettings,
CancellationManager cancellationManager,
Expand All @@ -54,7 +52,6 @@ ITopLevelExceptionHandler topLevelExceptionHandler
_store = store;
_idleManager = idleManager;
_unitOfWorkFactory = unitOfWorkFactory;
_sendOperation = sendOperation;
_sendFilters = sendFilters.ToList();
_rhinoSettings = rhinoSettings;
_cancellationManager = cancellationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Speckle.Converters.Common;
using Speckle.ProxyGenerator;

namespace Speckle.Connectors.Rhino7.DependencyInjection;

public class ProxyMapper : IProxyMapper
{
public Type? GetMappedTypeFromHostType(Type type) => ProxyMap.GetMappedTypeFromHostType(type);

public Type? GetMappedTypeFromProxyType(Type type) => ProxyMap.GetMappedTypeFromProxyType(type);

public Type? GetHostTypeFromMappedType(Type type) => ProxyMap.GetHostTypeFromMappedType(type);

public object CreateProxy(Type type, object toWrap) => ProxyMap.CreateProxy(type, toWrap);

public T CreateProxy<T>(object toWrap) => ProxyMap.CreateProxy<T>(toWrap);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Speckle.Connectors.Rhino7.Bindings;
using Speckle.Connectors.Rhino7.Filters;
using Speckle.Connectors.Rhino7.HostApp;
using Speckle.Connectors.Rhino7.Interfaces;
using Speckle.Connectors.Rhino7.Operations.Send;
using Speckle.Connectors.Rhino7.Plugin;
using Speckle.Connectors.Utils.Cancellation;
Expand All @@ -21,7 +20,9 @@
using Speckle.Connectors.Utils.Builders;
using Speckle.Connectors.Utils.Caching;
using Speckle.Connectors.Utils.Operations;
using Speckle.Converters.Common;
using Speckle.Core.Models.GraphTraversal;
using Speckle.Rhino7.Api;

namespace Speckle.Connectors.Rhino7.DependencyInjection;

Expand All @@ -37,14 +38,16 @@ public void Load(SpeckleContainerBuilder builder)
builder.AddConnectorUtils();
builder.AddDUI();
builder.AddDUIView();
builder.ScanAssemblyOfType<RhinoArcFactory>();

// POC: Overwriting the SyncToMainThread to SyncToCurrentThread for Rhino!
builder.AddSingletonInstance<ISyncToThread, SyncToCurrentThread>();

// Register other connector specific types
builder.AddSingleton<IRhinoPlugin, RhinoPlugin>();
builder.AddSingleton<DocumentModelStore, RhinoDocumentStore>();
builder.AddSingleton<RhinoIdleManager>();
builder.AddSingleton<IRhinoIdleManager, RhinoIdleManager>();
builder.AddSingleton<IProxyMapper, ProxyMapper>();

// Register bindings
builder.AddSingleton<IBinding, TestBinding>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
using Rhino;
using Speckle.Connectors.DUI.WebView;
using Speckle.Connectors.Rhino7.HostApp;
using Speckle.Connectors.Rhino7.Interfaces;
using Speckle.Connectors.Rhino7.Plugin;
using Speckle.InterfaceGenerator;

namespace Speckle.Connectors.Rhino7.DependencyInjection;

[GenerateAutoInterface]
public class RhinoPlugin : IRhinoPlugin
{
private readonly RhinoIdleManager _idleManager;
private readonly DUI3ControlWebView _panel;
private readonly RhinoSettings _settings;
private readonly IRhinoIdleManager _idleManager;

public RhinoPlugin(DUI3ControlWebView panel, RhinoSettings settings, RhinoIdleManager idleManager)
public RhinoPlugin(IRhinoIdleManager idleManager)
{
_panel = panel;
_settings = settings;
_idleManager = idleManager;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System.Collections.Concurrent;
using Rhino;
using Speckle.InterfaceGenerator;

namespace Speckle.Connectors.Rhino7.HostApp;

/// <summary>
/// Rhino Idle Manager is a helper util to manage deferred actions.
/// </summary>
public class RhinoIdleManager
[GenerateAutoInterface]
public class RhinoIdleManager : IRhinoIdleManager
{
// NOTE: ConcurrentDictionary possibly removing the collection has been modified errors in here
private readonly ConcurrentDictionary<string, Action> _sCalls = new();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Rhino.DocObjects.Tables;
using Speckle.Rhino7.Interfaces;

namespace Speckle.Connectors.Rhino7.Operations.Receive;

/// <summary>
/// Helper class to disable <see cref="ViewTable.RedrawEnabled"/> within a scope
/// Helper class to disable <see cref="IRhinoViewTable.RedrawEnabled"/> within a scope
/// </summary>
public sealed class DisableRedrawScope : IDisposable
{
private readonly ViewTable _viewTable;
private readonly IRhinoViewTable _viewTable;
private readonly bool _returnToStatus;

public DisableRedrawScope(ViewTable viewTable, bool returnToStatus = true)
public DisableRedrawScope(IRhinoViewTable viewTable, bool returnToStatus = true)
{
_viewTable = viewTable;
_returnToStatus = returnToStatus;
Expand Down
Loading
Loading