diff --git a/Connectors/Autocad/Speckle.Connectors.Autocad2023/Speckle.Connectors.Autocad2023.csproj b/Connectors/Autocad/Speckle.Connectors.Autocad2023/Speckle.Connectors.Autocad2023.csproj index e3913f6c1..88e6b47cd 100644 --- a/Connectors/Autocad/Speckle.Connectors.Autocad2023/Speckle.Connectors.Autocad2023.csproj +++ b/Connectors/Autocad/Speckle.Connectors.Autocad2023/Speckle.Connectors.Autocad2023.csproj @@ -10,7 +10,7 @@ - + @@ -19,7 +19,7 @@ - + diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs index 52da8c7d7..777a2ed66 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs @@ -1,25 +1,6 @@ #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; @@ -27,43 +8,14 @@ public class AutocadConnectorModule : ISpeckleModule { public void Load(SpeckleContainerBuilder builder) { - builder.AddAutofac(); - builder.AddConnectorUtils(); - builder.AddDUI(); - builder.AddDUIView(); - - // Register other connector specific types - builder.AddSingleton(); - builder.AddTransient(); - builder.AddSingleton(new AutocadDocumentManager()); // TODO: Dependent to TransactionContext, can be moved to AutocadContext - builder.AddSingleton(); - builder.AddSingleton(); - builder.AddSingleton(); - - SharedConnectorModule.LoadShared(builder); - - - builder.AddScoped(); + SharedRegistration.Load(builder); // Operations - builder.AddScoped>(); - builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); - - // Object Builders - builder.AddScoped(); - builder.AddScoped, AutocadRootObjectBuilder>(); + SharedRegistration.LoadSend(builder); + SharedRegistration.LoadReceive(builder); // Register bindings builder.AddSingleton("connectorName", "Autocad"); // POC: Easier like this for now, should be cleaned up later - builder.AddSingleton(); - builder.AddSingleton(); - - // register send filters - builder.AddTransient(); - - // register send conversion cache - builder.AddSingleton(); - builder.AddScoped>, AutocadInstanceObjectManager>(); } } #endif diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/Civil3dConnectorModule.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/Civil3dConnectorModule.cs index e6889843c..0b06869c6 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/Civil3dConnectorModule.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/Civil3dConnectorModule.cs @@ -1,13 +1,7 @@ #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; @@ -15,23 +9,11 @@ public class Civil3dConnectorModule : ISpeckleModule { public void Load(SpeckleContainerBuilder builder) { - SharedConnectorModule.LoadShared(builder); - - // Operations - builder.AddScoped>(); - - // Object Builders - builder.AddScoped, AutocadRootObjectBuilder>(); - + SharedRegistration.Load(builder); + SharedRegistration.LoadSend(builder); + // Register bindings builder.AddSingleton("connectorName", "Civil3d"); // POC: Easier like this for now, should be cleaned up later - builder.AddSingleton(); - - // register send filters - builder.AddTransient(); - - // register send conversion cache - builder.AddSingleton(); } } #endif diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/SharedRegistration.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/SharedRegistration.cs new file mode 100644 index 000000000..b9b585605 --- /dev/null +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/SharedRegistration.cs @@ -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 +{ + public static void Load(SpeckleContainerBuilder builder) + { + builder.AddAutofac(); + builder.AddConnectorUtils(); + builder.AddDUI(); + builder.AddDUIView(); + + // Register other connector specific types + builder.AddSingleton(); + builder.AddTransient(); + builder.AddSingleton(new AutocadDocumentManager()); // TODO: Dependent to TransactionContext, can be moved to AutocadContext + builder.AddSingleton(); + builder.AddSingleton(); + builder.AddScoped(); + builder.AddSingleton(); + + // Register bindings + builder.AddSingleton(); + builder.AddSingleton(); + builder.AddSingleton(); + builder.AddSingleton(); + builder.AddSingleton(); + } + + public static void LoadSend(SpeckleContainerBuilder builder) + { + // Operations + builder.AddScoped>(); + + // Object Builders + builder.AddScoped, AutocadRootObjectBuilder>(); + + // Register bindings + builder.AddSingleton(); + + // register send filters + builder.AddTransient(); + + // register send conversion cache + builder.AddSingleton(); + builder.AddScoped>, AutocadInstanceObjectManager>(); + } + + public static void LoadReceive(SpeckleContainerBuilder builder) + { + // traversal + builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); + + // Object Builders + builder.AddScoped(); + + // Register bindings + builder.AddSingleton(); + } +} diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems index b95639804..8fb44c372 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems @@ -13,7 +13,7 @@ - + diff --git a/Connectors/Autocad/Speckle.Connectors.Civil3d2024/Speckle.Connectors.Civil3d2024.csproj b/Connectors/Autocad/Speckle.Connectors.Civil3d2024/Speckle.Connectors.Civil3d2024.csproj index b04e1c73e..ebeefa66e 100644 --- a/Connectors/Autocad/Speckle.Connectors.Civil3d2024/Speckle.Connectors.Civil3d2024.csproj +++ b/Connectors/Autocad/Speckle.Connectors.Civil3d2024/Speckle.Connectors.Civil3d2024.csproj @@ -1,4 +1,4 @@ - + Speckle.Connectors.Civil3d net48 @@ -10,7 +10,7 @@ - + @@ -19,7 +19,8 @@ - + + diff --git a/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json index 71a6fee08..99e611c5c 100644 --- a/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json @@ -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, )", @@ -437,8 +443,8 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", - "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Connectors.Utils": "[2.0.999-local, )", + "Speckle.Autofac": "[1.0.0, )", + "Speckle.Connectors.Utils": "[1.0.0, )", "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } @@ -447,44 +453,45 @@ "type": "Project", "dependencies": { "Microsoft.Web.WebView2": "[1.0.1823.32, )", - "Speckle.Connectors.DUI": "[2.0.999-local, )" + "Speckle.Connectors.DUI": "[1.0.0, )" } }, "speckle.connectors.utils": { "type": "Project", "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", - "Speckle.Autofac": "[2.0.999-local, )", + "Speckle.Autofac": "[1.0.0, )", "Speckle.Core": "[3.0.1-alpha.14, )" } }, - "speckle.converters.autocad2024": { + "speckle.converters.civil3d2024": { "type": "Project", "dependencies": { "Speckle.AutoCAD.API": "[2024.0.0, )", - "Speckle.Converters.Common": "[2.0.999-local, )" + "Speckle.Civil3D.API": "[2024.0.0, )", + "Speckle.Converters.Common": "[1.0.0, )" } }, - "speckle.converters.autocad2024.dependencyinjection": { + "speckle.converters.civil3d2024.dependencyinjection": { "type": "Project", "dependencies": { "Autofac": "[5.2.0, )", - "Speckle.Converters.Autocad2024": "[2.0.999-local, )", - "Speckle.Converters.Common.DependencyInjection": "[2.0.999-local, )" + "Speckle.Converters.Civil3d2024": "[1.0.0, )", + "Speckle.Converters.Common.DependencyInjection": "[1.0.0, )" } }, "speckle.converters.common": { "type": "Project", "dependencies": { - "Speckle.Autofac": "[2.0.999-local, )", + "Speckle.Autofac": "[1.0.0, )", "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { "type": "Project", "dependencies": { - "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Converters.Common": "[2.0.999-local, )" + "Speckle.Autofac": "[1.0.0, )", + "Speckle.Converters.Common": "[1.0.0, )" } }, "Autofac": { @@ -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, )", diff --git a/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/AutocadConverterModule.cs b/Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/AutocadConverterModule.cs similarity index 100% rename from Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/AutocadConverterModule.cs rename to Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/AutocadConverterModule.cs diff --git a/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/Speckle.Converters.Autocad2023.DependencyInjection.csproj b/Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/Speckle.Converters.Autocad2023.DependencyInjection.csproj similarity index 72% rename from Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/Speckle.Converters.Autocad2023.DependencyInjection.csproj rename to Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/Speckle.Converters.Autocad2023.DependencyInjection.csproj index 303e2f808..aa5a5af31 100644 --- a/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/Speckle.Converters.Autocad2023.DependencyInjection.csproj +++ b/Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/Speckle.Converters.Autocad2023.DependencyInjection.csproj @@ -4,14 +4,14 @@ net48 x64 - + - - + - + + diff --git a/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json similarity index 98% rename from Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json rename to Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json index e51635ea8..4aff90a3b 100644 --- a/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json +++ b/Converters/Autocad/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json @@ -367,21 +367,21 @@ "type": "Project", "dependencies": { "Speckle.AutoCAD.API": "[2023.0.0, )", - "Speckle.Converters.Common": "[2.0.999-local, )" + "Speckle.Converters.Common": "[1.0.0, )" } }, "speckle.converters.common": { "type": "Project", "dependencies": { - "Speckle.Autofac": "[2.0.999-local, )", + "Speckle.Autofac": "[1.0.0, )", "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { "type": "Project", "dependencies": { - "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Converters.Common": "[2.0.999-local, )" + "Speckle.Autofac": "[1.0.0, )", + "Speckle.Converters.Common": "[1.0.0, )" } }, "Microsoft.Extensions.Logging.Abstractions": { diff --git a/Converters/Autocad/2023/Speckle.Converters.Autocad2023/Speckle.Converters.Autocad2023.csproj b/Converters/Autocad/Speckle.Converters.Autocad2023/Speckle.Converters.Autocad2023.csproj similarity index 57% rename from Converters/Autocad/2023/Speckle.Converters.Autocad2023/Speckle.Converters.Autocad2023.csproj rename to Converters/Autocad/Speckle.Converters.Autocad2023/Speckle.Converters.Autocad2023.csproj index 2fc9b23da..06ab0541d 100644 --- a/Converters/Autocad/2023/Speckle.Converters.Autocad2023/Speckle.Converters.Autocad2023.csproj +++ b/Converters/Autocad/Speckle.Converters.Autocad2023/Speckle.Converters.Autocad2023.csproj @@ -10,9 +10,9 @@ - + - + diff --git a/Converters/Autocad/2023/Speckle.Converters.Autocad2023/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2023/packages.lock.json similarity index 100% rename from Converters/Autocad/2023/Speckle.Converters.Autocad2023/packages.lock.json rename to Converters/Autocad/Speckle.Converters.Autocad2023/packages.lock.json diff --git a/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/AutocadConverterModule.cs b/Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/AutocadConverterModule.cs similarity index 91% rename from Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/AutocadConverterModule.cs rename to Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/AutocadConverterModule.cs index 66c4b57af..6d9b3a767 100644 --- a/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/AutocadConverterModule.cs +++ b/Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/AutocadConverterModule.cs @@ -5,7 +5,7 @@ using Speckle.Converters.Common; using Speckle.Converters.Common.DependencyInjection; -namespace Speckle.Converters.Autocad20243.DependencyInjection; +namespace Speckle.Converters.Autocad2024.DependencyInjection; public class AutocadConverterModule : ISpeckleModule { diff --git a/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/Speckle.Converters.Autocad2024.DependencyInjection.csproj b/Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/Speckle.Converters.Autocad2024.DependencyInjection.csproj similarity index 73% rename from Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/Speckle.Converters.Autocad2024.DependencyInjection.csproj rename to Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/Speckle.Converters.Autocad2024.DependencyInjection.csproj index 05de443d1..79c93f345 100644 --- a/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/Speckle.Converters.Autocad2024.DependencyInjection.csproj +++ b/Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/Speckle.Converters.Autocad2024.DependencyInjection.csproj @@ -6,7 +6,7 @@ - + diff --git a/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json similarity index 98% rename from Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json rename to Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json index bb0e3cfe0..e18c59aca 100644 --- a/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json +++ b/Converters/Autocad/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json @@ -367,21 +367,21 @@ "type": "Project", "dependencies": { "Speckle.AutoCAD.API": "[2024.0.0, )", - "Speckle.Converters.Common": "[2.0.999-local, )" + "Speckle.Converters.Common": "[1.0.0, )" } }, "speckle.converters.common": { "type": "Project", "dependencies": { - "Speckle.Autofac": "[2.0.999-local, )", + "Speckle.Autofac": "[1.0.0, )", "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { "type": "Project", "dependencies": { - "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Converters.Common": "[2.0.999-local, )" + "Speckle.Autofac": "[1.0.0, )", + "Speckle.Converters.Common": "[1.0.0, )" } }, "Microsoft.Extensions.Logging.Abstractions": { diff --git a/Converters/Autocad/2024/Speckle.Converters.Autocad2024/Speckle.Converters.Autocad2024.csproj b/Converters/Autocad/Speckle.Converters.Autocad2024/Speckle.Converters.Autocad2024.csproj similarity index 57% rename from Converters/Autocad/2024/Speckle.Converters.Autocad2024/Speckle.Converters.Autocad2024.csproj rename to Converters/Autocad/Speckle.Converters.Autocad2024/Speckle.Converters.Autocad2024.csproj index 05f9613b3..da1163a6a 100644 --- a/Converters/Autocad/2024/Speckle.Converters.Autocad2024/Speckle.Converters.Autocad2024.csproj +++ b/Converters/Autocad/Speckle.Converters.Autocad2024/Speckle.Converters.Autocad2024.csproj @@ -10,9 +10,9 @@ - + - + diff --git a/Converters/Autocad/2024/Speckle.Converters.Autocad2024/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2024/packages.lock.json similarity index 100% rename from Converters/Autocad/2024/Speckle.Converters.Autocad2024/packages.lock.json rename to Converters/Autocad/Speckle.Converters.Autocad2024/packages.lock.json diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/GlobalUsings.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/GlobalUsings.cs index 9c48f198a..7922a5980 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/GlobalUsings.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/GlobalUsings.cs @@ -1,5 +1,6 @@ global using ADB = Autodesk.AutoCAD.DatabaseServices; global using AG = Autodesk.AutoCAD.Geometry; +global using ABR = Autodesk.AutoCAD.BoundaryRepresentation; global using SOG = Objects.Geometry; global using SOP = Objects.Primitive; global using Document = Autodesk.AutoCAD.ApplicationServices.Document; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems b/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems index 3644c81cc..8fb784a3a 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems @@ -38,6 +38,13 @@ + + + + + + + @@ -49,11 +56,12 @@ - + + \ No newline at end of file diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs index 36d7b796f..c437aa04e 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs @@ -5,55 +5,16 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; [NameAndRankValue(nameof(ADB.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class DBArcToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter +public class DBArcToSpeckleConverter : IToSpeckleTopLevelConverter { - private readonly ITypedConverter _pointConverter; - private readonly ITypedConverter _planeConverter; - private readonly ITypedConverter _boxConverter; - private readonly IConversionContextStack _contextStack; + private readonly ITypedConverter _arcConverter; - public DBArcToSpeckleConverter( - ITypedConverter pointConverter, - ITypedConverter planeConverter, - ITypedConverter boxConverter, - IConversionContextStack contextStack - ) + public DBArcToSpeckleConverter(ITypedConverter arcConverter) { - _pointConverter = pointConverter; - _planeConverter = planeConverter; - _boxConverter = boxConverter; - _contextStack = contextStack; + _arcConverter = arcConverter; } public Base Convert(object target) => Convert((ADB.Arc)target); - public SOG.Arc Convert(ADB.Arc target) - { - SOG.Plane plane = _planeConverter.Convert(target.GetPlane()); - SOG.Point start = _pointConverter.Convert(target.StartPoint); - SOG.Point end = _pointConverter.Convert(target.EndPoint); - SOG.Point mid = _pointConverter.Convert(target.GetPointAtDist(target.Length / 2.0)); - SOP.Interval domain = new(target.StartParam, target.EndParam); - SOG.Box bbox = _boxConverter.Convert(target.GeometricExtents); - - SOG.Arc arc = - new( - plane, - target.Radius, - target.StartAngle, - target.EndAngle, - target.TotalAngle, - _contextStack.Current.SpeckleUnits - ) - { - startPoint = start, - endPoint = end, - midPoint = mid, - domain = domain, - length = target.Length, - bbox = bbox - }; - - return arc; - } + public SOG.Arc Convert(ADB.Arc target) => _arcConverter.Convert(target); } diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs index 18b45a8da..16b1a2bd2 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs @@ -7,30 +7,14 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; [NameAndRankValue(nameof(ADB.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DBCircleToSpeckleConverter : IToSpeckleTopLevelConverter { - private readonly ITypedConverter _planeConverter; - private readonly ITypedConverter _boxConverter; - private readonly IConversionContextStack _contextStack; + private readonly ITypedConverter _circleConverter; - public DBCircleToSpeckleConverter( - ITypedConverter planeConverter, - ITypedConverter boxConverter, - IConversionContextStack contextStack - ) + public DBCircleToSpeckleConverter(ITypedConverter circleConverter) { - _planeConverter = planeConverter; - _boxConverter = boxConverter; - _contextStack = contextStack; + _circleConverter = circleConverter; } public Base Convert(object target) => RawConvert((ADB.Circle)target); - public SOG.Circle RawConvert(ADB.Circle target) - { - SOG.Plane plane = _planeConverter.Convert(target.GetPlane()); - SOG.Box bbox = _boxConverter.Convert(target.GeometricExtents); - SOG.Circle circle = - new(plane, target.Radius, _contextStack.Current.SpeckleUnits) { length = target.Circumference, bbox = bbox }; - - return circle; - } + public SOG.Circle RawConvert(ADB.Circle target) => _circleConverter.Convert(target); } diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs index 524e1a1d8..53d3d7e5b 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs @@ -7,40 +7,14 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; [NameAndRankValue(nameof(ADB.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DBEllipseToSpeckleConverter : IToSpeckleTopLevelConverter { - private readonly ITypedConverter _planeConverter; - private readonly ITypedConverter _boxConverter; - private readonly IConversionContextStack _contextStack; + private readonly ITypedConverter _ellipseConverter; - public DBEllipseToSpeckleConverter( - ITypedConverter planeConverter, - ITypedConverter boxConverter, - IConversionContextStack contextStack - ) + public DBEllipseToSpeckleConverter(ITypedConverter ellipseConverter) { - _planeConverter = planeConverter; - _boxConverter = boxConverter; - _contextStack = contextStack; + _ellipseConverter = ellipseConverter; } public Base Convert(object target) => RawConvert((ADB.Ellipse)target); - public SOG.Ellipse RawConvert(ADB.Ellipse target) - { - SOG.Plane plane = _planeConverter.Convert(new AG.Plane(target.Center, target.MajorAxis, target.MinorAxis)); - SOG.Box bbox = _boxConverter.Convert(target.GeometricExtents); - - // the start and end param corresponds to start and end angle in radians - SOP.Interval trim = new(target.StartAngle, target.EndAngle); - - SOG.Ellipse ellipse = - new(plane, target.MajorRadius, target.MinorRadius, _contextStack.Current.SpeckleUnits) - { - domain = new(0, Math.PI * 2), - trimDomain = trim, - length = target.GetDistanceAtParameter(target.EndParam), - bbox = bbox - }; - - return ellipse; - } + public SOG.Ellipse RawConvert(ADB.Ellipse target) => _ellipseConverter.Convert(target); } diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs index 22787e229..710a607f9 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs @@ -5,34 +5,16 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; [NameAndRankValue(nameof(ADB.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class LineToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter +public class LineToSpeckleConverter : IToSpeckleTopLevelConverter { - private readonly ITypedConverter _pointConverter; - private readonly ITypedConverter _boxConverter; - private readonly IConversionContextStack _contextStack; + private readonly ITypedConverter _lineConverter; - public LineToSpeckleConverter( - ITypedConverter pointConverter, - ITypedConverter boxConverter, - IConversionContextStack contextStack - ) + public LineToSpeckleConverter(ITypedConverter lineConverter) { - _pointConverter = pointConverter; - _boxConverter = boxConverter; - _contextStack = contextStack; + _lineConverter = lineConverter; } public Base Convert(object target) => Convert((ADB.Line)target); - public SOG.Line Convert(ADB.Line target) => - new( - _pointConverter.Convert(target.StartPoint), - _pointConverter.Convert(target.EndPoint), - _contextStack.Current.SpeckleUnits - ) - { - length = target.Length, - domain = new SOP.Interval(0, target.Length), - bbox = _boxConverter.Convert(target.GeometricExtents) - }; + public SOG.Line Convert(ADB.Line target) => _lineConverter.Convert(target); } diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs index 330d832cb..e0b053c12 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs @@ -15,7 +15,9 @@ namespace Speckle.Converters.Autocad.Geometry; /// The IToSpeckleTopLevelConverter inheritance should only expect database-resident objects. IRawConversion inheritance can expect non database-resident objects, when generated from other converters. /// [NameAndRankValue(nameof(ADB.Polyline2d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class Polyline2dToSpeckleConverter : IToSpeckleTopLevelConverter +public class Polyline2dToSpeckleConverter + : IToSpeckleTopLevelConverter, + ITypedConverter { private readonly ITypedConverter _arcConverter; private readonly ITypedConverter _lineConverter; @@ -44,9 +46,9 @@ public Polyline2dToSpeckleConverter( _contextStack = contextStack; } - public Base Convert(object target) => RawConvert((ADB.Polyline2d)target); + public Base Convert(object target) => Convert((ADB.Polyline2d)target); - public SOG.Autocad.AutocadPolycurve RawConvert(ADB.Polyline2d target) + public SOG.Autocad.AutocadPolycurve Convert(ADB.Polyline2d target) { // get the poly type var polyType = SOG.Autocad.AutocadPolyType.Unknown; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs index fdef5bd47..87b90ad1e 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs @@ -14,7 +14,9 @@ namespace Speckle.Converters.Autocad.Geometry; /// The IToSpeckleTopLevelConverter inheritance should only expect database-resident Polyline2d objects. IRawConversion inheritance can expect non database-resident objects, when generated from other converters. /// [NameAndRankValue(nameof(ADB.Polyline3d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class Polyline3dToSpeckleConverter : IToSpeckleTopLevelConverter +public class Polyline3dToSpeckleConverter + : IToSpeckleTopLevelConverter, + ITypedConverter { private readonly ITypedConverter _pointConverter; private readonly ITypedConverter _splineConverter; @@ -34,9 +36,9 @@ public Polyline3dToSpeckleConverter( _contextStack = contextStack; } - public Base Convert(object target) => RawConvert((ADB.Polyline3d)target); + public Base Convert(object target) => Convert((ADB.Polyline3d)target); - public SOG.Autocad.AutocadPolycurve RawConvert(ADB.Polyline3d target) + public SOG.Autocad.AutocadPolycurve Convert(ADB.Polyline3d target) { // get the poly type var polyType = SOG.Autocad.AutocadPolyType.Unknown; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Solid3dToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Solid3dToSpeckleConverter.cs new file mode 100644 index 000000000..841dc1120 --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Solid3dToSpeckleConverter.cs @@ -0,0 +1,23 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.Geometry; + +[NameAndRankValue(nameof(ADB.Solid3d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +public class Solid3dToSpeckleConverter : IToSpeckleTopLevelConverter +{ + private readonly ITypedConverter _solidConverter; + + public Solid3dToSpeckleConverter(ITypedConverter solidConverter) + { + _solidConverter = solidConverter; + } + + public Base Convert(object target) => RawConvert((ADB.Solid3d)target); + + public SOG.Mesh RawConvert(ADB.Solid3d target) + { + return _solidConverter.Convert(target); + } +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs index 059f92f03..d182376cd 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs @@ -1,5 +1,3 @@ -using Autodesk.AutoCAD.Geometry; -using Speckle.Converters.Autocad.Extensions; using Speckle.Converters.Common; using Speckle.Converters.Common.Objects; using Speckle.Core.Models; @@ -7,150 +5,16 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; [NameAndRankValue(nameof(ADB.Spline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class SplineToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter +public class SplineToSpeckleConverter : IToSpeckleTopLevelConverter { - private readonly ITypedConverter _intervalConverter; - private readonly ITypedConverter _boxConverter; - private readonly IConversionContextStack _contextStack; + private readonly ITypedConverter _splineConverter; - public SplineToSpeckleConverter( - ITypedConverter intervalConverter, - ITypedConverter boxConverter, - IConversionContextStack contextStack - ) + public SplineToSpeckleConverter(ITypedConverter splineConverter) { - _intervalConverter = intervalConverter; - _boxConverter = boxConverter; - _contextStack = contextStack; + _splineConverter = splineConverter; } public Base Convert(object target) => Convert((ADB.Spline)target); - public SOG.Curve Convert(ADB.Spline target) - { - // get nurbs and geo data - ADB.NurbsData data = target.NurbsData; - - // POC: HACK: check for incorrectly closed periodic curves (this seems like acad bug, has resulted from receiving rhino curves) - bool periodicClosed = false; - double length = 0; - SOP.Interval domain = new(); - if (target.GetGeCurve() is NurbCurve3d nurbs) - { - length = nurbs.GetLength(nurbs.StartParameter, nurbs.EndParameter, 0.001); - domain = _intervalConverter.Convert(nurbs.GetInterval()); - if (nurbs.Knots.Count < nurbs.NumberOfControlPoints + nurbs.Degree + 1 && target.IsPeriodic) - { - periodicClosed = true; - } - } - - // get points - List points = new(); - foreach (Point3d point in data.GetControlPoints().OfType()) - { - points.Add(point); - } - - // NOTE: for closed periodic splines, autocad does not track last #degree points. - // Add the first #degree control points to the list if so. - if (periodicClosed) - { - points.AddRange(points.GetRange(0, target.Degree)); - } - - // get knots - // NOTE: for closed periodic splines, autocad has #control points + 1 knots. - // Add #degree extra knots to beginning and end with #degree - 1 multiplicity for first and last - var knots = data.GetKnots().OfType().ToList(); - if (periodicClosed) - { - double interval = knots[1] - knots[0]; //knot interval - - for (int i = 0; i < data.Degree; i++) - { - if (i < 2) - { - knots.Insert(knots.Count, knots[^1] + interval); - knots.Insert(0, knots[0] - interval); - } - else - { - knots.Insert(knots.Count, knots[^1]); - knots.Insert(0, knots[0]); - } - } - } - - // get weights - // NOTE: autocad assigns unweighted points a value of -1, and will return an empty list in the spline's nurbsdata if no points are weighted - // NOTE: for closed periodic splines, autocad does not track last #degree points. Add the first #degree weights to the list if so. - List weights = new(); - for (int i = 0; i < target.NumControlPoints; i++) - { - double weight = target.WeightAt(i); - weights.Add(weight <= 0 ? 1 : weight); - } - - if (periodicClosed) - { - weights.AddRange(weights.GetRange(0, target.Degree)); - } - - // set nurbs curve info - var curve = new SOG.Curve - { - points = points.SelectMany(o => o.ToArray()).ToList(), - knots = knots, - weights = weights, - degree = target.Degree, - periodic = target.IsPeriodic, - rational = target.IsRational, - closed = periodicClosed || target.Closed, - length = length, - domain = domain, - bbox = _boxConverter.Convert(target.GeometricExtents), - units = _contextStack.Current.SpeckleUnits - }; - - // POC: get display value if this is a database-resident spline - // POC: if this is called by another converter that has created a spline, assumes the display value is set by that converter - if (target.Database is not null) - { - curve.displayValue = GetDisplayValue(target); - } - - return curve; - } - - // POC: we might have DisplayValue converter/mapper? - private SOG.Polyline GetDisplayValue(ADB.Spline spline) - { - ADB.Curve polySpline = spline.ToPolylineWithPrecision(10, false, false); - List verticesList = new(); - switch (polySpline) - { - case ADB.Polyline2d o: - verticesList = o.GetSubEntities( - ADB.OpenMode.ForRead, - _contextStack.Current.Document.TransactionManager.TopTransaction - ) - .Where(e => e.VertexType != ADB.Vertex2dType.SplineControlVertex) // POC: not validated yet! - .SelectMany(o => o.Position.ToArray()) - .ToList(); - - break; - case ADB.Polyline3d o: - verticesList = o.GetSubEntities( - ADB.OpenMode.ForRead, - _contextStack.Current.Document.TransactionManager.TopTransaction - ) - .Where(e => e.VertexType != ADB.Vertex3dType.ControlVertex) - .SelectMany(o => o.Position.ToArray()) - .ToList(); - break; - } - - return verticesList.ConvertToSpecklePolyline(_contextStack.Current.SpeckleUnits); - } + public SOG.Curve Convert(ADB.Spline target) => _splineConverter.Convert(target); } diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/CircularArc3dToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/CircularArc3dToSpeckleRawConverter.cs new file mode 100644 index 000000000..ec8f91e0b --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/CircularArc3dToSpeckleRawConverter.cs @@ -0,0 +1,50 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class CircularArc3dToSpeckleConverter : ITypedConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly ITypedConverter _planeConverter; + private readonly IConversionContextStack _contextStack; + + public CircularArc3dToSpeckleConverter( + ITypedConverter pointConverter, + ITypedConverter planeConverter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _planeConverter = planeConverter; + _contextStack = contextStack; + } + + public SOG.Arc Convert(AG.CircularArc3d target) + { + SOG.Plane plane = _planeConverter.Convert(target.GetPlane()); + SOG.Point start = _pointConverter.Convert(target.StartPoint); + SOG.Point end = _pointConverter.Convert(target.EndPoint); + SOG.Point mid = _pointConverter.Convert(target.EvaluatePoint(0.5)); // POC: testing, unsure + SOP.Interval domain = new(target.GetInterval().LowerBound, target.GetInterval().UpperBound); + + SOG.Arc arc = + new( + plane, + target.Radius, + target.StartAngle, + target.EndAngle, + target.EndAngle - target.StartAngle, // POC: testing, unsure + _contextStack.Current.SpeckleUnits + ) + { + startPoint = start, + endPoint = end, + midPoint = mid, + domain = domain, + length = target.GetLength(0, 1, 0.000) + }; + + return arc; + } +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBArcToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBArcToSpeckleRawConverter.cs new file mode 100644 index 000000000..8b45be3de --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBArcToSpeckleRawConverter.cs @@ -0,0 +1,58 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class DBArcToSpeckleRawConverter : ITypedConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly ITypedConverter _planeConverter; + private readonly ITypedConverter _boxConverter; + private readonly IConversionContextStack _contextStack; + + public DBArcToSpeckleRawConverter( + ITypedConverter pointConverter, + ITypedConverter planeConverter, + ITypedConverter boxConverter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _planeConverter = planeConverter; + _boxConverter = boxConverter; + _contextStack = contextStack; + } + + public Base Convert(object target) => Convert((ADB.Arc)target); + + public SOG.Arc Convert(ADB.Arc target) + { + SOG.Plane plane = _planeConverter.Convert(target.GetPlane()); + SOG.Point start = _pointConverter.Convert(target.StartPoint); + SOG.Point end = _pointConverter.Convert(target.EndPoint); + SOG.Point mid = _pointConverter.Convert(target.GetPointAtDist(target.Length / 2.0)); + SOP.Interval domain = new(target.StartParam, target.EndParam); + SOG.Box bbox = _boxConverter.Convert(target.GeometricExtents); + + SOG.Arc arc = + new( + plane, + target.Radius, + target.StartAngle, + target.EndAngle, + target.TotalAngle, + _contextStack.Current.SpeckleUnits + ) + { + startPoint = start, + endPoint = end, + midPoint = mid, + domain = domain, + length = target.Length, + bbox = bbox + }; + + return arc; + } +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBCircleToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBCircleToSpeckleRawConverter.cs new file mode 100644 index 000000000..06f4cf687 --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBCircleToSpeckleRawConverter.cs @@ -0,0 +1,35 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class DBCircleToSpeckleRawConverter : ITypedConverter +{ + private readonly ITypedConverter _planeConverter; + private readonly ITypedConverter _boxConverter; + private readonly IConversionContextStack _contextStack; + + public DBCircleToSpeckleRawConverter( + ITypedConverter planeConverter, + ITypedConverter boxConverter, + IConversionContextStack contextStack + ) + { + _planeConverter = planeConverter; + _boxConverter = boxConverter; + _contextStack = contextStack; + } + + public Base Convert(object target) => Convert((ADB.Circle)target); + + public SOG.Circle Convert(ADB.Circle target) + { + SOG.Plane plane = _planeConverter.Convert(target.GetPlane()); + SOG.Box bbox = _boxConverter.Convert(target.GeometricExtents); + SOG.Circle circle = + new(plane, target.Radius, _contextStack.Current.SpeckleUnits) { length = target.Circumference, bbox = bbox }; + + return circle; + } +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBCurveToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBCurveToSpeckleRawConverter.cs new file mode 100644 index 000000000..ef392923b --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBCurveToSpeckleRawConverter.cs @@ -0,0 +1,67 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class DBCurveToSpeckleRawConverter : ITypedConverter, ITypedConverter +{ + private readonly ITypedConverter _lineConverter; + + private readonly ITypedConverter _polylineConverter; + private readonly ITypedConverter _polyline2dConverter; + private readonly ITypedConverter _polyline3dConverter; + private readonly ITypedConverter _arcConverter; + private readonly ITypedConverter _circleConverter; + private readonly ITypedConverter _ellipseConverter; + private readonly ITypedConverter _splineConverter; + private readonly IConversionContextStack _contextStack; + + public DBCurveToSpeckleRawConverter( + ITypedConverter lineConverter, + ITypedConverter polylineConverter, + ITypedConverter polyline2dConverter, + ITypedConverter polyline3dConverter, + ITypedConverter arcConverter, + ITypedConverter circleConverter, + ITypedConverter ellipseConverter, + ITypedConverter splineConverter, + IConversionContextStack contextStack + ) + { + _lineConverter = lineConverter; + _polylineConverter = polylineConverter; + _polyline2dConverter = polyline2dConverter; + _polyline3dConverter = polyline3dConverter; + _arcConverter = arcConverter; + _circleConverter = circleConverter; + _ellipseConverter = ellipseConverter; + _splineConverter = splineConverter; + _contextStack = contextStack; + } + + /// + /// Converts an Autocad curve to a Speckle ICurve. + /// + /// The Autocad curve to convert. + /// The Speckle curve. + /// + /// This is the main converter when the type of curve you input or output does not matter to the caller.
+ /// ⚠️ If an unsupported type of Curve is input, it will be converted as Spline. + ///
+ public Objects.ICurve Convert(ADB.Curve target) => + target switch + { + ADB.Line line => _lineConverter.Convert(line), + //ADB.Polyline polyline => _polylineConverter.Convert(polyline), + //ADB.Polyline2d polyline2d => _polyline2dConverter.Convert(polyline2d), + //ADB.Polyline3d polyline3d => _polyline3dConverter.Convert(polyline3d), + ADB.Arc arc => _arcConverter.Convert(arc), + ADB.Circle circle => _circleConverter.Convert(circle), + ADB.Ellipse ellipse => _ellipseConverter.Convert(ellipse), + ADB.Spline spline => _splineConverter.Convert(spline), + _ => _splineConverter.Convert(target.Spline) + }; + + Base ITypedConverter.Convert(ADB.Curve target) => (Base)Convert(target); +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBEllipseToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBEllipseToSpeckleRawConverter.cs new file mode 100644 index 000000000..c763bb0e6 --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBEllipseToSpeckleRawConverter.cs @@ -0,0 +1,45 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class DBEllipseToSpeckleRawConverter : ITypedConverter +{ + private readonly ITypedConverter _planeConverter; + private readonly ITypedConverter _boxConverter; + private readonly IConversionContextStack _contextStack; + + public DBEllipseToSpeckleRawConverter( + ITypedConverter planeConverter, + ITypedConverter boxConverter, + IConversionContextStack contextStack + ) + { + _planeConverter = planeConverter; + _boxConverter = boxConverter; + _contextStack = contextStack; + } + + public Base Convert(object target) => Convert((ADB.Ellipse)target); + + public SOG.Ellipse Convert(ADB.Ellipse target) + { + SOG.Plane plane = _planeConverter.Convert(new AG.Plane(target.Center, target.MajorAxis, target.MinorAxis)); + SOG.Box bbox = _boxConverter.Convert(target.GeometricExtents); + + // the start and end param corresponds to start and end angle in radians + SOP.Interval trim = new(target.StartAngle, target.EndAngle); + + SOG.Ellipse ellipse = + new(plane, target.MajorRadius, target.MinorRadius, _contextStack.Current.SpeckleUnits) + { + domain = new(0, Math.PI * 2), + trimDomain = trim, + length = target.GetDistanceAtParameter(target.EndParam), + bbox = bbox + }; + + return ellipse; + } +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBLineToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBLineToSpeckleRawConverter.cs new file mode 100644 index 000000000..b4a083c8e --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBLineToSpeckleRawConverter.cs @@ -0,0 +1,37 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class DBLineToSpeckleRawConverter : ITypedConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly ITypedConverter _boxConverter; + private readonly IConversionContextStack _contextStack; + + public DBLineToSpeckleRawConverter( + ITypedConverter pointConverter, + ITypedConverter boxConverter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _boxConverter = boxConverter; + _contextStack = contextStack; + } + + public Base Convert(object target) => Convert((ADB.Line)target); + + public SOG.Line Convert(ADB.Line target) => + new( + _pointConverter.Convert(target.StartPoint), + _pointConverter.Convert(target.EndPoint), + _contextStack.Current.SpeckleUnits + ) + { + length = target.Length, + domain = new SOP.Interval(0, target.Length), + bbox = _boxConverter.Convert(target.GeometricExtents) + }; +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBSolid3dToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBSolid3dToSpeckleRawConverter.cs new file mode 100644 index 000000000..45c2d531a --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBSolid3dToSpeckleRawConverter.cs @@ -0,0 +1,84 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class Solid3dToSpeckleRawConverter : ITypedConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly ITypedConverter _boxConverter; + private readonly IConversionContextStack _contextStack; + + public Solid3dToSpeckleRawConverter( + ITypedConverter pointConverter, + ITypedConverter boxConverter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _boxConverter = boxConverter; + _contextStack = contextStack; + } + + public Base Convert(object target) => Convert((ADB.Solid3d)target); + + public SOG.Mesh Convert(ADB.Solid3d target) + { + using ABR.Brep brep = new(target); + if (brep.IsNull) + { + throw new SpeckleConversionException("Could not retrieve brep from the solid3d."); + } + + var vertices = new List(); + var faces = new List(); + + // create mesh from solid with mesh filter + using ABR.Mesh2dControl control = new(); + control.MaxSubdivisions = 10000; // POC: these settings may need adjusting + using ABR.Mesh2dFilter filter = new(); + filter.Insert(brep, control); + using ABR.Mesh2d m = new(filter); + foreach (ABR.Element2d e in m.Element2ds) + { + // get vertices + List faceIndices = new(); + foreach (ABR.Node n in e.Nodes) + { + faceIndices.Add(vertices.Count); + vertices.Add(n.Point); + n.Dispose(); + } + + // get faces + List faceList = new() { e.Nodes.Count() }; + for (int i = 0; i < e.Nodes.Count(); i++) + { + faceList.Add(faceIndices[i]); + } + + faces.AddRange(faceList); + + e.Dispose(); + } + + // mesh props + var convertedVertices = vertices.SelectMany(o => _pointConverter.Convert(o).ToList()).ToList(); + double volume = target.MassProperties.Volume; + double area = target.Area; + SOG.Box bbox = _boxConverter.Convert(target.GeometricExtents); + + // create speckle mesh + SOG.Mesh mesh = + new(convertedVertices, faces) + { + units = _contextStack.Current.SpeckleUnits, + bbox = bbox, + area = area, + volume = volume + }; + + return mesh; + } +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBSplineToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBSplineToSpeckleRawConverter.cs new file mode 100644 index 000000000..d46b9de0a --- /dev/null +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/DBSplineToSpeckleRawConverter.cs @@ -0,0 +1,155 @@ +using Autodesk.AutoCAD.Geometry; +using Speckle.Converters.Autocad.Extensions; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Autocad.ToSpeckle.Raw; + +public class DBSplineToSpeckleRawConverter : ITypedConverter +{ + private readonly ITypedConverter _intervalConverter; + private readonly ITypedConverter _boxConverter; + private readonly IConversionContextStack _contextStack; + + public DBSplineToSpeckleRawConverter( + ITypedConverter intervalConverter, + ITypedConverter boxConverter, + IConversionContextStack contextStack + ) + { + _intervalConverter = intervalConverter; + _boxConverter = boxConverter; + _contextStack = contextStack; + } + + public Base Convert(object target) => Convert((ADB.Spline)target); + + public SOG.Curve Convert(ADB.Spline target) + { + // get nurbs and geo data + ADB.NurbsData data = target.NurbsData; + + // POC: HACK: check for incorrectly closed periodic curves (this seems like acad bug, has resulted from receiving rhino curves) + bool periodicClosed = false; + double length = 0; + SOP.Interval domain = new(); + if (target.GetGeCurve() is NurbCurve3d nurbs) + { + length = nurbs.GetLength(nurbs.StartParameter, nurbs.EndParameter, 0.001); + domain = _intervalConverter.Convert(nurbs.GetInterval()); + if (nurbs.Knots.Count < nurbs.NumberOfControlPoints + nurbs.Degree + 1 && target.IsPeriodic) + { + periodicClosed = true; + } + } + + // get points + List points = new(); + foreach (Point3d point in data.GetControlPoints().OfType()) + { + points.Add(point); + } + + // NOTE: for closed periodic splines, autocad does not track last #degree points. + // Add the first #degree control points to the list if so. + if (periodicClosed) + { + points.AddRange(points.GetRange(0, target.Degree)); + } + + // get knots + // NOTE: for closed periodic splines, autocad has #control points + 1 knots. + // Add #degree extra knots to beginning and end with #degree - 1 multiplicity for first and last + var knots = data.GetKnots().OfType().ToList(); + if (periodicClosed) + { + double interval = knots[1] - knots[0]; //knot interval + + for (int i = 0; i < data.Degree; i++) + { + if (i < 2) + { + knots.Insert(knots.Count, knots[^1] + interval); + knots.Insert(0, knots[0] - interval); + } + else + { + knots.Insert(knots.Count, knots[^1]); + knots.Insert(0, knots[0]); + } + } + } + + // get weights + // NOTE: autocad assigns unweighted points a value of -1, and will return an empty list in the spline's nurbsdata if no points are weighted + // NOTE: for closed periodic splines, autocad does not track last #degree points. Add the first #degree weights to the list if so. + List weights = new(); + for (int i = 0; i < target.NumControlPoints; i++) + { + double weight = target.WeightAt(i); + weights.Add(weight <= 0 ? 1 : weight); + } + + if (periodicClosed) + { + weights.AddRange(weights.GetRange(0, target.Degree)); + } + + // set nurbs curve info + var curve = new SOG.Curve + { + points = points.SelectMany(o => o.ToArray()).ToList(), + knots = knots, + weights = weights, + degree = target.Degree, + periodic = target.IsPeriodic, + rational = target.IsRational, + closed = periodicClosed || target.Closed, + length = length, + domain = domain, + bbox = _boxConverter.Convert(target.GeometricExtents), + units = _contextStack.Current.SpeckleUnits + }; + + // POC: get display value if this is a database-resident spline + // POC: if this is called by another converter that has created a spline, assumes the display value is set by that converter + if (target.Database is not null) + { + curve.displayValue = GetDisplayValue(target); + } + + return curve; + } + + // POC: we might have DisplayValue converter/mapper? + private SOG.Polyline GetDisplayValue(ADB.Spline spline) + { + ADB.Curve polySpline = spline.ToPolylineWithPrecision(10, false, false); + List verticesList = new(); + switch (polySpline) + { + case ADB.Polyline2d o: + verticesList = o.GetSubEntities( + ADB.OpenMode.ForRead, + _contextStack.Current.Document.TransactionManager.TopTransaction + ) + .Where(e => e.VertexType != ADB.Vertex2dType.SplineControlVertex) // POC: not validated yet! + .SelectMany(o => o.Position.ToArray()) + .ToList(); + + break; + case ADB.Polyline3d o: + verticesList = o.GetSubEntities( + ADB.OpenMode.ForRead, + _contextStack.Current.Document.TransactionManager.TopTransaction + ) + .Where(e => e.VertexType != ADB.Vertex3dType.ControlVertex) + .SelectMany(o => o.Position.ToArray()) + .ToList(); + break; + } + + return verticesList.ConvertToSpecklePolyline(_contextStack.Current.SpeckleUnits); + } +} diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/PlaneToSpeckleRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/PlaneToSpeckleRawConverter.cs index 4c5bc6f1c..5e712b033 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/PlaneToSpeckleRawConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/PlaneToSpeckleRawConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Raw; -public class PlaneToSpeckleRawConverter : IToSpeckleTopLevelConverter, ITypedConverter +public class PlaneToSpeckleRawConverter : ITypedConverter { private readonly ITypedConverter _vectorConverter; private readonly ITypedConverter _pointConverter; diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/Civil3dConverterModule.cs b/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/Civil3dConverterModule.cs new file mode 100644 index 000000000..193648613 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/Civil3dConverterModule.cs @@ -0,0 +1,24 @@ +using Autodesk.AutoCAD.ApplicationServices; +using Speckle.Autofac.DependencyInjection; +using Speckle.Converters.Civil3d; +using Speckle.Converters.Common; +using Speckle.Converters.Common.DependencyInjection; +using Autodesk.AutoCAD.DatabaseServices; +using Speckle.Converters.Autocad; + +namespace Speckle.Converters.Civil3d2024.DependencyInjection; + +public class Civil3dConverterModule : ISpeckleModule +{ + public void Load(SpeckleContainerBuilder builder) + { + // Register single root + builder.AddRootCommon(); + + // register all application converters + builder.AddApplicationConverters(); + builder.AddApplicationConverters(); + builder.AddScoped, Civil3dConversionContextStack>(); + builder.AddScoped, AutocadConversionContextStack>(); + } +} diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/Speckle.Converters.Civil3d2024.DependencyInjection.csproj b/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/Speckle.Converters.Civil3d2024.DependencyInjection.csproj new file mode 100644 index 000000000..9cbf64f01 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/Speckle.Converters.Civil3d2024.DependencyInjection.csproj @@ -0,0 +1,17 @@ + + + + net48 + x64 + + + + + + + + + + + + diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/packages.lock.json b/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/packages.lock.json new file mode 100644 index 000000000..d11a6d91e --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2024.DependencyInjection/packages.lock.json @@ -0,0 +1,448 @@ +{ + "version": 2, + "dependencies": { + ".NETFramework,Version=v4.8": { + "Autofac": { + "type": "Direct", + "requested": "[5.2.0, )", + "resolved": "5.2.0", + "contentHash": "V8dBH0dsv75uDzl7Sw+HkhKDPUw2eXnlMjcSVMH+tLo2s67MpTKGyDj1pDcpR+IF2u4YRs0s3/x7R88YJzIWvg==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.0" + } + }, + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "PolySharp": { + "type": "Direct", + "requested": "[1.14.1, )", + "resolved": "1.14.1", + "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" + }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, + "GraphQL.Client": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0", + "GraphQL.Client.Abstractions.Websocket": "6.0.0", + "System.Net.WebSockets.Client.Managed": "1.0.22", + "System.Reactive": "5.0.0" + } + }, + "GraphQL.Client.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==", + "dependencies": { + "GraphQL.Primitives": "6.0.0" + } + }, + "GraphQL.Client.Abstractions.Websocket": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0" + } + }, + "GraphQL.Primitives": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==" + }, + "Microsoft.Data.Sqlite": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==", + "dependencies": { + "Microsoft.Data.Sqlite.Core": "7.0.5", + "SQLitePCLRaw.bundle_e_sqlite3": "2.1.4" + } + }, + "Microsoft.Data.Sqlite.Core": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "Polly": { + "type": "Transitive", + "resolved": "7.2.3", + "contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ==" + }, + "Polly.Contrib.WaitAndRetry": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA==" + }, + "Polly.Extensions.Http": { + "type": "Transitive", + "resolved": "3.0.0", + "contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==", + "dependencies": { + "Polly": "7.1.0" + } + }, + "Sentry": { + "type": "Transitive", + "resolved": "3.33.0", + "contentHash": "8vbD2o6IR2wrRrkSiRbnodWGWUOqIlwYtzpjvPNOb5raJdOf+zxMwfS8f6nx9bmrTTfDj7KrCB8C/5OuicAc8A==", + "dependencies": { + "System.Reflection.Metadata": "5.0.0", + "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", + "System.Text.Json": "5.0.2" + } + }, + "Sentry.Serilog": { + "type": "Transitive", + "resolved": "3.33.0", + "contentHash": "V8BU7QGWg2qLYfNPqtuTBhC1opysny5l+Ifp6J6PhOeAxU0FssR7nYfbJVetrnLIoh2rd3DlJ6hHYYQosQYcUQ==", + "dependencies": { + "Sentry": "3.33.0", + "Serilog": "2.7.1" + } + }, + "Serilog": { + "type": "Transitive", + "resolved": "2.12.0", + "contentHash": "xaiJLIdu6rYMKfQMYUZgTy8YK7SMZjB4Yk50C/u//Z4OsvxkUfSPJy4nknfvwAC34yr13q7kcyh4grbwhSxyZg==" + }, + "Serilog.Enrichers.ClientInfo": { + "type": "Transitive", + "resolved": "1.3.0", + "contentHash": "mTc7PM+wC9Hr7LWSwqt5mmnlAr7RJs+eTb3PGPRhwdOackk95MkhUZognuxXEdlW19HAFNmEBTSBY5DfLwM8jQ==", + "dependencies": { + "Serilog": "2.4.0" + } + }, + "Serilog.Exceptions": { + "type": "Transitive", + "resolved": "8.4.0", + "contentHash": "nc/+hUw3lsdo0zCj0KMIybAu7perMx79vu72w0za9Nsi6mWyNkGXxYxakAjWB7nEmYL6zdmhEQRB4oJ2ALUeug==", + "dependencies": { + "Serilog": "2.8.0" + } + }, + "Serilog.Formatting.Compact": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "pNroKVjo+rDqlxNG5PXkRLpfSCuDOBY0ri6jp9PLe505ljqwhwZz8ospy2vWhQlFu5GkIesh3FcDs4n7sWZODA==", + "dependencies": { + "Serilog": "2.8.0" + } + }, + "Serilog.Sinks.Console": { + "type": "Transitive", + "resolved": "4.1.0", + "contentHash": "K6N5q+5fetjnJPvCmkWOpJ/V8IEIoMIB1s86OzBrbxwTyHxdx3pmz4H+8+O/Dc/ftUX12DM1aynx/dDowkwzqg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.File": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.PeriodicBatching": { + "type": "Transitive", + "resolved": "3.1.0", + "contentHash": "NDWR7m3PalVlGEq3rzoktrXikjFMLmpwF0HI4sowo8YDdU+gqPlTHlDQiOGxHfB0sTfjPA9JjA7ctKG9zqjGkw==", + "dependencies": { + "Serilog": "2.0.0" + } + }, + "Serilog.Sinks.Seq": { + "type": "Transitive", + "resolved": "5.2.2", + "contentHash": "1Csmo5ua7NKUe0yXUx+zsRefjAniPWcXFhUXxXG8pwo0iMiw2gjn9SOkgYnnxbgWqmlGv236w0N/dHc2v5XwMg==", + "dependencies": { + "Serilog": "2.12.0", + "Serilog.Formatting.Compact": "1.1.0", + "Serilog.Sinks.File": "5.0.0", + "Serilog.Sinks.PeriodicBatching": "3.1.0" + } + }, + "SerilogTimings": { + "type": "Transitive", + "resolved": "3.0.1", + "contentHash": "Zs28eTgszAMwpIrbBnWHBI50yuxL50p/dmAUWmy75+axdZYK/Sjm5/5m1N/CisR8acJUhTVcjPZrsB1P5iv0Uw==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Speckle.Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.2", + "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" + }, + "SQLitePCLRaw.bundle_e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==", + "dependencies": { + "SQLitePCLRaw.lib.e_sqlite3": "2.1.4", + "SQLitePCLRaw.provider.dynamic_cdecl": "2.1.4" + } + }, + "SQLitePCLRaw.core": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==", + "dependencies": { + "System.Memory": "4.5.3" + } + }, + "SQLitePCLRaw.lib.e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg==" + }, + "SQLitePCLRaw.provider.dynamic_cdecl": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "ZsaKKhgYF9B1fvcnOGKl3EycNAwd9CRWX7v0rEfuPWhQQ5Jjpvf2VEHahiLIGHio3hxi3EIKFJw9KvyowWOUAw==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "System.Buffers": { + "type": "Transitive", + "resolved": "4.5.1", + "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" + }, + "System.Collections.Immutable": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==", + "dependencies": { + "System.Memory": "4.5.4" + } + }, + "System.DoubleNumerics": { + "type": "Transitive", + "resolved": "3.1.3", + "contentHash": "KRKEM/L3KBodjA9VOg3EifFVWUY6EOqaMB05UvPEDm7Zeby/kZW+4kdWUEPzW6xtkwf46p661L9NrbeeQhtLzw==", + "dependencies": { + "NETStandard.Library": "1.6.1" + } + }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + } + }, + "System.Net.WebSockets.Client.Managed": { + "type": "Transitive", + "resolved": "1.0.22", + "contentHash": "WqEOxPlXjuZrIjUtXNE9NxEfU/n5E35iV2PtoZdJSUC4tlrqwHnTee+wvMIM4OUaJWmwrymeqcgYrE0IkGAgLA==", + "dependencies": { + "System.Buffers": "4.4.0", + "System.Numerics.Vectors": "4.4.0" + } + }, + "System.Numerics.Vectors": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" + }, + "System.Reactive": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "System.Reflection.Metadata": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==", + "dependencies": { + "System.Collections.Immutable": "5.0.0" + } + }, + "System.Runtime.CompilerServices.Unsafe": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==" + }, + "System.Runtime.InteropServices.RuntimeInformation": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==" + }, + "System.Text.Encodings.Web": { + "type": "Transitive", + "resolved": "5.0.1", + "contentHash": "KmJ+CJXizDofbq6mpqDoRRLcxgOd2z9X3XoFNULSbvbqVRZkFX3istvr+MUjL6Zw1RT+RNdoI4GYidIINtgvqQ==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4" + } + }, + "System.Text.Json": { + "type": "Transitive", + "resolved": "5.0.2", + "contentHash": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "5.0.0", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "5.0.0", + "System.Text.Encodings.Web": "5.0.1", + "System.Threading.Tasks.Extensions": "4.5.4", + "System.ValueTuple": "4.5.0" + } + }, + "System.Threading.Tasks.Extensions": { + "type": "Transitive", + "resolved": "4.5.4", + "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + } + }, + "System.ValueTuple": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==" + }, + "speckle.autofac": { + "type": "Project", + "dependencies": { + "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )" + } + }, + "speckle.converters.civil3d2024": { + "type": "Project", + "dependencies": { + "Speckle.AutoCAD.API": "[2024.0.0, )", + "Speckle.Civil3D.API": "[2024.0.0, )", + "Speckle.Converters.Common": "[1.0.0, )" + } + }, + "speckle.converters.common": { + "type": "Project", + "dependencies": { + "Speckle.Autofac": "[1.0.0, )", + "Speckle.Objects": "[3.0.1-alpha.14, )" + } + }, + "speckle.converters.common.dependencyinjection": { + "type": "Project", + "dependencies": { + "Speckle.Autofac": "[1.0.0, )", + "Speckle.Converters.Common": "[1.0.0, )" + } + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "CentralTransitive", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.5" + } + }, + "Speckle.AutoCAD.API": { + "type": "CentralTransitive", + "requested": "[2023.0.0, )", + "resolved": "2024.0.0", + "contentHash": "pZZ5uI+NXhZaQnsqRkgp/rywqBAjDObDJ9XNFGJvemT5k2OthDpHzlK/mKxz8QDCYie7uImQ8dv3uWj2QUFDPw==" + }, + "Speckle.Civil3D.API": { + "type": "CentralTransitive", + "requested": "[2024.0.0, )", + "resolved": "2024.0.0", + "contentHash": "9Q7M1k0DotN8w7MkiScQezErRdnZ4dAkxBMcPNhHSWoth/lSaT6UPV1aYEdl90RhehJWG4l3O7U2e3OXvVSFdw==", + "dependencies": { + "Speckle.AutoCAD.API": "2024.0.0" + } + }, + "Speckle.Core": { + "type": "CentralTransitive", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "dependencies": { + "GraphQL.Client": "6.0.0", + "Microsoft.CSharp": "4.7.0", + "Microsoft.Data.Sqlite": "7.0.5", + "Polly": "7.2.3", + "Polly.Contrib.WaitAndRetry": "1.1.1", + "Polly.Extensions.Http": "3.0.0", + "Sentry": "3.33.0", + "Sentry.Serilog": "3.33.0", + "Serilog": "2.12.0", + "Serilog.Enrichers.ClientInfo": "1.3.0", + "Serilog.Exceptions": "8.4.0", + "Serilog.Sinks.Console": "4.1.0", + "Serilog.Sinks.Seq": "5.2.2", + "SerilogTimings": "3.0.1", + "Speckle.Newtonsoft.Json": "13.0.2", + "System.DoubleNumerics": "3.1.3" + } + }, + "Speckle.Objects": { + "type": "CentralTransitive", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", + "dependencies": { + "Speckle.Core": "3.0.1-alpha.14" + } + } + } + } +} \ No newline at end of file diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2024/Speckle.Converters.Civil3d2024.csproj b/Converters/Civil3d/Speckle.Converters.Civil3d2024/Speckle.Converters.Civil3d2024.csproj new file mode 100644 index 000000000..34ef592b7 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2024/Speckle.Converters.Civil3d2024.csproj @@ -0,0 +1,21 @@ + + + + net48 + x64 + + + + + + + + + + + + + + + + diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2024/packages.lock.json b/Converters/Civil3d/Speckle.Converters.Civil3d2024/packages.lock.json new file mode 100644 index 000000000..ee91f00d0 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2024/packages.lock.json @@ -0,0 +1,424 @@ +{ + "version": 2, + "dependencies": { + ".NETFramework,Version=v4.8": { + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "PolySharp": { + "type": "Direct", + "requested": "[1.14.1, )", + "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, )", + "resolved": "2024.0.0", + "contentHash": "9Q7M1k0DotN8w7MkiScQezErRdnZ4dAkxBMcPNhHSWoth/lSaT6UPV1aYEdl90RhehJWG4l3O7U2e3OXvVSFdw==", + "dependencies": { + "Speckle.AutoCAD.API": "2024.0.0" + } + }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, + "GraphQL.Client": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0", + "GraphQL.Client.Abstractions.Websocket": "6.0.0", + "System.Net.WebSockets.Client.Managed": "1.0.22", + "System.Reactive": "5.0.0" + } + }, + "GraphQL.Client.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==", + "dependencies": { + "GraphQL.Primitives": "6.0.0" + } + }, + "GraphQL.Client.Abstractions.Websocket": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0" + } + }, + "GraphQL.Primitives": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==" + }, + "Microsoft.Data.Sqlite": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==", + "dependencies": { + "Microsoft.Data.Sqlite.Core": "7.0.5", + "SQLitePCLRaw.bundle_e_sqlite3": "2.1.4" + } + }, + "Microsoft.Data.Sqlite.Core": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "Polly": { + "type": "Transitive", + "resolved": "7.2.3", + "contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ==" + }, + "Polly.Contrib.WaitAndRetry": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA==" + }, + "Polly.Extensions.Http": { + "type": "Transitive", + "resolved": "3.0.0", + "contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==", + "dependencies": { + "Polly": "7.1.0" + } + }, + "Sentry": { + "type": "Transitive", + "resolved": "3.33.0", + "contentHash": "8vbD2o6IR2wrRrkSiRbnodWGWUOqIlwYtzpjvPNOb5raJdOf+zxMwfS8f6nx9bmrTTfDj7KrCB8C/5OuicAc8A==", + "dependencies": { + "System.Reflection.Metadata": "5.0.0", + "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", + "System.Text.Json": "5.0.2" + } + }, + "Sentry.Serilog": { + "type": "Transitive", + "resolved": "3.33.0", + "contentHash": "V8BU7QGWg2qLYfNPqtuTBhC1opysny5l+Ifp6J6PhOeAxU0FssR7nYfbJVetrnLIoh2rd3DlJ6hHYYQosQYcUQ==", + "dependencies": { + "Sentry": "3.33.0", + "Serilog": "2.7.1" + } + }, + "Serilog": { + "type": "Transitive", + "resolved": "2.12.0", + "contentHash": "xaiJLIdu6rYMKfQMYUZgTy8YK7SMZjB4Yk50C/u//Z4OsvxkUfSPJy4nknfvwAC34yr13q7kcyh4grbwhSxyZg==" + }, + "Serilog.Enrichers.ClientInfo": { + "type": "Transitive", + "resolved": "1.3.0", + "contentHash": "mTc7PM+wC9Hr7LWSwqt5mmnlAr7RJs+eTb3PGPRhwdOackk95MkhUZognuxXEdlW19HAFNmEBTSBY5DfLwM8jQ==", + "dependencies": { + "Serilog": "2.4.0" + } + }, + "Serilog.Exceptions": { + "type": "Transitive", + "resolved": "8.4.0", + "contentHash": "nc/+hUw3lsdo0zCj0KMIybAu7perMx79vu72w0za9Nsi6mWyNkGXxYxakAjWB7nEmYL6zdmhEQRB4oJ2ALUeug==", + "dependencies": { + "Serilog": "2.8.0" + } + }, + "Serilog.Formatting.Compact": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "pNroKVjo+rDqlxNG5PXkRLpfSCuDOBY0ri6jp9PLe505ljqwhwZz8ospy2vWhQlFu5GkIesh3FcDs4n7sWZODA==", + "dependencies": { + "Serilog": "2.8.0" + } + }, + "Serilog.Sinks.Console": { + "type": "Transitive", + "resolved": "4.1.0", + "contentHash": "K6N5q+5fetjnJPvCmkWOpJ/V8IEIoMIB1s86OzBrbxwTyHxdx3pmz4H+8+O/Dc/ftUX12DM1aynx/dDowkwzqg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.File": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.PeriodicBatching": { + "type": "Transitive", + "resolved": "3.1.0", + "contentHash": "NDWR7m3PalVlGEq3rzoktrXikjFMLmpwF0HI4sowo8YDdU+gqPlTHlDQiOGxHfB0sTfjPA9JjA7ctKG9zqjGkw==", + "dependencies": { + "Serilog": "2.0.0" + } + }, + "Serilog.Sinks.Seq": { + "type": "Transitive", + "resolved": "5.2.2", + "contentHash": "1Csmo5ua7NKUe0yXUx+zsRefjAniPWcXFhUXxXG8pwo0iMiw2gjn9SOkgYnnxbgWqmlGv236w0N/dHc2v5XwMg==", + "dependencies": { + "Serilog": "2.12.0", + "Serilog.Formatting.Compact": "1.1.0", + "Serilog.Sinks.File": "5.0.0", + "Serilog.Sinks.PeriodicBatching": "3.1.0" + } + }, + "SerilogTimings": { + "type": "Transitive", + "resolved": "3.0.1", + "contentHash": "Zs28eTgszAMwpIrbBnWHBI50yuxL50p/dmAUWmy75+axdZYK/Sjm5/5m1N/CisR8acJUhTVcjPZrsB1P5iv0Uw==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Speckle.Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.2", + "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" + }, + "SQLitePCLRaw.bundle_e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==", + "dependencies": { + "SQLitePCLRaw.lib.e_sqlite3": "2.1.4", + "SQLitePCLRaw.provider.dynamic_cdecl": "2.1.4" + } + }, + "SQLitePCLRaw.core": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==", + "dependencies": { + "System.Memory": "4.5.3" + } + }, + "SQLitePCLRaw.lib.e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg==" + }, + "SQLitePCLRaw.provider.dynamic_cdecl": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "ZsaKKhgYF9B1fvcnOGKl3EycNAwd9CRWX7v0rEfuPWhQQ5Jjpvf2VEHahiLIGHio3hxi3EIKFJw9KvyowWOUAw==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "System.Buffers": { + "type": "Transitive", + "resolved": "4.5.1", + "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" + }, + "System.Collections.Immutable": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==", + "dependencies": { + "System.Memory": "4.5.4" + } + }, + "System.DoubleNumerics": { + "type": "Transitive", + "resolved": "3.1.3", + "contentHash": "KRKEM/L3KBodjA9VOg3EifFVWUY6EOqaMB05UvPEDm7Zeby/kZW+4kdWUEPzW6xtkwf46p661L9NrbeeQhtLzw==", + "dependencies": { + "NETStandard.Library": "1.6.1" + } + }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + } + }, + "System.Net.WebSockets.Client.Managed": { + "type": "Transitive", + "resolved": "1.0.22", + "contentHash": "WqEOxPlXjuZrIjUtXNE9NxEfU/n5E35iV2PtoZdJSUC4tlrqwHnTee+wvMIM4OUaJWmwrymeqcgYrE0IkGAgLA==", + "dependencies": { + "System.Buffers": "4.4.0", + "System.Numerics.Vectors": "4.4.0" + } + }, + "System.Numerics.Vectors": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" + }, + "System.Reactive": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "System.Reflection.Metadata": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==", + "dependencies": { + "System.Collections.Immutable": "5.0.0" + } + }, + "System.Runtime.CompilerServices.Unsafe": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==" + }, + "System.Runtime.InteropServices.RuntimeInformation": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==" + }, + "System.Text.Encodings.Web": { + "type": "Transitive", + "resolved": "5.0.1", + "contentHash": "KmJ+CJXizDofbq6mpqDoRRLcxgOd2z9X3XoFNULSbvbqVRZkFX3istvr+MUjL6Zw1RT+RNdoI4GYidIINtgvqQ==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4" + } + }, + "System.Text.Json": { + "type": "Transitive", + "resolved": "5.0.2", + "contentHash": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "5.0.0", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "5.0.0", + "System.Text.Encodings.Web": "5.0.1", + "System.Threading.Tasks.Extensions": "4.5.4", + "System.ValueTuple": "4.5.0" + } + }, + "System.Threading.Tasks.Extensions": { + "type": "Transitive", + "resolved": "4.5.4", + "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + } + }, + "System.ValueTuple": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==" + }, + "speckle.autofac": { + "type": "Project", + "dependencies": { + "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )" + } + }, + "speckle.converters.common": { + "type": "Project", + "dependencies": { + "Speckle.Autofac": "[1.0.0, )", + "Speckle.Objects": "[3.0.1-alpha.14, )" + } + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "CentralTransitive", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.5" + } + }, + "Speckle.Core": { + "type": "CentralTransitive", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", + "dependencies": { + "GraphQL.Client": "6.0.0", + "Microsoft.CSharp": "4.7.0", + "Microsoft.Data.Sqlite": "7.0.5", + "Polly": "7.2.3", + "Polly.Contrib.WaitAndRetry": "1.1.1", + "Polly.Extensions.Http": "3.0.0", + "Sentry": "3.33.0", + "Sentry.Serilog": "3.33.0", + "Serilog": "2.12.0", + "Serilog.Enrichers.ClientInfo": "1.3.0", + "Serilog.Exceptions": "8.4.0", + "Serilog.Sinks.Console": "4.1.0", + "Serilog.Sinks.Seq": "5.2.2", + "SerilogTimings": "3.0.1", + "Speckle.Newtonsoft.Json": "13.0.2", + "System.DoubleNumerics": "3.1.3" + } + }, + "Speckle.Objects": { + "type": "CentralTransitive", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", + "dependencies": { + "Speckle.Core": "3.0.1-alpha.14" + } + } + } + } +} \ No newline at end of file diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dConversionContextStack.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dConversionContextStack.cs new file mode 100644 index 000000000..0d803db25 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dConversionContextStack.cs @@ -0,0 +1,38 @@ +using System.Diagnostics.CodeAnalysis; +using Speckle.Converters.Common; + +namespace Speckle.Converters.Civil3d; + +// POC: Suppressed naming warning for now, but we should evaluate if we should follow this or disable it. +[SuppressMessage( + "Naming", + "CA1711:Identifiers should not have incorrect suffix", + Justification = "Name ends in Stack but it is in fact a Stack, just not inheriting from `System.Collections.Stack`" +)] +public class Civil3dConversionContextStack : ConversionContextStack +{ + public Civil3dConversionContextStack(IHostToSpeckleUnitConverter unitConverter) + : base( + Application.DocumentManager.CurrentDocument, + GetDocBuiltInUnit(Application.DocumentManager.CurrentDocument), + unitConverter + ) { } + + private static AAEC.BuiltInUnit GetDocBuiltInUnit(Document doc) + { + AAEC.BuiltInUnit unit = AAEC.BuiltInUnit.Dimensionless; + + using (ADB.Transaction tr = doc.Database.TransactionManager.StartTransaction()) + { + ADB.ObjectId id = AAEC.ApplicationServices.DrawingSetupVariables.GetInstance(doc.Database, false); + if (tr.GetObject(id, ADB.OpenMode.ForRead) is AAEC.ApplicationServices.DrawingSetupVariables setupVariables) + { + unit = setupVariables.LinearUnit; + } + + tr.Commit(); + } + + return unit; + } +} diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dRootToHostConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dRootToHostConverter.cs new file mode 100644 index 000000000..265cd3a79 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dRootToHostConverter.cs @@ -0,0 +1,59 @@ +using Autodesk.AutoCAD.DatabaseServices; +using Speckle.Autofac.DependencyInjection; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.Civil3d; + +public class Civil3dRootToHostConverter : IRootToSpeckleConverter +{ + private readonly IFactory _toSpeckle; + private readonly IConversionContextStack _contextStack; + + public Civil3dRootToHostConverter( + IFactory toSpeckle, + IConversionContextStack contextStack + ) + { + _toSpeckle = toSpeckle; + _contextStack = contextStack; + } + + public Base Convert(object target) + { + if (target is not DBObject dbObject) + { + throw new NotSupportedException( + $"Conversion of {target.GetType().Name} to Speckle is not supported. Only objects that inherit from DBObject are." + ); + } + + Type type = dbObject.GetType(); + + try + { + using (var l = _contextStack.Current.Document.LockDocument()) + { + using (var tr = _contextStack.Current.Document.Database.TransactionManager.StartTransaction()) + { + var objectConverter = _toSpeckle.ResolveInstance(type.Name); + + if (objectConverter == null) + { + throw new NotSupportedException($"No conversion found for {target.GetType().Name}"); + } + + var convertedObject = objectConverter.Convert(dbObject); + tr.Commit(); + return convertedObject; + } + } + } + catch (SpeckleConversionException e) + { + Console.WriteLine(e); + throw; // Just rethrowing for now, Logs may be needed here. + } + } +} diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dToSpeckleUnitConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dToSpeckleUnitConverter.cs new file mode 100644 index 000000000..0c61621a4 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dToSpeckleUnitConverter.cs @@ -0,0 +1,39 @@ +using Speckle.Converters.Common; +using Speckle.Core.Kits; +using Speckle.Core.Logging; // POC: boy do I think this is the wrong place for SpeckleException! + +namespace Speckle.Converters.Civil3d; + +public class Civil3dToSpeckleUnitConverter : IHostToSpeckleUnitConverter +{ + private static readonly IReadOnlyDictionary s_unitsMapping = Create(); + + private static IReadOnlyDictionary Create() + { + var dict = new Dictionary(); + + // POC: we should have a unit test to confirm these are as expected and don't change + dict[AAEC.BuiltInUnit.Kilometer] = Units.Kilometers; + dict[AAEC.BuiltInUnit.Meter] = Units.Meters; + dict[AAEC.BuiltInUnit.Centimeter] = Units.Centimeters; + dict[AAEC.BuiltInUnit.Millimeter] = Units.Millimeters; + dict[AAEC.BuiltInUnit.Mile] = Units.Miles; + dict[AAEC.BuiltInUnit.Yards] = Units.Yards; + dict[AAEC.BuiltInUnit.Foot] = Units.Feet; + dict[AAEC.BuiltInUnit.SurveyFoot] = Units.USFeet; + dict[AAEC.BuiltInUnit.Inch] = Units.Inches; + dict[AAEC.BuiltInUnit.Dimensionless] = Units.None; + return dict; + } + + public string ConvertOrThrow(AAEC.BuiltInUnit hostUnit) + { + if (s_unitsMapping.TryGetValue(hostUnit, out string value)) + { + return value; + } + + // POC: probably would prefer something more specific + throw new SpeckleException($"The Unit System \"{hostUnit}\" is unsupported."); + } +} diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/GlobalUsings.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/GlobalUsings.cs new file mode 100644 index 000000000..c4134c866 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/GlobalUsings.cs @@ -0,0 +1,3 @@ +global using AAEC = Autodesk.Aec; +global using CDB = Autodesk.Civil.DatabaseServices; +global using SOBE = Objects.BuiltElements; diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.projitems b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.projitems new file mode 100644 index 000000000..1dc6ebd3b --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.projitems @@ -0,0 +1,19 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 35175682-da83-4c0a-a49d-b191f5885d8e + + + Speckle.Converters.Civil3dShared + + + + + + + + + + \ No newline at end of file diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.shproj b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.shproj new file mode 100644 index 000000000..ab81b391e --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.shproj @@ -0,0 +1,13 @@ + + + + 35175682-da83-4c0a-a49d-b191f5885d8e + 14.0 + + + + + + + + diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/BuiltElements/PipeToSpeckleConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/BuiltElements/PipeToSpeckleConverter.cs new file mode 100644 index 000000000..f061a890b --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/BuiltElements/PipeToSpeckleConverter.cs @@ -0,0 +1,60 @@ +using Objects; +using Objects.Other; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; +using AECPropDB = Autodesk.Aec.PropertyData.DatabaseServices; + +namespace Speckle.Converters.Civil3d.ToSpeckle.BuiltElements; + +[NameAndRankValue(nameof(CDB.Pipe), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +public class PipeToSpeckleConverter : IToSpeckleTopLevelConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly ITypedConverter _curveConverter; + private readonly ITypedConverter _boxConverter; + private readonly ITypedConverter _solidConverter; + private readonly ITypedConverter> _propertySetConverter; + private readonly IConversionContextStack _contextStack; + + public PipeToSpeckleConverter( + ITypedConverter pointConverter, + ITypedConverter curveConverter, + ITypedConverter boxConverter, + ITypedConverter solidConverter, + ITypedConverter> propertySetConverter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _curveConverter = curveConverter; + _boxConverter = boxConverter; + _solidConverter = solidConverter; + _propertySetConverter = propertySetConverter; + _contextStack = contextStack; + } + + public Base Convert(object target) => Convert((CDB.Pipe)target); + + public SOBE.Pipe Convert(CDB.Pipe target) + { + ICurve curve = _curveConverter.Convert(target.BaseCurve); + SOG.Mesh pipeMesh = _solidConverter.Convert(target.Solid3dBody); + + SOBE.Pipe specklePipe = + new() + { + baseCurve = curve, + diameter = target.InnerDiameterOrWidth, + length = target.Length3DToInsideEdge, + displayValue = new List { pipeMesh }, + units = _contextStack.Current.SpeckleUnits + }; + + // POC: not setting property sets yet, need to determine connector parameter interoperability + // POC: not setting part data yet, same reason as above + // POC: not setting additional pipe properties, probably should scope a CivilPipe class + + return specklePipe; + } +} diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/PropertySetToSpeckleRawConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/PropertySetToSpeckleRawConverter.cs new file mode 100644 index 000000000..d3576871c --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/PropertySetToSpeckleRawConverter.cs @@ -0,0 +1,55 @@ +using Objects.Other; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using AECPropDB = Autodesk.Aec.PropertyData.DatabaseServices; + +namespace Speckle.Converters.Civil3d.ToSpeckle.Raw; + +public class PropertySetToSpeckleRawConverter : ITypedConverter> +{ + private readonly ITypedConverter _vectorConverter; + private readonly ITypedConverter _pointConverter; + private readonly IConversionContextStack _contextStack; + + public PropertySetToSpeckleRawConverter( + ITypedConverter vectorConverter, + ITypedConverter pointConverter, + IConversionContextStack contextStack + ) + { + _vectorConverter = vectorConverter; + _pointConverter = pointConverter; + _contextStack = contextStack; + } + + public List Convert(object target) => Convert((AECPropDB.PropertySet)target); + + public List Convert(AECPropDB.PropertySet target) + { + List properties = new(); + + ADB.Transaction tr = _contextStack.Current.Document.TransactionManager.TopTransaction; + AECPropDB.PropertySetDefinition setDef = (AECPropDB.PropertySetDefinition) + tr.GetObject(target.PropertySetDefinition, ADB.OpenMode.ForRead); + + // get property definitions + var propDefs = new Dictionary(); + foreach (AECPropDB.PropertyDefinition def in setDef.Definitions) + { + propDefs.Add(def.Id, def); + } + + foreach (AECPropDB.PropertySetData data in target.PropertySetData) + { + string fieldName = propDefs.TryGetValue(data.Id, out AECPropDB.PropertyDefinition value) + ? value.Name + : data.FieldBucketId; + + object fieldData = data.GetData(); + DataField field = new(fieldName, fieldData.GetType().Name, data.UnitType.PluralName(false), fieldData); + properties.Add(field); + } + + return properties; + } +} diff --git a/Directory.Packages.props b/Directory.Packages.props index 1927c16b8..5ab4632db 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,12 +12,12 @@ - + diff --git a/Speckle.Connectors.sln b/Speckle.Connectors.sln index 67915ee02..c16b2e344 100644 --- a/Speckle.Connectors.sln +++ b/Speckle.Connectors.sln @@ -63,9 +63,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Autocad", "Autocad", "{804E EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Converters.AutocadShared", "Converters\Autocad\Speckle.Converters.AutocadShared\Speckle.Converters.AutocadShared.shproj", "{9ADD1B7A-6401-4202-8613-F668E2FBC0A4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Converters.Autocad2023", "Converters\Autocad\2023\Speckle.Converters.Autocad2023\Speckle.Converters.Autocad2023.csproj", "{631C295A-7CCF-4B42-8686-7034E31469E7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Converters.Autocad2023", "Converters\Autocad\Speckle.Converters.Autocad2023\Speckle.Converters.Autocad2023.csproj", "{631C295A-7CCF-4B42-8686-7034E31469E7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Converters.Autocad2023.DependencyInjection", "Converters\Autocad\2023\Speckle.Converters.Autocad2023.DependencyInjection\Speckle.Converters.Autocad2023.DependencyInjection.csproj", "{D940853C-003A-482C-BDB0-665367F274A0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Converters.Autocad2023.DependencyInjection", "Converters\Autocad\Speckle.Converters.Autocad2023.DependencyInjection\Speckle.Converters.Autocad2023.DependencyInjection.csproj", "{D940853C-003A-482C-BDB0-665367F274A0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Connectors.DUI.WebView", "DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj", "{7420652C-3046-4F38-BE64-9B9E69D76FA2}" EndProject @@ -79,6 +79,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{59E8E8F3 .github\workflows\ci.yml = .github\workflows\ci.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Connectors.Civil3d2024", "Connectors\Autocad\Speckle.Connectors.Civil3d2024\Speckle.Connectors.Civil3d2024.csproj", "{CA8EAE01-AB9F-4EC1-B6F3-73721487E9E1}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Converters.Civil3dShared", "Converters\Civil3d\Speckle.Converters.Civil3dShared\Speckle.Converters.Civil3dShared.shproj", "{35175682-DA83-4C0A-A49D-B191F5885D8E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Civil3d2024.DependencyInjection", "Converters\Civil3d\Speckle.Converters.Civil3d2024.DependencyInjection\Speckle.Converters.Civil3d2024.DependencyInjection.csproj", "{80F965C4-E2A8-4F54-985D-73D06E45F9CE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Autocad2024", "Converters\Autocad\Speckle.Converters.Autocad2024\Speckle.Converters.Autocad2024.csproj", "{C2DE264A-AA87-4012-B954-17E3F403A237}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Autocad2024.DependencyInjection", "Converters\Autocad\Speckle.Converters.Autocad2024.DependencyInjection\Speckle.Converters.Autocad2024.DependencyInjection.csproj", "{AF507D61-6766-4C20-9F58-23DC29508219}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Civil3d2024", "Converters\Civil3d\Speckle.Converters.Civil3d2024\Speckle.Converters.Civil3d2024.csproj", "{25172C49-7AA4-4739-BB07-69785094C379}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -161,6 +173,26 @@ Global {C50AA3E3-8C31-4131-9DEC-1D8B377D5A89}.Debug|Any CPU.Build.0 = Debug|Any CPU {C50AA3E3-8C31-4131-9DEC-1D8B377D5A89}.Release|Any CPU.ActiveCfg = Release|Any CPU {C50AA3E3-8C31-4131-9DEC-1D8B377D5A89}.Release|Any CPU.Build.0 = Release|Any CPU + {CA8EAE01-AB9F-4EC1-B6F3-73721487E9E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA8EAE01-AB9F-4EC1-B6F3-73721487E9E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA8EAE01-AB9F-4EC1-B6F3-73721487E9E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA8EAE01-AB9F-4EC1-B6F3-73721487E9E1}.Release|Any CPU.Build.0 = Release|Any CPU + {80F965C4-E2A8-4F54-985D-73D06E45F9CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80F965C4-E2A8-4F54-985D-73D06E45F9CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80F965C4-E2A8-4F54-985D-73D06E45F9CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80F965C4-E2A8-4F54-985D-73D06E45F9CE}.Release|Any CPU.Build.0 = Release|Any CPU + {C2DE264A-AA87-4012-B954-17E3F403A237}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C2DE264A-AA87-4012-B954-17E3F403A237}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C2DE264A-AA87-4012-B954-17E3F403A237}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C2DE264A-AA87-4012-B954-17E3F403A237}.Release|Any CPU.Build.0 = Release|Any CPU + {AF507D61-6766-4C20-9F58-23DC29508219}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF507D61-6766-4C20-9F58-23DC29508219}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF507D61-6766-4C20-9F58-23DC29508219}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF507D61-6766-4C20-9F58-23DC29508219}.Release|Any CPU.Build.0 = Release|Any CPU + {25172C49-7AA4-4739-BB07-69785094C379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25172C49-7AA4-4739-BB07-69785094C379}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25172C49-7AA4-4739-BB07-69785094C379}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25172C49-7AA4-4739-BB07-69785094C379}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {C9D4CA21-182B-4ED2-81BB-280A6FD713F6} = {2E00592E-558D-492D-88F9-3ECEE4C0C7DA} @@ -190,5 +222,11 @@ Global {D92751C8-1039-4005-90B2-913E55E0B8BD} = {42826721-9A18-4762-8BA9-F1429DD5C5B1} {9584AEE5-CD59-46E6-93E6-2DC2B5285B75} = {42826721-9A18-4762-8BA9-F1429DD5C5B1} {C50AA3E3-8C31-4131-9DEC-1D8B377D5A89} = {59E8E8F3-4E42-4E92-83B3-B1C2AB901D18} + {CA8EAE01-AB9F-4EC1-B6F3-73721487E9E1} = {804E065F-914C-414A-AF84-009312C3CFF6} + {35175682-DA83-4C0A-A49D-B191F5885D8E} = {804E065F-914C-414A-AF84-009312C3CFF6} + {80F965C4-E2A8-4F54-985D-73D06E45F9CE} = {804E065F-914C-414A-AF84-009312C3CFF6} + {C2DE264A-AA87-4012-B954-17E3F403A237} = {804E065F-914C-414A-AF84-009312C3CFF6} + {AF507D61-6766-4C20-9F58-23DC29508219} = {804E065F-914C-414A-AF84-009312C3CFF6} + {25172C49-7AA4-4739-BB07-69785094C379} = {804E065F-914C-414A-AF84-009312C3CFF6} EndGlobalSection EndGlobal