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

DUI3-326: Add civil3d 2024 converter #3548

Merged
merged 13 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
199 changes: 123 additions & 76 deletions All.sln

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions DUI3-DX.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
"DUI3-DX\\Connectors\\Rhino\\Speckle.Connectors.Rhino7\\Speckle.Connectors.Rhino7.csproj",
"DUI3-DX\\Converters\\ArcGIS\\Speckle.Converters.ArcGIS3.DependencyInjection\\Speckle.Converters.ArcGIS3.DependencyInjection.csproj",
"DUI3-DX\\Converters\\ArcGIS\\Speckle.Converters.ArcGIS3\\Speckle.Converters.ArcGIS3.csproj",
"DUI3-DX\\Converters\\Autocad\\2023\\Speckle.Converters.Autocad2023.DependencyInjection\\Speckle.Converters.Autocad2023.DependencyInjection.csproj",
"DUI3-DX\\Converters\\Autocad\\2023\\Speckle.Converters.Autocad2023\\Speckle.Converters.Autocad2023.csproj",
"DUI3-DX\\Converters\\Autocad\\2024\\Speckle.Converters.Autocad2024.DependencyInjection\\Speckle.Converters.Autocad2024.DependencyInjection.csproj",
"DUI3-DX\\Converters\\Autocad\\2024\\Speckle.Converters.Autocad2024\\Speckle.Converters.Autocad2024.csproj",
"DUI3-DX\\Converters\\Autocad\\Speckle.Converters.Autocad2023.DependencyInjection\\Speckle.Converters.Autocad2023.DependencyInjection.csproj",
"DUI3-DX\\Converters\\Autocad\\Speckle.Converters.Autocad2023\\Speckle.Converters.Autocad2023.csproj",
"DUI3-DX\\Converters\\Autocad\\Speckle.Converters.Autocad2024.DependencyInjection\\Speckle.Converters.Autocad2024.DependencyInjection.csproj",
"DUI3-DX\\Converters\\Autocad\\Speckle.Converters.Autocad2024\\Speckle.Converters.Autocad2024.csproj",
"DUI3-DX\\Converters\\Autocad\\Speckle.Converters.AutocadShared\\Speckle.Converters.AutocadShared.shproj",
"DUI3-DX\\Converters\\Civil3d\\Speckle.Converters.Civil3d2024.DependencyInjection\\Speckle.Converters.Civil3d2024.DependencyInjection.csproj",
"DUI3-DX\\Converters\\Civil3d\\Speckle.Converters.Civil3d2024\\Speckle.Converters.Civil3d2024.csproj",
"DUI3-DX\\Converters\\Civil3d\\Speckle.Converters.Civil3dShared\\Speckle.Converters.Civil3dShared.shproj",
"DUI3-DX\\Converters\\Revit\\Speckle.Converters.Revit2023.DependencyInjection\\Speckle.Converters.Revit2023.DependencyInjection.csproj",
"DUI3-DX\\Converters\\Revit\\Speckle.Converters.Revit2023\\Speckle.Converters.Revit2023.csproj",
"DUI3-DX\\Converters\\Revit\\Speckle.Converters.RevitShared\\Speckle.Converters.RevitShared.shproj",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Converters\Autocad\2023\Speckle.Converters.Autocad2023.DependencyInjection\Speckle.Converters.Autocad2023.DependencyInjection.csproj" />
<ProjectReference Include="..\..\..\Converters\Autocad\Speckle.Converters.Autocad2023.DependencyInjection\Speckle.Converters.Autocad2023.DependencyInjection.csproj" />
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Autofac\Speckle.Autofac.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Utils\Speckle.Connectors.Utils.csproj" />
Expand All @@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2023.0.0" />
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2023.0.0" />
</ItemGroup>
<Import Project="..\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.projitems" Label="Shared" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,69 +1,21 @@
#if AUTOCAD
using Autodesk.AutoCAD.DatabaseServices;
using Speckle.Autofac;
using Speckle.Autofac.DependencyInjection;
using Speckle.Connectors.Autocad.Bindings;
using Speckle.Connectors.Autocad.Filters;
using Speckle.Connectors.Autocad.HostApp;
using Speckle.Connectors.Autocad.Interfaces;
using Speckle.Connectors.Autocad.Operations.Receive;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.Autocad.Plugin;
using Speckle.Connectors.DUI;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.WebView;
using Speckle.Connectors.Utils;
using Speckle.Connectors.Utils.Builders;
using Speckle.Connectors.Utils.Caching;
using Speckle.Connectors.Utils.Instances;
using Speckle.Connectors.Utils.Operations;
using Speckle.Core.Models.GraphTraversal;

namespace Speckle.Connectors.Autocad.DependencyInjection;

public class AutocadConnectorModule : ISpeckleModule
{
public void Load(SpeckleContainerBuilder builder)
{
builder.AddAutofac();
builder.AddConnectorUtils();
builder.AddDUI();
builder.AddDUIView();

// Register other connector specific types
builder.AddSingleton<IAutocadPlugin, AutocadPlugin>();
builder.AddTransient<TransactionContext>();
builder.AddSingleton(new AutocadDocumentManager()); // TODO: Dependent to TransactionContext, can be moved to AutocadContext
builder.AddSingleton<DocumentModelStore, AutocadDocumentStore>();
builder.AddSingleton<AutocadContext>();
builder.AddSingleton<AutocadIdleManager>();

SharedConnectorModule.LoadShared(builder);


builder.AddScoped<AutocadLayerManager>();
SharedRegistration.Load(builder);

// Operations
builder.AddScoped<SendOperation<AutocadRootObject>>();
builder.AddSingleton(DefaultTraversal.CreateTraversalFunc());

// Object Builders
builder.AddScoped<IHostObjectBuilder, AutocadHostObjectBuilder>();
builder.AddScoped<IRootObjectBuilder<AutocadRootObject>, AutocadRootObjectBuilder>();
SharedRegistration.LoadSend(builder);
SharedRegistration.LoadReceive(builder);

// Register bindings
builder.AddSingleton<IBinding, ConfigBinding>("connectorName", "Autocad"); // POC: Easier like this for now, should be cleaned up later
builder.AddSingleton<IBinding, AutocadSendBinding>();
builder.AddSingleton<IBinding, AutocadReceiveBinding>();

// register send filters
builder.AddTransient<ISendFilter, AutocadSelectionFilter>();

// register send conversion cache
builder.AddSingleton<ISendConversionCache, SendConversionCache>();
builder.AddScoped<IInstanceObjectsManager<AutocadRootObject, List<Entity>>, AutocadInstanceObjectManager>();
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
#if CIVIL3D

using Speckle.Autofac.DependencyInjection;
using Speckle.Connectors.Autocad.Bindings;
using Speckle.Connectors.Autocad.Filters;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.Utils.Builders;
using Speckle.Connectors.Utils.Caching;
using Speckle.Connectors.Utils.Operations;

namespace Speckle.Connectors.Autocad.DependencyInjection;

public class Civil3dConnectorModule : ISpeckleModule
{
public void Load(SpeckleContainerBuilder builder)
{
SharedConnectorModule.LoadShared(builder);

// Operations
builder.AddScoped<SendOperation<AutocadRootObject>>();

// Object Builders
builder.AddScoped<IRootObjectBuilder<AutocadRootObject>, AutocadRootObjectBuilder>();

SharedRegistration.Load(builder);
SharedRegistration.LoadSend(builder);

// Register bindings
builder.AddSingleton<IBinding, ConfigBinding>("connectorName", "Civil3d"); // POC: Easier like this for now, should be cleaned up later
builder.AddSingleton<IBinding, AutocadSendBinding>();

// register send filters
builder.AddTransient<ISendFilter, AutocadSelectionFilter>();

// register send conversion cache
builder.AddSingleton<ISendConversionCache, SendConversionCache>();
}
}
#endif

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using Autodesk.AutoCAD.DatabaseServices;
using Speckle.Autofac;
using Speckle.Autofac.DependencyInjection;
using Speckle.Connectors.Autocad.Bindings;
using Speckle.Connectors.Autocad.HostApp;
using Speckle.Connectors.Autocad.Interfaces;
using Speckle.Connectors.Autocad.Plugin;
using Speckle.Connectors.DUI;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.WebView;
using Speckle.Connectors.Utils;
using Speckle.Connectors.Autocad.Filters;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.Utils.Builders;
using Speckle.Connectors.Utils.Caching;
using Speckle.Connectors.Utils.Operations;
using Speckle.Connectors.Utils.Instances;
using Speckle.Connectors.Autocad.Operations.Receive;

using Speckle.Core.Models.GraphTraversal;

namespace Speckle.Connectors.Autocad.DependencyInjection;

public static class SharedRegistration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this class need to be static?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registration is usually static and local to the module

{
public static void Load(SpeckleContainerBuilder builder)
{
builder.AddAutofac();
builder.AddConnectorUtils();
builder.AddDUI();
builder.AddDUIView();

// Register other connector specific types
builder.AddSingleton<IAutocadPlugin, AutocadPlugin>();
builder.AddTransient<TransactionContext>();
builder.AddSingleton(new AutocadDocumentManager()); // TODO: Dependent to TransactionContext, can be moved to AutocadContext
builder.AddSingleton<DocumentModelStore, AutocadDocumentStore>();
builder.AddSingleton<AutocadContext>();
builder.AddScoped<AutocadLayerManager>();
builder.AddSingleton<AutocadIdleManager>();

// Register bindings
builder.AddSingleton<IBinding, TestBinding>();
builder.AddSingleton<IBinding, AccountBinding>();
builder.AddSingleton<IBinding, AutocadBasicConnectorBinding>();
builder.AddSingleton<IBasicConnectorBinding, AutocadBasicConnectorBinding>();
builder.AddSingleton<IBinding, AutocadSelectionBinding>();
}

public static void LoadSend(SpeckleContainerBuilder builder)
{
// Operations
builder.AddScoped<SendOperation<AutocadRootObject>>();

// Object Builders
builder.AddScoped<IRootObjectBuilder<AutocadRootObject>, AutocadRootObjectBuilder>();

// Register bindings
builder.AddSingleton<IBinding, AutocadSendBinding>();

// register send filters
builder.AddTransient<ISendFilter, AutocadSelectionFilter>();

// register send conversion cache
builder.AddSingleton<ISendConversionCache, SendConversionCache>();
builder.AddScoped<IInstanceObjectsManager<AutocadRootObject, List<Entity>>, AutocadInstanceObjectManager>();
}

public static void LoadReceive(SpeckleContainerBuilder builder)
{
// traversal
builder.AddSingleton(DefaultTraversal.CreateTraversalFunc());

// Object Builders
builder.AddScoped<IHostObjectBuilder, AutocadHostObjectBuilder>();

// Register bindings
builder.AddSingleton<IBinding, AutocadReceiveBinding>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadReceiveBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadSendBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadBasicConnectorBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\SharedConnectorModule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\SharedRegistration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\AutocadConnectorModule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\Civil3dConnectorModule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Filters\AutocadSelectionFilter.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Speckle.Connectors.Civil3d</RootNamespace>
<TargetFramework>net48</TargetFramework>
Expand All @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Converters\Autocad\2024\Speckle.Converters.Autocad2024.DependencyInjection\Speckle.Converters.Autocad2024.DependencyInjection.csproj" />
<ProjectReference Include="..\..\..\Converters\Civil3d\Speckle.Converters.Civil3d2024.DependencyInjection\Speckle.Converters.Civil3d2024.DependencyInjection.csproj" />
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Autofac\Speckle.Autofac.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Utils\Speckle.Connectors.Utils.csproj" />
Expand All @@ -19,6 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Speckle.AutoCAD.API" />
<PackageReference Include="Speckle.Civil3D.API" />
</ItemGroup>
<Import Project="..\..\Autocad\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.projitems" Label="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
"resolved": "1.14.1",
"contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ=="
},
"Speckle.AutoCAD.API": {
"type": "Direct",
"requested": "[2024.0.0, )",
"resolved": "2024.0.0",
"contentHash": "pZZ5uI+NXhZaQnsqRkgp/rywqBAjDObDJ9XNFGJvemT5k2OthDpHzlK/mKxz8QDCYie7uImQ8dv3uWj2QUFDPw=="
},
"Speckle.Civil3D.API": {
"type": "Direct",
"requested": "[2024.0.0, )",
Expand Down Expand Up @@ -458,18 +464,19 @@
"Speckle.Core": "[3.0.1-alpha.14, )"
}
},
"speckle.converters.autocad2024": {
"speckle.converters.civil3d2024": {
"type": "Project",
"dependencies": {
"Speckle.AutoCAD.API": "[2024.0.0, )",
"Speckle.Civil3D.API": "[2024.0.0, )",
"Speckle.Converters.Common": "[2.0.999-local, )"
}
},
"speckle.converters.autocad2024.dependencyinjection": {
"speckle.converters.civil3d2024.dependencyinjection": {
"type": "Project",
"dependencies": {
"Autofac": "[5.2.0, )",
"Speckle.Converters.Autocad2024": "[2.0.999-local, )",
"Speckle.Converters.Civil3d2024": "[2.0.999-local, )",
"Speckle.Converters.Common.DependencyInjection": "[2.0.999-local, )"
}
},
Expand Down Expand Up @@ -512,12 +519,6 @@
"Serilog": "2.12.0"
}
},
"Speckle.AutoCAD.API": {
"type": "CentralTransitive",
"requested": "[2023.0.0, )",
"resolved": "2024.0.0",
"contentHash": "pZZ5uI+NXhZaQnsqRkgp/rywqBAjDObDJ9XNFGJvemT5k2OthDpHzlK/mKxz8QDCYie7uImQ8dv3uWj2QUFDPw=="
},
"Speckle.Core": {
"type": "CentralTransitive",
"requested": "[3.0.1-alpha.14, )",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\Sdk\Speckle.Converters.Common.DependencyInjection\Speckle.Converters.Common.DependencyInjection.csproj" />
<ProjectReference Include="..\Speckle.Converters.Autocad2023\Speckle.Converters.Autocad2023.csproj" />
<PackageReference Include="Autofac" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Autofac" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Converters.Common.DependencyInjection\Speckle.Converters.Common.DependencyInjection.csproj" />
<ProjectReference Include="..\Speckle.Converters.Autocad2023\Speckle.Converters.Autocad2023.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
},
"Speckle.AutoCAD.API": {
"type": "CentralTransitive",
"requested": "[2023.0.0, )",
"requested": "[2024.0.0, )",
"resolved": "2023.0.0",
"contentHash": "aNfiNw9zRW8pCl8AAQK7afEJuea4bJ4sFNsGVSDrdq1egaonZrwALU01dSyFNCE8tne86eVjlprpOGG6r0+G/A=="
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\Sdk\Speckle.Converters.Common\Speckle.Converters.Common.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Converters.Common\Speckle.Converters.Common.csproj" />
</ItemGroup>

<Import Project="..\..\Speckle.Converters.AutocadShared\Speckle.Converters.AutocadShared.projitems" Label="Shared" />
<Import Project="..\Speckle.Converters.AutocadShared\Speckle.Converters.AutocadShared.projitems" Label="Shared" />

</Project>
Loading
Loading