diff --git a/.circleci/scripts/config-template.yml b/.circleci/scripts/config-template.yml index d450b0a006..d042edf273 100644 --- a/.circleci/scripts/config-template.yml +++ b/.circleci/scripts/config-template.yml @@ -76,9 +76,7 @@ jobs: # Each project will have individual jobs for each specific task it has to - run: name: Install dotnet command: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel sts - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 7.0.410 - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.206 + curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.404 $HOME/.dotnet/dotnet --version - run: name: Enforce formatting @@ -125,8 +123,7 @@ jobs: # Each project will have individual jobs for each specific task it has to - run: name: Install dotnet command: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel sts - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.206 + curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.404 $HOME/.dotnet/dotnet --version - run: name: Startup the Speckle Server @@ -257,7 +254,7 @@ jobs: # Each project will have individual jobs for each specific task it has to deploy-connector-new: docker: - - image: mcr.microsoft.com/dotnet/sdk:6.0 + - image: mcr.microsoft.com/dotnet/sdk:8.0 parameters: slug: type: string @@ -324,8 +321,7 @@ jobs: # Each project will have individual jobs for each specific task it has to - run: name: Install dotnet command: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel sts - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.206 + curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 8.0.404 $HOME/.dotnet/dotnet --version $HOME/.dotnet/dotnet --list-runtimes diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 3b0ca23774..a58302b536 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "csharpier": { - "version": "0.23.0", + "version": "0.28.2", "commands": [ "dotnet-csharpier" ] diff --git a/Automate/Speckle.Automate.Sdk/AutomationContext.cs b/Automate/Speckle.Automate.Sdk/AutomationContext.cs index 0ebe96f173..721d53e0f8 100644 --- a/Automate/Speckle.Automate.Sdk/AutomationContext.cs +++ b/Automate/Speckle.Automate.Sdk/AutomationContext.cs @@ -284,8 +284,8 @@ public async Task StoreFileResult(string filePath) FileStream fileStream = new(filePath, FileMode.Open, FileAccess.Read); using StreamContent streamContent = new(fileStream); formData.Add(streamContent, "files", Path.GetFileName(filePath)); - HttpResponseMessage? request = await SpeckleClient.GQLClient.HttpClient - .PostAsync( + HttpResponseMessage? request = await SpeckleClient + .GQLClient.HttpClient.PostAsync( new Uri($"{AutomationRunData.SpeckleServerUrl}api/stream/{AutomationRunData.ProjectId}/blob"), formData ) diff --git a/Automate/Speckle.Automate.Sdk/Test/TestAutomateEnvironment.cs b/Automate/Speckle.Automate.Sdk/Test/TestAutomateEnvironment.cs index c5e3b8e080..e3519f5bd3 100644 --- a/Automate/Speckle.Automate.Sdk/Test/TestAutomateEnvironment.cs +++ b/Automate/Speckle.Automate.Sdk/Test/TestAutomateEnvironment.cs @@ -1,5 +1,5 @@ -using Speckle.Core.Logging; using System.Text.Json; +using Speckle.Core.Logging; namespace Speckle.Automate.Sdk.Test; diff --git a/Automate/Speckle.Automate.Sdk/Test/TestAutomateUtils.cs b/Automate/Speckle.Automate.Sdk/Test/TestAutomateUtils.cs index 21e6f83d2a..009add96c8 100644 --- a/Automate/Speckle.Automate.Sdk/Test/TestAutomateUtils.cs +++ b/Automate/Speckle.Automate.Sdk/Test/TestAutomateUtils.cs @@ -12,24 +12,24 @@ public static async Task CreateTestRun(Client speckleClient) GraphQLRequest query = new( query: """ - mutation Mutation($projectId: ID!, $automationId: ID!) { - projectMutations { - automationMutations(projectId: $projectId) { - createTestAutomationRun(automationId: $automationId) { - automationRunId - functionRunId - triggers { - payload { - modelId - versionId - } - triggerType - } + mutation Mutation($projectId: ID!, $automationId: ID!) { + projectMutations { + automationMutations(projectId: $projectId) { + createTestAutomationRun(automationId: $automationId) { + automationRunId + functionRunId + triggers { + payload { + modelId + versionId } + triggerType } } } - """, + } + } + """, variables: new { automationId = TestAutomateEnvironment.GetSpeckleAutomationId(), diff --git a/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/SpeckleAutomate.cs b/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/SpeckleAutomate.cs index 1c663e6ecb..1ffa3d96a8 100644 --- a/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/SpeckleAutomate.cs +++ b/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/SpeckleAutomate.cs @@ -155,8 +155,8 @@ public async Task TestCreateVersionInProject() await automationContext.CreateNewVersionInProject(Utils.TestObject(), BRANCH_NAME, COMMIT_MSG); - Branch branch = await automationContext.SpeckleClient - .BranchGet(automationRunData.ProjectId, BRANCH_NAME, 1) + Branch branch = await automationContext + .SpeckleClient.BranchGet(automationRunData.ProjectId, BRANCH_NAME, 1) .ConfigureAwait(false); Assert.NotNull(branch); diff --git a/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/TestAutomateUtils.cs b/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/TestAutomateUtils.cs index 081259cdff..7362c8a655 100644 --- a/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/TestAutomateUtils.cs +++ b/Automate/Tests/Speckle.Automate.Sdk.Tests.Integration/TestAutomateUtils.cs @@ -34,26 +34,26 @@ string automationRevisionId GraphQLRequest query = new( query: """ - mutation CreateAutomation( - $projectId: String! - $modelId: String! - $automationName: String! - $automationId: String! - $automationRevisionId: String! - ) { - automationMutations { - create( - input: { - projectId: $projectId - modelId: $modelId - automationName: $automationName - automationId: $automationId - automationRevisionId: $automationRevisionId - } - ) - } - } - """, + mutation CreateAutomation( + $projectId: String! + $modelId: String! + $automationName: String! + $automationId: String! + $automationRevisionId: String! + ) { + automationMutations { + create( + input: { + projectId: $projectId + modelId: $modelId + automationName: $automationName + automationId: $automationId + automationRevisionId: $automationRevisionId + } + ) + } + } + """, variables: new { projectId, diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateBeam.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateBeam.cs index a63103cfd6..b5d870250d 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateBeam.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateBeam.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateBeam : ICommand> +internal sealed class CreateBeam : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateColumn.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateColumn.cs index ceee938fa1..9b02163f5e 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateColumn.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateColumn.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateColumn : ICommand> +internal sealed class CreateColumn : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDirectShape.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDirectShape.cs index ab416a5ebf..68deb0d615 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDirectShape.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDirectShape.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateDirectShape : ICommand> +internal sealed class CreateDirectShape : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDoor.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDoor.cs index 7388404de6..2f07ff529c 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDoor.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateDoor.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateDoor : ICommand> +internal sealed class CreateDoor : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateFloor.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateFloor.cs index ddba97fb14..6fbca35730 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateFloor.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateFloor.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateFloor : ICommand> +internal sealed class CreateFloor : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateGridElement.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateGridElement.cs index 3b28dd3efc..e2a223486f 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateGridElement.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateGridElement.cs @@ -5,7 +5,7 @@ namespace Archicad.Communication.Commands; -sealed internal class CreateGridElement : ICommand> +internal sealed class CreateGridElement : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateObject.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateObject.cs index 1502f17c2d..d09368ccd0 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateObject.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateObject.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Archicad.Model; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Archicad.Model; namespace Archicad.Communication.Commands; -sealed internal class CreateObject : ICommand> +internal sealed class CreateObject : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateOpening.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateOpening.cs index ab65f3dde1..963a445520 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateOpening.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateOpening.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateOpening : ICommand> +internal sealed class CreateOpening : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoof.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoof.cs index c8204daa44..4424e68235 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoof.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoof.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; using Objects.BuiltElements.Archicad; -using Speckle.Newtonsoft.Json; using Speckle.Core.Models; +using Speckle.Newtonsoft.Json; namespace Archicad.Communication.Commands; -sealed internal class CreateRoof : ICommand> +internal sealed class CreateRoof : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoom.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoom.cs index 624aee7dde..77a014b5fb 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoom.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateRoom.cs @@ -5,7 +5,7 @@ namespace Archicad.Communication.Commands; -sealed internal class CreateRoom : ICommand> +internal sealed class CreateRoom : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateShell.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateShell.cs index e3f28c5bce..2559cb812d 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateShell.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateShell.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; using Objects.BuiltElements.Archicad; -using Speckle.Newtonsoft.Json; using Speckle.Core.Models; +using Speckle.Newtonsoft.Json; namespace Archicad.Communication.Commands; -sealed internal class CreateShell : ICommand> +internal sealed class CreateShell : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateSkylight.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateSkylight.cs index 8c79a78b44..a337ab43a6 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateSkylight.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateSkylight.cs @@ -6,7 +6,7 @@ namespace Archicad.Communication.Commands; -sealed internal class CreateSkylight : ICommand> +internal sealed class CreateSkylight : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWall.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWall.cs index a7832497c4..a74a9aeeb1 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWall.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWall.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateWall : ICommand> +internal sealed class CreateWall : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWindow.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWindow.cs index 386c75bf53..9db3580292 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWindow.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_CreateWindow.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Objects.BuiltElements.Archicad; using Speckle.Core.Models; using Speckle.Newtonsoft.Json; -using Objects.BuiltElements.Archicad; namespace Archicad.Communication.Commands; -sealed internal class CreateWindow : ICommand> +internal sealed class CreateWindow : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_FinishReceiveTransaction.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_FinishReceiveTransaction.cs index c74979e226..662433753b 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_FinishReceiveTransaction.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_FinishReceiveTransaction.cs @@ -3,7 +3,7 @@ namespace Archicad.Communication.Commands; -sealed internal class FinishReceiveTransaction : ICommand +internal sealed class FinishReceiveTransaction : ICommand { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters { } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetBeamData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetBeamData.cs index 12d5d7778d..6f11441f4c 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetBeamData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetBeamData.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetBeamData : GetDataBase, ICommand +internal sealed class GetBeamData : GetDataBase, ICommand { public GetBeamData(IEnumerable applicationIds, bool sendProperties, bool sendListingParameters) : base(applicationIds, sendProperties, sendListingParameters) { } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetColumnData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetColumnData.cs index 858b59bf1b..0b691e8f29 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetColumnData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetColumnData.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetColumnData : GetDataBase, ICommand +internal sealed class GetColumnData : GetDataBase, ICommand { public GetColumnData(IEnumerable applicationIds, bool sendProperties, bool sendListingParameters) : base(applicationIds, sendProperties, sendListingParameters) { } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetDoorData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetDoorData.cs index 966ae0adfa..bc76e97eca 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetDoorData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetDoorData.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetDoorData : GetDataBase, ICommand +internal sealed class GetDoorData : GetDataBase, ICommand { public GetDoorData(IEnumerable applicationIds, bool sendProperties, bool sendListingParameters) : base(applicationIds, sendProperties, sendListingParameters) { } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementBaseData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementBaseData.cs index 82d9499427..323a1f9ed9 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementBaseData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementBaseData.cs @@ -6,7 +6,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetElementBaseData : GetDataBase, ICommand +internal sealed class GetElementBaseData : GetDataBase, ICommand { [JsonObject(MemberSerialization.OptIn)] private sealed class Result diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementType.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementType.cs index 95e3234160..21d21b791d 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementType.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetElementType.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -using System.Threading.Tasks; using System.Linq; +using System.Threading.Tasks; using Speckle.Newtonsoft.Json; namespace Archicad.Communication.Commands; @@ -75,8 +75,8 @@ public async Task>> Execute() "GetElementTypes", new Parameters(ApplicationIds) ); - return result.ElementTypes - .GroupBy(row => row.ElementType) + return result + .ElementTypes.GroupBy(row => row.ElementType) .ToDictionary(group => group.Key, group => group.Select(x => x.ApplicationId)); } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetGridElementData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetGridElementData.cs index 527f232a07..82d3b3ec86 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetGridElementData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetGridElementData.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Threading.Tasks; -using Speckle.Newtonsoft.Json; using ConnectorArchicad.Communication.Commands; +using Speckle.Newtonsoft.Json; namespace Archicad.Communication.Commands; -sealed internal class GetGridElementData : GetDataBase, ICommand> +internal sealed class GetGridElementData : GetDataBase, ICommand> { [JsonObject(MemberSerialization.OptIn)] private sealed class Result diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetModelOfElements.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetModelOfElements.cs index 992b315a79..c39b0d5ea2 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetModelOfElements.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetModelOfElements.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetModelForElements : ICommand> +internal sealed class GetModelForElements : ICommand> { [JsonObject(MemberSerialization.OptIn)] public sealed class Parameters diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetObjectData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetObjectData.cs index aac5def320..e6f6fab3b5 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetObjectData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetObjectData.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Threading.Tasks; +using ConnectorArchicad.Communication.Commands; using Speckle.Core.Kits; using Speckle.Newtonsoft.Json; -using ConnectorArchicad.Communication.Commands; namespace Archicad.Communication.Commands; -sealed internal class GetObjectData : GetDataBase, ICommand> +internal sealed class GetObjectData : GetDataBase, ICommand> { [JsonObject(MemberSerialization.OptIn)] private sealed class Result diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetOpening.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetOpening.cs index 5e64507ed7..8d42afd09e 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetOpening.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetOpening.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetOpeningData : GetDataBase, ICommand +internal sealed class GetOpeningData : GetDataBase, ICommand { public GetOpeningData(IEnumerable applicationIds, bool sendProperties, bool sendListingParameters) : base(applicationIds, sendProperties, sendListingParameters) { } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetRoomData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetRoomData.cs index b760969cf0..5f1b9eb943 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetRoomData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetRoomData.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Threading.Tasks; -using Speckle.Newtonsoft.Json; using ConnectorArchicad.Communication.Commands; +using Speckle.Newtonsoft.Json; namespace Archicad.Communication.Commands; -sealed internal class GetRoomData : GetDataBase, ICommand> +internal sealed class GetRoomData : GetDataBase, ICommand> { [JsonObject(MemberSerialization.OptIn)] private sealed class Result diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetSkylightData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetSkylightData.cs index f6e8afc1a7..c736a2a7c4 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetSkylightData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetSkylightData.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetSkylightData : GetDataBase, ICommand +internal sealed class GetSkylightData : GetDataBase, ICommand { public GetSkylightData(IEnumerable applicationIds, bool sendProperties, bool sendListingParameters) : base(applicationIds, sendProperties, sendListingParameters) { } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWallData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWallData.cs index 89b32fb908..3e5c991d00 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWallData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWallData.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetWallData : GetDataBase, ICommand +internal sealed class GetWallData : GetDataBase, ICommand { public GetWallData(IEnumerable applicationIds, bool sendProperties, bool sendListingParameters) : base(applicationIds, sendProperties, sendListingParameters) { } diff --git a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWindowData.cs b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWindowData.cs index 470382b87c..ce23a4ef1f 100644 --- a/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWindowData.cs +++ b/ConnectorArchicad/ConnectorArchicad/Communication/Commands/Command_GetWindowData.cs @@ -4,7 +4,7 @@ namespace Archicad.Communication.Commands; -sealed internal class GetWindowData : GetDataBase, ICommand +internal sealed class GetWindowData : GetDataBase, ICommand { public GetWindowData(IEnumerable applicationIds, bool sendProperties, bool sendListingParameters) : base(applicationIds, sendProperties, sendListingParameters) { } diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/BeamConverter.cs b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/BeamConverter.cs index 1dcf566e77..fc7a2a4cbf 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/BeamConverter.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/BeamConverter.cs @@ -39,7 +39,6 @@ CancellationToken token beams.Add(archiBeam); break; case Objects.BuiltElements.Beam beam: - // upgrade (if not Archicad beam): Objects.BuiltElements.Beam --> Objects.BuiltElements.Archicad.ArchicadBeam { if (beam.baseLine is Line baseLine) diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/ColumnConverter.cs b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/ColumnConverter.cs index d3b1018bb7..bb351f5016 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/ColumnConverter.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/ColumnConverter.cs @@ -41,7 +41,6 @@ CancellationToken token columns.Add(archicadColumn); break; case Objects.BuiltElements.Column column: - { if (column.baseLine is Line baseLine) { diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/FloorConverter.cs b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/FloorConverter.cs index 6f378fa2ff..76e5ae07b8 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/FloorConverter.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/FloorConverter.cs @@ -39,7 +39,6 @@ CancellationToken token floors.Add(archiFloor); break; case Objects.BuiltElements.Floor floor: - { try { diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/GridLineConverter.cs b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/GridLineConverter.cs index ee02fe0ec9..5f85492871 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/GridLineConverter.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/GridLineConverter.cs @@ -130,8 +130,10 @@ ConversionOptions conversionOptions ); } - speckleGridLine.displayValue = Operations.ModelConverter - .MeshesAndLinesToSpeckle(elementModels.First(e => e.applicationId == archicadGridElement.applicationId).model) + speckleGridLine.displayValue = Operations + .ModelConverter.MeshesAndLinesToSpeckle( + elementModels.First(e => e.applicationId == archicadGridElement.applicationId).model + ) .Cast() .ToList(); diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoofConverter.cs b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoofConverter.cs index 0820db005c..59dd943081 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoofConverter.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoofConverter.cs @@ -44,7 +44,6 @@ CancellationToken token shells.Add(archiShell); break; case Objects.BuiltElements.Roof roof: - { try { diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoomConverter.cs b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoomConverter.cs index f43f306400..d58fecd140 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoomConverter.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/Converters/RoomConverter.cs @@ -38,7 +38,6 @@ CancellationToken token switch (tc.current) { case Objects.BuiltElements.Archicad.ArchicadRoom speckleRoom: - { Archicad.Room archicadRoom = new() @@ -62,7 +61,6 @@ CancellationToken token } break; case Objects.BuiltElements.Room speckleRoom: - { try { diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/ElementConverterManager.cs b/ConnectorArchicad/ConnectorArchicad/Converters/ElementConverterManager.cs index 287ba885c4..8c8f70b7a0 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/ElementConverterManager.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/ElementConverterManager.cs @@ -5,7 +5,9 @@ using System.Threading; using System.Threading.Tasks; using Archicad.Communication; +using DesktopUI2.Models; using DesktopUI2.ViewModels; +using Objects.BuiltElements.Archicad; using Speckle.Core.Logging; using Speckle.Core.Models; using Beam = Objects.BuiltElements.Beam; @@ -13,15 +15,13 @@ using Column = Objects.BuiltElements.Column; using Door = Objects.BuiltElements.Archicad.ArchicadDoor; using Fenestration = Objects.BuiltElements.Archicad.ArchicadFenestration; -using Opening = Objects.BuiltElements.Opening; using Floor = Objects.BuiltElements.Floor; +using GridLine = Objects.BuiltElements.GridLine; +using Opening = Objects.BuiltElements.Opening; using Roof = Objects.BuiltElements.Roof; +using Skylight = Objects.BuiltElements.Archicad.ArchicadSkylight; using Wall = Objects.BuiltElements.Wall; using Window = Objects.BuiltElements.Archicad.ArchicadWindow; -using Skylight = Objects.BuiltElements.Archicad.ArchicadSkylight; -using GridLine = Objects.BuiltElements.GridLine; -using DesktopUI2.Models; -using Objects.BuiltElements.Archicad; namespace Archicad; diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/ElementTypeProvider.cs b/ConnectorArchicad/ConnectorArchicad/Converters/ElementTypeProvider.cs index a2cb24e846..4ace211e58 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/ElementTypeProvider.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/ElementTypeProvider.cs @@ -5,12 +5,12 @@ using DirectShape = Objects.BuiltElements.Archicad.DirectShape; using Door = Objects.BuiltElements.Archicad.ArchicadDoor; using Floor = Objects.BuiltElements.Archicad.ArchicadFloor; +using Opening = Objects.BuiltElements.Archicad.ArchicadOpening; using Roof = Objects.BuiltElements.Archicad.ArchicadRoof; using Shell = Objects.BuiltElements.Archicad.ArchicadShell; +using Skylight = Objects.BuiltElements.Archicad.ArchicadSkylight; using Wall = Objects.BuiltElements.Archicad.ArchicadWall; using Window = Objects.BuiltElements.Archicad.ArchicadWindow; -using Skylight = Objects.BuiltElements.Archicad.ArchicadSkylight; -using Opening = Objects.BuiltElements.Archicad.ArchicadOpening; namespace Archicad; diff --git a/ConnectorArchicad/ConnectorArchicad/Converters/ModelConverter.cs b/ConnectorArchicad/ConnectorArchicad/Converters/ModelConverter.cs index 34f6546e20..257de8bb56 100644 --- a/ConnectorArchicad/ConnectorArchicad/Converters/ModelConverter.cs +++ b/ConnectorArchicad/ConnectorArchicad/Converters/ModelConverter.cs @@ -3,14 +3,14 @@ using System.Linq; using Archicad.Converters; using Archicad.Model; -using Objects.BuiltElements.Archicad; using Objects; +using Objects.BuiltElements.Archicad; using Objects.Geometry; using Objects.Other; using Objects.Utils; using Speckle.Core.Kits; -using static Archicad.Model.MeshModel; using Speckle.Core.Logging; +using static Archicad.Model.MeshModel; namespace Archicad.Operations; @@ -30,9 +30,8 @@ public static List MeshesToSpeckle(MeshModel meshModel) foreach (var poly in meshModel.polygons) { var meshIndex = poly.material; - meshes[meshIndex].vertices.AddRange( - poly.pointIds.SelectMany(id => FlattenPoint(meshModel.vertices[id])).ToList() - ); + meshes[meshIndex] + .vertices.AddRange(poly.pointIds.SelectMany(id => FlattenPoint(meshModel.vertices[id])).ToList()); meshes[meshIndex].faces.AddRange(PolygonToSpeckle(poly, vertCount[meshIndex])); vertCount[meshIndex] += poly.pointIds.Count; } @@ -571,9 +570,12 @@ out double height // Form the 4 points of the rectangle from the polyline List points = Enumerable .Range(0, polyline.value.Count / 3) - .Select( - i => new Vector(polyline.value[i * 3], polyline.value[i * 3 + 1], polyline.value[i * 3 + 2], polyline.units) - ) + .Select(i => new Vector( + polyline.value[i * 3], + polyline.value[i * 3 + 1], + polyline.value[i * 3 + 2], + polyline.units + )) .ToList(); Vector bottomLeft = Utils.ScaleToNative(points[0]); diff --git a/ConnectorArchicad/ConnectorArchicad/Elements/GridElement.cs b/ConnectorArchicad/ConnectorArchicad/Elements/GridElement.cs index 91b117623b..ccb99f46f9 100644 --- a/ConnectorArchicad/ConnectorArchicad/Elements/GridElement.cs +++ b/ConnectorArchicad/ConnectorArchicad/Elements/GridElement.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -using Objects.Geometry; using Objects.BuiltElements.Archicad; +using Objects.Geometry; namespace Archicad; diff --git a/ConnectorArchicad/ConnectorArchicad/Elements/Object.cs b/ConnectorArchicad/ConnectorArchicad/Elements/Object.cs index e3b6e91435..6d419bc90b 100644 --- a/ConnectorArchicad/ConnectorArchicad/Elements/Object.cs +++ b/ConnectorArchicad/ConnectorArchicad/Elements/Object.cs @@ -1,7 +1,7 @@ -using Objects.Geometry; +using System.Collections.Generic; using Objects.BuiltElements.Archicad; +using Objects.Geometry; using Speckle.Core.Kits; -using System.Collections.Generic; namespace Archicad; diff --git a/ConnectorArchicad/ConnectorArchicad/Elements/Room.cs b/ConnectorArchicad/ConnectorArchicad/Elements/Room.cs index 14a9516a99..5f0babfa9b 100644 --- a/ConnectorArchicad/ConnectorArchicad/Elements/Room.cs +++ b/ConnectorArchicad/ConnectorArchicad/Elements/Room.cs @@ -1,6 +1,6 @@ -using Objects.Geometry; using System.Collections.Generic; using Objects.BuiltElements.Archicad; +using Objects.Geometry; namespace Archicad; diff --git a/ConnectorArchicad/ConnectorArchicad/UI/ConnectorBinding.Settings.cs b/ConnectorArchicad/ConnectorArchicad/UI/ConnectorBinding.Settings.cs index 7a9132de8d..95363d38ce 100644 --- a/ConnectorArchicad/ConnectorArchicad/UI/ConnectorBinding.Settings.cs +++ b/ConnectorArchicad/ConnectorArchicad/UI/ConnectorBinding.Settings.cs @@ -12,7 +12,7 @@ public enum SettingSlugs ReceiveParametric = 2 } - static public string[] settingSlugs = + public static string[] settingSlugs = { "filter - properties", "filter - listing parameters", diff --git a/ConnectorAutocadCivil/AdvanceSteelAddinRegistrator/Program.cs b/ConnectorAutocadCivil/AdvanceSteelAddinRegistrator/Program.cs index 552fd016dc..4493bbc660 100644 --- a/ConnectorAutocadCivil/AdvanceSteelAddinRegistrator/Program.cs +++ b/ConnectorAutocadCivil/AdvanceSteelAddinRegistrator/Program.cs @@ -106,8 +106,8 @@ private static AddonsData UpdateManifestFile(AddonsData addonsData) return addonsData; } - addonsData.Addons = addonsData.Addons - .Append(new AddonsDataAddon() { Name = addinName, FullPath = Path.Combine(addinPath, addinDllName) }) + addonsData.Addons = addonsData + .Addons.Append(new AddonsDataAddon() { Name = addinName, FullPath = Path.Combine(addinPath, addinDllName) }) .ToArray(); } catch (Exception ex) diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/DocumentUtils/TransactionContext.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/DocumentUtils/TransactionContext.cs index ca29013e57..b3f108a366 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/DocumentUtils/TransactionContext.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/DocumentUtils/TransactionContext.cs @@ -1,7 +1,6 @@ using System; using Autodesk.AutoCAD.ApplicationServices; using Document = Autodesk.AutoCAD.ApplicationServices.Document; - #if ADVANCESTEEL using Autodesk.AdvanceSteel.DocumentManagement; #else diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/App.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/App.cs index 672409c495..4e4fc6fe29 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/App.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/App.cs @@ -1,6 +1,3 @@ -using Autodesk.AutoCAD.ApplicationServices; -using Autodesk.Windows; -using Speckle.ConnectorAutocadCivil.UI; using System; using System.Diagnostics.CodeAnalysis; using System.IO; @@ -9,9 +6,11 @@ using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; +using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.Windows; +using Speckle.ConnectorAutocadCivil.UI; using Speckle.Core.Logging; using Forms = System.Windows.Forms; - #if ADVANCESTEEL using Autodesk.AdvanceSteel.Runtime; #else @@ -20,6 +19,7 @@ #if ADVANCESTEEL [assembly: ExtensionApplication(typeof(Speckle.ConnectorAutocadCivil.Entry.App))] + #endif namespace Speckle.ConnectorAutocadCivil.Entry; @@ -264,8 +264,8 @@ private ImageSource LoadPngImgSource(string sourceName) if (!string.IsNullOrEmpty(sourceName) && sourceName.ToLower().EndsWith(".png")) { Assembly assembly = Assembly.GetExecutingAssembly(); - string resource = GetType().Assembly - .GetManifestResourceNames() + string resource = GetType() + .Assembly.GetManifestResourceNames() .Where(o => o.EndsWith(sourceName)) .FirstOrDefault(); diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/SpeckleAutocadCommand.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/SpeckleAutocadCommand.cs index 0472abc882..2a0add0eb8 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/SpeckleAutocadCommand.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/Entry/SpeckleAutocadCommand.cs @@ -1,29 +1,26 @@ using System; using System.Diagnostics.CodeAnalysis; -using System.Threading.Tasks; using System.Runtime.InteropServices; using System.Threading; - -#if ADVANCESTEEL -using Autodesk.AdvanceSteel.Runtime; -#else -using Autodesk.AutoCAD.Runtime; -#endif - -using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application; - +using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; using Avalonia.ReactiveUI; - using DesktopUI2.ViewModels; using DesktopUI2.Views; using Speckle.ConnectorAutocadCivil.UI; using Speckle.Core.Logging; +using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application; using Exception = System.Exception; +#if ADVANCESTEEL +using Autodesk.AdvanceSteel.Runtime; +#else +using Autodesk.AutoCAD.Runtime; +#endif #if ADVANCESTEEL [assembly: CommandClass(typeof(Speckle.ConnectorAutocadCivil.Entry.SpeckleAutocadCommand))] + #endif namespace Speckle.ConnectorAutocadCivil.Entry; diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/Storage/SpeckleStreamManager.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/Storage/SpeckleStreamManager.cs index 925c384367..bd3d13be79 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/Storage/SpeckleStreamManager.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/Storage/SpeckleStreamManager.cs @@ -3,7 +3,6 @@ using System.Text; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; - using DesktopUI2.Models; using Speckle.ConnectorAutocadCivil.DocumentUtils; using Speckle.Core.Logging; diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Events.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Events.cs index 8dd352013e..5a7300479f 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Events.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Events.cs @@ -6,7 +6,6 @@ using DesktopUI2.ViewModels; using Speckle.ConnectorAutocadCivil.Entry; using Speckle.Core.Logging; - #if ADVANCESTEEL using ASFilerObject = Autodesk.AdvanceSteel.CADAccess.FilerObject; #endif diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Previews.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Previews.cs index fd0de31160..a258de991a 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Previews.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Previews.cs @@ -7,7 +7,6 @@ using DesktopUI2.ViewModels; using Speckle.Core.Kits; using Speckle.Core.Models; - #if ADVANCESTEEL using ASFilerObject = Autodesk.AdvanceSteel.CADAccess.FilerObject; #endif diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Receive.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Receive.cs index e17f04d0c8..a5df847272 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Receive.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Receive.cs @@ -16,7 +16,6 @@ using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; using static Speckle.ConnectorAutocadCivil.Utils; - #if ADVANCESTEEL using ASFilerObject = Autodesk.AdvanceSteel.CADAccess.FilerObject; #endif @@ -172,8 +171,8 @@ string id string layer = null; // try to see if there's a collection object first - var collection = commitObjs.FirstOrDefault( - o => o.Container == container && o.Descriptor.Contains("Collection") + var collection = commitObjs.FirstOrDefault(o => + o.Container == container && o.Descriptor.Contains("Collection") ); if (collection != null) { @@ -388,8 +387,8 @@ ApplicationObject CreateApplicationObject(Base current, string containerId) { ApplicationObject NewAppObj() { - var speckleType = current.speckle_type - .Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries) + var speckleType = current + .speckle_type.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault(); return new ApplicationObject(current.id, speckleType) { diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Selection.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Selection.cs index cb75cc08bb..c231baf26a 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Selection.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Selection.cs @@ -6,7 +6,6 @@ using DesktopUI2; using DesktopUI2.Models.Filters; using Speckle.Core.Kits; - #if ADVANCESTEEL using ASFilerObject = Autodesk.AdvanceSteel.CADAccess.FilerObject; #endif diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Send.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Send.cs index 0b329dd4d3..b502c054c9 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Send.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.Send.cs @@ -14,7 +14,6 @@ using Speckle.Core.Models; using Speckle.Core.Transports; using static Speckle.ConnectorAutocadCivil.Utils; - #if ADVANCESTEEL using ASFilerObject = Autodesk.AdvanceSteel.CADAccess.FilerObject; #endif diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.cs index 28cfb74fbe..61eee82fba 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/UI/ConnectorBindingsAutocadCivil.cs @@ -8,9 +8,8 @@ using DesktopUI2.Models.Settings; using Speckle.ConnectorAutocadCivil.Storage; using Speckle.Core.Kits; -using Speckle.Core.Models; using Speckle.Core.Logging; - +using Speckle.Core.Models; #if ADVANCESTEEL using ASFilerObject = Autodesk.AdvanceSteel.CADAccess.FilerObject; #endif @@ -78,8 +77,8 @@ public override List GetStreamsInFile() #endregion public override string GetHostAppNameVersion() => - Utils.VersionedAppName - .Replace("AutoCAD", "AutoCAD ") + Utils + .VersionedAppName.Replace("AutoCAD", "AutoCAD ") .Replace("Civil3D", "Civil 3D ") .Replace("AdvanceSteel", "Advance Steel "); //hack for ADSK store; diff --git a/ConnectorAutocadCivil/ConnectorAutocadCivil/Utils.cs b/ConnectorAutocadCivil/ConnectorAutocadCivil/Utils.cs index 461dec506e..f61ac9d330 100644 --- a/ConnectorAutocadCivil/ConnectorAutocadCivil/Utils.cs +++ b/ConnectorAutocadCivil/ConnectorAutocadCivil/Utils.cs @@ -1,19 +1,16 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.RegularExpressions; using System.Reflection; - +using System.Text.RegularExpressions; using Autodesk.AutoCAD.ApplicationServices; +using Autodesk.AutoCAD.Colors; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; -using Autodesk.AutoCAD.Colors; - -using Speckle.Core.Kits; -using Speckle.Core.Models; using Speckle.ConnectorAutocadCivil.DocumentUtils; +using Speckle.Core.Kits; using Speckle.Core.Logging; - +using Speckle.Core.Models; #if CIVIL using Autodesk.Aec.ApplicationServices; using Autodesk.Aec.PropertyData.DatabaseServices; @@ -340,7 +337,7 @@ public static bool GetOrMakeLayer(this Document doc, string layerName, Transacti } } - public static PropertySetDefinition CreatePropertySet(Dictionary propertySetDict, Document doc) + public static PropertySetDefinition CreatePropertySet(Dictionary propertySetDict, Document doc) { PropertySetDefinition propSetDef = new(); propSetDef.SetToStandard(doc.Database); @@ -366,7 +363,9 @@ public static PropertySetDefinition CreatePropertySet(Dictionary } else { - SpeckleLog.Logger.Error( $"Could not determine property set entry type of {entry.Value}. Property set entry not added to property set definitions."); + SpeckleLog.Logger.Error( + $"Could not determine property set entry type of {entry.Value}. Property set entry not added to property set definitions." + ); } } @@ -386,7 +385,7 @@ public static bool ObjectHasPropertySet(DBObject obj, ObjectId propertySetId) try { temporaryId = PropertyDataServices.GetPropertySet(obj, propertySetId); - } + } catch (Autodesk.AutoCAD.Runtime.Exception e) when (!e.IsFatal()) { // This will throw if the property set does not exist on the object. @@ -423,9 +422,13 @@ public static void AddPropertySetToObject(DBObject obj, ObjectId propertySetId) { throw new InvalidOperationException($"Could not create property set on object {obj.Id}", e); } - } + } - public static void SetPropertySets(this Entity entity, Document doc, List> propertySetDicts) + public static void SetPropertySets( + this Entity entity, + Document doc, + List> propertySetDicts + ) { // create a dictionary for property sets for this object var name = $"Speckle {entity.Handle} Property Set"; @@ -469,7 +472,7 @@ public static bool TryGetPropertySets(this DBObject obj, Transaction tr, out Bas { propertySetIds = PropertyDataServices.GetPropertySets(obj); } - catch (Autodesk.AutoCAD.Runtime.Exception e) + catch (Autodesk.AutoCAD.Runtime.Exception e) { // This may throw if property sets do not exist on the object. // afaik, trycatch is necessary because there is no way to preemptively check if the set already exists. @@ -483,10 +486,11 @@ public static bool TryGetPropertySets(this DBObject obj, Transaction tr, out Bas foreach (ObjectId id in propertySetIds) { - Dictionary setDictionary = new() ; + Dictionary setDictionary = new(); PropertySet propertySet = (PropertySet)tr.GetObject(id, OpenMode.ForRead); - PropertySetDefinition setDef = (PropertySetDefinition)tr.GetObject(propertySet.PropertySetDefinition, OpenMode.ForRead); + PropertySetDefinition setDef = (PropertySetDefinition) + tr.GetObject(propertySet.PropertySetDefinition, OpenMode.ForRead); PropertyDefinitionCollection propDef = setDef.Definitions; Dictionary propDefs = new(); @@ -896,7 +900,8 @@ public static string RemoveInvalidChars(string str) #if ADVANCESTEEL - public static T GetFilerObjectByEntity(DBObject @object) where T : ASFilerObject + public static T GetFilerObjectByEntity(DBObject @object) + where T : ASFilerObject { ASObjectId idCadEntity = new(@object.ObjectId.OldIdPtr); ASObjectId idFilerObject = Autodesk.AdvanceSteel.CADAccess.DatabaseManager.GetFilerObjectId(idCadEntity, false); diff --git a/ConnectorBentley/ConnectorBentleyShared/Entry/App.cs b/ConnectorBentley/ConnectorBentleyShared/Entry/App.cs index 2c54967095..7439a190ec 100644 --- a/ConnectorBentley/ConnectorBentleyShared/Entry/App.cs +++ b/ConnectorBentley/ConnectorBentleyShared/Entry/App.cs @@ -1,9 +1,3 @@ -using Bentley.DgnPlatformNET; -using Bentley.DgnPlatformNET.Elements; -using Bentley.GeometryNET; -using Bentley.MstnPlatformNET; -using DesktopUI2; -using Speckle.ConnectorBentley.UI; using System; using System.Collections.Generic; using System.IO; @@ -12,6 +6,12 @@ using System.Text; using System.Threading.Tasks; using System.Windows; +using Bentley.DgnPlatformNET; +using Bentley.DgnPlatformNET.Elements; +using Bentley.GeometryNET; +using Bentley.MstnPlatformNET; +using DesktopUI2; +using Speckle.ConnectorBentley.UI; namespace Speckle.ConnectorBentley.Entry; diff --git a/ConnectorBentley/ConnectorBentleyShared/Entry/SpeckleBentleyCommand.cs b/ConnectorBentley/ConnectorBentleyShared/Entry/SpeckleBentleyCommand.cs index 6488c2ee17..05736af5c9 100644 --- a/ConnectorBentley/ConnectorBentleyShared/Entry/SpeckleBentleyCommand.cs +++ b/ConnectorBentley/ConnectorBentleyShared/Entry/SpeckleBentleyCommand.cs @@ -1,3 +1,7 @@ +using System; +using System.IO; +using System.Reflection; +using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; using Avalonia.ReactiveUI; @@ -9,10 +13,6 @@ using DesktopUI2.ViewModels; using DesktopUI2.Views; using Speckle.ConnectorBentley.UI; -using System; -using System.IO; -using System.Reflection; -using System.Threading.Tasks; namespace Speckle.ConnectorBentley.Entry; diff --git a/ConnectorBentley/ConnectorBentleyShared/Keyins.cs b/ConnectorBentley/ConnectorBentleyShared/Keyins.cs index e0759dcf98..a653cb78be 100644 --- a/ConnectorBentley/ConnectorBentleyShared/Keyins.cs +++ b/ConnectorBentley/ConnectorBentleyShared/Keyins.cs @@ -4,7 +4,6 @@ using System.Text; using System.Threading.Tasks; using System.Windows; - using Speckle.ConnectorBentley.Entry; namespace Speckle.ConnectorBentley; diff --git a/ConnectorBentley/ConnectorBentleyShared/Storage/StreamStateManager.cs b/ConnectorBentley/ConnectorBentleyShared/Storage/StreamStateManager.cs index 5dfcd32ea6..a422fa0f05 100644 --- a/ConnectorBentley/ConnectorBentleyShared/Storage/StreamStateManager.cs +++ b/ConnectorBentley/ConnectorBentleyShared/Storage/StreamStateManager.cs @@ -3,16 +3,15 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Bentley.DgnPlatformNET.DgnEC; -using Bentley.MstnPlatformNET; using Bentley.DgnPlatformNET; -using Bentley.ECObjects.Schema; +using Bentley.DgnPlatformNET.DgnEC; +using Bentley.EC.Persistence.Query; using Bentley.ECObjects; using Bentley.ECObjects.Instance; -using Bentley.EC.Persistence.Query; - -using Speckle.Newtonsoft.Json; +using Bentley.ECObjects.Schema; +using Bentley.MstnPlatformNET; using DesktopUI2.Models; +using Speckle.Newtonsoft.Json; namespace Speckle.ConnectorBentley.Storage; diff --git a/ConnectorBentley/ConnectorBentleyShared/UI/Bindings.cs b/ConnectorBentley/ConnectorBentleyShared/UI/Bindings.cs index 43a1dcd9c1..fe9bf6bbc6 100644 --- a/ConnectorBentley/ConnectorBentleyShared/UI/Bindings.cs +++ b/ConnectorBentley/ConnectorBentleyShared/UI/Bindings.cs @@ -1,27 +1,24 @@ using System; +using System.Collections; +using System.Collections.Concurrent; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; -using System.IO; -using System.Collections.Concurrent; -using System.Collections; - -using Speckle.Core.Api; -using Speckle.Core.Models; -using Speckle.Core.Kits; -using Speckle.Core.Transports; +using Bentley.DgnPlatformNET; +using Bentley.DgnPlatformNET.Elements; +using Bentley.MstnPlatformNET; using DesktopUI2; using DesktopUI2.Models; -using DesktopUI2.ViewModels; using DesktopUI2.Models.Filters; using DesktopUI2.Models.Settings; - -using Bentley.DgnPlatformNET; -using Bentley.DgnPlatformNET.Elements; -using Bentley.MstnPlatformNET; +using DesktopUI2.ViewModels; using Speckle.ConnectorBentley.Storage; +using Speckle.Core.Api; +using Speckle.Core.Kits; using Speckle.Core.Logging; - +using Speckle.Core.Models; +using Speckle.Core.Transports; #if (OPENBUILDINGS) using Bentley.Building.Api; #endif @@ -212,7 +209,16 @@ public override List GetSelectionFilters() #if (OPENROADS || OPENRAIL) var civilElementTypes = new List { "Alignment" }; - filterList.Add(new ListSelectionFilter { Slug = "civilElementType", Name = "Civil Features", Icon = "RailroadVariant", Description = "Selects civil features based on their type.", Values = civilElementTypes }); + filterList.Add( + new ListSelectionFilter + { + Slug = "civilElementType", + Name = "Civil Features", + Icon = "RailroadVariant", + Description = "Selects civil features based on their type.", + Values = civilElementTypes + } + ); #endif return filterList; @@ -568,7 +574,8 @@ public override async Task SendStream(StreamState state, ProgressViewMod { if (Control.InvokeRequired) { - civObjs = (List)Control.Invoke(new GetCivilObjectsDelegate(GetCivilObjects), new object[] { state }); + civObjs = + (List)Control.Invoke(new GetCivilObjectsDelegate(GetCivilObjects), new object[] { state }); } else { @@ -653,8 +660,16 @@ public override async Task SendStream(StreamState state, ProgressViewMod var civilObj = civObjs[objs.IndexOf(obj)]; if (Control.InvokeRequired) { - converted = (Base)Control.Invoke(new SpeckleConversionDelegate(converter.ConvertToSpeckle), new object[] { civilObj }); - Control.Invoke((Action)(() => { containerName = civilObj.Name == "" ? "Unnamed" : civilObj.Name; })); + converted = (Base) + Control.Invoke(new SpeckleConversionDelegate(converter.ConvertToSpeckle), new object[] { civilObj }); + Control.Invoke( + (Action)( + () => + { + containerName = civilObj.Name == "" ? "Unnamed" : civilObj.Name; + } + ) + ); } else { @@ -666,7 +681,8 @@ public override async Task SendStream(StreamState state, ProgressViewMod { if (Control.InvokeRequired) { - converted = (Base)Control.Invoke(new SpeckleConversionDelegate(converter.ConvertToSpeckle), new object[] { obj }); + converted = (Base) + Control.Invoke(new SpeckleConversionDelegate(converter.ConvertToSpeckle), new object[] { obj }); } else { @@ -764,6 +780,7 @@ public override async Task SendStream(StreamState state, ProgressViewMod #if (OPENROADS || OPENRAIL) delegate List GetCivilObjectsDelegate(StreamState state); + private List GetCivilObjects(StreamState state) { var civilObjs = new List(); @@ -800,7 +817,14 @@ private Base ConvertGridLines(ISpeckleConverter converter, ProgressViewModel pro ITFDrawingGrid drawingGrid = null; if (Control.InvokeRequired) { - Control.Invoke((Action)(() => { proj.GetDrawingGrid(false, 0, out drawingGrid); })); + Control.Invoke( + (Action)( + () => + { + proj.GetDrawingGrid(false, 0, out drawingGrid); + } + ) + ); } else { @@ -815,7 +839,8 @@ private Base ConvertGridLines(ISpeckleConverter converter, ProgressViewModel pro if (Control.InvokeRequired) { - converted = (Base)Control.Invoke(new SpeckleConversionDelegate(converter.ConvertToSpeckle), new object[] { drawingGrid }); + converted = (Base) + Control.Invoke(new SpeckleConversionDelegate(converter.ConvertToSpeckle), new object[] { drawingGrid }); } else { diff --git a/ConnectorBentley/ConnectorBentleyShared/Utils.cs b/ConnectorBentley/ConnectorBentleyShared/Utils.cs index 72348690cf..daeaa336b9 100644 --- a/ConnectorBentley/ConnectorBentleyShared/Utils.cs +++ b/ConnectorBentley/ConnectorBentleyShared/Utils.cs @@ -1,12 +1,12 @@ -using Bentley.DgnPlatformNET; -using Bentley.GeometryNET; -using Bentley.MstnPlatformNET; -using Speckle.Core.Kits; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Bentley.DgnPlatformNET; +using Bentley.GeometryNET; +using Bentley.MstnPlatformNET; +using Speckle.Core.Kits; namespace Speckle.ConnectorBentley; diff --git a/ConnectorCSI/ConnectorCSIShared/StreamStateManager/StreamStateManager.cs b/ConnectorCSI/ConnectorCSIShared/StreamStateManager/StreamStateManager.cs index 010ec6f517..90f284b0b0 100644 --- a/ConnectorCSI/ConnectorCSIShared/StreamStateManager/StreamStateManager.cs +++ b/ConnectorCSI/ConnectorCSIShared/StreamStateManager/StreamStateManager.cs @@ -1,11 +1,11 @@ -using CSiAPIv1; -using DesktopUI2.Models; -using Speckle.Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using CSiAPIv1; +using DesktopUI2.Models; +using Speckle.Newtonsoft.Json; namespace ConnectorCSI.Storage; diff --git a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.ClientOperations.cs b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.ClientOperations.cs index b41578d497..0cb00cee1c 100644 --- a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.ClientOperations.cs +++ b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.ClientOperations.cs @@ -1,9 +1,9 @@ +using System; using System.Collections.Generic; +using ConnectorCSI.Storage; using DesktopUI2; using DesktopUI2.Models; -using ConnectorCSI.Storage; using Speckle.Core.Logging; -using System; namespace Speckle.ConnectorCSI.UI; diff --git a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Recieve.cs b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Recieve.cs index 7c53935a18..5380a333c6 100644 --- a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Recieve.cs +++ b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Recieve.cs @@ -1,20 +1,20 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using ConnectorCSI.Storage; using DesktopUI2; using DesktopUI2.Models; using DesktopUI2.ViewModels; +using Serilog.Context; using Speckle.ConnectorCSI.Util; using Speckle.Core.Api; using Speckle.Core.Kits; +using Speckle.Core.Kits.ConverterInterfaces; using Speckle.Core.Logging; using Speckle.Core.Models; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Serilog.Context; using Speckle.Core.Models.GraphTraversal; -using Speckle.Core.Kits.ConverterInterfaces; namespace Speckle.ConnectorCSI.UI; @@ -184,8 +184,8 @@ ApplicationObject CreateApplicationObject(Base current) { ApplicationObject NewAppObj() { - var speckleType = current.speckle_type - .Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries) + var speckleType = current + .speckle_type.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault(); return new ApplicationObject(current.id, speckleType) { applicationId = current.applicationId, }; @@ -201,8 +201,8 @@ ApplicationObject NewAppObj() } //Handle objects convertable using displayValues - var fallbackMember = DefaultTraversal.displayValuePropAliases - .Where(o => current[o] != null) + var fallbackMember = DefaultTraversal + .displayValuePropAliases.Where(o => current[o] != null) .Select(o => current[o]) .FirstOrDefault(); diff --git a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Selection.cs b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Selection.cs index 922759878c..c963337732 100644 --- a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Selection.cs +++ b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Selection.cs @@ -1,8 +1,8 @@ +using System.Collections.Generic; +using System.Linq; using DesktopUI2; using DesktopUI2.Models.Filters; using Speckle.ConnectorCSI.Util; -using System.Collections.Generic; -using System.Linq; namespace Speckle.ConnectorCSI.UI; @@ -114,8 +114,8 @@ private List GetSelectionFilterObjects(ISelectionFilter filter) foreach (var type in typeFilter.Selection) { selection.AddRange( - ConnectorCSIUtils.ObjectIDsTypesAndNames - .Where(pair => pair.Value.Item1 == type) + ConnectorCSIUtils + .ObjectIDsTypesAndNames.Where(pair => pair.Value.Item1 == type) .Select(pair => pair.Key) .ToList() ); diff --git a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Send.cs b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Send.cs index 494e5915be..8a67d30a37 100644 --- a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Send.cs +++ b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Send.cs @@ -1,17 +1,17 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using DesktopUI2; using DesktopUI2.Models; using DesktopUI2.ViewModels; +using Serilog.Context; using Speckle.ConnectorCSI.Util; using Speckle.Core.Api; using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Serilog.Context; using SCT = Speckle.Core.Transports; namespace Speckle.ConnectorCSI.UI; @@ -94,8 +94,8 @@ ref ConcurrentDictionary conversionProgressDict Base converted = null; string containerName = string.Empty; - var selectedObjectType = ConnectorCSIUtils.ObjectIDsTypesAndNames - .Where(pair => pair.Key == applicationId) + var selectedObjectType = ConnectorCSIUtils + .ObjectIDsTypesAndNames.Where(pair => pair.Key == applicationId) .Select(pair => pair.Value.Item1) .FirstOrDefault(); @@ -107,8 +107,8 @@ ref ConcurrentDictionary conversionProgressDict continue; } - var typeAndName = ConnectorCSIUtils.ObjectIDsTypesAndNames - .Where(pair => pair.Key == applicationId) + var typeAndName = ConnectorCSIUtils + .ObjectIDsTypesAndNames.Where(pair => pair.Key == applicationId) .Select(pair => pair.Value) .FirstOrDefault(); diff --git a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Settings.cs b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Settings.cs index 74bf98825d..561cb98d4d 100644 --- a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Settings.cs +++ b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.Settings.cs @@ -1,7 +1,7 @@ +using System.Collections.Generic; using ConnectorCSIShared.Util; using DesktopUI2; using DesktopUI2.Models.Settings; -using System.Collections.Generic; namespace Speckle.ConnectorCSI.UI; diff --git a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.cs b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.cs index 52edef22a8..05171cdd2b 100644 --- a/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.cs +++ b/ConnectorCSI/ConnectorCSIShared/UI/ConnectorBindingsCSI.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using DesktopUI2; -using Speckle.Core.Models; using CSiAPIv1; +using DesktopUI2; using Speckle.Core.Kits; +using Speckle.Core.Models; namespace Speckle.ConnectorCSI.UI; diff --git a/ConnectorCSI/ConnectorCSIShared/Util/ConnectorCSIUtils.cs b/ConnectorCSI/ConnectorCSIShared/Util/ConnectorCSIUtils.cs index baca0fc375..ec0de35ec2 100644 --- a/ConnectorCSI/ConnectorCSIShared/Util/ConnectorCSIUtils.cs +++ b/ConnectorCSI/ConnectorCSIShared/Util/ConnectorCSIUtils.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; -using Speckle.Core.Logging; using System.Linq; using CSiAPIv1; +using Speckle.Core.Logging; namespace Speckle.ConnectorCSI.Util; diff --git a/ConnectorCSI/ConnectorCSIShared/cPlugin.cs b/ConnectorCSI/ConnectorCSIShared/cPlugin.cs index bde6185d0d..c7d6fc6c2a 100644 --- a/ConnectorCSI/ConnectorCSIShared/cPlugin.cs +++ b/ConnectorCSI/ConnectorCSIShared/cPlugin.cs @@ -1,16 +1,16 @@ using System; using System.Collections.Generic; -using DesktopUI2.ViewModels; -using DesktopUI2.Views; -using System.Timers; using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Timers; using Avalonia; using Avalonia.Controls; using Avalonia.ReactiveUI; using CSiAPIv1; +using DesktopUI2.ViewModels; +using DesktopUI2.Views; using Speckle.ConnectorCSI.UI; -using System.Reflection; -using System.IO; using Speckle.Core.Logging; namespace SpeckleConnectorCSI; diff --git a/ConnectorCSI/DriverCSharp/Program.cs b/ConnectorCSI/DriverCSharp/Program.cs index be6fc1d362..e71012229b 100644 --- a/ConnectorCSI/DriverCSharp/Program.cs +++ b/ConnectorCSI/DriverCSharp/Program.cs @@ -1,9 +1,8 @@ using System; -using Speckle.Core.Logging; using System.Windows.Forms; using CSiAPIv1; +using Speckle.Core.Logging; using SpeckleConnectorCSI; - #if DEBUG using System.Diagnostics; #endif diff --git a/ConnectorCore/DllConflictManagement/DllConflictManager.cs b/ConnectorCore/DllConflictManagement/DllConflictManager.cs index 6d38c00fc4..f045cdd783 100644 --- a/ConnectorCore/DllConflictManagement/DllConflictManager.cs +++ b/ConnectorCore/DllConflictManagement/DllConflictManager.cs @@ -255,8 +255,8 @@ public IEnumerable GetConflictInfoThatUserHasntSuppressedW } var options = _optionsLoader.LoadOptions(); - return _assemblyConflicts.Values.Where( - info => !options.DllsToIgnore.Contains(info.SpeckleDependencyAssemblyName.Name) + return _assemblyConflicts.Values.Where(info => + !options.DllsToIgnore.Contains(info.SpeckleDependencyAssemblyName.Name) ); } diff --git a/ConnectorDynamo/ConnectorDynamo/AccountsNode/AccountsViewCustomization.cs b/ConnectorDynamo/ConnectorDynamo/AccountsNode/AccountsViewCustomization.cs index a2ec9a6536..640080bf90 100644 --- a/ConnectorDynamo/ConnectorDynamo/AccountsNode/AccountsViewCustomization.cs +++ b/ConnectorDynamo/ConnectorDynamo/AccountsNode/AccountsViewCustomization.cs @@ -1,12 +1,12 @@ using System; -using Dynamo.Controls; -using Dynamo.Models; -using Dynamo.ViewModels; -using Dynamo.Wpf; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; +using Dynamo.Controls; +using Dynamo.Models; +using Dynamo.ViewModels; +using Dynamo.Wpf; using Speckle.Core.Credentials; namespace Speckle.ConnectorDynamo.AccountsNode; diff --git a/ConnectorDynamo/ConnectorDynamo/CreateStreamNode/CreateStreamViewCustomization.cs b/ConnectorDynamo/ConnectorDynamo/CreateStreamNode/CreateStreamViewCustomization.cs index 004466b5e3..250bc4f8a9 100644 --- a/ConnectorDynamo/ConnectorDynamo/CreateStreamNode/CreateStreamViewCustomization.cs +++ b/ConnectorDynamo/ConnectorDynamo/CreateStreamNode/CreateStreamViewCustomization.cs @@ -1,12 +1,12 @@ using System; -using Dynamo.Controls; -using Dynamo.Models; -using Dynamo.ViewModels; -using Dynamo.Wpf; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; +using Dynamo.Controls; +using Dynamo.Models; +using Dynamo.ViewModels; +using Dynamo.Wpf; using Speckle.Core.Helpers; namespace Speckle.ConnectorDynamo.CreateStreamNode; diff --git a/ConnectorDynamo/ConnectorDynamo/ReceiveNode/ReceiveViewCustomization.cs b/ConnectorDynamo/ConnectorDynamo/ReceiveNode/ReceiveViewCustomization.cs index 88301a5d2e..67d6ddcff7 100644 --- a/ConnectorDynamo/ConnectorDynamo/ReceiveNode/ReceiveViewCustomization.cs +++ b/ConnectorDynamo/ConnectorDynamo/ReceiveNode/ReceiveViewCustomization.cs @@ -1,11 +1,11 @@ -using Dynamo.Controls; -using Dynamo.Models; -using Dynamo.ViewModels; -using Dynamo.Wpf; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; +using Dynamo.Controls; +using Dynamo.Models; +using Dynamo.ViewModels; +using Dynamo.Wpf; using Speckle.Core.Helpers; namespace Speckle.ConnectorDynamo.ReceiveNode; diff --git a/ConnectorDynamo/ConnectorDynamo/SendNode/SendViewCustomization.cs b/ConnectorDynamo/ConnectorDynamo/SendNode/SendViewCustomization.cs index fbc6f138e7..f1be4aea92 100644 --- a/ConnectorDynamo/ConnectorDynamo/SendNode/SendViewCustomization.cs +++ b/ConnectorDynamo/ConnectorDynamo/SendNode/SendViewCustomization.cs @@ -1,12 +1,12 @@ -using Dynamo.Controls; -using Dynamo.Models; -using Dynamo.ViewModels; -using Dynamo.Wpf; using System.Collections.Generic; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; +using Dynamo.Controls; +using Dynamo.Models; +using Dynamo.ViewModels; +using Dynamo.Wpf; using Speckle.Core.Helpers; namespace Speckle.ConnectorDynamo.SendNode; diff --git a/ConnectorDynamo/ConnectorDynamo/ValueConverters/BoolVisibConverter.cs b/ConnectorDynamo/ConnectorDynamo/ValueConverters/BoolVisibConverter.cs index d43069e214..11f4317b36 100644 --- a/ConnectorDynamo/ConnectorDynamo/ValueConverters/BoolVisibConverter.cs +++ b/ConnectorDynamo/ConnectorDynamo/ValueConverters/BoolVisibConverter.cs @@ -1,7 +1,7 @@ using System; +using System.Globalization; using System.Windows; using System.Windows.Data; -using System.Globalization; namespace Speckle.ConnectorDynamo.ValueConverters; diff --git a/ConnectorDynamo/ConnectorDynamo/ViewNode/ViewViewCustomization.cs b/ConnectorDynamo/ConnectorDynamo/ViewNode/ViewViewCustomization.cs index 35cc05f0f0..671cb8e58c 100644 --- a/ConnectorDynamo/ConnectorDynamo/ViewNode/ViewViewCustomization.cs +++ b/ConnectorDynamo/ConnectorDynamo/ViewNode/ViewViewCustomization.cs @@ -1,10 +1,10 @@ +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; using Dynamo.Controls; using Dynamo.Models; using Dynamo.ViewModels; using Dynamo.Wpf; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Threading; namespace Speckle.ConnectorDynamo.ViewNode; diff --git a/ConnectorDynamo/ConnectorDynamoExtension/SpeckleExtension.cs b/ConnectorDynamo/ConnectorDynamoExtension/SpeckleExtension.cs index 57df1b6ff5..55fc08c0a8 100644 --- a/ConnectorDynamo/ConnectorDynamoExtension/SpeckleExtension.cs +++ b/ConnectorDynamo/ConnectorDynamoExtension/SpeckleExtension.cs @@ -40,8 +40,8 @@ public void Loaded(ViewLoadedParams viewLoadedParams) private static void SetCurrentRevitDocumentToGlobals() { - Globals.RevitDocument = DocumentManager.Instance - .GetType() + Globals.RevitDocument = DocumentManager + .Instance.GetType() .GetProperty("CurrentDBDocument") ?.GetValue(DocumentManager.Instance); } diff --git a/ConnectorDynamo/ConnectorDynamoExtension/SpeckleWatchHandler.cs b/ConnectorDynamo/ConnectorDynamoExtension/SpeckleWatchHandler.cs index c212bc035f..cd3fdb017a 100644 --- a/ConnectorDynamo/ConnectorDynamoExtension/SpeckleWatchHandler.cs +++ b/ConnectorDynamo/ConnectorDynamoExtension/SpeckleWatchHandler.cs @@ -3,7 +3,6 @@ using System.Linq; using Dynamo.Interfaces; using Dynamo.ViewModels; - using ProtoCore.Mirror; using Speckle.Core.Credentials; using Speckle.Core.Helpers; diff --git a/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs b/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs index 6d5658fb57..7bd2d9c05b 100644 --- a/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs +++ b/ConnectorDynamo/ConnectorDynamoFunctions/BatchConverter.cs @@ -1,12 +1,12 @@ -using Autodesk.DesignScript.Runtime; -using Speckle.Core.Kits; -using Speckle.Core.Models; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; +using Autodesk.DesignScript.Runtime; +using Speckle.Core.Kits; using Speckle.Core.Logging; +using Speckle.Core.Models; namespace Speckle.ConnectorDynamo.Functions; @@ -97,8 +97,8 @@ private static Dictionary DynamoDictionaryToDictionary(DesignScr { var dict = new Dictionary(); - dsDic.Keys - .ToList() + dsDic + .Keys.ToList() .ForEach(key => { dict[key] = dsDic.ValueAtKey(key); @@ -219,10 +219,8 @@ public object ConvertDataTreeToNative(Base @base) continue; // Ignore non matching elements, done for extra safety. } - var parts = name.Split('{')[ - 1 - ] // Get everything after open curly brace - .Split('}')[0] // Get everything before close curly brace + var parts = name.Split('{')[1] // Get everything after open curly brace + .Split('}')[0] // Get everything before close curly brace .Split(';') // Split by ; .Select(text => { diff --git a/ConnectorDynamo/ConnectorDynamoFunctions/InMemoryCache.cs b/ConnectorDynamo/ConnectorDynamoFunctions/InMemoryCache.cs index 393a597476..199036ed6c 100644 --- a/ConnectorDynamo/ConnectorDynamoFunctions/InMemoryCache.cs +++ b/ConnectorDynamo/ConnectorDynamoFunctions/InMemoryCache.cs @@ -1,5 +1,5 @@ -using Autodesk.DesignScript.Runtime; using System.Collections.Generic; +using Autodesk.DesignScript.Runtime; namespace Speckle.ConnectorDynamo.Functions; diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Accounts/Accounts.ListAccounts.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Accounts/Accounts.ListAccounts.cs index 3e87ecbfad..8bcf2bd7f3 100755 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Accounts/Accounts.ListAccounts.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Accounts/Accounts.ListAccounts.cs @@ -71,9 +71,10 @@ private void SetAccountList() Tracker.TrackNodeRun("Accounts list"); - var valueItems = accounts.Select( - account => new GH_ValueListItem(account.ToString(), $"\"{AccountManager.GetLocalIdentifierForAccount(account)}\"") - ); + var valueItems = accounts.Select(account => new GH_ValueListItem( + account.ToString(), + $"\"{AccountManager.GetLocalIdentifierForAccount(account)}\"" + )); ListItems.AddRange(valueItems); if (_selectedAccountUrl == null) diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Extras/Utilities.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Extras/Utilities.cs index e7f71c8af1..795650497a 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Extras/Utilities.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Extras/Utilities.cs @@ -16,7 +16,6 @@ using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; - #if RHINO8_OR_GREATER using Grasshopper.Rhinoceros.Model; #endif @@ -547,9 +546,9 @@ private static object UnwrapRhino8Object(object value) case ModelObject modelObject: { var propInfo = value - .GetType() - .GetProperty("Geometry", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - + .GetType() + .GetProperty("Geometry", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + return propInfo?.GetValue(value) ?? value; } default: diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Loader.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Loader.cs index d5b4b2759b..5dffe14135 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Loader.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Loader.cs @@ -38,7 +38,7 @@ public override GH_LoadingInstruction PriorityLoad() { const bool ENHANCED_LOG_CONTEXT = #if MAC - false; + false; #else true; #endif @@ -243,7 +243,7 @@ private void AddSpeckleMenu(MenuStrip mainMenu) ); #if MAC - path = @"/Applications/Manager for Speckle.app"; + path = @"/Applications/Manager for Speckle.app"; #else path = Path.Combine( @@ -313,7 +313,7 @@ private void CreateHeadlessTemplateMenu() Directory.CreateDirectory(path); } #if MAC - Open.File("file://" + path); + Open.File("file://" + path); #else Open.File("explorer.exe", "/select, " + path); #endif @@ -510,8 +510,11 @@ public static void SetupHeadlessDoc() _headlessDoc = RhinoDoc.CreateHeadless(null); Console.WriteLine( - $"Speckle - Backup headless doc is ready: '{_headlessDoc.Name ?? "Untitled"}'\n with template: '{_headlessDoc.TemplateFileUsed ?? "No template"}'\n with units: {_headlessDoc.ModelUnitSystem}"); - Console.WriteLine("Speckle - To modify the units in a headless run, you can override the 'RhinoDoc.ActiveDoc' in the '.gh' file using a c#/python script."); + $"Speckle - Backup headless doc is ready: '{_headlessDoc.Name ?? "Untitled"}'\n with template: '{_headlessDoc.TemplateFileUsed ?? "No template"}'\n with units: {_headlessDoc.ModelUnitSystem}" + ); + Console.WriteLine( + "Speckle - To modify the units in a headless run, you can override the 'RhinoDoc.ActiveDoc' in the '.gh' file using a c#/python script." + ); #endif } @@ -529,7 +532,8 @@ public static RhinoDoc GetCurrentDocument() // Only time the _headlessDoc is not set is upon document opening, where the components will // check for this as their normal initialisation routine, but the document will be refreshed on every solution run. Console.WriteLine( - $"Speckle - Fetching headless doc '{_headlessDoc?.Name ?? "Untitled"}'\n with template: '{_headlessDoc.TemplateFileUsed ?? "No template"}'"); + $"Speckle - Fetching headless doc '{_headlessDoc?.Name ?? "Untitled"}'\n with template: '{_headlessDoc.TemplateFileUsed ?? "No template"}'" + ); Console.WriteLine(" Model units:" + _headlessDoc.ModelUnitSystem); return _headlessDoc; } diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/CreateSpeckleObjectTaskComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/CreateSpeckleObjectTaskComponent.cs index e2b979b667..e3a8e972fb 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/CreateSpeckleObjectTaskComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/CreateSpeckleObjectTaskComponent.cs @@ -63,8 +63,8 @@ public bool DestroyParameter(GH_ParameterSide side, int index) public void VariableParameterMaintenance() { - Params.Input - .Where(param => !(param.Attributes is GenericAccessParamAttributes)) + Params + .Input.Where(param => !(param.Attributes is GenericAccessParamAttributes)) .ToList() .ForEach(param => param.Attributes = new GenericAccessParamAttributes(param, Attributes)); } @@ -203,8 +203,8 @@ public async Task DoWork(Dictionary inputData) @base = null; } - inputData?.Keys - .ToList() + inputData + ?.Keys.ToList() .ForEach(key => { var value = inputData[key]; diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/DeconstructSpeckleObjectTaskComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/DeconstructSpeckleObjectTaskComponent.cs index 8e34cb420f..67c3fba25d 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/DeconstructSpeckleObjectTaskComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/DeconstructSpeckleObjectTaskComponent.cs @@ -66,8 +66,8 @@ public bool DestroyParameter(GH_ParameterSide side, int index) public void VariableParameterMaintenance() { // Perform parameter maintenance here! - Params.Input - .Where(param => !(param.Attributes is GenericAccessParamAttributes)) + Params + .Input.Where(param => !(param.Attributes is GenericAccessParamAttributes)) .ToList() .ForEach(param => param.Attributes = new GenericAccessParamAttributes(param, Attributes)); } @@ -177,8 +177,8 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA) { case IGH_Structure structure: var path = DA.ParameterTargetPath(indexOfOutputParam); - structure.Paths - .ToList() + structure + .Paths.ToList() .ForEach(p => { var indices = path.Indices.ToList(); @@ -224,8 +224,8 @@ private bool HasSingleRename() return false; } - var diffParams = Params.Output.Where( - param => !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) + var diffParams = Params.Output.Where(param => + !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) ); return diffParams.Count() == 1; } @@ -242,11 +242,11 @@ private void AutoCreateOutputs() // Check for single param rename, if so, just rename it and go on. if (HasSingleRename()) { - var diffParams = Params.Output.Where( - param => !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) + var diffParams = Params.Output.Where(param => + !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) ); - var diffOut = outputList.Where( - name => !Params.Output.Select(p => p.NickName).Contains(name.StartsWith("@") ? name.Substring(1) : name) + var diffOut = outputList.Where(name => + !Params.Output.Select(p => p.NickName).Contains(name.StartsWith("@") ? name.Substring(1) : name) ); var newName = diffOut.First(); @@ -261,8 +261,8 @@ private void AutoCreateOutputs() else { // Check what params must be deleted, and do so when safe. - var remove = Params.Output - .Select( + var remove = Params + .Output.Select( (p, i) => { var res = outputList.Find(o => o == p.Name); @@ -356,8 +356,8 @@ private List GetOutputList(GH_Structure speckleObjects) if (converted is Base b) { b.GetMembers( - DynamicBaseMemberType.Instance | DynamicBaseMemberType.Dynamic | DynamicBaseMemberType.SchemaComputed - ) + DynamicBaseMemberType.Instance | DynamicBaseMemberType.Dynamic | DynamicBaseMemberType.SchemaComputed + ) .Keys.ToList() .ForEach(prop => { diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/Deprecated/ExpandSpeckleObjectTaskComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/Deprecated/ExpandSpeckleObjectTaskComponent.cs index 8e51085412..954d90d956 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/Deprecated/ExpandSpeckleObjectTaskComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/Deprecated/ExpandSpeckleObjectTaskComponent.cs @@ -110,8 +110,8 @@ public bool DestroyParameter(GH_ParameterSide side, int index) public void VariableParameterMaintenance() { // Perform parameter maintenance here! - Params.Input - .Where(param => !(param.Attributes is GenericAccessParamAttributes)) + Params + .Input.Where(param => !(param.Attributes is GenericAccessParamAttributes)) .ToList() .ForEach(param => param.Attributes = new GenericAccessParamAttributes(param, Attributes)); } @@ -190,8 +190,8 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA) { case IGH_Structure structure: var path = DA.ParameterTargetPath(indexOfOutputParam); - structure.Paths - .ToList() + structure + .Paths.ToList() .ForEach(p => { var indices = path.Indices.ToList(); @@ -238,8 +238,8 @@ private bool HasSingleRename() return false; } - var diffParams = Params.Output.Where( - param => !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) + var diffParams = Params.Output.Where(param => + !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) ); return diffParams.Count() == 1; } @@ -256,11 +256,11 @@ private void AutoCreateOutputs() // Check for single param rename, if so, just rename it and go on. if (HasSingleRename()) { - var diffParams = Params.Output.Where( - param => !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) + var diffParams = Params.Output.Where(param => + !outputList.Contains(param.NickName) && !outputList.Contains("@" + param.NickName) ); - var diffOut = outputList.Where( - name => !Params.Output.Select(p => p.NickName).Contains(name.StartsWith("@") ? name.Substring(1) : name) + var diffOut = outputList.Where(name => + !Params.Output.Select(p => p.NickName).Contains(name.StartsWith("@") ? name.Substring(1) : name) ); var newName = diffOut.First(); @@ -274,8 +274,8 @@ private void AutoCreateOutputs() return; } // Check what params must be deleted, and do so when safe. - var remove = Params.Output - .Select( + var remove = Params + .Output.Select( (p, i) => { var res = outputList.Find(o => o == p.Name); diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/ExtendSpeckleObjectTaskComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/ExtendSpeckleObjectTaskComponent.cs index 2fe0e18e8c..8c15c1e288 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/ExtendSpeckleObjectTaskComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Objects/ExtendSpeckleObjectTaskComponent.cs @@ -64,8 +64,8 @@ public bool DestroyParameter(GH_ParameterSide side, int index) public void VariableParameterMaintenance() { - Params.Input - .Where(param => !(param.Attributes is GenericAccessParamAttributes)) + Params + .Input.Where(param => !(param.Attributes is GenericAccessParamAttributes)) .ToList() .ForEach(param => param.Attributes = new GenericAccessParamAttributes(param, Attributes)); } @@ -282,8 +282,8 @@ public Base DoWork(Base @base, Dictionary inputData) { var hasErrors = false; - inputData?.Keys - .ToList() + inputData + ?.Keys.ToList() .ForEach(key => { var value = inputData[key]; diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs index 05fe8b2e69..19427cb5a3 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponent.cs @@ -561,8 +561,8 @@ public override void DoWork(Action ReportProgress, Action Done) }; // Check to see if we have a previous commit; if so set it. - var prevCommit = prevCommits.FirstOrDefault( - c => c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId + var prevCommit = prevCommits.FirstOrDefault(c => + c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId ); if (prevCommit != null) { diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponentSync.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponentSync.cs index 9296efe98b..bbfac21ed5 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponentSync.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.SendComponentSync.cs @@ -450,8 +450,8 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA) }; // Check to see if we have a previous commit; if so set it. - var prevCommit = prevCommits.FirstOrDefault( - c => c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId + var prevCommit = prevCommits.FirstOrDefault(c => + c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId ); if (prevCommit != null) { diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs index 13625e25a5..90c32cb98c 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Deprecated/Operations.VariableInputSendComponent.cs @@ -645,8 +645,8 @@ public override void DoWork(Action ReportProgress, Action Done) }; // Check to see if we have a previous commit; if so set it. - var prevCommit = prevCommits.FirstOrDefault( - c => c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId + var prevCommit = prevCommits.FirstOrDefault(c => + c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId ); if (prevCommit != null) { diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncSendComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncSendComponent.cs index 1e7031a33c..aabbccb1b6 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncSendComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.SyncSendComponent.cs @@ -290,8 +290,8 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA) }; // Check to see if we have a previous commit; if so set it. - var prevCommit = prevCommits.FirstOrDefault( - c => c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId + var prevCommit = prevCommits.FirstOrDefault(c => + c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId ); if (prevCommit != null) { diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs index 7b9aca80d5..f03edf0118 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputReceiveComponent.cs @@ -383,8 +383,8 @@ protected override void SolveInstance(IGH_DataAccess DA) { foreach (var key in PrevReceivedData.Keys) { - var index = Params.Output.FindIndex( - p => p.Name == key || p.NickName == key || p.Name == key.Substring(1) || p.NickName == key.Substring(1) + var index = Params.Output.FindIndex(p => + p.Name == key || p.NickName == key || p.Name == key.Substring(1) || p.NickName == key.Substring(1) ); var outTree = PrevReceivedData[key]; DA.SetDataTree(index, outTree); @@ -988,8 +988,8 @@ private bool HasSingleRename() return false; } - var diffParams = Parent?.Params.Output.Where( - param => !outputList.Contains(param.Name) && !outputList.Contains("@" + param.Name) + var diffParams = Parent?.Params.Output.Where(param => + !outputList.Contains(param.Name) && !outputList.Contains("@" + param.Name) ); return diffParams.Count() == 1; } @@ -1021,8 +1021,8 @@ private void AutoCreateOutputs(Base @base) } // Check what params must be deleted, and do so when safe. - var remove = Parent.Params.Output - .Select( + var remove = Parent + .Params.Output.Select( (p, i) => { var res = outputList.Find(o => o == p.Name || p.Name == o.Substring(1)); diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs index 5d4a143a0b..7cfc6e089b 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Ops/Operations.VariableInputSendComponent.cs @@ -101,8 +101,8 @@ public bool DestroyParameter(GH_ParameterSide side, int index) public void VariableParameterMaintenance() { - Params.Input - .Skip(2) + Params + .Input.Skip(2) .Where(param => !(param.Attributes is GenericAccessParamAttributes)) .ToList() .ForEach(param => param.Attributes = new GenericAccessParamAttributes(param, Attributes)); @@ -681,8 +681,8 @@ public override void DoWork(Action ReportProgress, Action Done) }; // Check to see if we have a previous commit; if so set it. - var prevCommit = prevCommits.FirstOrDefault( - c => c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId + var prevCommit = prevCommits.FirstOrDefault(c => + c.ServerUrl == client.ServerUrl && c.StreamId == ((ServerTransport)transport).StreamId ); if (prevCommit != null) { diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObject.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObject.cs index 67f00ce746..636eb9686a 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObject.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObject.cs @@ -102,11 +102,10 @@ public override void AppendAdditionalMenuItems(ToolStripDropDown menu) { mainParam = SelectedConstructor .GetParameters() - .First( - cParam => - CustomAttributeData - .GetCustomAttributes(cParam) - .Any(o => o.AttributeType.IsEquivalentTo(typeof(SchemaMainParam))) + .First(cParam => + CustomAttributeData + .GetCustomAttributes(cParam) + .Any(o => o.AttributeType.IsEquivalentTo(typeof(SchemaMainParam))) ); } catch (Exception ex) when (!ex.IsFatal()) diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObjectBase.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObjectBase.cs index 3c15340967..1218790f03 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObjectBase.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/CreateSchemaObjectBase.cs @@ -90,12 +90,11 @@ public override void AppendAdditionalMenuItems(ToolStripDropDown menu) { mainParam = SelectedConstructor .GetParameters() - .FirstOrDefault( - cParam => - CustomAttributeData - .GetCustomAttributes(cParam) - ?.Where(o => o.AttributeType.IsEquivalentTo(typeof(SchemaMainParam))) - ?.Count() > 0 + .FirstOrDefault(cParam => + CustomAttributeData + .GetCustomAttributes(cParam) + ?.Where(o => o.AttributeType.IsEquivalentTo(typeof(SchemaMainParam))) + ?.Count() > 0 ); } catch (Exception ex) when (!ex.IsFatal()) diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/SchemaBuilderGen.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/SchemaBuilderGen.cs index 11aa00f1d2..76a24c9601 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/SchemaBuilderGen.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/SchemaBuilder/SchemaBuilderGen.cs @@ -1,8 +1,8 @@ using System; using System.Linq; -using Grasshopper.Kernel; -using Grasshopper; using ConnectorGrasshopperUtils; +using Grasshopper; +using Grasshopper.Kernel; namespace ConnectorGrasshopper; diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/Streams/Deprecated/StreamDetailsComponent.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/Streams/Deprecated/StreamDetailsComponent.cs index 67ed396806..8fc208f670 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/Streams/Deprecated/StreamDetailsComponent.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/Streams/Deprecated/StreamDetailsComponent.cs @@ -110,8 +110,8 @@ public override void SolveInstanceWithLogContext(IGH_DataAccess DA) int count = 0; var tasks = new Dictionary>(); - ghStreamTree.Paths - .ToList() + ghStreamTree + .Paths.ToList() .ForEach(path => { if (count >= 20) diff --git a/ConnectorGrasshopper/ConnectorGrasshopperShared/UpgradeUtilities.cs b/ConnectorGrasshopper/ConnectorGrasshopperShared/UpgradeUtilities.cs index a57f43add3..a6b7e5e77e 100644 --- a/ConnectorGrasshopper/ConnectorGrasshopperShared/UpgradeUtilities.cs +++ b/ConnectorGrasshopper/ConnectorGrasshopperShared/UpgradeUtilities.cs @@ -8,8 +8,8 @@ public static class UpgradeUtils { public static void SwapGroups(GH_Document document, IGH_Component component, IGH_Component upgradedComponent) { - var groups = document.Objects - .OfType() + var groups = document + .Objects.OfType() .Where(gr => gr.ObjectIDs.Contains(component.InstanceGuid)) .ToList(); groups.ForEach(g => g.AddObject(upgradedComponent.InstanceGuid)); diff --git a/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Conversion.cs b/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Conversion.cs index 2823be9e47..ed270c1957 100644 --- a/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Conversion.cs +++ b/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Conversion.cs @@ -354,8 +354,8 @@ private void ConvertViews(StreamState state, DynamicBase commitObject) { var selectionBuilder = new SelectionHandler(state, _progressViewModel) { ProgressBar = _progressBar }; - var selectedViews = state.Filter.Selection - .Distinct() + var selectedViews = state + .Filter.Selection.Distinct() .Select(selectionBuilder.ResolveSavedViewpoint) .Select(_conversionInvoker.Convert) .Where(c => c != null) diff --git a/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Selections.cs b/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Selections.cs index 67a4c4de62..8fa944232d 100644 --- a/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Selections.cs +++ b/ConnectorNavisworks/ConnectorNavisworks/Bindings/ConnectorNavisworksBindings.Selections.cs @@ -23,8 +23,8 @@ public override List GetSelectedObjects() // Storing as a Set for consistency with the converter's handling of fragments and paths. var selectedObjects = new HashSet( - s_activeDoc.CurrentSelection.SelectedItems - .Where(Element.IsElementVisible) + s_activeDoc + .CurrentSelection.SelectedItems.Where(Element.IsElementVisible) .Select(Element.ResolveModelItemToIndexPath) ); diff --git a/ConnectorNavisworks/ConnectorNavisworks/Entry/Ribbon.xaml.cs b/ConnectorNavisworks/ConnectorNavisworks/Entry/Ribbon.xaml.cs index 421f0ba280..28c7177d7b 100644 --- a/ConnectorNavisworks/ConnectorNavisworks/Entry/Ribbon.xaml.cs +++ b/ConnectorNavisworks/ConnectorNavisworks/Entry/Ribbon.xaml.cs @@ -7,7 +7,6 @@ using Speckle.Core.Helpers; using Speckle.Core.Logging; using NavisworksApp = Autodesk.Navisworks.Api.Application; - #if DEBUG using System.Text; #endif @@ -79,25 +78,21 @@ public override CommandState CanExecuteCommand(string commandId) return commandId switch { TurnPersistCacheOn.COMMAND - => new CommandState - { + => new CommandState { #if DEBUG IsVisible = !ConnectorBindingsNavisworks.PersistCache, #else IsVisible = false, #endif - IsEnabled = !ConnectorBindingsNavisworks.PersistCache - }, + IsEnabled = !ConnectorBindingsNavisworks.PersistCache }, TurnPersistCacheOff.COMMAND - => new CommandState - { + => new CommandState { #if DEBUG IsVisible = ConnectorBindingsNavisworks.PersistCache, #else IsVisible = false, #endif - IsEnabled = ConnectorBindingsNavisworks.PersistCache - }, + IsEnabled = ConnectorBindingsNavisworks.PersistCache }, _ => commandId == RetryLastConversionSend.COMMAND ? new CommandState(ConnectorBindingsNavisworks.CachedConversion) diff --git a/ConnectorNavisworks/ConnectorNavisworks/Other/Elements.cs b/ConnectorNavisworks/ConnectorNavisworks/Other/Elements.cs index 3dd451cf80..a10a2acf9a 100644 --- a/ConnectorNavisworks/ConnectorNavisworks/Other/Elements.cs +++ b/ConnectorNavisworks/ConnectorNavisworks/Other/Elements.cs @@ -280,15 +280,12 @@ DynamicBase baseNode .ToDictionary(group => group.Key, group => group.Select(item => item.Value).Last()); var formattedProperties = groupedProperties - .Select( - kVp => - new - { - Category = kVp.Key.Substring(0, kVp.Key.IndexOf("--", StringComparison.Ordinal)), - Property = kVp.Key.Substring(kVp.Key.IndexOf("--", StringComparison.Ordinal) + 2), - kVp.Value - } - ) + .Select(kVp => new + { + Category = kVp.Key.Substring(0, kVp.Key.IndexOf("--", StringComparison.Ordinal)), + Property = kVp.Key.Substring(kVp.Key.IndexOf("--", StringComparison.Ordinal) + 2), + kVp.Value + }) .Where(item => item.Category != "Internal"); var propertyStack = formattedProperties diff --git a/ConnectorNavisworks/ConnectorNavisworks/Other/SelectionBuilder.cs b/ConnectorNavisworks/ConnectorNavisworks/Other/SelectionBuilder.cs index 9cae7b675a..dc87009e77 100644 --- a/ConnectorNavisworks/ConnectorNavisworks/Other/SelectionBuilder.cs +++ b/ConnectorNavisworks/ConnectorNavisworks/Other/SelectionBuilder.cs @@ -169,16 +169,16 @@ private HashSet GetObjectsFromSavedViewpoint() public SavedViewpoint ResolveSavedViewpoint(string savedViewReference) { // Get a flattened list of viewpoints and their references - var flattenedViewpointList = Application.ActiveDocument.SavedViewpoints.RootItem.Children - .Select(GetViews) + var flattenedViewpointList = Application + .ActiveDocument.SavedViewpoints.RootItem.Children.Select(GetViews) .Where(x => x != null) .SelectMany(node => node.Flatten()) .Select(node => new { node.Reference, node.Guid }) .ToList(); // Find a match based on the saved view reference - var viewPointMatch = flattenedViewpointList.FirstOrDefault( - node => node.Guid.ToString() == savedViewReference || node.Reference == savedViewReference + var viewPointMatch = flattenedViewpointList.FirstOrDefault(node => + node.Guid.ToString() == savedViewReference || node.Reference == savedViewReference ); if (viewPointMatch != null) @@ -385,8 +385,8 @@ public void PopulateHierarchyAndOmitHidden() return new HashSet(); } - var trimmedAncestors = targetFirstObjectChild.Ancestors - .TakeWhile(ancestor => ancestor != firstObjectAncestor) + var trimmedAncestors = targetFirstObjectChild + .Ancestors.TakeWhile(ancestor => ancestor != firstObjectAncestor) .Append(firstObjectAncestor); return trimmedAncestors; diff --git a/ConnectorNavisworks/ConnectorNavisworks/Other/Utilities.cs b/ConnectorNavisworks/ConnectorNavisworks/Other/Utilities.cs index 89c0a7d208..b019c318c0 100644 --- a/ConnectorNavisworks/ConnectorNavisworks/Other/Utilities.cs +++ b/ConnectorNavisworks/ConnectorNavisworks/Other/Utilities.cs @@ -20,17 +20,17 @@ public static T[] ToArray(this Array arr) public static class SpeckleNavisworksUtilities { #if NAVMAN22 - public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2025); + public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2025); #elif NAVMAN21 - public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2024); + public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2024); #elif NAVMAN20 public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2023); #elif NAVMAN19 - public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2022); + public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2022); #elif NAVMAN18 - public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2021); + public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2021); #elif NAVMAN17 - public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2020); + public static readonly string VersionedAppName = HostApplications.Navisworks.GetVersion(HostAppVersion.v2020); #endif internal static void ConsoleLog(string message, ConsoleColor color = ConsoleColor.Blue) => diff --git a/ConnectorRevit/ConnectorRevit/ConnectorRevitUtils.cs b/ConnectorRevit/ConnectorRevit/ConnectorRevitUtils.cs index 469db91068..1f8c02d72f 100644 --- a/ConnectorRevit/ConnectorRevit/ConnectorRevitUtils.cs +++ b/ConnectorRevit/ConnectorRevit/ConnectorRevitUtils.cs @@ -109,12 +109,11 @@ public static List Views2D(this Document doc) .WhereElementIsNotElementType() .OfCategory(BuiltInCategory.OST_Views) .Cast() - .Where( - x => - x.ViewType == ViewType.CeilingPlan - || x.ViewType == ViewType.FloorPlan - || x.ViewType == ViewType.Elevation - || x.ViewType == ViewType.Section + .Where(x => + x.ViewType == ViewType.CeilingPlan + || x.ViewType == ViewType.FloorPlan + || x.ViewType == ViewType.Elevation + || x.ViewType == ViewType.Section ) .ToList(); diff --git a/ConnectorRevit/ConnectorRevit/Entry/App.cs b/ConnectorRevit/ConnectorRevit/Entry/App.cs index f5f37980c9..29de9e88e0 100644 --- a/ConnectorRevit/ConnectorRevit/Entry/App.cs +++ b/ConnectorRevit/ConnectorRevit/Entry/App.cs @@ -4,20 +4,20 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using Autodesk.Revit.ApplicationServices; +using Autodesk.Revit.DB.Events; using Autodesk.Revit.UI; +using ConnectorRevit.Entry; using RevitSharedResources.Extensions.SpeckleExtensions; using RevitSharedResources.Models; using Speckle.ConnectorRevit.UI; +using Speckle.Core.Helpers; using Speckle.Core.Kits; using Speckle.Core.Logging; -using ConnectorRevit.Entry; using Speckle.DllConflictManagement; -using Speckle.DllConflictManagement.Serialization; using Speckle.DllConflictManagement.Analytics; -using Speckle.DllConflictManagement.EventEmitter; using Speckle.DllConflictManagement.ConflictManagementOptions; -using Autodesk.Revit.DB.Events; -using Speckle.Core.Helpers; +using Speckle.DllConflictManagement.EventEmitter; +using Speckle.DllConflictManagement.Serialization; namespace Speckle.ConnectorRevit.Entry; diff --git a/ConnectorRevit/ConnectorRevit/Storage/StreamStateManager.cs b/ConnectorRevit/ConnectorRevit/Storage/StreamStateManager.cs index 3c44df3989..c947eac8b0 100644 --- a/ConnectorRevit/ConnectorRevit/Storage/StreamStateManager.cs +++ b/ConnectorRevit/ConnectorRevit/Storage/StreamStateManager.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; - using Autodesk.Revit.DB; using Autodesk.Revit.DB.ExtensibleStorage; using DesktopUI2.Models; @@ -16,7 +15,7 @@ namespace Speckle.ConnectorRevit.Storage; /// public static class StreamStateManager { - readonly static Guid ID = new("4EF264B9-5AA0-4B99-A6E7-C82ACEB26DE2"); + static readonly Guid ID = new("4EF264B9-5AA0-4B99-A6E7-C82ACEB26DE2"); /// /// Returns all the speckle stream states present in the current document. diff --git a/ConnectorRevit/ConnectorRevit/TypeMapping/ElementTypeMapper.cs b/ConnectorRevit/ConnectorRevit/TypeMapping/ElementTypeMapper.cs index cc7a18fe25..b4b1ca104f 100644 --- a/ConnectorRevit/ConnectorRevit/TypeMapping/ElementTypeMapper.cs +++ b/ConnectorRevit/ConnectorRevit/TypeMapping/ElementTypeMapper.cs @@ -153,8 +153,8 @@ private async Task ShouldShowCustomMappingDialog(string listBoxSelection, private static async Task ShowMissingIncomingTypesDialog() { - var response = await Dispatcher.UIThread - .InvokeAsync(() => + var response = await Dispatcher + .UIThread.InvokeAsync(() => { Analytics.TrackEvent( Analytics.Events.DUIAction, @@ -193,8 +193,8 @@ int numNewTypes var vm = new TypeMappingOnReceiveViewModel(currentMapping, hostTypesContainer, numNewTypes == 0); FamilyImporter familyImporter = null; - await Dispatcher.UIThread - .InvokeAsync(() => + await Dispatcher + .UIThread.InvokeAsync(() => { var mappingView = new MappingViewDialog { DataContext = vm }; return mappingView.ShowDialog(); @@ -225,8 +225,8 @@ await Dispatcher.UIThread } vm = new TypeMappingOnReceiveViewModel(currentMapping, hostTypesContainer, numNewTypes == 0); - await Dispatcher.UIThread - .InvokeAsync(() => + await Dispatcher + .UIThread.InvokeAsync(() => { var mappingView = new MappingViewDialog { DataContext = vm }; return mappingView.ShowDialog(); diff --git a/ConnectorRevit/ConnectorRevit/TypeMapping/FamilyImporter.cs b/ConnectorRevit/ConnectorRevit/TypeMapping/FamilyImporter.cs index d7cf9a0921..efb905a984 100644 --- a/ConnectorRevit/ConnectorRevit/TypeMapping/FamilyImporter.cs +++ b/ConnectorRevit/ConnectorRevit/TypeMapping/FamilyImporter.cs @@ -47,8 +47,8 @@ IRevitDocumentAggregateCache revitDocumentAggregateCache /// public async Task ImportFamilyTypes(HostTypeContainer hostTypesContainer) { - var familyPaths = await Dispatcher.UIThread - .InvokeAsync(() => + var familyPaths = await Dispatcher + .UIThread.InvokeAsync(() => { using var windowsDialog = new OpenFileDialog { @@ -71,8 +71,8 @@ public async Task ImportFamilyTypes(HostTypeContainer hostTypesContainer) await PopulateSymbolAndFamilyInfo(familyPaths, allSymbols, familyInfo).ConfigureAwait(false); var vm = new ImportFamiliesDialogViewModel(allSymbols); - await Dispatcher.UIThread - .InvokeAsync(async () => + await Dispatcher + .UIThread.InvokeAsync(async () => { var importFamilies = new ImportFamiliesDialog { DataContext = vm }; await importFamilies.ShowDialog().ConfigureAwait(true); diff --git a/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Events.cs b/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Events.cs index 9d696564a9..9ab1109a99 100644 --- a/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Events.cs +++ b/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Events.cs @@ -8,13 +8,13 @@ using DesktopUI2.Models; using DesktopUI2.ViewModels; using DesktopUI2.Views.Windows.Dialogs; +using RevitSharedResources.Extensions.SpeckleExtensions; using RevitSharedResources.Models; using Speckle.ConnectorRevit.Entry; using Speckle.ConnectorRevit.Storage; using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; -using RevitSharedResources.Extensions.SpeckleExtensions; namespace Speckle.ConnectorRevit.UI; diff --git a/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Previews.cs b/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Previews.cs index e07220ea7d..71a40beb0d 100644 --- a/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Previews.cs +++ b/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Previews.cs @@ -1,19 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Autodesk.Revit.DB; +using Autodesk.Revit.DB.DirectContext3D; using Autodesk.Revit.DB.ExternalService; using DesktopUI2; using DesktopUI2.Models; using DesktopUI2.ViewModels; +using RevitSharedResources.Interfaces; +using RevitSharedResources.Models; using Speckle.Core.Api; using Speckle.Core.Kits; using Speckle.Core.Models; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using System.Linq; using ApplicationObject = Speckle.Core.Models.ApplicationObject; -using Autodesk.Revit.DB.DirectContext3D; -using RevitSharedResources.Interfaces; -using RevitSharedResources.Models; namespace Speckle.ConnectorRevit.UI; diff --git a/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Selection.cs b/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Selection.cs index a01c341f0f..9b5246105c 100644 --- a/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Selection.cs +++ b/ConnectorRevit/ConnectorRevit/UI/ConnectorBindingsRevit.Selection.cs @@ -130,8 +130,8 @@ public override List GetSelectedObjects() return new List(); } - var selectedObjects = CurrentDoc.Selection - .GetElementIds() + var selectedObjects = CurrentDoc + .Selection.GetElementIds() .Select(id => CurrentDoc.Document.GetElement(id).UniqueId) .ToList(); return selectedObjects; @@ -476,9 +476,11 @@ private static List GetSelectionByView(List views, Dictionary !selection.Any(s => s.UniqueId == x.UniqueId))); + selection.AddRange( + linkedDoc + .Value.GetSupportedElements(revitDocumentAggregateCache) + .Where(x => !selection.Any(s => s.UniqueId == x.UniqueId)) + ); #endif } } diff --git a/ConnectorRevit/RevitSharedResources/Extensions/SpeckleExtensions/IRevitObjectCacheExtensions.cs b/ConnectorRevit/RevitSharedResources/Extensions/SpeckleExtensions/IRevitObjectCacheExtensions.cs index 2099593e16..3c3403cdf4 100644 --- a/ConnectorRevit/RevitSharedResources/Extensions/SpeckleExtensions/IRevitObjectCacheExtensions.cs +++ b/ConnectorRevit/RevitSharedResources/Extensions/SpeckleExtensions/IRevitObjectCacheExtensions.cs @@ -20,8 +20,8 @@ out bool isExistingValue // if type was added instead of retreived, add types to master cache to facilitate lookup later if (!isExistingValue) { - cache.ParentCache - .GetOrInitializeWithDefaultFactory() + cache + .ParentCache.GetOrInitializeWithDefaultFactory() .AddMany(elementTypes, type => categoryInfo.GetCategorySpecificTypeName(type.Name)); } return elementTypes; diff --git a/ConnectorRevit/RevitSharedResources/Models/APIContext.cs b/ConnectorRevit/RevitSharedResources/Models/APIContext.cs index 223186ff64..ed5f3a8722 100644 --- a/ConnectorRevit/RevitSharedResources/Models/APIContext.cs +++ b/ConnectorRevit/RevitSharedResources/Models/APIContext.cs @@ -1,7 +1,7 @@ using System; -using Autodesk.Revit.UI; -using System.Threading.Tasks; using System.Threading; +using System.Threading.Tasks; +using Autodesk.Revit.UI; namespace RevitSharedResources.Models; diff --git a/ConnectorRevit/RevitSharedResources/Models/TransactionManager.cs b/ConnectorRevit/RevitSharedResources/Models/TransactionManager.cs index 4a9908b2cb..eb4030024d 100644 --- a/ConnectorRevit/RevitSharedResources/Models/TransactionManager.cs +++ b/ConnectorRevit/RevitSharedResources/Models/TransactionManager.cs @@ -65,7 +65,9 @@ public void Start() public TransactionStatus Commit() { if ( - subTransaction != null && subTransaction.IsValidObject && subTransaction.GetStatus() == TransactionStatus.Started + subTransaction != null + && subTransaction.IsValidObject + && subTransaction.GetStatus() == TransactionStatus.Started ) { HandleFailedCommit(subTransaction.Commit()); @@ -126,7 +128,9 @@ public void RollbackTransaction() public void RollbackSubTransaction() { if ( - subTransaction != null && subTransaction.IsValidObject && subTransaction.GetStatus() == TransactionStatus.Started + subTransaction != null + && subTransaction.IsValidObject + && subTransaction.GetStatus() == TransactionStatus.Started ) { subTransaction.RollBack(); @@ -150,7 +154,9 @@ public void StartSubtransaction() { Start(); if ( - subTransaction == null || !subTransaction.IsValidObject || subTransaction.GetStatus() != TransactionStatus.Started + subTransaction == null + || !subTransaction.IsValidObject + || subTransaction.GetStatus() != TransactionStatus.Started ) { subTransaction = new SubTransaction(document); diff --git a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/Plugin.cs b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/Plugin.cs index 5e3537ea51..70ab76f442 100644 --- a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/Plugin.cs +++ b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/Plugin.cs @@ -19,7 +19,6 @@ using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models.Extensions; - #if !MAC using Rhino.UI; #endif @@ -58,7 +57,7 @@ public void Init() return; } #if MAC - InitAvaloniaMac(); + InitAvaloniaMac(); #else appBuilder = BuildAvaloniaApp().SetupWithoutStarting(); #endif @@ -142,15 +141,15 @@ private void RhinoDoc_EndOpenDocument(object sender, DocumentOpenEventArgs e) if (Bindings.GetStreamsInFile().Count > 0) { #if MAC - try - { - SpeckleCommandMac.CreateOrFocusSpeckle(); - } - catch (Exception ex) when (!ex.IsFatal()) - { - SpeckleLog.Logger.Fatal(ex, "Failed to create or focus Speckle window"); - RhinoApp.CommandLineOut.WriteLine($"Speckle error - {ex.ToFormattedString()}"); - } + try + { + SpeckleCommandMac.CreateOrFocusSpeckle(); + } + catch (Exception ex) when (!ex.IsFatal()) + { + SpeckleLog.Logger.Fatal(ex, "Failed to create or focus Speckle window"); + RhinoApp.CommandLineOut.WriteLine($"Speckle error - {ex.ToFormattedString()}"); + } #else Panels.OpenPanel(typeof(DuiPanel).GUID); Panels.OpenPanel(typeof(MappingsPanel).GUID); @@ -204,8 +203,8 @@ protected override LoadReturnCode OnLoad(ref string errorMessage) // https://speckle.community/t/revit-command-failure-for-external-command/3489/27 if (!processName.Equals("rhino", StringComparison.InvariantCultureIgnoreCase)) { - SpeckleLog.Logger - .ForContext("processVersion", processVersion) + SpeckleLog + .Logger.ForContext("processVersion", processVersion) .Warning("Speckle does not currently support unsupported process {processName}", processName); errorMessage = "Speckle does not currently support Rhino.Inside"; RhinoApp.CommandLineOut.WriteLine(errorMessage); @@ -262,9 +261,9 @@ private void EnsureVersionSettings() #if RHINO6 sb.Append(@"\McNeel\Rhinoceros\6.0\UI\Plug-ins\"); #elif RHINO7 - sb.Append(@"\McNeel\Rhinoceros\7.0\UI\Plug-ins\"); + sb.Append(@"\McNeel\Rhinoceros\7.0\UI\Plug-ins\"); #elif RHINO8 - sb.Append(@"\McNeel\Rhinoceros\8.0\UI\Plug-ins\"); + sb.Append(@"\McNeel\Rhinoceros\8.0\UI\Plug-ins\"); #endif sb.AppendFormat("{0}.rui", Assembly.GetName().Name); diff --git a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleCommandMac.cs b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleCommandMac.cs index a5351e526b..b00d2fa642 100644 --- a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleCommandMac.cs +++ b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleCommandMac.cs @@ -10,50 +10,45 @@ namespace SpeckleRhino; - public class SpeckleCommandMac : Command - { +public class SpeckleCommandMac : Command +{ + public static SpeckleCommandMac Instance { get; private set; } - public static SpeckleCommandMac Instance { get; private set; } + public override string EnglishName => "Speckle"; - public override string EnglishName => "Speckle"; + public static Window MainWindow { get; private set; } - public static Window MainWindow { get; private set; } + public SpeckleCommandMac() + { + Instance = this; + } - public SpeckleCommandMac() + protected override Result RunCommand(RhinoDoc doc, RunMode mode) + { + try { - Instance = this; + CreateOrFocusSpeckle(); + return Result.Success; } - - protected override Result RunCommand(RhinoDoc doc, RunMode mode) + catch (Exception e) when (!e.IsFatal()) { - - try - { - CreateOrFocusSpeckle(); - return Result.Success; - } - catch (Exception e) when (!e.IsFatal()) - { - SpeckleLog.Logger.Fatal(e, "Failed to create or focus Speckle window"); - RhinoApp.CommandLineOut.WriteLine($"Speckle Error - { e.ToFormattedString() }"); - return Result.Failure; - } + SpeckleLog.Logger.Fatal(e, "Failed to create or focus Speckle window"); + RhinoApp.CommandLineOut.WriteLine($"Speckle Error - {e.ToFormattedString()}"); + return Result.Failure; } + } - public static void CreateOrFocusSpeckle() + public static void CreateOrFocusSpeckle() + { + //SpeckleRhinoConnectorPlugin.Instance.Init(); + if (MainWindow == null) { - //SpeckleRhinoConnectorPlugin.Instance.Init(); - if (MainWindow == null) - { - var viewModel = new MainViewModel(SpeckleRhinoConnectorPlugin.Instance.Bindings); - MainWindow = new MainWindow - { - DataContext = viewModel - }; - } - - MainWindow.Show(); - MainWindow.Activate(); + var viewModel = new MainViewModel(SpeckleRhinoConnectorPlugin.Instance.Bindings); + MainWindow = new MainWindow { DataContext = viewModel }; } + + MainWindow.Show(); + MainWindow.Activate(); } +} #endif diff --git a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleMappingsCommandMac.cs b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleMappingsCommandMac.cs index 9b46cb1364..2782641674 100644 --- a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleMappingsCommandMac.cs +++ b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/Entry/SpeckleMappingsCommandMac.cs @@ -10,46 +10,38 @@ namespace SpeckleRhino; - public class SpeckleMappingsCommandMac : Command - { - - public static SpeckleMappingsCommandMac Instance { get; private set; } +public class SpeckleMappingsCommandMac : Command +{ + public static SpeckleMappingsCommandMac Instance { get; private set; } - public override string EnglishName => "SpeckleMappings"; - public static Window MainWindow { get; private set; } + public override string EnglishName => "SpeckleMappings"; + public static Window MainWindow { get; private set; } - public SpeckleMappingsCommandMac() - { - Instance = this; - } + public SpeckleMappingsCommandMac() + { + Instance = this; + } - protected override Result RunCommand(RhinoDoc doc, RunMode mode) + protected override Result RunCommand(RhinoDoc doc, RunMode mode) + { + try { - - try + if (MainWindow == null) { - if (MainWindow == null) - { - var viewModel = new MappingsViewModel(SpeckleRhinoConnectorPlugin.Instance.MappingBindings); - MainWindow = new MappingsWindow - { - DataContext = viewModel - }; - } - - MainWindow.Show(); - MainWindow.Activate(); - return Result.Success; + var viewModel = new MappingsViewModel(SpeckleRhinoConnectorPlugin.Instance.MappingBindings); + MainWindow = new MappingsWindow { DataContext = viewModel }; } - catch (Exception e) when (!e.IsFatal()) - { - SpeckleLog.Logger.Fatal(e, "Failed to create or focus Speckle mappings window"); - RhinoApp.CommandLineOut.WriteLine($"Speckle Error - {e.ToFormattedString()}"); - return Result.Failure; - } - } - - + MainWindow.Show(); + MainWindow.Activate(); + return Result.Success; + } + catch (Exception e) when (!e.IsFatal()) + { + SpeckleLog.Logger.Fatal(e, "Failed to create or focus Speckle mappings window"); + RhinoApp.CommandLineOut.WriteLine($"Speckle Error - {e.ToFormattedString()}"); + return Result.Failure; + } } +} #endif diff --git a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/ConnectorBindingsRhino.Receive.cs b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/ConnectorBindingsRhino.Receive.cs index 944d35a57c..24c10ec533 100644 --- a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/ConnectorBindingsRhino.Receive.cs +++ b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/ConnectorBindingsRhino.Receive.cs @@ -118,8 +118,8 @@ await ConnectorHelpers.TryCommitReceived( if (!isPreviewIgnore && (previewObj.Converted == null || previewObj.Converted.Count == 0)) { - var convertedFallback = previewObj.Fallback - .Where(o => o.Converted != null || o.Converted.Count > 0) + var convertedFallback = previewObj + .Fallback.Where(o => o.Converted != null || o.Converted.Count > 0) .ToList(); if (convertedFallback.Any()) { @@ -398,8 +398,8 @@ ApplicationObject CreateApplicationObject(Base current, string containerId) { ApplicationObject NewAppObj() { - var speckleType = current.speckle_type - .Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries) + var speckleType = current + .speckle_type.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries) .LastOrDefault(); return new ApplicationObject(current.id, speckleType) @@ -428,8 +428,8 @@ ApplicationObject NewAppObj() } //Handle objects convertable using displayValues - var fallbackMember = DefaultTraversal.displayValuePropAliases - .Where(o => current[o] != null) + var fallbackMember = DefaultTraversal + .displayValuePropAliases.Where(o => current[o] != null) ?.Select(o => current[o]) ?.FirstOrDefault(); if (fallbackMember != null) diff --git a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/MappingBindingsRhino.cs b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/MappingBindingsRhino.cs index d43812e920..0ee403369d 100644 --- a/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/MappingBindingsRhino.cs +++ b/ConnectorRhino/ConnectorRhino/ConnectorRhinoShared/UI/MappingBindingsRhino.cs @@ -212,14 +212,13 @@ bool HasPlanarBottomEdge(Brep brp) { var brpCurves = b.DuplicateNakedEdgeCurves(true, false); // see if the bottom curve is parallel to worldxy var lowestZ = brp.GetBoundingBox(false).Min.Z; - var bottomCrv = brpCurves.Where( - o => - new Vector3d( - o.PointAtEnd.X - o.PointAtStart.X, - o.PointAtEnd.Y - o.PointAtStart.Y, - o.PointAtEnd.Z - o.PointAtStart.Z - ).IsPerpendicularTo(Vector3d.ZAxis, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance) - && o.PointAtStart.Z - lowestZ <= RhinoDoc.ActiveDoc.ModelAbsoluteTolerance + var bottomCrv = brpCurves.Where(o => + new Vector3d( + o.PointAtEnd.X - o.PointAtStart.X, + o.PointAtEnd.Y - o.PointAtStart.Y, + o.PointAtEnd.Z - o.PointAtStart.Z + ).IsPerpendicularTo(Vector3d.ZAxis, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance) + && o.PointAtStart.Z - lowestZ <= RhinoDoc.ActiveDoc.ModelAbsoluteTolerance ); if (bottomCrv.Any() && (bottomCrv.First().IsLinear() || bottomCrv.First().IsArc())) { @@ -332,8 +331,8 @@ public override List GetExistingSchemaElements() var objects = RhinoDoc.ActiveDoc.Objects.FindByUserString(SpeckleMappingViewKey, "*", true); var schemas = objects - .Select( - obj => JsonConvert.DeserializeObject(obj.Attributes.GetUserString(SpeckleMappingViewKey), settings) + .Select(obj => + JsonConvert.DeserializeObject(obj.Attributes.GetUserString(SpeckleMappingViewKey), settings) ) .ToList(); diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/StreamStateManager/StreamStateManager.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/StreamStateManager/StreamStateManager.cs index 9408665257..de6647ba8e 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/StreamStateManager/StreamStateManager.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/StreamStateManager/StreamStateManager.cs @@ -1,10 +1,10 @@ using System; -using DesktopUI2.Models; -using Speckle.Newtonsoft.Json; using System.Collections.Generic; using System.IO; using System.Text; +using DesktopUI2.Models; using Speckle.Core.Logging; +using Speckle.Newtonsoft.Json; using Tekla.Structures.Model; namespace ConnectorTeklaStructures.Storage; diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Send.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Send.cs index d1680f6250..b1690e726a 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Send.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Send.cs @@ -1,18 +1,18 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; using DesktopUI2; using DesktopUI2.Models; using DesktopUI2.Models.Settings; using DesktopUI2.ViewModels; +using Serilog.Context; using Speckle.ConnectorTeklaStructures.Util; using Speckle.Core.Api; using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Serilog.Context; using Tekla.Structures.Model; using SCT = Speckle.Core.Transports; diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Settings.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Settings.cs index 59e149b589..1baaff1556 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Settings.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructure.Settings.cs @@ -1,5 +1,5 @@ -using DesktopUI2; using System.Collections.Generic; +using DesktopUI2; using DesktopUI2.Models.Settings; namespace Speckle.ConnectorTeklaStructures.UI; diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.ClientOperations.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.ClientOperations.cs index 752bc807de..b2683aba30 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.ClientOperations.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.ClientOperations.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; +using ConnectorTeklaStructures.Storage; using DesktopUI2; using DesktopUI2.Models; -using ConnectorTeklaStructures.Storage; namespace Speckle.ConnectorTeklaStructures.UI; diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Receive.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Receive.cs index 44b0dfaf98..34b2804531 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Receive.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Receive.cs @@ -1,17 +1,17 @@ -using DesktopUI2; -using DesktopUI2.Models; -using DesktopUI2.ViewModels; -using Speckle.ConnectorTeklaStructures.Util; -using Speckle.Core.Api; -using Speckle.Core.Kits; -using Speckle.Core.Models; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; +using DesktopUI2; +using DesktopUI2.Models; +using DesktopUI2.ViewModels; using Serilog.Context; +using Speckle.ConnectorTeklaStructures.Util; +using Speckle.Core.Api; +using Speckle.Core.Kits; +using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; namespace Speckle.ConnectorTeklaStructures.UI; diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Recieve.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Recieve.cs index 6ad9c5aea3..70892ccbdb 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Recieve.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Recieve.cs @@ -1,19 +1,19 @@ using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using DesktopUI2; using DesktopUI2.Models; +using DesktopUI2.ViewModels; +using Speckle.ConnectorTeklaStructures.Util; using Speckle.Core.Api; using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.Core.Transports; using Stylet; -using System.Collections; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using Speckle.ConnectorTeklaStructures.Util; -using DesktopUI2.ViewModels; using Tekla.Structures.Model; namespace Speckle.ConnectorTeklaStructures.UI diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Selection.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Selection.cs index 5efb80c314..55de087673 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Selection.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.Selection.cs @@ -1,7 +1,7 @@ +using System.Collections.Generic; using DesktopUI2; using DesktopUI2.Models.Filters; using Speckle.ConnectorTeklaStructures.Util; -using System.Collections.Generic; using Tekla.Structures.Model; namespace Speckle.ConnectorTeklaStructures.UI; diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.cs index 59f021860d..9b06d19b8e 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/UI/ConnectorBindingsTeklaStructures.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using DesktopUI2; using DesktopUI2.Models; -using Speckle.Core.Models; using Speckle.ConnectorTeklaStructures.Util; -using Tekla.Structures.Model; using Speckle.Core.Kits; +using Speckle.Core.Models; +using Tekla.Structures.Model; namespace Speckle.ConnectorTeklaStructures.UI; diff --git a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/Util/ConnectorTeklaStructuresUtils.cs b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/Util/ConnectorTeklaStructuresUtils.cs index 22254cc7ee..3d381003f7 100644 --- a/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/Util/ConnectorTeklaStructuresUtils.cs +++ b/ConnectorTeklaStructures/ConnectorTeklaStructuresShared/Util/ConnectorTeklaStructuresUtils.cs @@ -1,7 +1,7 @@ -using Speckle.Core.Kits; -using Speckle.Core.Logging; using System.Collections.Generic; using System.Linq; +using Speckle.Core.Kits; +using Speckle.Core.Logging; using Tekla.Structures.Model; namespace Speckle.ConnectorTeklaStructures.Util; diff --git a/Core/Core/Api/GraphQL/Client.cs b/Core/Core/Api/GraphQL/Client.cs index 075d6144ff..79a6d5a782 100644 --- a/Core/Core/Api/GraphQL/Client.cs +++ b/Core/Core/Api/GraphQL/Client.cs @@ -167,13 +167,12 @@ internal void MaybeThrowFromGraphQLErrors(GraphQLRequest request, GraphQLResp { var errorMessages = errors.Select(e => e.Message); if ( - errors.Any( - e => - e.Extensions != null - && ( - e.Extensions.Contains(new KeyValuePair("code", "FORBIDDEN")) - || e.Extensions.Contains(new KeyValuePair("code", "UNAUTHENTICATED")) - ) + errors.Any(e => + e.Extensions != null + && ( + e.Extensions.Contains(new KeyValuePair("code", "FORBIDDEN")) + || e.Extensions.Contains(new KeyValuePair("code", "UNAUTHENTICATED")) + ) ) ) { @@ -181,9 +180,8 @@ internal void MaybeThrowFromGraphQLErrors(GraphQLRequest request, GraphQLResp } if ( - errors.Any( - e => - e.Extensions != null && e.Extensions.Contains(new KeyValuePair("code", "STREAM_NOT_FOUND")) + errors.Any(e => + e.Extensions != null && e.Extensions.Contains(new KeyValuePair("code", "STREAM_NOT_FOUND")) ) ) { @@ -191,10 +189,9 @@ internal void MaybeThrowFromGraphQLErrors(GraphQLRequest request, GraphQLResp } if ( - errors.Any( - e => - e.Extensions != null - && e.Extensions.Contains(new KeyValuePair("code", "INTERNAL_SERVER_ERROR")) + errors.Any(e => + e.Extensions != null + && e.Extensions.Contains(new KeyValuePair("code", "INTERNAL_SERVER_ERROR")) ) ) { @@ -264,8 +261,8 @@ internal IDisposable SubscribeTo(GraphQLRequest request, Action ca } else { - SpeckleLog.Logger - .ForContext("graphqlResponse", response) + SpeckleLog + .Logger.ForContext("graphqlResponse", response) .Error("Cannot execute graphql callback for {resultType}, the response has no data.", typeof(T).Name); } } @@ -277,8 +274,8 @@ internal IDisposable SubscribeTo(GraphQLRequest request, Action ca // anything else related to graphql gets logged catch (SpeckleGraphQLException gqlException) { - SpeckleLog.Logger - .ForContext("graphqlResponse", gqlException.Response) + SpeckleLog + .Logger.ForContext("graphqlResponse", gqlException.Response) .ForContext("graphqlExtensions", gqlException.Extensions) .ForContext("graphqlErrorMessages", gqlException.ErrorMessages.ToList()) .Warning( @@ -384,12 +381,12 @@ private static HttpClient CreateHttpClient(Account account) } const string QUERY = """ - query Project($projectId: String!) { - project(id: $projectId) { - workspaceId - } - } - """; + query Project($projectId: String!) { + project(id: $projectId) { + workspaceId + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId } }; diff --git a/Core/Core/Api/GraphQL/GraphQLHttpClientExtensions.cs b/Core/Core/Api/GraphQL/GraphQLHttpClientExtensions.cs index 0e7244e98b..252fa7f9c4 100644 --- a/Core/Core/Api/GraphQL/GraphQLHttpClientExtensions.cs +++ b/Core/Core/Api/GraphQL/GraphQLHttpClientExtensions.cs @@ -1,8 +1,8 @@ -using GraphQL; -using System.Threading.Tasks; +using System.Linq; using System.Threading; +using System.Threading.Tasks; +using GraphQL; using GraphQL.Client.Http; -using System.Linq; using Speckle.Core.Api.GraphQL.Models; using Speckle.Core.Api.GraphQL.Models.Responses; diff --git a/Core/Core/Api/GraphQL/Models/Model.cs b/Core/Core/Api/GraphQL/Models/Model.cs index 3c779960fa..1b4f001e06 100644 --- a/Core/Core/Api/GraphQL/Models/Model.cs +++ b/Core/Core/Api/GraphQL/Models/Model.cs @@ -1,6 +1,5 @@ #nullable disable using System; - using System.Collections.Generic; namespace Speckle.Core.Api.GraphQL.Models; diff --git a/Core/Core/Api/GraphQL/Resources/ActiveUserResource.cs b/Core/Core/Api/GraphQL/Resources/ActiveUserResource.cs index 400385cc93..6da8610a65 100644 --- a/Core/Core/Api/GraphQL/Resources/ActiveUserResource.cs +++ b/Core/Core/Api/GraphQL/Resources/ActiveUserResource.cs @@ -28,20 +28,20 @@ internal ActiveUserResource(ISpeckleGraphQLClient client) { //language=graphql const string QUERY = """ - query User { - activeUser { - id, - email, - name, - bio, - company, - avatar, - verified, - profiles, - role, - } - } - """; + query User { + activeUser { + id, + email, + name, + bio, + company, + avatar, + verified, + profiles, + role, + } + } + """; var request = new GraphQLRequest { Query = QUERY }; var response = await _client @@ -66,25 +66,25 @@ public async Task> GetProjects( { //language=graphql const string QUERY = """ - query User($limit : Int!, $cursor: String, $filter: UserProjectsFilter) { - activeUser { - projects(limit: $limit, cursor: $cursor, filter: $filter) { - totalCount - items { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - sourceApps - } - } - } - } - """; + query User($limit : Int!, $cursor: String, $filter: UserProjectsFilter) { + activeUser { + projects(limit: $limit, cursor: $cursor, filter: $filter) { + totalCount + items { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + sourceApps + } + } + } + } + """; var request = new GraphQLRequest { Query = QUERY, @@ -115,39 +115,39 @@ public async Task> ProjectInvites(CancellationTo { //language=graphql const string QUERY = """ - query ProjectInvites { - activeUser { - projectInvites { - id - inviteId - invitedBy { - avatar - bio - company - id - name - role - verified - } - projectId - projectName - role - streamId - streamName - title - token - user { - id, - name, - bio, - company, - verified, - role, - } - } - } - } - """; + query ProjectInvites { + activeUser { + projectInvites { + id + inviteId + invitedBy { + avatar + bio + company + id + name + role + verified + } + projectId + projectName + role + streamId + streamName + title + token + user { + id, + name, + bio, + company, + verified, + role, + } + } + } + } + """; var request = new GraphQLRequest { Query = QUERY }; diff --git a/Core/Core/Api/GraphQL/Resources/CommentResource.cs b/Core/Core/Api/GraphQL/Resources/CommentResource.cs index 1e078e204c..131e6b62d1 100644 --- a/Core/Core/Api/GraphQL/Resources/CommentResource.cs +++ b/Core/Core/Api/GraphQL/Resources/CommentResource.cs @@ -40,52 +40,52 @@ public async Task> GetProjectComments( { //language=graphql const string QUERY = """ - query CommentThreads($projectId: String!, $cursor: String, $limit: Int!, $filter: ProjectCommentsFilter, $repliesLimit: Int, $repliesCursor: String) { - project(id: $projectId) { - commentThreads(cursor: $cursor, limit: $limit, filter: $filter) { - cursor - totalArchivedCount - totalCount - items { - archived - authorId - createdAt - hasParent - id - rawText - replies(limit: $repliesLimit, cursor: $repliesCursor) { - cursor - items { - archived - authorId - createdAt - hasParent - id - rawText - updatedAt - viewedAt - } - totalCount - } - resources { - resourceId - resourceType - } - screenshot - updatedAt - viewedAt - viewerResources { - modelId - objectId - versionId - } - viewerState - data - } - } - } - } - """; + query CommentThreads($projectId: String!, $cursor: String, $limit: Int!, $filter: ProjectCommentsFilter, $repliesLimit: Int, $repliesCursor: String) { + project(id: $projectId) { + commentThreads(cursor: $cursor, limit: $limit, filter: $filter) { + cursor + totalArchivedCount + totalCount + items { + archived + authorId + createdAt + hasParent + id + rawText + replies(limit: $repliesLimit, cursor: $repliesCursor) { + cursor + items { + archived + authorId + createdAt + hasParent + id + rawText + updatedAt + viewedAt + } + totalCount + } + resources { + resourceId + resourceType + } + screenshot + updatedAt + viewedAt + viewerResources { + modelId + objectId + versionId + } + viewerState + data + } + } + } + } + """; GraphQLRequest request = new() @@ -119,12 +119,12 @@ public async Task Archive(string commentId, bool archive = true, Cancellat { //language=graphql const string QUERY = """ - mutation Mutation($commentId: String!, $archive: Boolean!) { - data:commentMutations { - archive(commentId: $commentId, archived: $archive) - } - } - """; + mutation Mutation($commentId: String!, $archive: Boolean!) { + data:commentMutations { + archive(commentId: $commentId, archived: $archive) + } + } + """; GraphQLRequest request = new(QUERY, variables: new { commentId, archive }); var res = await _client .ExecuteGraphQLRequest>(request, cancellationToken) @@ -141,12 +141,12 @@ public async Task MarkViewed(string commentId, CancellationToken cancellat { //language=graphql const string QUERY = """ - mutation Mutation($commentId: String!) { - data:commentMutations { - markViewed(commentId: $commentId) - } - } - """; + mutation Mutation($commentId: String!) { + data:commentMutations { + markViewed(commentId: $commentId) + } + } + """; GraphQLRequest request = new(QUERY, variables: new { commentId }); var res = await _client .ExecuteGraphQLRequest>(request, cancellationToken) diff --git a/Core/Core/Api/GraphQL/Resources/ModelResource.cs b/Core/Core/Api/GraphQL/Resources/ModelResource.cs index 95b3514a2b..ee986422f7 100644 --- a/Core/Core/Api/GraphQL/Resources/ModelResource.cs +++ b/Core/Core/Api/GraphQL/Resources/ModelResource.cs @@ -26,30 +26,30 @@ public async Task Get(string modelId, string projectId, CancellationToken { //language=graphql const string QUERY = """ - query ModelGet($modelId: String!, $projectId: String!) { - project(id: $projectId) { - model(id: $modelId) { - id - name - previewUrl - updatedAt - description - displayName - createdAt - author { - avatar - bio - company - id - name - role - totalOwnedStreamsFavorites - verified - } - } - } - } - """; + query ModelGet($modelId: String!, $projectId: String!) { + project(id: $projectId) { + model(id: $modelId) { + id + name + previewUrl + updatedAt + description + displayName + createdAt + author { + avatar + bio + company + id + name + role + totalOwnedStreamsFavorites + verified + } + } + } + } + """; var request = new GraphQLRequest { Query = QUERY, Variables = new { modelId, projectId } }; var response = await _client @@ -79,51 +79,51 @@ public async Task GetWithVersions( { //language=graphql const string QUERY = """ - query ModelGetWithVersions($modelId: String!, $projectId: String!, $versionsLimit: Int!, $versionsCursor: String, $versionsFilter: ModelVersionsFilter) { - project(id: $projectId) { - model(id: $modelId) { - id - name - previewUrl - updatedAt - versions(limit: $versionsLimit, cursor: $versionsCursor, filter: $versionsFilter) { - items { - id - referencedObject - message - sourceApplication - createdAt - previewUrl - authorUser { - totalOwnedStreamsFavorites - id - name - bio - company - verified - role - } - } - totalCount - cursor - } - description - displayName - createdAt - author { - avatar - bio - company - id - name - role - totalOwnedStreamsFavorites - verified - } - } - } - } - """; + query ModelGetWithVersions($modelId: String!, $projectId: String!, $versionsLimit: Int!, $versionsCursor: String, $versionsFilter: ModelVersionsFilter) { + project(id: $projectId) { + model(id: $modelId) { + id + name + previewUrl + updatedAt + versions(limit: $versionsLimit, cursor: $versionsCursor, filter: $versionsFilter) { + items { + id + referencedObject + message + sourceApplication + createdAt + previewUrl + authorUser { + totalOwnedStreamsFavorites + id + name + bio + company + verified + role + } + } + totalCount + cursor + } + description + displayName + createdAt + author { + avatar + bio + company + id + name + role + totalOwnedStreamsFavorites + verified + } + } + } + } + """; var request = new GraphQLRequest { @@ -162,24 +162,24 @@ public async Task> GetModels( { //language=graphql const string QUERY = """ - query ProjectGetWithModels($projectId: String!, $modelsLimit: Int!, $modelsCursor: String, $modelsFilter: ProjectModelsFilter) { - project(id: $projectId) { - models(limit: $modelsLimit, cursor: $modelsCursor, filter: $modelsFilter) { - items { - id - name - previewUrl - updatedAt - displayName - description - createdAt - } - totalCount - cursor - } - } - } - """; + query ProjectGetWithModels($projectId: String!, $modelsLimit: Int!, $modelsCursor: String, $modelsFilter: ProjectModelsFilter) { + project(id: $projectId) { + models(limit: $modelsLimit, cursor: $modelsCursor, filter: $modelsFilter) { + items { + id + name + previewUrl + updatedAt + displayName + description + createdAt + } + totalCount + cursor + } + } + } + """; GraphQLRequest request = new() { @@ -207,30 +207,30 @@ public async Task Create(CreateModelInput input, CancellationToken cancel { //language=graphql const string QUERY = """ - mutation ModelCreate($input: CreateModelInput!) { - modelMutations { - create(input: $input) { - id - displayName - name - description - createdAt - updatedAt - previewUrl - author { - avatar - bio - company - id - name - role - totalOwnedStreamsFavorites - verified - } - } - } - } - """; + mutation ModelCreate($input: CreateModelInput!) { + modelMutations { + create(input: $input) { + id + displayName + name + description + createdAt + updatedAt + previewUrl + author { + avatar + bio + company + id + name + role + totalOwnedStreamsFavorites + verified + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; @@ -249,12 +249,12 @@ public async Task Delete(DeleteModelInput input, CancellationToken cancell { //language=graphql const string QUERY = """ - mutation ModelDelete($input: DeleteModelInput!) { - modelMutations { - delete(input: $input) - } - } - """; + mutation ModelDelete($input: DeleteModelInput!) { + modelMutations { + delete(input: $input) + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; @@ -273,30 +273,30 @@ public async Task Update(UpdateModelInput input, CancellationToken cancel { //language=graphql const string QUERY = """ - mutation ModelUpdate($input: UpdateModelInput!) { - modelMutations { - update(input: $input) { - id - name - displayName - description - createdAt - updatedAt - previewUrl - author { - avatar - bio - company - id - name - role - totalOwnedStreamsFavorites - verified - } - } - } - } - """; + mutation ModelUpdate($input: UpdateModelInput!) { + modelMutations { + update(input: $input) { + id + name + displayName + description + createdAt + updatedAt + previewUrl + author { + avatar + bio + company + id + name + role + totalOwnedStreamsFavorites + verified + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; diff --git a/Core/Core/Api/GraphQL/Resources/OtherUserResource.cs b/Core/Core/Api/GraphQL/Resources/OtherUserResource.cs index 5f51ced885..c269561543 100644 --- a/Core/Core/Api/GraphQL/Resources/OtherUserResource.cs +++ b/Core/Core/Api/GraphQL/Resources/OtherUserResource.cs @@ -26,18 +26,18 @@ internal OtherUserResource(ISpeckleGraphQLClient client) { //language=graphql const string QUERY = """ - query LimitedUser($id: String!) { - otherUser(id: $id){ - id, - name, - bio, - company, - avatar, - verified, - role, - } - } - """; + query LimitedUser($id: String!) { + otherUser(id: $id){ + id, + name, + bio, + company, + avatar, + verified, + role, + } + } + """; var request = new GraphQLRequest { Query = QUERY, Variables = new { id } }; @@ -70,21 +70,21 @@ public async Task> UserSearch( { //language=graphql const string QUERY = """ - query UserSearch($query: String!, $limit: Int!, $cursor: String, $archived: Boolean, $emailOnly: Boolean) { - userSearch(query: $query, limit: $limit, cursor: $cursor, archived: $archived, emailOnly: $emailOnly) { - cursor, - items { - id - name - bio - company - avatar - verified - role - } - } - } - """; + query UserSearch($query: String!, $limit: Int!, $cursor: String, $archived: Boolean, $emailOnly: Boolean) { + userSearch(query: $query, limit: $limit, cursor: $cursor, archived: $archived, emailOnly: $emailOnly) { + cursor, + items { + id + name + bio + company + avatar + verified + role + } + } + } + """; var request = new GraphQLRequest { diff --git a/Core/Core/Api/GraphQL/Resources/ProjectInviteResource.cs b/Core/Core/Api/GraphQL/Resources/ProjectInviteResource.cs index 65f1cb1e30..547c75691f 100644 --- a/Core/Core/Api/GraphQL/Resources/ProjectInviteResource.cs +++ b/Core/Core/Api/GraphQL/Resources/ProjectInviteResource.cs @@ -29,67 +29,67 @@ public async Task Create( { //language=graphql const string QUERY = """ - mutation ProjectInviteCreate($projectId: ID!, $input: ProjectInviteCreateInput!) { - projectMutations { - invites { - create(projectId: $projectId, input: $input) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - team { - role - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - invitedTeam { - id - inviteId - projectId - projectName - streamName - title - role - streamId - token - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - invitedBy { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - } - } - } - } - """; + mutation ProjectInviteCreate($projectId: ID!, $input: ProjectInviteCreateInput!) { + projectMutations { + invites { + create(projectId: $projectId, input: $input) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + team { + role + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + invitedTeam { + id + inviteId + projectId + projectName + streamName + title + role + streamId + token + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + invitedBy { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId, input } }; var response = await _client @@ -107,14 +107,14 @@ public async Task Use(ProjectInviteUseInput input, CancellationToken cance { //language=graphql const string QUERY = """ - mutation ProjectInviteUse($input: ProjectInviteUseInput!) { - projectMutations { - invites { - use(input: $input) - } - } - } - """; + mutation ProjectInviteUse($input: ProjectInviteUseInput!) { + projectMutations { + invites { + use(input: $input) + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; var response = await _client @@ -136,40 +136,40 @@ mutation ProjectInviteUse($input: ProjectInviteUseInput!) { { //language=graphql const string QUERY = """ - query ProjectInvite($projectId: String!, $token: String) { - projectInvite(projectId: $projectId, token: $token) { - id - inviteId - invitedBy { - avatar - bio - company - id - name - role - totalOwnedStreamsFavorites - verified - } - projectId - projectName - role - streamId - streamName - title - token - user { - avatar - bio - company - id - name - role - totalOwnedStreamsFavorites - verified - } - } - } - """; + query ProjectInvite($projectId: String!, $token: String) { + projectInvite(projectId: $projectId, token: $token) { + id + inviteId + invitedBy { + avatar + bio + company + id + name + role + totalOwnedStreamsFavorites + verified + } + projectId + projectName + role + streamId + streamName + title + token + user { + avatar + bio + company + id + name + role + totalOwnedStreamsFavorites + verified + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId, token } }; var response = await _client @@ -188,67 +188,67 @@ public async Task Cancel(string projectId, string inviteId, Cancellatio { //language=graphql const string QUERY = """ - mutation ProjectInviteCancel($projectId: ID!, $inviteId: String!) { - projectMutations { - invites { - cancel(projectId: $projectId, inviteId: $inviteId) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - team { - role - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - invitedTeam { - id - inviteId - projectId - projectName - streamName - title - role - streamId - token - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - invitedBy { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - } - } - } - } - """; + mutation ProjectInviteCancel($projectId: ID!, $inviteId: String!) { + projectMutations { + invites { + cancel(projectId: $projectId, inviteId: $inviteId) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + team { + role + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + invitedTeam { + id + inviteId + projectId + projectName + streamName + title + role + streamId + token + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + invitedBy { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId, inviteId } }; var response = await _client diff --git a/Core/Core/Api/GraphQL/Resources/ProjectResource.cs b/Core/Core/Api/GraphQL/Resources/ProjectResource.cs index f21fb723ae..34c505ec33 100644 --- a/Core/Core/Api/GraphQL/Resources/ProjectResource.cs +++ b/Core/Core/Api/GraphQL/Resources/ProjectResource.cs @@ -26,20 +26,20 @@ public async Task Get(string projectId, CancellationToken cancellationT { //language=graphql const string QUERY = """ - query Project($projectId: String!) { - project(id: $projectId) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - sourceApps - } - } - """; + query Project($projectId: String!) { + project(id: $projectId) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + sourceApps + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId } }; var response = await _client @@ -67,33 +67,33 @@ public async Task GetWithModels( { //language=graphql const string QUERY = """ - query ProjectGetWithModels($projectId: String!, $modelsLimit: Int!, $modelsCursor: String, $modelsFilter: ProjectModelsFilter) { - project(id: $projectId) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - sourceApps - models(limit: $modelsLimit, cursor: $modelsCursor, filter: $modelsFilter) { - items { - id - name - previewUrl - updatedAt - displayName - description - createdAt - } - cursor - totalCount - } - } - } - """; + query ProjectGetWithModels($projectId: String!, $modelsLimit: Int!, $modelsCursor: String, $modelsFilter: ProjectModelsFilter) { + project(id: $projectId) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + sourceApps + models(limit: $modelsLimit, cursor: $modelsCursor, filter: $modelsFilter) { + items { + id + name + previewUrl + updatedAt + displayName + description + createdAt + } + cursor + totalCount + } + } + } + """; GraphQLRequest request = new() { @@ -123,63 +123,63 @@ public async Task GetWithTeam(string projectId, CancellationToken cance { //language=graphql const string QUERY = """ - query ProjectGetWithTeam($projectId: String!) { - project(id: $projectId) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - team { - role - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - invitedTeam { - id - inviteId - projectId - projectName - streamId - streamName - title - role - token - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - invitedBy { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - } - } - """; + query ProjectGetWithTeam($projectId: String!) { + project(id: $projectId) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + team { + role + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + invitedTeam { + id + inviteId + projectId + projectName + streamId + streamName + title + role + token + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + invitedBy { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId } }; var response = await _client @@ -196,22 +196,22 @@ public async Task Create(ProjectCreateInput input, CancellationToken ca { //language=graphql const string QUERY = """ - mutation ProjectCreate($input: ProjectCreateInput) { - projectMutations { - create(input: $input) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - sourceApps - } - } - } - """; + mutation ProjectCreate($input: ProjectCreateInput) { + projectMutations { + create(input: $input) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + sourceApps + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; var response = await _client @@ -228,21 +228,21 @@ public async Task Update(ProjectUpdateInput input, CancellationToken ca { //language=graphql const string QUERY = """ - mutation ProjectUpdate($input: ProjectUpdateInput!) { - projectMutations{ - update(update: $input) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - } - } - } - """; + mutation ProjectUpdate($input: ProjectUpdateInput!) { + projectMutations{ + update(update: $input) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; var response = await _client @@ -259,12 +259,12 @@ public async Task Delete(string projectId, CancellationToken cancellationT { //language=graphql const string QUERY = """ - mutation ProjectDelete($projectId: String!) { - projectMutations { - delete(id: $projectId) - } - } - """; + mutation ProjectDelete($projectId: String!) { + projectMutations { + delete(id: $projectId) + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId } }; var response = await _client @@ -280,65 +280,65 @@ public async Task UpdateRole(ProjectUpdateRoleInput input, Cancellation { //language=graphql const string QUERY = """ - mutation ProjectUpdateRole($input: ProjectUpdateRoleInput!) { - projectMutations { - updateRole(input: $input) { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - team { - role - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - invitedTeam { - id - inviteId - projectId - projectName - streamId - streamName - title - role - token - user { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - invitedBy { - totalOwnedStreamsFavorites - id - name - bio - company - avatar - verified - role - } - } - } - } - } - """; + mutation ProjectUpdateRole($input: ProjectUpdateRoleInput!) { + projectMutations { + updateRole(input: $input) { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + team { + role + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + invitedTeam { + id + inviteId + projectId + projectName + streamId + streamName + title + role + token + user { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + invitedBy { + totalOwnedStreamsFavorites + id + name + bio + company + avatar + verified + role + } + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; var response = await _client diff --git a/Core/Core/Api/GraphQL/Resources/SubscriptionResource.cs b/Core/Core/Api/GraphQL/Resources/SubscriptionResource.cs index fded4aba95..9d372206a6 100644 --- a/Core/Core/Api/GraphQL/Resources/SubscriptionResource.cs +++ b/Core/Core/Api/GraphQL/Resources/SubscriptionResource.cs @@ -48,16 +48,16 @@ public Subscription CreateUserProjectsUpdatedSubscri { //language=graphql const string QUERY = """ - subscription UserProjectsUpdated { - data:userProjectsUpdated { - id - project { - id - } - type - } - } - """; + subscription UserProjectsUpdated { + data:userProjectsUpdated { + id + project { + id + } + type + } + } + """; GraphQLRequest request = new() { Query = QUERY }; Subscription subscription = new(_client, request); @@ -74,16 +74,16 @@ ViewerUpdateTrackingTarget target { //language=graphql const string QUERY = """ - subscription Subscription($target: ViewerUpdateTrackingTarget!) { - data:projectCommentsUpdated(target: $target) { - comment { - id - } - id - type - } - } - """; + subscription Subscription($target: ViewerUpdateTrackingTarget!) { + data:projectCommentsUpdated(target: $target) { + comment { + id + } + id + type + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { target } }; Subscription subscription = new(_client, request); @@ -101,32 +101,32 @@ public Subscription CreateProjectModelsUpdatedSubsc { //language=graphql const string QUERY = """ - subscription ProjectModelsUpdated($id: String!, $modelIds: [String!]) { - data:projectModelsUpdated(id: $id, modelIds: $modelIds) { - id - model { - id - name - previewUrl - updatedAt - description - displayName - createdAt - author { - avatar - bio - company - id - name - role - totalOwnedStreamsFavorites - verified - } - } - type - } - } - """; + subscription ProjectModelsUpdated($id: String!, $modelIds: [String!]) { + data:projectModelsUpdated(id: $id, modelIds: $modelIds) { + id + model { + id + name + previewUrl + updatedAt + description + displayName + createdAt + author { + avatar + bio + company + id + name + role + totalOwnedStreamsFavorites + verified + } + } + type + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { id, modelIds } }; Subscription subscription = new(_client, request); @@ -141,24 +141,24 @@ public Subscription CreateProjectUpdatedSubscription(stri { //language=graphql const string QUERY = """ - subscription ProjectUpdated($id: String!) { - data:projectUpdated(id: $id) { - id - project { - id - name - description - visibility - allowPublicComments - role - createdAt - updatedAt - sourceApps - } - type - } - } - """; + subscription ProjectUpdated($id: String!) { + data:projectUpdated(id: $id) { + id + project { + id + name + description + visibility + allowPublicComments + role + createdAt + updatedAt + sourceApps + } + type + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { id } }; Subscription subscription = new(_client, request); @@ -173,40 +173,40 @@ public Subscription CreateProjectVersionsUpdatedS { //language=graphql const string QUERY = """ - subscription ProjectVersionsUpdated($id: String!) { - data:projectVersionsUpdated(id: $id) { - id - modelId - type - version { - id - referencedObject - message - sourceApplication - createdAt - previewUrl - authorUser { - totalOwnedStreamsFavorites - id - name - bio - company - verified - role - avatar - } - model{ - id - name - description - displayName - updatedAt - createdAt - } - } - } - } - """; + subscription ProjectVersionsUpdated($id: String!) { + data:projectVersionsUpdated(id: $id) { + id + modelId + type + version { + id + referencedObject + message + sourceApplication + createdAt + previewUrl + authorUser { + totalOwnedStreamsFavorites + id + name + bio + company + verified + role + avatar + } + model{ + id + name + description + displayName + updatedAt + createdAt + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { id } }; Subscription subscription = new(_client, request); diff --git a/Core/Core/Api/GraphQL/Resources/VersionResource.cs b/Core/Core/Api/GraphQL/Resources/VersionResource.cs index e21ac09e0c..7aeb385de7 100644 --- a/Core/Core/Api/GraphQL/Resources/VersionResource.cs +++ b/Core/Core/Api/GraphQL/Resources/VersionResource.cs @@ -32,31 +32,31 @@ public async Task Get( { //language=graphql const string QUERY = """ - query VersionGet($projectId: String!, $modelId: String!, $versionId: String!) { - project(id: $projectId) { - model(id: $modelId) { - version(id: $versionId) { - id - referencedObject - message - sourceApplication - createdAt - previewUrl - authorUser { - totalOwnedStreamsFavorites - id - name - bio - company - verified - role - avatar - } - } - } - } - } - """; + query VersionGet($projectId: String!, $modelId: String!, $versionId: String!) { + project(id: $projectId) { + model(id: $modelId) { + version(id: $versionId) { + id + referencedObject + message + sourceApplication + createdAt + previewUrl + authorUser { + totalOwnedStreamsFavorites + id + name + bio + company + verified + role + avatar + } + } + } + } + } + """; GraphQLRequest request = new() { @@ -93,35 +93,35 @@ public async Task> GetVersions( { //language=graphql const string QUERY = """ - query VersionGetVersions($projectId: String!, $modelId: String!, $limit: Int!, $cursor: String, $filter: ModelVersionsFilter) { - project(id: $projectId) { - model(id: $modelId) { - versions(limit: $limit, cursor: $cursor, filter: $filter) { - items { - id - referencedObject - message - sourceApplication - createdAt - previewUrl - authorUser { - totalOwnedStreamsFavorites - id - name - bio - company - verified - role - avatar - } - } - cursor - totalCount - } - } - } - } - """; + query VersionGetVersions($projectId: String!, $modelId: String!, $limit: Int!, $cursor: String, $filter: ModelVersionsFilter) { + project(id: $projectId) { + model(id: $modelId) { + versions(limit: $limit, cursor: $cursor, filter: $filter) { + items { + id + referencedObject + message + sourceApplication + createdAt + previewUrl + authorUser { + totalOwnedStreamsFavorites + id + name + bio + company + verified + role + avatar + } + } + cursor + totalCount + } + } + } + } + """; GraphQLRequest request = new() @@ -159,29 +159,29 @@ public async Task Update(UpdateVersionInput input, CancellationToken ca { //language=graphql const string QUERY = """ - mutation VersionUpdate($input: UpdateVersionInput!) { - versionMutations { - update(input: $input) { - id - referencedObject - message - sourceApplication - createdAt - previewUrl - authorUser { - totalOwnedStreamsFavorites - id - name - bio - company - verified - role - avatar - } - } - } - } - """; + mutation VersionUpdate($input: UpdateVersionInput!) { + versionMutations { + update(input: $input) { + id + referencedObject + message + sourceApplication + createdAt + previewUrl + authorUser { + totalOwnedStreamsFavorites + id + name + bio + company + verified + role + avatar + } + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input, } }; var response = await _client @@ -199,14 +199,14 @@ public async Task MoveToModel(MoveVersionsInput input, CancellationToken { //language=graphql const string QUERY = """ - mutation VersionMoveToModel($input: MoveVersionsInput!) { - versionMutations { - moveToModel(input: $input) { - id - } - } - } - """; + mutation VersionMoveToModel($input: MoveVersionsInput!) { + versionMutations { + moveToModel(input: $input) { + id + } + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input, } }; var response = await _client @@ -222,12 +222,12 @@ public async Task Delete(DeleteVersionsInput input, CancellationToken canc { //language=graphql const string QUERY = """ - mutation VersionDelete($input: DeleteVersionsInput!) { - versionMutations { - delete(input: $input) - } - } - """; + mutation VersionDelete($input: DeleteVersionsInput!) { + versionMutations { + delete(input: $input) + } + } + """; GraphQLRequest request = new() { Query = QUERY, Variables = new { input } }; var response = await _client diff --git a/Core/Core/Api/Operations/Operations.Receive.Obsolete.cs b/Core/Core/Api/Operations/Operations.Receive.Obsolete.cs index 02a7de42c4..5c486aa28c 100644 --- a/Core/Core/Api/Operations/Operations.Receive.Obsolete.cs +++ b/Core/Core/Api/Operations/Operations.Receive.Obsolete.cs @@ -26,11 +26,11 @@ public enum SerializerVersion public static partial class Operations { private const string RECEIVE_DEPRECATION_MESSAGE = """ - This method overload is obsolete, consider using a non-obsolete overload. - 1.SerializerVersion selection will no longer be supported going foward (serializer v1 is now deprecated). - 2.Use of disposeTransports will no longer be supported going forward (you should dispose your own transports). - 3 OnErrorAction is no longer used (instead functions with throw exceptions for consistancy and clear stack trace) - """; + This method overload is obsolete, consider using a non-obsolete overload. + 1.SerializerVersion selection will no longer be supported going foward (serializer v1 is now deprecated). + 2.Use of disposeTransports will no longer be supported going forward (you should dispose your own transports). + 3 OnErrorAction is no longer used (instead functions with throw exceptions for consistancy and clear stack trace) + """; /// /// @@ -425,8 +425,8 @@ SerializerVersion serializerVersion } timer.Stop(); - SpeckleLog.Logger - .ForContext("deserializerElapsed", serializerV2?.Elapsed) + SpeckleLog + .Logger.ForContext("deserializerElapsed", serializerV2?.Elapsed) .ForContext( "transportElapsedBreakdown", new[] { localTransport, remoteTransport } @@ -481,8 +481,8 @@ SerializerVersion serializerVersion dr.Dispose(); } - SpeckleLog.Logger - .ForContext("deserializerElapsed", serializerV2?.Elapsed) + SpeckleLog + .Logger.ForContext("deserializerElapsed", serializerV2?.Elapsed) .ForContext( "transportElapsedBreakdown", new[] { localTransport, remoteTransport } diff --git a/Core/Core/Api/Operations/Operations.Receive.cs b/Core/Core/Api/Operations/Operations.Receive.cs index 2c8d1d98c4..2502b6d047 100644 --- a/Core/Core/Api/Operations/Operations.Receive.cs +++ b/Core/Core/Api/Operations/Operations.Receive.cs @@ -114,8 +114,8 @@ public static async Task Receive( Base res = serializerV2.Deserialize(objString); timer.Stop(); - SpeckleLog.Logger - .ForContext("deserializerElapsed", serializerV2.Elapsed) + SpeckleLog + .Logger.ForContext("deserializerElapsed", serializerV2.Elapsed) .ForContext( "transportElapsedBreakdown", new[] { localTransport, remoteTransport } diff --git a/Core/Core/Api/Operations/Operations.Send.Obsolete.cs b/Core/Core/Api/Operations/Operations.Send.Obsolete.cs index 15f11ebd10..1ec08c5867 100644 --- a/Core/Core/Api/Operations/Operations.Send.Obsolete.cs +++ b/Core/Core/Api/Operations/Operations.Send.Obsolete.cs @@ -19,11 +19,11 @@ namespace Speckle.Core.Api; public static partial class Operations { private const string DEPRECATION_NOTICE = """ - This Send overload has been replaced by an overload with fewer function arguments. - We are no longer supporting SerializerV1, OnErrorAction, or handling disposal of transports. - Consider switching one of the other send overloads instead. - This function will be kept around for several releases, but will eventually be removed. - """; + This Send overload has been replaced by an overload with fewer function arguments. + We are no longer supporting SerializerV1, OnErrorAction, or handling disposal of transports. + Consider switching one of the other send overloads instead. + This function will be kept around for several releases, but will eventually be removed. + """; /// [Obsolete("This overload has been deprecated along with serializer v1. Use other Send overloads instead.")] @@ -225,8 +225,8 @@ public static async Task Send( var hash = idToken.ToString(); sendTimer.Stop(); - SpeckleLog.Logger - .ForContext("transportElapsedBreakdown", transports.ToDictionary(t => t.TransportName, t => t.Elapsed)) + SpeckleLog + .Logger.ForContext("transportElapsedBreakdown", transports.ToDictionary(t => t.TransportName, t => t.Elapsed)) .ForContext("note", "the elapsed summary doesn't need to add up to the total elapsed... Threading magic...") .ForContext("serializerElapsed", serializerV2?.Elapsed) .Information( diff --git a/Core/Core/Api/Operations/Operations.Send.cs b/Core/Core/Api/Operations/Operations.Send.cs index da01128a02..f99a04d315 100644 --- a/Core/Core/Api/Operations/Operations.Send.cs +++ b/Core/Core/Api/Operations/Operations.Send.cs @@ -132,8 +132,8 @@ public static async Task Send( } sendTimer.Stop(); - SpeckleLog.Logger - .ForContext("transportElapsedBreakdown", transports.ToDictionary(t => t.TransportName, t => t.Elapsed)) + SpeckleLog + .Logger.ForContext("transportElapsedBreakdown", transports.ToDictionary(t => t.TransportName, t => t.Elapsed)) .ForContext("note", "the elapsed summary doesn't need to add up to the total elapsed... Threading magic...") .ForContext("serializerElapsed", serializerV2.Elapsed) .Information( diff --git a/Core/Core/Credentials/AccountManager.cs b/Core/Core/Credentials/AccountManager.cs index 6a5bf478b2..29965efa43 100644 --- a/Core/Core/Credentials/AccountManager.cs +++ b/Core/Core/Credentials/AccountManager.cs @@ -13,8 +13,8 @@ using GraphQL; using GraphQL.Client.Http; using Speckle.Core.Api; -using Speckle.Core.Api.GraphQL.Models; using Speckle.Core.Api.GraphQL; +using Speckle.Core.Api.GraphQL.Models; using Speckle.Core.Api.GraphQL.Models.Responses; using Speckle.Core.Api.GraphQL.Serializer; using Speckle.Core.Helpers; @@ -117,15 +117,15 @@ public static async Task GetUserInfo( ); //language=graphql const string QUERY = """ - query { - data:activeUser { - name - email - id - company - } - } - """; + query { + data:activeUser { + name + email + id + company + } + } + """; var request = new GraphQLRequest { Query = QUERY }; var response = await gqlClient diff --git a/Core/Core/Helpers/Http.cs b/Core/Core/Helpers/Http.cs index 24002c7a1c..36407bbc16 100644 --- a/Core/Core/Helpers/Http.cs +++ b/Core/Core/Helpers/Http.cs @@ -232,8 +232,8 @@ CancellationToken cancellationToken timer.Stop(); var status = policyResult.Outcome == OutcomeType.Successful ? "succeeded" : "failed"; context.TryGetValue("retryCount", out var retryCount); - SpeckleLog.Logger - .ForContext("ExceptionType", policyResult.FinalException?.GetType()) + SpeckleLog + .Logger.ForContext("ExceptionType", policyResult.FinalException?.GetType()) .Information( "Execution of http request to {httpScheme}://{hostUrl}{relativeUrl} {resultStatus} with {httpStatusCode} after {elapsed} seconds and {retryCount} retries. Request correlation ID: {correlationId}", request.RequestUri.Scheme, diff --git a/Core/Core/Logging/Analytics.cs b/Core/Core/Logging/Analytics.cs index 66f77895cf..062345110a 100644 --- a/Core/Core/Logging/Analytics.cs +++ b/Core/Core/Logging/Analytics.cs @@ -134,9 +134,8 @@ public static void TrackEvent( { var macAddr = NetworkInterface .GetAllNetworkInterfaces() - .Where( - nic => - nic.OperationalStatus == OperationalStatus.Up && nic.NetworkInterfaceType != NetworkInterfaceType.Loopback + .Where(nic => + nic.OperationalStatus == OperationalStatus.Up && nic.NetworkInterfaceType != NetworkInterfaceType.Loopback ) .Select(nic => nic.GetPhysicalAddress().ToString()) .FirstOrDefault(); @@ -249,8 +248,8 @@ private static void TrackEvent( } catch (Exception ex) when (!ex.IsFatal()) { - SpeckleLog.Logger - .ForContext("eventName", eventName.ToString()) + SpeckleLog + .Logger.ForContext("eventName", eventName.ToString()) .ForContext("isAction", isAction) .Warning(ex, "Analytics event failed {exceptionMessage}", ex.Message); } diff --git a/Core/Core/Logging/Setup.cs b/Core/Core/Logging/Setup.cs index 3c40989651..9a3a3e8bf8 100644 --- a/Core/Core/Logging/Setup.cs +++ b/Core/Core/Logging/Setup.cs @@ -54,8 +54,8 @@ public static void Init( { if (s_initialized) { - SpeckleLog.Logger - .ForContext("newVersionedHostApplication", versionedHostApplication) + SpeckleLog + .Logger.ForContext("newVersionedHostApplication", versionedHostApplication) .ForContext("newHostApplication", hostApplication) .Information( "Setup was already initialized with {currentHostApp} {currentVersionedHostApp}", diff --git a/Core/Core/Logging/SpeckleLog.cs b/Core/Core/Logging/SpeckleLog.cs index ac45fd9e18..2c5558abb6 100644 --- a/Core/Core/Logging/SpeckleLog.cs +++ b/Core/Core/Logging/SpeckleLog.cs @@ -174,8 +174,8 @@ SpeckleLogConfiguration logConfiguration var logFilePath = Path.Combine(s_logFolderPath, "SpeckleCoreLog.txt"); var fileVersionInfo = GetFileVersionInfo(); - var serilogLogConfiguration = new LoggerConfiguration().MinimumLevel - .Is(logConfiguration.MinimumLevel) + var serilogLogConfiguration = new LoggerConfiguration() + .MinimumLevel.Is(logConfiguration.MinimumLevel) .Enrich.FromLogContext() .Enrich.WithProperty("version", fileVersionInfo?.FileVersion ?? "unknown") .Enrich.WithProperty("productVersion", fileVersionInfo?.ProductVersion ?? "unknown") diff --git a/Core/Core/Models/Base.cs b/Core/Core/Models/Base.cs index b7e6eeacf1..84d8403092 100644 --- a/Core/Core/Models/Base.cs +++ b/Core/Core/Models/Base.cs @@ -271,8 +271,8 @@ var kvp in GetMembers( catch (Exception ex) when (!ex.IsFatal()) { // avoids any last ditch unsettable or strange props. - SpeckleLog.Logger - .ForContext("canWrite", propertyInfo?.CanWrite) + SpeckleLog + .Logger.ForContext("canWrite", propertyInfo?.CanWrite) .ForContext("canRead", propertyInfo?.CanRead) .Warning( "Shallow copy of {type} failed to copy {propertyName} of type {propertyType} with value {valueType}", diff --git a/Core/Core/Serialisation/BaseObjectSerializerV2.cs b/Core/Core/Serialisation/BaseObjectSerializerV2.cs index eef522c00d..74e247c66f 100644 --- a/Core/Core/Serialisation/BaseObjectSerializerV2.cs +++ b/Core/Core/Serialisation/BaseObjectSerializerV2.cs @@ -265,7 +265,8 @@ public string Serialize(Base baseObj) object? convertedValue = PreserializeBasePropertyValue(prop.Value.Item1, prop.Value.Item2); if ( - convertedValue == null && prop.Value.Item2.JsonPropertyInfo is { NullValueHandling: NullValueHandling.Ignore } + convertedValue == null + && prop.Value.Item2.JsonPropertyInfo is { NullValueHandling: NullValueHandling.Ignore } ) { continue; diff --git a/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs b/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs index 2df5d5b3f5..eafabc4f0e 100644 --- a/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs +++ b/Core/Tests/Speckle.Core.Tests.Integration/Credentials/UserServerInfoTests.cs @@ -23,15 +23,6 @@ public async Task IsFrontEnd2True() Assert.That(result.frontend2, Is.True); } - [Test] - public async Task IsFrontEnd2False() - { - ServerInfo result = await AccountManager.GetServerInfo("https://speckle.xyz/"); - - Assert.That(result, Is.Not.Null); - Assert.That(result.frontend2, Is.False); - } - /// /// We get ServerInfo from "http://localhost:3000/graphql", /// Then we mutate the `frontend2` property of ServerInfo by trying to fetch header from "http://localhost:3000/", diff --git a/Core/Tests/Speckle.Core.Tests.Performance/Api/Operations/ReceiveFromSQLite.cs b/Core/Tests/Speckle.Core.Tests.Performance/Api/Operations/ReceiveFromSQLite.cs index 8a42ce5b69..420ec09f46 100644 --- a/Core/Tests/Speckle.Core.Tests.Performance/Api/Operations/ReceiveFromSQLite.cs +++ b/Core/Tests/Speckle.Core.Tests.Performance/Api/Operations/ReceiveFromSQLite.cs @@ -23,8 +23,8 @@ public async Task Setup() [Benchmark] public async Task Receive_FromSQLite() { - Base? b = await Speckle.Core.Api.Operations - .Receive(_dataSource.ObjectId, null, _dataSource.Transport) + Base? b = await Speckle + .Core.Api.Operations.Receive(_dataSource.ObjectId, null, _dataSource.Transport) .ConfigureAwait(false); Trace.Assert(b is not null); diff --git a/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/GraphTraversalTests.cs b/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/GraphTraversalTests.cs index c64c843949..110041d19c 100644 --- a/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/GraphTraversalTests.cs +++ b/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/GraphTraversalTests.cs @@ -20,8 +20,8 @@ public void Traverse_TraversesListMembers() var traverseListsRule = TraversalRule .NewTraversalRule() .When(_ => true) - .ContinueTraversing( - x => x.GetMembers(DynamicBaseMemberType.All).Where(p => p.Value is IList).Select(kvp => kvp.Key) + .ContinueTraversing(x => + x.GetMembers(DynamicBaseMemberType.All).Where(p => p.Value is IList).Select(kvp => kvp.Key) ); var expectTraverse = new Base { id = "List Member" }; @@ -52,8 +52,8 @@ public void Traverse_TraversesDictMembers() var traverseListsRule = TraversalRule .NewTraversalRule() .When(_ => true) - .ContinueTraversing( - x => x.GetMembers(DynamicBaseMemberType.All).Where(p => p.Value is IDictionary).Select(kvp => kvp.Key) + .ContinueTraversing(x => + x.GetMembers(DynamicBaseMemberType.All).Where(p => p.Value is IDictionary).Select(kvp => kvp.Key) ); var expectTraverse = new Base { id = "Dict Member" }; diff --git a/DesktopUI2/DesktopUI2/ConnectorHelpers.cs b/DesktopUI2/DesktopUI2/ConnectorHelpers.cs index dc752d7602..13518a1e70 100644 --- a/DesktopUI2/DesktopUI2/ConnectorHelpers.cs +++ b/DesktopUI2/DesktopUI2/ConnectorHelpers.cs @@ -67,8 +67,8 @@ public static async Task GetCommitFromState(StreamState state, Cancellat { if (state.CommitId == LatestCommitString) //if "latest", always make sure we get the latest commit { - var res = await state.Client - .BranchGet(state.StreamId, state.BranchName, 1, cancellationToken) + var res = await state + .Client.BranchGet(state.StreamId, state.BranchName, 1, cancellationToken) .ConfigureAwait(false); commit = res.commits.items.First(); } @@ -109,8 +109,8 @@ public static async Task TryCommitReceived( } catch (SpeckleException ex) { - SpeckleLog.Logger - .ForContext("commitReceivedInput", commitReceivedInput) + SpeckleLog + .Logger.ForContext("commitReceivedInput", commitReceivedInput) .Warning(ex, "Client operation {operationName} failed", nameof(Client.CommitReceived)); } } @@ -158,8 +158,8 @@ public static async Task CreateCommit( } catch (Exception ex) { - SpeckleLog.Logger - .ForContext("commitInput", commitInput) + SpeckleLog + .Logger.ForContext("commitInput", commitInput) .Warning(ex, "Client operation {operationName} failed", nameof(Client.CommitCreate)); throw new SpeckleException("Failed to create commit object", ex); } diff --git a/DesktopUI2/DesktopUI2/Utils.cs b/DesktopUI2/DesktopUI2/Utils.cs index 90a0cf8b1b..b5bb1d803b 100644 --- a/DesktopUI2/DesktopUI2/Utils.cs +++ b/DesktopUI2/DesktopUI2/Utils.cs @@ -273,8 +273,8 @@ public static async Task AddAccountCommand() } catch (Exception ex) { - SpeckleLog.Logger - .ForContext("dialogResult", result) + SpeckleLog + .Logger.ForContext("dialogResult", result) .Warning( ex, "Swallowing exception in {methodName} {exceptionMessage}", diff --git a/DesktopUI2/DesktopUI2/ViewModels/AccountViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/AccountViewModel.cs index f9faee7727..9b77e46cc0 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/AccountViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/AccountViewModel.cs @@ -149,8 +149,8 @@ private async void TrySetAvatarFromUrl(string url) } catch (Exception ex) { - SpeckleLog.Logger - .ForContext("imageUrl", url) + SpeckleLog + .Logger.ForContext("imageUrl", url) .Warning( ex, "Swallowing exception in {methodName}: {exceptionMessage}", diff --git a/DesktopUI2/DesktopUI2/ViewModels/CollaboratorsViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/CollaboratorsViewModel.cs index d86f39bc50..7bde4d7400 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/CollaboratorsViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/CollaboratorsViewModel.cs @@ -139,8 +139,8 @@ private async void SearchUsers() try { //exclude existing ones - var users = (await _stream.StreamState.Client.UserSearch(SearchQuery).ConfigureAwait(true)).Where( - x => !AddedUsers.Any(u => u.Id == x.id) + var users = (await _stream.StreamState.Client.UserSearch(SearchQuery).ConfigureAwait(true)).Where(x => + !AddedUsers.Any(u => u.Id == x.id) ); //exclude myself users = users.Where(x => _stream.StreamState.Client.Account.userInfo.id != x.id); @@ -254,8 +254,11 @@ private async void SaveCommand() { try { - await _stream.StreamState.Client.ProjectInvite - .Create(_stream.StreamState.StreamId, new ProjectInviteCreateInput(null, user.Role, null, user.Id)) + await _stream + .StreamState.Client.ProjectInvite.Create( + _stream.StreamState.StreamId, + new ProjectInviteCreateInput(null, user.Role, null, user.Id) + ) .ConfigureAwait(true); Analytics.TrackEvent( _stream.StreamState.Client.Account, @@ -276,8 +279,11 @@ await _stream.StreamState.Client.ProjectInvite { try { - await _stream.StreamState.Client.ProjectInvite - .Create(_stream.StreamState.StreamId, new ProjectInviteCreateInput(null, user.Role, null, user.Id)) + await _stream + .StreamState.Client.ProjectInvite.Create( + _stream.StreamState.StreamId, + new ProjectInviteCreateInput(null, user.Role, null, user.Id) + ) .ConfigureAwait(true); Analytics.TrackEvent( _stream.StreamState.Client.Account, @@ -298,8 +304,10 @@ await _stream.StreamState.Client.ProjectInvite { try { - await _stream.StreamState.Client.Project - .UpdateRole(new ProjectUpdateRoleInput(user.Id, _stream.StreamState.StreamId, user.Role)) + await _stream + .StreamState.Client.Project.UpdateRole( + new ProjectUpdateRoleInput(user.Id, _stream.StreamState.StreamId, user.Role) + ) .ConfigureAwait(true); Analytics.TrackEvent( _stream.StreamState.Client.Account, @@ -321,8 +329,10 @@ await _stream.StreamState.Client.Project { try { - await _stream.StreamState.Client.Project - .UpdateRole(new ProjectUpdateRoleInput(user.id, _stream.StreamState.StreamId, null)) + await _stream + .StreamState.Client.Project.UpdateRole( + new ProjectUpdateRoleInput(user.id, _stream.StreamState.StreamId, null) + ) .ConfigureAwait(true); Analytics.TrackEvent( _stream.StreamState.Client.Account, @@ -344,8 +354,8 @@ await _stream.StreamState.Client.Project { try { - await _stream.StreamState.Client.ProjectInvite - .Cancel(_stream.StreamState.StreamId, user.inviteId) + await _stream + .StreamState.Client.ProjectInvite.Cancel(_stream.StreamState.StreamId, user.inviteId) .ConfigureAwait(true); Analytics.TrackEvent( _stream.StreamState.Client.Account, @@ -363,8 +373,8 @@ await _stream.StreamState.Client.ProjectInvite try { _stream.Stream = await _stream.StreamState.Client.StreamGet(_stream.StreamState.StreamId).ConfigureAwait(true); - var pc = await _stream.StreamState.Client - .StreamGetPendingCollaborators(_stream.StreamState.StreamId) + var pc = await _stream + .StreamState.Client.StreamGetPendingCollaborators(_stream.StreamState.StreamId) .ConfigureAwait(true); _stream.Stream.pendingCollaborators = pc.pendingCollaborators; _stream.StreamState.CachedStream = _stream.Stream; diff --git a/DesktopUI2/DesktopUI2/ViewModels/HomeViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/HomeViewModel.cs index 6cc8f0fcec..8273df5309 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/HomeViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/HomeViewModel.cs @@ -199,8 +199,8 @@ private async Task GetStreams() SelectedFilter = Filter.all; } - result = await account.Client - .StreamSearch(SearchQuery, 25, StreamGetCancelTokenSource.Token) + result = await account + .Client.StreamSearch(SearchQuery, 25, StreamGetCancelTokenSource.Token) .ConfigureAwait(true); } diff --git a/DesktopUI2/DesktopUI2/ViewModels/MappingTool/MappingsViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/MappingTool/MappingsViewModel.cs index 69a9c7e29c..0c5fa784be 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/MappingTool/MappingsViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/MappingTool/MappingsViewModel.cs @@ -627,8 +627,8 @@ private List GetCheckedBoxesIds() var ids = new List(); try { - var lBoxes = MappingsControl.Instance - .GetVisualDescendants() + var lBoxes = MappingsControl + .Instance.GetVisualDescendants() .OfType() .Where(x => x.Classes.Contains("ExistingMapping")); foreach (var lBox in lBoxes) diff --git a/DesktopUI2/DesktopUI2/ViewModels/OneClickViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/OneClickViewModel.cs index 5204e04330..11c05f7266 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/OneClickViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/OneClickViewModel.cs @@ -207,8 +207,8 @@ private async Task SearchStreams(Client client) } catch (Exception ex) { - SpeckleLog.Logger - .ForContext("fileName", _fileName) + SpeckleLog + .Logger.ForContext("fileName", _fileName) .Debug(ex, "Swallowing exception in {methodName}: {exceptionMessage}", nameof(SearchStreams), ex.Message); } return stream; diff --git a/DesktopUI2/DesktopUI2/ViewModels/StreamSelectorViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/StreamSelectorViewModel.cs index 0d01c176d9..a89a15ff2a 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/StreamSelectorViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/StreamSelectorViewModel.cs @@ -68,8 +68,8 @@ private async Task GetStreams() //SEARCH else { - result = await account.Client - .StreamSearch(SearchQuery, 25, StreamGetCancelTokenSource.Token) + result = await account + .Client.StreamSearch(SearchQuery, 25, StreamGetCancelTokenSource.Token) .ConfigureAwait(true); } diff --git a/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs index 487a1a15ac..4558fd4dcb 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs @@ -298,8 +298,8 @@ internal async void GetBranchesAndRestoreState() } else { - var selectionFilter = AvailableFilters.FirstOrDefault( - x => x.Filter.Type == typeof(ManualSelectionFilter).ToString() + var selectionFilter = AvailableFilters.FirstOrDefault(x => + x.Filter.Type == typeof(ManualSelectionFilter).ToString() ); //if there are any selected objects, set the manual selection automagically if (selectionFilter != null && Bindings.GetSelectedObjects().Any()) @@ -576,8 +576,8 @@ public async Task DownloadImage360(string url) } catch (Exception ex) { - SpeckleLog.Logger - .ForContext("imageUrl", url) + SpeckleLog + .Logger.ForContext("imageUrl", url) .Warning(ex, "Swallowing exception in {methodName}: {exceptionMessage}", nameof(DownloadImage360), ex.Message); Debug.WriteLine(ex); _previewImage360 = null; // Could not download... @@ -1275,8 +1275,8 @@ private async void AddNewBranch() try { _isAddingBranches = true; - var branchId = await StreamState.Client - .BranchCreate( + var branchId = await StreamState + .Client.BranchCreate( new BranchCreateInput { streamId = Stream.id, @@ -1483,8 +1483,8 @@ public async void PreviewCommand() } GetReport(); - SpeckleLog.Logger - .ForContext(nameof(IsReceiver), IsReceiver) + SpeckleLog + .Logger.ForContext(nameof(IsReceiver), IsReceiver) .Information(CommandSucceededLogTemplate, nameof(PreviewCommand)); } catch (Exception ex) diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.ASGeometry.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.ASGeometry.cs index 6b191fad19..376a7156e5 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.ASGeometry.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.ASGeometry.cs @@ -3,10 +3,8 @@ using System.Collections; using System.Collections.Generic; using System.Linq; - using Autodesk.AutoCAD.Geometry; using AcadGeo = Autodesk.AutoCAD.Geometry; - using Arc = Objects.Geometry.Arc; using Box = Objects.Geometry.Box; using Interval = Objects.Primitive.Interval; @@ -15,9 +13,7 @@ using Point = Objects.Geometry.Point; using Polycurve = Objects.Geometry.Polycurve; using Vector = Objects.Geometry.Vector; - using MathNet.Spatial.Euclidean; - using ASPolyline3d = Autodesk.AdvanceSteel.Geometry.Polyline3d; using ASCurve3d = Autodesk.AdvanceSteel.Geometry.Curve3d; using ASLineSeg3d = Autodesk.AdvanceSteel.Geometry.LineSeg3d; @@ -27,7 +23,6 @@ using ASExtents = Autodesk.AdvanceSteel.Geometry.Extents; using ASPlane = Autodesk.AdvanceSteel.Geometry.Plane; using ASBoundBlock3d = Autodesk.AdvanceSteel.Geometry.BoundBlock3d; - using static Autodesk.AdvanceSteel.DotNetRoots.Units.Unit; using Autodesk.AdvanceSteel.DocumentManagement; using Autodesk.AdvanceSteel.DotNetRoots.Units; @@ -62,6 +57,7 @@ public Vector VectorToSpeckle(ASVector3d vector, string units = null) var extV = ToExternalCoordinates(VectorASToAcad(vector)); return new Vector(extV.X, extV.Y, extV.Z, ModelUnits); } + private Vector3d VectorASToAcad(ASVector3d vector) { return new Vector3d(vector.x * FactorFromNative, vector.y * FactorFromNative, vector.z * FactorFromNative); @@ -102,6 +98,7 @@ private Box BoxToSpeckle(ASBoundBlock3d bound) return null; } } + private Box BoxToSpeckle(ASExtents extents) { try @@ -199,7 +196,13 @@ private Arc ArcToSpeckle(ASCircArc3d arc) if (arc.IsPlanar(out var plane)) { - _arc = new Arc(PlaneToSpeckle(plane), PointToSpeckle(arc.StartPoint), PointToSpeckle(arc.EndPoint), arc.IncludedAngle, ModelUnits); + _arc = new Arc( + PlaneToSpeckle(plane), + PointToSpeckle(arc.StartPoint), + PointToSpeckle(arc.EndPoint), + arc.IncludedAngle, + ModelUnits + ); } else { @@ -222,7 +225,13 @@ private Plane PlaneToSpeckle(ASPlane plane) { plane.GetCoordSystem(out var origin, out var vectorX, out var vectorY, out var vectorZ); - return new Plane(PointToSpeckle(origin), VectorToSpeckle(plane.Normal), VectorToSpeckle(vectorX), VectorToSpeckle(vectorY), ModelUnits); + return new Plane( + PointToSpeckle(origin), + VectorToSpeckle(plane.Normal), + VectorToSpeckle(vectorX), + VectorToSpeckle(vectorY), + ModelUnits + ); } private object ConvertValueToSpeckle(object @object, eUnitType? unitType, out bool converted) @@ -270,7 +279,7 @@ private object ConvertValueToSpeckle(object @object, eUnitType? unitType, out bo } else { - if(unitType.HasValue && @object is double) + if (unitType.HasValue && @object is double) { @object = FromInternalUnits((double)@object, unitType.Value); } @@ -331,7 +340,7 @@ private static double RoundBigDecimalNumbers(double value, int digits) return Math.Round(value, digits, MidpointRounding.AwayFromZero); } -#region Units + #region Units private UnitsSet _unitsSet; @@ -411,6 +420,6 @@ private string UnitArea } } -#endregion + #endregion } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.AdvanceSteel.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.AdvanceSteel.cs index f301d7fb71..3e04a1547b 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.AdvanceSteel.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.AdvanceSteel.cs @@ -2,9 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; - using Speckle.Core.Models; - using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AdvanceSteel.CADAccess; using Autodesk.AdvanceSteel.Modeler; @@ -12,10 +10,8 @@ using ASObjectId = Autodesk.AdvanceSteel.CADLink.Database.ObjectId; using ASFilerObject = Autodesk.AdvanceSteel.CADAccess.FilerObject; using ASExtents = Autodesk.AdvanceSteel.Geometry.Extents; - using Objects.BuiltElements.AdvanceSteel; using Mesh = Objects.Geometry.Mesh; - using MathNet.Spatial.Euclidean; using MathPlane = MathNet.Spatial.Euclidean.Plane; using TriangleNet.Geometry; @@ -109,7 +105,6 @@ private void SetAsteelObjectPropertiesToSpeckle(IAsteelObject asteelObject, File } } } - } catch (System.Exception e) { @@ -117,7 +112,6 @@ private void SetAsteelObjectPropertiesToSpeckle(IAsteelObject asteelObject, File } asteelObject.asteelProperties = propsAsteelObject; - } private bool CheckProperty(ASProperty propInfo, object @object, out object value) @@ -130,7 +124,7 @@ private bool CheckProperty(ASProperty propInfo, object @object, out object value if (propInfo.ValueType.IsPrimitive || propInfo.ValueType == typeof(decimal)) { - if(propInfo.UnitType.HasValue && value is double) + if (propInfo.UnitType.HasValue && value is double) { value = FromInternalUnits((double)value, propInfo.UnitType.Value); } @@ -148,7 +142,7 @@ private bool CheckProperty(ASProperty propInfo, object @object, out object value value = value.ToString(); return true; } - + value = ConvertValueToSpeckle(value, propInfo.UnitType, out var converted); return converted; @@ -210,7 +204,9 @@ private Mesh GetMeshFromModelerBody(ModelerBody modelerBody, ASExtents extents) var triangleMesh = (TriangleMesh)input.Triangulate(); CoordinateSystem coordinateSystemInverted = coordinateSystemAligned.Invert(); - var verticesMesh = triangleMesh.Vertices.Select(x => new Point3D(x.X, x.Y, 0).TransformBy(coordinateSystemInverted)); + var verticesMesh = triangleMesh.Vertices.Select(x => + new Point3D(x.X, x.Y, 0).TransformBy(coordinateSystemInverted) + ); vertexList.AddRange(GetFlatCoordinates(verticesMesh)); facesList.AddRange(GetFaceVertices(triangleMesh.Triangles, faceIndexOffset)); @@ -224,7 +220,9 @@ private Mesh GetMeshFromModelerBody(ModelerBody modelerBody, ASExtents extents) private Contour CreateContour(IEnumerable points, CoordinateSystem coordinateSystemAligned) { - var listTriangleVertex = points.Select(x => x.TransformBy(coordinateSystemAligned)).Select(x => new TriangleVertex(x.X, x.Y)); + var listTriangleVertex = points + .Select(x => x.TransformBy(coordinateSystemAligned)) + .Select(x => new TriangleVertex(x.X, x.Y)); return new Contour(listTriangleVertex); } @@ -267,7 +265,8 @@ private CoordinateSystem CreateCoordinateSystemAligned(IEnumerable poin return CoordinateSystem.CreateMappingCoordinateSystem(fromCs, toCs); } - public static T GetFilerObjectByEntity(DBObject @object) where T : FilerObject + public static T GetFilerObjectByEntity(DBObject @object) + where T : FilerObject { ASObjectId idCadEntity = new(@object.ObjectId.OldIdPtr); ASObjectId idFilerObject = DatabaseManager.GetFilerObjectId(idCadEntity, false); diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Beams.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Beams.cs index 2bd293fa24..bb25f7efec 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Beams.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Beams.cs @@ -1,17 +1,14 @@ #if ADVANCESTEEL using System.Collections.Generic; using System.Linq; - using Autodesk.AdvanceSteel.DotNetRoots.DatabaseAccess; using Autodesk.AdvanceSteel.Profiles; - using Objects.BuiltElements.AdvanceSteel; using Line = Objects.Geometry.Line; using Point = Objects.Geometry.Point; using ASBeam = Autodesk.AdvanceSteel.Modelling.Beam; using ASPolyBeam = Autodesk.AdvanceSteel.Modelling.PolyBeam; using ASPolyline3d = Autodesk.AdvanceSteel.Geometry.Polyline3d; - using Objects.Structural.Properties.Profiles; using static Autodesk.AdvanceSteel.DotNetRoots.Units.Unit; @@ -59,7 +56,10 @@ private void GetBeamPropertiesToSpeckle(AsteelBeam asteelBeam, ASBeam beam) dynamic profType = beam.GetProfType(); asteelBeam.profile = GetProfileSectionProperties(profType); - asteelBeam.asteelProfile.SectionProfileDB = GetProfileSectionDBProperties(beam.ProfSectionType, beam.ProfSectionName); + asteelBeam.asteelProfile.SectionProfileDB = GetProfileSectionDBProperties( + beam.ProfSectionType, + beam.ProfSectionName + ); asteelBeam.area = FromInternalUnits(beam.GetPaintArea(), eUnitType.kArea); @@ -129,10 +129,7 @@ private SectionProfile GetProfileSectionProperties(ProfileTypeT profileType) private SectionProfile GetProfileSectionProperties(ProfileType profileType) { //Undefined - SectionProfile sectionProfile = new() - { - name = profileType.GetType().Name - }; + SectionProfile sectionProfile = new() { name = profileType.GetType().Name }; return sectionProfile; } @@ -193,7 +190,6 @@ private AsteelSectionProfileDB GetProfileSectionDBProperties(string typeNameText return sectionProfileDB; } - } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Bolts.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Bolts.cs index d4acab7bff..16f95e26ba 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Bolts.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Bolts.cs @@ -11,7 +11,8 @@ public partial class ConverterAutocadCivil { private IAsteelObject FilerObjectToSpeckle(ASBoltPattern bolt, List notes) { - AsteelBolt asteelBolt = bolt is CircleScrewBoltPattern ? (AsteelBolt)new AsteelCircularBolt() : (AsteelBolt)new AsteelRectangularBolt(); + AsteelBolt asteelBolt = + bolt is CircleScrewBoltPattern ? (AsteelBolt)new AsteelCircularBolt() : (AsteelBolt)new AsteelRectangularBolt(); SetDisplayValue(asteelBolt, bolt); diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.DxfNames.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.DxfNames.cs index ade6e2e2fd..a45e0c8237 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.DxfNames.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.DxfNames.cs @@ -6,7 +6,7 @@ namespace Objects.Converter.AutocadCivil; public static class DxfNames -{ +{ public const string BEAM = "ASTBEAM"; public const string PLATE = "ASTPLATE"; diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Gratings.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Gratings.cs index 8a07851181..dfb26d37c5 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Gratings.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/ConverterAutocadCivil.Gratings.cs @@ -1,8 +1,8 @@ #if ADVANCESTEEL using System.Collections.Generic; - using Objects.BuiltElements.AdvanceSteel; using ASGrating = Autodesk.AdvanceSteel.Modelling.Grating; + namespace Objects.Converter.AutocadCivil; public partial class ConverterAutocadCivil diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASBaseProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASBaseProperties.cs index c1c00b44f8..fdb90f879a 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASBaseProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASBaseProperties.cs @@ -5,9 +5,13 @@ namespace Objects.Converter.AutocadCivil; -public abstract class ASBaseProperties : IASProperties where T : class +public abstract class ASBaseProperties : IASProperties + where T : class { - public Type ObjectType { get => typeof(T); } + public Type ObjectType + { + get => typeof(T); + } public abstract Dictionary BuildedPropertyList(); @@ -18,7 +22,12 @@ public abstract class ASBaseProperties : IASProperties where T : class /// /// Member name of AS Object - May be Get/Set property or Get Method(without parameter) /// - protected void InsertProperty(Dictionary dictionary, string description, string memberName, eUnitType? unitType = null) + protected void InsertProperty( + Dictionary dictionary, + string description, + string memberName, + eUnitType? unitType = null + ) { dictionary.Add(description, new ASProperty(ObjectType, description, memberName, unitType)); } @@ -31,7 +40,13 @@ protected void InsertProperty(Dictionary dictionary, string /// Method name of Get Custom Function on properties class /// Method name of Set Custom Function on properties class /// - protected void InsertCustomProperty(Dictionary dictionary, string description, string methodInfoGet, string methodInfoSet, eUnitType? unitType = null) + protected void InsertCustomProperty( + Dictionary dictionary, + string description, + string methodInfoGet, + string methodInfoSet, + eUnitType? unitType = null + ) { ASPropertyMethods propertyMethods = new(this.GetType(), methodInfoGet, methodInfoSet); dictionary.Add(description, new ASProperty(ObjectType, description, propertyMethods, unitType)); diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertiesCache.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertiesCache.cs index c21720c56e..393cea1a98 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertiesCache.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertiesCache.cs @@ -14,18 +14,15 @@ namespace Objects.Converter.AutocadCivil; public class ASPropertiesCache { - private ASPropertiesCache() - { - - } + private ASPropertiesCache() { } private static ASPropertiesCache instance; public static ASPropertiesCache Instance { - get + get { - if (instance == null) + if (instance == null) { instance = new ASPropertiesCache(); instance.LoadASTypeDictionary(); @@ -33,20 +30,20 @@ public static ASPropertiesCache Instance return instance; } - } - private readonly Dictionary ASPropertiesSets = new() - { - { typeof(AtomicElement), new ASTypeData ("assembly") }, - { typeof(Beam), new ASTypeData("beam") }, - { typeof(MainAlias), new ASTypeData("manufacturing") }, - { typeof(PolyBeam), new ASTypeData("poly beam") }, - { typeof(BoltPattern), new ASTypeData("bolt") }, - { typeof(ScrewBoltPattern), new ASTypeData("screw bolt") }, - { typeof(ConstructionElement), new ASTypeData("construction") }, - { typeof(FilerObject), new ASTypeData("asteel") } - }; + private readonly Dictionary ASPropertiesSets = + new() + { + { typeof(AtomicElement), new ASTypeData("assembly") }, + { typeof(Beam), new ASTypeData("beam") }, + { typeof(MainAlias), new ASTypeData("manufacturing") }, + { typeof(PolyBeam), new ASTypeData("poly beam") }, + { typeof(BoltPattern), new ASTypeData("bolt") }, + { typeof(ScrewBoltPattern), new ASTypeData("screw bolt") }, + { typeof(ConstructionElement), new ASTypeData("construction") }, + { typeof(FilerObject), new ASTypeData("asteel") } + }; /// /// Get all properties sets that are subclasses or equivalents of the type @@ -56,12 +53,14 @@ public static ASPropertiesCache Instance /// internal IEnumerable GetPropertiesSetsByType(Type objectType) { - IEnumerable steelTypeDataList = ASPropertiesSets.Where(x => objectType.IsSubclassOf(x.Key) || objectType.IsEquivalentTo(x.Key)).Select(x => x.Value); + IEnumerable steelTypeDataList = ASPropertiesSets + .Where(x => objectType.IsSubclassOf(x.Key) || objectType.IsEquivalentTo(x.Key)) + .Select(x => x.Value); return steelTypeDataList; } -#region Load dictionary + #region Load dictionary /// /// Load all properties of each Advance Steel object type @@ -69,7 +68,9 @@ internal IEnumerable GetPropertiesSetsByType(Type objectType) private void LoadASTypeDictionary() { var assemblyTypes = System.Reflection.Assembly.GetExecutingAssembly().GetTypes(); - var listIASProperties = assemblyTypes.Where(x => !x.IsAbstract && x.GetInterfaces().Contains(typeof(IASProperties))).Select(x => Activator.CreateInstance(x) as IASProperties); + var listIASProperties = assemblyTypes + .Where(x => !x.IsAbstract && x.GetInterfaces().Contains(typeof(IASProperties))) + .Select(x => Activator.CreateInstance(x) as IASProperties); //Set specific properties of each type foreach (var item in ASPropertiesSets) @@ -98,6 +99,6 @@ private void LoadASTypeDictionary() } } -#endregion + #endregion } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASProperty.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASProperty.cs index 60b423d281..16cad33a51 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASProperty.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASProperty.cs @@ -25,7 +25,6 @@ public class ASProperty public eUnitType? UnitType { get; private set; } - internal ASProperty(Type objectASType, string description, string memberName, eUnitType? unitType = null) { ObjectType = objectASType; @@ -56,10 +55,17 @@ internal ASProperty(Type objectASType, string description, string memberName, eU return; } - throw new Exception($"'{memberName}' is not a property nor return method with 0 arguments nor void method with 1 argument"); + throw new Exception( + $"'{memberName}' is not a property nor return method with 0 arguments nor void method with 1 argument" + ); } - internal ASProperty(Type objectType, string description, ASPropertyMethods propertyMethods, eUnitType? unitType = null) + internal ASProperty( + Type objectType, + string description, + ASPropertyMethods propertyMethods, + eUnitType? unitType = null + ) { ObjectType = objectType; Description = description; @@ -123,7 +129,6 @@ internal object EvaluateValue(object asObject) { throw new System.Exception($"Object has no property - {Description?.ToString()}"); } - } private object GetObjectPropertyValue(object asObject) @@ -147,6 +152,5 @@ private object GetObjectPropertyValue(object asObject) throw new NotImplementedException(); } } - } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertyMethods.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertyMethods.cs index 7acec91e0e..a63d834f81 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertyMethods.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASPropertyMethods.cs @@ -13,7 +13,10 @@ internal ASPropertyMethods(Type typeProperties, string methodInfoGet, string met if (!string.IsNullOrEmpty(methodInfoGet)) { MethodInfoGet = typeProperties.GetMethod(methodInfoGet, BindingFlags.Static | BindingFlags.NonPublic); - if (MethodInfoGet == null || MethodInfoGet.GetParameters().Length != 1 && MethodInfoGet.ReturnType == typeof(void)) + if ( + MethodInfoGet == null + || MethodInfoGet.GetParameters().Length != 1 && MethodInfoGet.ReturnType == typeof(void) + ) { throw new Exception($"Method Get '{methodInfoGet}' must have 1 parameter, 1 return and be static"); } @@ -22,7 +25,10 @@ internal ASPropertyMethods(Type typeProperties, string methodInfoGet, string met if (!string.IsNullOrEmpty(methodInfoSet)) { MethodInfoSet = typeProperties.GetMethod(methodInfoSet, BindingFlags.Static | BindingFlags.NonPublic); - if (MethodInfoSet == null || MethodInfoSet.GetParameters().Length != 2 && MethodInfoSet.ReturnType != typeof(void)) + if ( + MethodInfoSet == null + || MethodInfoSet.GetParameters().Length != 2 && MethodInfoSet.ReturnType != typeof(void) + ) { throw new Exception($"Method Set '{MethodInfoSet}' must have 2 parameters, void return and be static"); } @@ -41,7 +47,6 @@ internal ASPropertyMethods(Type typeProperties, string methodInfoGet, string met throw new Exception("The get return type must be the same second parameter of set method"); } } - } internal MethodInfo MethodInfoGet { get; private set; } diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASTypeData.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASTypeData.cs index e8004ce300..ff424b0be3 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASTypeData.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/ASTypeData.cs @@ -42,7 +42,10 @@ internal void AddPropertiesAll(Dictionary properties) internal void OrderDictionaryPropertiesAll() { - PropertiesAll = (from entry in PropertiesAll orderby entry.Key ascending select entry).ToDictionary(x => x.Key, y => y.Value); + PropertiesAll = (from entry in PropertiesAll orderby entry.Key ascending select entry).ToDictionary( + x => x.Key, + y => y.Value + ); } } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/AtomicElementProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/AtomicElementProperties.cs index 575b7e765a..8a290aaff5 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/AtomicElementProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/AtomicElementProperties.cs @@ -66,8 +66,18 @@ public override Dictionary BuildedPropertyList() InsertCustomProperty(dictionary, "cuts number", nameof(AtomicElementProperties.GetCutsNumber), null); InsertCustomProperty(dictionary, "balance point", nameof(AtomicElementProperties.GetBalancePoint), null); InsertCustomProperty(dictionary, "holes", nameof(AtomicElementProperties.GetHoles), null, eUnitType.kDistance); - InsertCustomProperty(dictionary, "numbering - valid single part", nameof(AtomicElementProperties.HasValidSPNumber), null); - InsertCustomProperty(dictionary, "numbering - valid main part", nameof(AtomicElementProperties.HasValidMPNumber), null); + InsertCustomProperty( + dictionary, + "numbering - valid single part", + nameof(AtomicElementProperties.HasValidSPNumber), + null + ); + InsertCustomProperty( + dictionary, + "numbering - valid main part", + nameof(AtomicElementProperties.HasValidMPNumber), + null + ); return dictionary; } @@ -79,8 +89,8 @@ private static double GetCutsNumber(AtomicElement atomicElement) private static Point3d GetBalancePoint(AtomicElement atomicElement) { - //it's necessary round the balance point because it has different returns at the last decimals - if(!atomicElement.GetBalancepoint(out var point, out var weigth)) + //it's necessary round the balance point because it has different returns at the last decimals + if (!atomicElement.GetBalancepoint(out var point, out var weigth)) { return Point3d.kOrigin; } @@ -110,12 +120,13 @@ private static List> GetHoles(AtomicElement atomicEle { hole.CS.GetCoordSystem(out var point, out _, out _, out var vectorZ); - Dictionary holeProperties = new() - { - { "diameter", hole.Hole.Diameter}, - { "center", point }, - { "normal", vectorZ } - }; + Dictionary holeProperties = + new() + { + { "diameter", hole.Hole.Diameter }, + { "center", point }, + { "normal", vectorZ } + }; listHolesDetails.Add(holeProperties); } @@ -146,6 +157,5 @@ private static List GetHolesFeatures(AtomicElement pAtomi return holes; } - } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BeamProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BeamProperties.cs index feaff458ee..27f9882ac2 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BeamProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BeamProperties.cs @@ -9,7 +9,6 @@ using Objects.BuiltElements; using ASBeam = Autodesk.AdvanceSteel.Modelling.Beam; using ASPoint3d = Autodesk.AdvanceSteel.Geometry.Point3d; - using static Autodesk.AdvanceSteel.DotNetRoots.Units.Unit; namespace Objects.Converter.AutocadCivil; @@ -63,11 +62,7 @@ private static ASPoint3d GetPointAtEnd(ASBeam beam) private static Dictionary GetOffsets(ASBeam beam) { - Dictionary dictionary = new() - { - { "Y", beam.Offsets.x }, - { "Z", beam.Offsets.y } - }; + Dictionary dictionary = new() { { "Y", beam.Offsets.x }, { "Z", beam.Offsets.y } }; return dictionary; } @@ -102,42 +97,89 @@ private static int GetProfileType(ASBeam beam) private static double GetSawLength(ASBeam beam) { - GetSawInformation(beam, out var sawLength, out var flangeAngleAtStart, out var webAngleAtStart, out var flangeAngleAtEnd, out var webAngleAtEnd); + GetSawInformation( + beam, + out var sawLength, + out var flangeAngleAtStart, + out var webAngleAtStart, + out var flangeAngleAtEnd, + out var webAngleAtEnd + ); return sawLength; } private static double GetFlangeAngleAtStart(ASBeam beam) { - GetSawInformation(beam, out var sawLength, out var flangeAngleAtStart, out var webAngleAtStart, out var flangeAngleAtEnd, out var webAngleAtEnd); + GetSawInformation( + beam, + out var sawLength, + out var flangeAngleAtStart, + out var webAngleAtStart, + out var flangeAngleAtEnd, + out var webAngleAtEnd + ); return DegreeToRadian(flangeAngleAtStart); } private static double GetWebAngleAtStart(ASBeam beam) { - GetSawInformation(beam, out var sawLength, out var flangeAngleAtStart, out var webAngleAtStart, out var flangeAngleAtEnd, out var webAngleAtEnd); + GetSawInformation( + beam, + out var sawLength, + out var flangeAngleAtStart, + out var webAngleAtStart, + out var flangeAngleAtEnd, + out var webAngleAtEnd + ); return DegreeToRadian(webAngleAtStart); } private static double GetFlangeAngleAtEnd(ASBeam beam) { - GetSawInformation(beam, out var sawLength, out var flangeAngleAtStart, out var webAngleAtStart, out var flangeAngleAtEnd, out var webAngleAtEnd); + GetSawInformation( + beam, + out var sawLength, + out var flangeAngleAtStart, + out var webAngleAtStart, + out var flangeAngleAtEnd, + out var webAngleAtEnd + ); return DegreeToRadian(flangeAngleAtEnd); } private static double GetWebAngleAtEnd(ASBeam beam) { - GetSawInformation(beam, out var sawLength, out var flangeAngleAtStart, out var webAngleAtStart, out var flangeAngleAtEnd, out var webAngleAtEnd); + GetSawInformation( + beam, + out var sawLength, + out var flangeAngleAtStart, + out var webAngleAtStart, + out var flangeAngleAtEnd, + out var webAngleAtEnd + ); return DegreeToRadian(webAngleAtEnd); } - private static void GetSawInformation(ASBeam beam, out double sawLength, out double flangeAngleAtStart, out double webAngleAtStart, out double flangeAngleAtEnd, out double webAngleAtEnd) + private static void GetSawInformation( + ASBeam beam, + out double sawLength, + out double flangeAngleAtStart, + out double webAngleAtStart, + out double flangeAngleAtEnd, + out double webAngleAtEnd + ) { - int executed = beam.GetSawInformation(out sawLength, out flangeAngleAtStart, out webAngleAtStart, out flangeAngleAtEnd, out webAngleAtEnd); + int executed = beam.GetSawInformation( + out sawLength, + out flangeAngleAtStart, + out webAngleAtStart, + out flangeAngleAtEnd, + out webAngleAtEnd + ); //if (executed <= 0) //{ // throw new System.Exception("No values were found for this steel Beam from Function"); //} } - } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BoltPatternProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BoltPatternProperties.cs index c69a6e5a3a..63ededcc4f 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BoltPatternProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/BoltPatternProperties.cs @@ -30,6 +30,7 @@ public override Dictionary BuildedPropertyList() return dictionary; } + private static IEnumerable GetMidPoints(BoltPattern boltPattern) { boltPattern.GetMidpoints(out var points); diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ConstructionElementProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ConstructionElementProperties.cs index 5fe924865c..9b36254126 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ConstructionElementProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ConstructionElementProperties.cs @@ -24,7 +24,12 @@ public override Dictionary BuildedPropertyList() InsertProperty(dictionary, "display mode", nameof(ConstructionElement.ReprMode)); //ActiveConstructionElement has only 1 property, we put together here in ConstructionElementProperties - InsertCustomProperty(dictionary, "driven connection", nameof(ConstructionElementProperties.GetNumberOfDrivenConObj), null); + InsertCustomProperty( + dictionary, + "driven connection", + nameof(ConstructionElementProperties.GetNumberOfDrivenConObj), + null + ); return dictionary; } diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/MainAliasProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/MainAliasProperties.cs index e0faacc685..93a7997eae 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/MainAliasProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/MainAliasProperties.cs @@ -37,6 +37,5 @@ public override Dictionary BuildedPropertyList() return dictionary; } - } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/PolybeamProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/PolybeamProperties.cs index 413a2e9374..24c90b7e7e 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/PolybeamProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/PolybeamProperties.cs @@ -29,6 +29,5 @@ private static List GetListPoints(ASPolyBeam beam) var polyLine = beam.GetPolyline(true); return polyLine.Vertices.ToList(); } - } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ScrewBoltPatternProperties.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ScrewBoltPatternProperties.cs index dd559138d9..6b261c9b62 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ScrewBoltPatternProperties.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/PropertySets/ScrewBoltPatternProperties.cs @@ -19,7 +19,12 @@ public override Dictionary BuildedPropertyList() Dictionary dictionary = new(); InsertProperty(dictionary, "top tool diameter", nameof(ScrewBoltPattern.TopToolDiameter), eUnitType.kDistance); - InsertProperty(dictionary, "bottom tool diameter", nameof(ScrewBoltPattern.BottomToolDiameter), eUnitType.kDistance); + InsertProperty( + dictionary, + "bottom tool diameter", + nameof(ScrewBoltPattern.BottomToolDiameter), + eUnitType.kDistance + ); InsertProperty(dictionary, "bottom tool height", nameof(ScrewBoltPattern.BottomToolHeight), eUnitType.kDistance); InsertProperty(dictionary, "head number of edges", nameof(ScrewBoltPattern.BoltHeadNumEdges)); InsertProperty(dictionary, "head diameter", nameof(ScrewBoltPattern.BoltHeadDiameter), eUnitType.kDistance); @@ -29,12 +34,22 @@ public override Dictionary BuildedPropertyList() InsertProperty(dictionary, "grade", nameof(ScrewBoltPattern.Grade)); InsertProperty(dictionary, "standard", nameof(ScrewBoltPattern.Standard)); InsertProperty(dictionary, "hole tolerance", nameof(ScrewBoltPattern.HoleTolerance), eUnitType.kDistance); - InsertProperty(dictionary, "binding length addition", nameof(ScrewBoltPattern.BindingLengthAddition), eUnitType.kDistance); + InsertProperty( + dictionary, + "binding length addition", + nameof(ScrewBoltPattern.BindingLengthAddition), + eUnitType.kDistance + ); InsertProperty(dictionary, "annotation", nameof(ScrewBoltPattern.Annotation)); InsertProperty(dictionary, "screw length", nameof(ScrewBoltPattern.ScrewLength), eUnitType.kDistance); InsertProperty(dictionary, "sum top height", nameof(ScrewBoltPattern.SumTopHeight), eUnitType.kDistance); InsertProperty(dictionary, "sum top set height", nameof(ScrewBoltPattern.SumTopSetHeight), eUnitType.kDistance); - InsertProperty(dictionary, "sum bottom set height", nameof(ScrewBoltPattern.SumBottomSetHeight), eUnitType.kDistance); + InsertProperty( + dictionary, + "sum bottom set height", + nameof(ScrewBoltPattern.SumBottomSetHeight), + eUnitType.kDistance + ); InsertProperty(dictionary, "sum bottom height", nameof(ScrewBoltPattern.SumBottomHeight), eUnitType.kDistance); InsertProperty(dictionary, "max top diameter", nameof(ScrewBoltPattern.MaxTopDiameter), eUnitType.kDistance); InsertProperty(dictionary, "max bottom diameter", nameof(ScrewBoltPattern.MaxBottomDiameter), eUnitType.kDistance); diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/StructureUtils.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/StructureUtils.cs index c49c821dc7..b6951cebbd 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/StructureUtils.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/AdvanceSteel/Properties/StructureUtils.cs @@ -19,7 +19,7 @@ private static Dictionary GetStructures() BuildingStructureManager buildStructMan = BuildingStructureManager.getBuildingStructureManager(); // get the list objects from the manager BuildingStructureManagerListObject buildStructManListObject = buildStructMan.ListObject; - // get all of the structures in the BuildingStructureManagerListObject + // get all of the structures in the BuildingStructureManagerListObject List bsoList = buildStructManListObject.Structures; foreach (BuildingStructureObject currBSO in bsoList) @@ -64,7 +64,7 @@ private static Dictionary GetObjectsGroup(BuildingStructur public static Dictionary>> GetObjectHandleHierarchy() { - if(objectHandleHierarch == null) + if (objectHandleHierarch == null) { objectHandleHierarch = GetObjectHandleHierarchyIntern(); } @@ -84,7 +84,10 @@ private static Dictionary>> GetObjectHan foreach (var itemGroup in groups) { - IEnumerable listHandle = itemGroup.Value.getObjectsIDs().Select(x => new ObjectId(x.AsOldId()).Handle.ToString()).Where(x => !x.Equals("0")); + IEnumerable listHandle = itemGroup + .Value.getObjectsIDs() + .Select(x => new ObjectId(x.AsOldId()).Handle.ToString()) + .Where(x => !x.Equals("0")); foreach (var handle in listHandle) { @@ -112,16 +115,12 @@ private static Dictionary>> GetObjectHan } listGroup.Add(itemGroup.Key); - - }//foreach handle - - }//foreach group - - }//foreach structure + } //foreach handle + } //foreach group + } //foreach structure return dictionaryHierarchy; } - } #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/Converter.AutocadCivil.Utils.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/Converter.AutocadCivil.Utils.cs index 56e6b7e48f..092f30a693 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/Converter.AutocadCivil.Utils.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/Converter.AutocadCivil.Utils.cs @@ -2,15 +2,12 @@ using System.Collections.Generic; using System.Reflection; using System.Text.RegularExpressions; - -using Speckle.Core.Kits; -using Speckle.Core.Models; - using Autodesk.AutoCAD.DatabaseServices; -using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; +using Autodesk.AutoCAD.Geometry; +using Speckle.Core.Kits; using Speckle.Core.Logging; - +using Speckle.Core.Models; #if CIVIL using Autodesk.Aec.ApplicationServices; #endif diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Civil.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Civil.cs index 60110843bd..a633139736 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Civil.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Civil.cs @@ -2,9 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; - using Speckle.Core.Models; - using Autodesk.AutoCAD.DatabaseServices; using Autodesk.Civil.ApplicationServices; using Autodesk.Civil.DatabaseServices; @@ -12,7 +10,6 @@ using Civil = Autodesk.Civil; using Autodesk.AutoCAD.Geometry; using Acad = Autodesk.AutoCAD.Geometry; - using Objects.BuiltElements.Civil; using Alignment = Objects.BuiltElements.Alignment; using Arc = Objects.Geometry.Arc; @@ -81,7 +78,9 @@ public CivilAlignment AlignmentToSpeckle(CivilDB.Alignment alignment) var directions = new List(); foreach (StationEquation stationEquation in alignment.StationEquations) { - equations.AddRange(new List { stationEquation.RawStationBack, stationEquation.StationBack, stationEquation.StationAhead }); + equations.AddRange( + new List { stationEquation.RawStationBack, stationEquation.StationBack, stationEquation.StationAhead } + ); bool equationIncreasing = stationEquation.EquationType.Equals(StationEquationType.Increasing); directions.Add(equationIncreasing); } @@ -137,20 +136,21 @@ public CivilAlignment AlignmentToSpeckle(CivilDB.Alignment alignment) } } - CivilAlignment speckleAlignment = new() - { - type = alignment.AlignmentType.ToString(), - profiles = profiles, - curves = curves, - startStation = alignment.StartingStation, - endStation = alignment.EndingStation, - stationEquations = equations, - stationEquationDirections = directions, - offset = alignment.IsOffsetAlignment ? alignment.OffsetAlignmentInfo.NominalOffset : 0, - site = alignment.SiteName ?? "", - style = alignment.StyleName ?? "", - units = ModelUnits - }; + CivilAlignment speckleAlignment = + new() + { + type = alignment.AlignmentType.ToString(), + profiles = profiles, + curves = curves, + startStation = alignment.StartingStation, + endStation = alignment.EndingStation, + stationEquations = equations, + stationEquationDirections = directions, + offset = alignment.IsOffsetAlignment ? alignment.OffsetAlignmentInfo.NominalOffset : 0, + site = alignment.SiteName ?? "", + style = alignment.StyleName ?? "", + units = ModelUnits + }; AddNameAndDescriptionProperty(alignment.Name, alignment.Description, speckleAlignment); @@ -177,7 +177,10 @@ public CivilAlignment AlignmentToSpeckle(CivilDB.Alignment alignment) { OffsetAlignmentInfo offsetInfo = alignment.OffsetAlignmentInfo; speckleAlignment["offsetSide"] = offsetInfo.Side.ToString(); - if (Trans.GetObject(offsetInfo.ParentAlignmentId, OpenMode.ForRead) is CivilDB.Alignment parent && parent.Name != null) + if ( + Trans.GetObject(offsetInfo.ParentAlignmentId, OpenMode.ForRead) is CivilDB.Alignment parent + && parent.Name != null + ) { speckleAlignment.parent = parent.Name; } @@ -209,7 +212,10 @@ private List DesignSpeedsToSpeckle(DesignSpeedCollection designSpeeds) public ApplicationObject AlignmentToNative(Alignment alignment) { - var appObj = new ApplicationObject(alignment.id, alignment.speckle_type) { applicationId = alignment.applicationId }; + var appObj = new ApplicationObject(alignment.id, alignment.speckle_type) + { + applicationId = alignment.applicationId + }; var existingObjs = GetExistingElementsByApplicationId(alignment.applicationId); var civilAlignment = alignment as CivilAlignment; @@ -220,15 +226,20 @@ public ApplicationObject AlignmentToNative(Alignment alignment) } // create or retrieve alignment, and parent if it exists - CivilDB.Alignment existingAlignment = existingObjs.Any() ? Trans.GetObject(existingObjs.FirstOrDefault(), OpenMode.ForWrite) as CivilDB.Alignment : null; - var parent = civilAlignment != null ? GetFromObjectIdCollection(civilAlignment.parent, civilDoc.GetAlignmentIds()) : ObjectId.Null; + CivilDB.Alignment existingAlignment = existingObjs.Any() + ? Trans.GetObject(existingObjs.FirstOrDefault(), OpenMode.ForWrite) as CivilDB.Alignment + : null; + var parent = + civilAlignment != null + ? GetFromObjectIdCollection(civilAlignment.parent, civilDoc.GetAlignmentIds()) + : ObjectId.Null; bool isUpdate = true; if (existingAlignment == null || ReceiveMode == Speckle.Core.Kits.ReceiveMode.Create) // just create a new alignment { isUpdate = false; // get civil props for creation -#region properties + #region properties var name = string.IsNullOrEmpty(alignment.name) ? alignment.applicationId : alignment.name; // names need to be unique on creation (but not send i guess??) var layer = Doc.Database.LayerZero; @@ -243,8 +254,8 @@ public ApplicationObject AlignmentToNative(Alignment alignment) } // site - var site = civilAlignment != null ? - GetFromObjectIdCollection(civilAlignment.site, civilDoc.GetSiteIds()) : ObjectId.Null; + var site = + civilAlignment != null ? GetFromObjectIdCollection(civilAlignment.site, civilDoc.GetSiteIds()) : ObjectId.Null; // style var docStyles = new ObjectIdCollection(); @@ -253,8 +264,10 @@ public ApplicationObject AlignmentToNative(Alignment alignment) docStyles.Add(styleId); } - var style = civilAlignment != null ? - GetFromObjectIdCollection(civilAlignment.style, docStyles, true) : civilDoc.Styles.AlignmentStyles.First(); + var style = + civilAlignment != null + ? GetFromObjectIdCollection(civilAlignment.style, docStyles, true) + : civilDoc.Styles.AlignmentStyles.First(); // label set style var labelStyles = new ObjectIdCollection(); @@ -263,9 +276,11 @@ public ApplicationObject AlignmentToNative(Alignment alignment) labelStyles.Add(styleId); } - var label = civilAlignment != null ? - GetFromObjectIdCollection(civilAlignment["label"] as string, labelStyles, true) : civilDoc.Styles.LabelSetStyles.AlignmentLabelSetStyles.First(); -#endregion + var label = + civilAlignment != null + ? GetFromObjectIdCollection(civilAlignment["label"] as string, labelStyles, true) + : civilDoc.Styles.LabelSetStyles.AlignmentLabelSetStyles.First(); + #endregion // create the alignment var id = ObjectId.Null; @@ -287,7 +302,12 @@ public ApplicationObject AlignmentToNative(Alignment alignment) // try to recreate with a unique name try { - id = CivilDB.Alignment.CreateOffsetAlignment(CivilDB.Alignment.GetNextUniqueName(name), parent, civilAlignment.offset, style); + id = CivilDB.Alignment.CreateOffsetAlignment( + CivilDB.Alignment.GetNextUniqueName(name), + parent, + civilAlignment.offset, + style + ); } catch (ArgumentException) { @@ -296,7 +316,7 @@ public ApplicationObject AlignmentToNative(Alignment alignment) } break; default: - id =CreateDefaultAlignment(civilDoc, name, site, layer, style, label); + id = CreateDefaultAlignment(civilDoc, name, site, layer, style, label); break; } @@ -359,8 +379,15 @@ public ApplicationObject AlignmentToNative(Alignment alignment) return appObj; } -#region helper methods - private ObjectId CreateDefaultAlignment(CivilDocument civilDoc, string name, ObjectId site, ObjectId layer, ObjectId style, ObjectId label) + #region helper methods + private ObjectId CreateDefaultAlignment( + CivilDocument civilDoc, + string name, + ObjectId site, + ObjectId layer, + ObjectId style, + ObjectId label + ) { ObjectId id = ObjectId.Null; try // throws when name already exsits or objectIds are invalid @@ -386,6 +413,7 @@ private SpiralType SpiralTypeToSpeckle(Civil.SpiralType type) _ => SpiralType.Unknown, }; } + private Civil.SpiralType SpiralTypeToNative(SpiralType type) { return type switch @@ -398,6 +426,7 @@ private Civil.SpiralType SpiralTypeToNative(SpiralType type) _ => Civil.SpiralType.Clothoid, }; } + private void AddAlignmentEntity(ICurve curve, ref CivilDB.AlignmentEntityCollection entities) { switch (curve) @@ -407,20 +436,25 @@ private void AddAlignmentEntity(ICurve curve, ref CivilDB.AlignmentEntityCollect break; case Arc o: - entities.AddFixedCurve(entities.LastEntity, PointToNative(o.startPoint), PointToNative(o.midPoint), PointToNative(o.endPoint)); + entities.AddFixedCurve( + entities.LastEntity, + PointToNative(o.startPoint), + PointToNative(o.midPoint), + PointToNative(o.endPoint) + ); break; case Spiral o: var start = PointToNative(o.startPoint); var end = PointToNative(o.endPoint); var intersectionPoints = o.displayValue.GetPoints(); // display poly points should be points of intersection for the spiral - if (intersectionPoints.Count == 0 ) + if (intersectionPoints.Count == 0) { break; } - var intersectionPoint = PointToNative(intersectionPoints[intersectionPoints.Count / 2]); - entities.AddFixedSpiral(entities.LastEntity, start, intersectionPoint , end, SpiralTypeToNative(o.spiralType)); + var intersectionPoint = PointToNative(intersectionPoints[intersectionPoints.Count / 2]); + entities.AddFixedSpiral(entities.LastEntity, start, intersectionPoint, end, SpiralTypeToNative(o.spiralType)); break; case Polycurve o: @@ -435,11 +469,13 @@ private void AddAlignmentEntity(ICurve curve, ref CivilDB.AlignmentEntityCollect break; } } + private Line AlignmentLineToSpeckle(CivilDB.AlignmentSubEntityLine line) { var speckleLine = LineToSpeckle(new LineSegment2d(line.StartPoint, line.EndPoint)); return speckleLine; } + private Arc AlignmentArcToSpeckle(AlignmentSubEntityArc arc) { // calculate midpoint of chord as between start and end point @@ -463,16 +499,21 @@ private Arc AlignmentArcToSpeckle(AlignmentSubEntityArc arc) midPoint = chordMid.Add(unitMidVector.Negate().MultiplyBy(2 * arc.Radius - sagitta)); } } - catch (InvalidOperationException){ } // continue with original midpoint if GreaterThan180 doesn't apply to this arc + catch (InvalidOperationException) { } // continue with original midpoint if GreaterThan180 doesn't apply to this arc // create arc var speckleArc = ArcToSpeckle(new CircularArc2d(arc.StartPoint, midPoint, arc.EndPoint)); return speckleArc; - } + } + private Spiral AlignmentSpiralToSpeckle(AlignmentSubEntitySpiral spiral, CivilDB.Alignment alignment) { // get plane - var vX = new Vector3d(Math.Cos(spiral.StartDirection) + spiral.StartPoint.X, Math.Sin(spiral.StartDirection) + spiral.StartPoint.Y, 0); + var vX = new Vector3d( + Math.Cos(spiral.StartDirection) + spiral.StartPoint.X, + Math.Sin(spiral.StartDirection) + spiral.StartPoint.Y, + 0 + ); var vY = vX.RotateBy(Math.PI / 2, Vector3d.ZAxis); var plane = new Acad.Plane(new Point3d(spiral.RadialPoint.X, spiral.RadialPoint.Y, 0), vX, vY); @@ -481,16 +522,17 @@ private Spiral AlignmentSpiralToSpeckle(AlignmentSubEntitySpiral spiral, CivilDB double turns = turnDirection * spiral.Delta / (Math.PI * 2); // create speckle spiral - Spiral speckleSpiral = new() - { - startPoint = PointToSpeckle(spiral.StartPoint), - endPoint = PointToSpeckle(spiral.EndPoint), - length = spiral.Length, - pitch = 0, - spiralType = SpiralTypeToSpeckle(spiral.SpiralDefinition), - plane = PlaneToSpeckle(plane), - turns = turns - }; + Spiral speckleSpiral = + new() + { + startPoint = PointToSpeckle(spiral.StartPoint), + endPoint = PointToSpeckle(spiral.EndPoint), + length = spiral.Length, + pitch = 0, + spiralType = SpiralTypeToSpeckle(spiral.SpiralDefinition), + plane = PlaneToSpeckle(plane), + turns = turns + }; // create polyline display, default tessellation length is 1 var tessellation = 1; @@ -498,10 +540,7 @@ private Spiral AlignmentSpiralToSpeckle(AlignmentSubEntitySpiral spiral, CivilDB spiralSegmentCount = (spiralSegmentCount < 10) ? 10 : spiralSegmentCount; double spiralSegmentLength = spiral.Length / spiralSegmentCount; - List points = new() - { - spiral.StartPoint - }; + List points = new() { spiral.StartPoint }; for (int i = 1; i < spiralSegmentCount; i++) { double x = 0; @@ -519,33 +558,35 @@ private Spiral AlignmentSpiralToSpeckle(AlignmentSubEntitySpiral spiral, CivilDB length += points[j].GetDistanceTo(points[j - 1]); } - Polyline poly = new() - { - value = points.SelectMany(o => PointToSpeckle(o).ToList()).ToList(), - units = ModelUnits, - closed = spiral.StartPoint == spiral.EndPoint, - length = length - }; + Polyline poly = + new() + { + value = points.SelectMany(o => PointToSpeckle(o).ToList()).ToList(), + units = ModelUnits, + closed = spiral.StartPoint == spiral.EndPoint, + length = length + }; speckleSpiral.displayValue = poly; return speckleSpiral; } -#endregion + #endregion // profiles public CivilProfile ProfileToSpeckle(CivilDB.Profile profile) { // TODO: get surface name of surface profiles from profile view - CivilProfile speckleProfile = new() - { - type = profile.ProfileType.ToString(), - offset = profile.Offset, - style = profile.StyleName ?? "", - startStation = profile.StartingStation, - endStation = profile.EndingStation, - units = ModelUnits - }; + CivilProfile speckleProfile = + new() + { + type = profile.ProfileType.ToString(), + offset = profile.Offset, + style = profile.StyleName ?? "", + startStation = profile.StartingStation, + endStation = profile.EndingStation, + units = ModelUnits + }; AddNameAndDescriptionProperty(profile.Name, profile.Description, speckleProfile); @@ -575,7 +616,12 @@ public CivilProfile ProfileToSpeckle(CivilDB.Profile profile) case ProfileEntityType.ParabolaSymmetric: case ProfileEntityType.ParabolaAsymmetric: default: - var segment = ProfileGenericToSpeckle(entity.StartStation, entity.StartElevation, entity.EndStation, entity.EndElevation); + var segment = ProfileGenericToSpeckle( + entity.StartStation, + entity.StartElevation, + entity.EndStation, + entity.EndElevation + ); if (segment != null) { curves.Add(segment); @@ -590,7 +636,10 @@ public CivilProfile ProfileToSpeckle(CivilDB.Profile profile) speckleProfile.offset = profile.Offset; if (profile.ProfileType is ProfileType.OffsetProfile && profile.OffsetParameters.ParentProfileId != ObjectId.Null) { - if (Trans.GetObject(profile.OffsetParameters.ParentProfileId, OpenMode.ForRead) is CivilDB.Profile parent && parent.Name != null) + if ( + Trans.GetObject(profile.OffsetParameters.ParentProfileId, OpenMode.ForRead) is CivilDB.Profile parent + && parent.Name != null + ) { speckleProfile.parent = parent.Name; } @@ -619,12 +668,14 @@ public CivilProfile ProfileToSpeckle(CivilDB.Profile profile) return speckleProfile; } + private Line ProfileLineToSpeckle(ProfileTangent tangent) { var start = new Point2d(tangent.StartStation, tangent.StartElevation); var end = new Point2d(tangent.EndStation, tangent.EndElevation); return LineToSpeckle(new LineSegment2d(start, end)); } + private Arc ProfileArcToSpeckle(ProfileCircular circular) { var start = new Point2d(circular.StartStation, circular.StartElevation); @@ -632,7 +683,13 @@ private Arc ProfileArcToSpeckle(ProfileCircular circular) var pvi = new Point2d(circular.PVIStation, circular.PVIElevation); return ArcToSpeckle(new CircularArc2d(start, pvi, end)); } - private Line ProfileGenericToSpeckle(double startStation, double startElevation, double endStation, double endElevation) // general approximation of segment as line + + private Line ProfileGenericToSpeckle( + double startStation, + double startElevation, + double endStation, + double endElevation + ) // general approximation of segment as line { var start = new Point2d(startStation, startElevation); var end = new Point2d(endStation, endElevation); @@ -670,20 +727,21 @@ public Featureline FeaturelineToSpeckle(CivilDB.FeatureLine featureline) var polyline = PolylineToSpeckle(new Polyline3d(Poly3dType.SimplePoly, intersectionPoints, false)); // featureline - Featureline speckleFeatureline = new() - { - points = points, - curve = CurveToSpeckle(featureline.BaseCurve, ModelUnits), - units = ModelUnits, - displayValue = new List() { polyline } - }; + Featureline speckleFeatureline = + new() + { + points = points, + curve = CurveToSpeckle(featureline.BaseCurve, ModelUnits), + units = ModelUnits, + displayValue = new List() { polyline } + }; AddNameAndDescriptionProperty(featureline.Name, featureline.Description, speckleFeatureline); speckleFeatureline["@piPoints"] = piPoints; speckleFeatureline["@elevationPoints"] = ePoints; - if (featureline.SiteId != null) - { - speckleFeatureline["site"] = featureline.SiteId.ToString(); + if (featureline.SiteId != null) + { + speckleFeatureline["site"] = featureline.SiteId.ToString(); } return speckleFeatureline; @@ -701,13 +759,15 @@ private Featureline FeaturelineToSpeckle(CivilDB.CorridorFeatureLine featureline { var point = featureline.FeatureLinePoints[i]; baseCurvePoints.Add(point.XYZ); - if (!point.IsBreak) { polylinePoints.Add(point.XYZ); } - if (polylinePoints.Count > 1 && (i == featureline.FeatureLinePoints.Count - 1 || point.IsBreak )) + if (!point.IsBreak) + { + polylinePoints.Add(point.XYZ); + } + if (polylinePoints.Count > 1 && (i == featureline.FeatureLinePoints.Count - 1 || point.IsBreak)) { var polyline = PolylineToSpeckle(new Polyline3d(Poly3dType.SimplePoly, polylinePoints, false)); polylines.Add(polyline); polylinePoints.Clear(); - } points.Add(PointToSpeckle(point.XYZ)); } @@ -731,15 +791,20 @@ public Mesh SurfaceToSpeckle(TinSurface surface) { // output vars List vertices = new(); - List faces = new (); + List faces = new(); Dictionary indices = new(); - + int indexCounter = 0; foreach (var triangle in surface.GetTriangles(false)) { try { - Point3d[] triangleVertices = { triangle.Vertex1.Location, triangle.Vertex2.Location, triangle.Vertex3.Location }; + Point3d[] triangleVertices = + { + triangle.Vertex1.Location, + triangle.Vertex2.Location, + triangle.Vertex3.Location + }; foreach (Point3d p in triangleVertices) { if (!indices.ContainsKey(p)) @@ -762,18 +827,14 @@ public Mesh SurfaceToSpeckle(TinSurface surface) triangle.Dispose(); } } - - var mesh = new Mesh(vertices, faces) - { - units = ModelUnits, - bbox = BoxToSpeckle(surface.GeometricExtents) - }; + + var mesh = new Mesh(vertices, faces) { units = ModelUnits, bbox = BoxToSpeckle(surface.GeometricExtents) }; // add tin surface props AddNameAndDescriptionProperty(surface.Name, surface.Description, mesh); Base props = Utilities.GetApplicationProps(surface, typeof(TinSurface), false); mesh[CivilPropName] = props; - + return mesh; } @@ -787,7 +848,15 @@ public Mesh SurfaceToSpeckle(GridSurface surface) { // get vertices var faceIndices = new List(); - foreach (var vertex in new List() {cell.BottomLeftVertex, cell.BottomRightVertex, cell.TopLeftVertex, cell.TopRightVertex}) + foreach ( + var vertex in new List() + { + cell.BottomLeftVertex, + cell.BottomRightVertex, + cell.TopLeftVertex, + cell.TopRightVertex + } + ) { if (!_vertices.Contains(vertex.Location)) { @@ -808,11 +877,7 @@ public Mesh SurfaceToSpeckle(GridSurface surface) } var vertices = _vertices.Select(o => PointToSpeckle(o).ToList()).SelectMany(o => o).ToList(); - var mesh = new Mesh(vertices, faces) - { - units = ModelUnits, - bbox = BoxToSpeckle(surface.GeometricExtents) - }; + var mesh = new Mesh(vertices, faces) { units = ModelUnits, bbox = BoxToSpeckle(surface.GeometricExtents) }; // add grid surface props AddNameAndDescriptionProperty(surface.Name, surface.Description, mesh); @@ -835,6 +900,7 @@ public object CivilSurfaceToNative(Mesh mesh) return MeshToNativeDB(mesh); } } + public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) { var appObj = new ApplicationObject(mesh.id, mesh.speckle_type) { applicationId = mesh.applicationId }; @@ -847,18 +913,20 @@ public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) } // create or retrieve tin surface - CivilDB.TinSurface surface = existingObjs.Any() ? Trans.GetObject(existingObjs.FirstOrDefault(), OpenMode.ForWrite) as CivilDB.TinSurface : null; + CivilDB.TinSurface surface = existingObjs.Any() + ? Trans.GetObject(existingObjs.FirstOrDefault(), OpenMode.ForWrite) as CivilDB.TinSurface + : null; bool isUpdate = true; if (surface == null || ReceiveMode == Speckle.Core.Kits.ReceiveMode.Create) // just create a new surface { isUpdate = false; // get civil props for creation - var name = string.IsNullOrEmpty(mesh["name"] as string) ? - string.IsNullOrEmpty(mesh.applicationId) ? - mesh.id : - mesh.applicationId : - mesh["name"] as string; + var name = string.IsNullOrEmpty(mesh["name"] as string) + ? string.IsNullOrEmpty(mesh.applicationId) + ? mesh.id + : mesh.applicationId + : mesh["name"] as string; ObjectId layer = Doc.Database.LayerZero; ObjectIdCollection docStyles = new(); ObjectId style = ObjectId.Null; @@ -866,8 +934,8 @@ public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) { docStyles.Add(styleId); } - - if (docStyles.Count != 0 ) + + if (docStyles.Count != 0) { style = GetFromObjectIdCollection(props["style"] as string, docStyles, true); } @@ -901,7 +969,7 @@ public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) var meshVertices = mesh.GetPoints().Select(o => PointToNative(o)).ToList(); meshVertices.ForEach(o => vertices.Add(o)); surface.AddVertices(vertices); - + // loop through faces to create an edge dictionary by vertex, which includes all other vertices this vertex is connected to int i = 0; var edges = new Dictionary>(); @@ -930,7 +998,7 @@ public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) } } - // loop through each surface vertex edge and create any that don't exist + // loop through each surface vertex edge and create any that don't exist foreach (Point3d edgeStart in edges.Keys) { var vertex = surface.FindVertexAtXY(edgeStart.X, edgeStart.Y); @@ -946,13 +1014,13 @@ public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) } vertex.Dispose(); - foreach (var vertexToAdd in edges[edgeStart]) + foreach (var vertexToAdd in edges[edgeStart]) { if (correctEdges.Contains(vertexToAdd)) { continue; } - + var a1 = surface.FindVertexAtXY(edgeStart.X, edgeStart.Y); var a2 = surface.FindVertexAtXY(vertexToAdd.X, vertexToAdd.Y); surface.AddLine(a1, a2); @@ -960,16 +1028,19 @@ public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) a2.Dispose(); } } - + // loop through and delete any edges var edgesToDelete = new List(); - foreach(TinSurfaceVertex vertex in surface.Vertices) + foreach (TinSurfaceVertex vertex in surface.Vertices) { if (vertex.Edges.Count > edges[vertex.Location].Count) { foreach (TinSurfaceEdge modifiedEdge in vertex.Edges) { - if (!edges[vertex.Location].Contains(modifiedEdge.Vertex2.Location) && !edges[modifiedEdge.Vertex2.Location].Contains(vertex.Location)) + if ( + !edges[vertex.Location].Contains(modifiedEdge.Vertex2.Location) + && !edges[modifiedEdge.Vertex2.Location].Contains(vertex.Location) + ) { edgesToDelete.Add(modifiedEdge); } @@ -983,7 +1054,7 @@ public ApplicationObject TinSurfaceToNative(Mesh mesh, Base props) surface.DeleteLines(edgesToDelete); surface.Rebuild(); } - + // update appobj var status = isUpdate ? ApplicationObject.State.Updated : ApplicationObject.State.Created; appObj.Update(status: status, createdId: surface.Handle.ToString(), convertedItem: surface); @@ -1000,27 +1071,64 @@ public Structure StructureToSpeckle(CivilDB.Structure structure) pipeIds.Add(structure.get_ConnectedPipe(i).ToString()); } - Structure speckleStructure = new() - { - location = PointToSpeckle(structure.Location, ModelUnits), - pipeIds = pipeIds, - displayValue = new List() { SolidToSpeckle(structure.Solid3dBody, out List_) }, - units = ModelUnits - }; + Structure speckleStructure = + new() + { + location = PointToSpeckle(structure.Location, ModelUnits), + pipeIds = pipeIds, + displayValue = new List() { SolidToSpeckle(structure.Solid3dBody, out List _) }, + units = ModelUnits + }; // assign additional structure props AddNameAndDescriptionProperty(structure.Name, structure.Description, speckleStructure); speckleStructure["partData"] = PartDataRecordToSpeckle(structure.PartData); - try { speckleStructure["station"] = structure.Station; } catch (Exception ex) when (!ex.IsFatal()) { } - try { speckleStructure["network"] = structure.NetworkName; } catch (Exception ex) when (!ex.IsFatal()) { } - try { speckleStructure["rotation"] = structure.Rotation; } catch (Exception e) when (!e.IsFatal()) { } - try { speckleStructure["sumpDepth"] = structure.SumpDepth; } catch (Exception e) when (!e.IsFatal()) { } - try { speckleStructure["rimElevation"] = structure.RimElevation; } catch (Exception e) when (!e.IsFatal()) { } - try { speckleStructure["sumpElevation"] = structure.SumpElevation; } catch (Exception e) when (!e.IsFatal()) { } - try { speckleStructure["lengthOuter"] = structure.Length; } catch (Exception e) when (!e.IsFatal()) { } - try { speckleStructure["lengthInner"] = structure.InnerLength; } catch (Exception e) when (!e.IsFatal()) { } - try { speckleStructure["structureId"] = structure.Id.ToString(); } catch (Exception ex) when (!ex.IsFatal()) { } + try + { + speckleStructure["station"] = structure.Station; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + speckleStructure["network"] = structure.NetworkName; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + speckleStructure["rotation"] = structure.Rotation; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + speckleStructure["sumpDepth"] = structure.SumpDepth; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + speckleStructure["rimElevation"] = structure.RimElevation; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + speckleStructure["sumpElevation"] = structure.SumpElevation; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + speckleStructure["lengthOuter"] = structure.Length; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + speckleStructure["lengthInner"] = structure.InnerLength; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + speckleStructure["structureId"] = structure.Id.ToString(); + } + catch (Exception ex) when (!ex.IsFatal()) { } return speckleStructure; } @@ -1036,7 +1144,15 @@ private Base PartDataRecordToSpeckle(PartDataRecord partData) foreach (PartDataField partField in partData.GetAllDataFields()) { - CivilDataField field = new(partField.Name, partField.DataType.ToString(), partField.Value, partField.Units.ToString(),partField.Context.ToString(), null); + CivilDataField field = + new( + partField.Name, + partField.DataType.ToString(), + partField.Value, + partField.Units.ToString(), + partField.Context.ToString(), + null + ); partDataBase[partField.Name] = field; } @@ -1053,7 +1169,8 @@ private List PartDataRecordToSpeckle(PressureNetworkPartData par foreach (PressurePartProperty partField in partData) { - CivilDataField field = new(partField.Name, partField.GetType().ToString(), partField.Value, null, null, partField.DisplayName); + CivilDataField field = + new(partField.Name, partField.GetType().ToString(), partField.Value, null, null, partField.DisplayName); fields.Add(field); } @@ -1083,35 +1200,84 @@ public Pipe PipeToSpeckle(CivilDB.Pipe pipe) break; } - Pipe specklePipe = new() - { - baseCurve = curve, - diameter = pipe.InnerDiameterOrWidth, - length = pipe.Length3DToInsideEdge, - displayValue = new List { SolidToSpeckle(pipe.Solid3dBody, out List notes) }, - units = ModelUnits - }; + Pipe specklePipe = + new() + { + baseCurve = curve, + diameter = pipe.InnerDiameterOrWidth, + length = pipe.Length3DToInsideEdge, + displayValue = new List { SolidToSpeckle(pipe.Solid3dBody, out List notes) }, + units = ModelUnits + }; // assign additional pipe props AddNameAndDescriptionProperty(pipe.Name, pipe.Description, specklePipe); specklePipe["partData"] = PartDataRecordToSpeckle(pipe.PartData); - try { specklePipe["shape"] = pipe.CrossSectionalShape.ToString(); } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["slope"] = pipe.Slope; } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["flowDirection"] = pipe.FlowDirection.ToString(); } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["flowRate"] = pipe.FlowRate; } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["network"] = pipe.NetworkName; } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["startOffset"] = pipe.StartOffset; } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["endOffset"] = pipe.EndOffset; } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["startStation"] = pipe.StartStation; } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["endStation"] = pipe.EndStation; } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["startStructureId"] = pipe.StartStructureId.ToString(); } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["endStructureId"] = pipe.EndStructureId.ToString(); } catch(Exception ex) when(!ex.IsFatal()) { } - try { specklePipe["pipeId"] = pipe.Id.ToString(); } catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["shape"] = pipe.CrossSectionalShape.ToString(); + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["slope"] = pipe.Slope; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["flowDirection"] = pipe.FlowDirection.ToString(); + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["flowRate"] = pipe.FlowRate; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["network"] = pipe.NetworkName; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["startOffset"] = pipe.StartOffset; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["endOffset"] = pipe.EndOffset; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["startStation"] = pipe.StartStation; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["endStation"] = pipe.EndStation; + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["startStructureId"] = pipe.StartStructureId.ToString(); + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["endStructureId"] = pipe.EndStructureId.ToString(); + } + catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["pipeId"] = pipe.Id.ToString(); + } + catch (Exception ex) when (!ex.IsFatal()) { } return specklePipe; } - + public Pipe PipeToSpeckle(PressurePipe pipe) { // get the pipe curve @@ -1135,14 +1301,15 @@ public Pipe PipeToSpeckle(PressurePipe pipe) break; } - Pipe specklePipe = new() - { - baseCurve = curve, - diameter = pipe.InnerDiameter, - length = pipe.Length3DCenterToCenter, - displayValue = new List { SolidToSpeckle(pipe.Get3dBody(), out List notes) }, - units = ModelUnits - }; + Pipe specklePipe = + new() + { + baseCurve = curve, + diameter = pipe.InnerDiameter, + length = pipe.Length3DCenterToCenter, + displayValue = new List { SolidToSpeckle(pipe.Get3dBody(), out List notes) }, + units = ModelUnits + }; // assign additional pipe props AddNameAndDescriptionProperty(pipe.Name, pipe.Description, specklePipe); @@ -1151,14 +1318,46 @@ public Pipe PipeToSpeckle(PressurePipe pipe) #endif specklePipe["isPressurePipe"] = true; - try { specklePipe["partType"] = pipe.PartType.ToString(); } catch (Exception e) when (!e.IsFatal()) { } - try { specklePipe["slope"] = pipe.Slope; } catch (Exception e) when (!e.IsFatal()) { } - try { specklePipe["network"] = pipe.NetworkName; } catch (Exception e) when (!e.IsFatal()) { } - try { specklePipe["startOffset"] = pipe.StartOffset; } catch (Exception e) when (!e.IsFatal()) { } - try { specklePipe["endOffset"] = pipe.EndOffset; } catch (Exception e) when (!e.IsFatal()) { } - try { specklePipe["startStation"] = pipe.StartStation; } catch (Exception e) when (!e.IsFatal()) { } - try { specklePipe["endStation"] = pipe.EndStation; } catch (Exception e) when (!e.IsFatal()) { } - try { specklePipe["pipeId"] = pipe.Id.ToString(); } catch (Exception ex) when (!ex.IsFatal()) { } + try + { + specklePipe["partType"] = pipe.PartType.ToString(); + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + specklePipe["slope"] = pipe.Slope; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + specklePipe["network"] = pipe.NetworkName; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + specklePipe["startOffset"] = pipe.StartOffset; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + specklePipe["endOffset"] = pipe.EndOffset; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + specklePipe["startStation"] = pipe.StartStation; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + specklePipe["endStation"] = pipe.EndStation; + } + catch (Exception e) when (!e.IsFatal()) { } + try + { + specklePipe["pipeId"] = pipe.Id.ToString(); + } + catch (Exception ex) when (!ex.IsFatal()) { } return specklePipe; } @@ -1168,7 +1367,8 @@ public Pipe PipeToSpeckle(PressurePipe pipe) private CivilDataField AppliedSubassemblyParamToSpeckle(IAppliedSubassemblyParam param) { - CivilDataField baseParam = new(param.KeyName, param.ValueType.Name, param.ValueAsObject, null, null, param.DisplayName); + CivilDataField baseParam = + new(param.KeyName, param.ValueType.Name, param.ValueAsObject, null, null, param.DisplayName); return baseParam; } @@ -1187,12 +1387,15 @@ private CivilAppliedSubassembly AppliedSubassemblyToSpeckle(AppliedSubassembly a } Point soePoint = PointToSpeckle(appliedSubassembly.OriginStationOffsetElevationToBaseline); - List speckleParameters = appliedSubassembly.Parameters.Select(p => AppliedSubassemblyParamToSpeckle(p)).ToList(); + List speckleParameters = appliedSubassembly + .Parameters.Select(p => AppliedSubassemblyParamToSpeckle(p)) + .ToList(); - CivilAppliedSubassembly speckleAppliedSubassembly = new(appliedSubassembly.SubassemblyId.ToString(), subassembly.Name, speckleShapes, soePoint, speckleParameters) - { - units = ModelUnits - }; + CivilAppliedSubassembly speckleAppliedSubassembly = + new(appliedSubassembly.SubassemblyId.ToString(), subassembly.Name, speckleShapes, soePoint, speckleParameters) + { + units = ModelUnits + }; return speckleAppliedSubassembly; } @@ -1239,10 +1442,18 @@ private CivilBaselineRegion BaselineRegionToSpeckle(BaselineRegion region) } // create the speckle region - CivilBaselineRegion speckleRegion = new(region.Name, region.StartStation, region.EndStation, assembly.Id.ToString(), assembly.Name, speckleAppliedAssemblies) - { - units = ModelUnits - }; + CivilBaselineRegion speckleRegion = + new( + region.Name, + region.StartStation, + region.EndStation, + assembly.Id.ToString(), + assembly.Name, + speckleAppliedAssemblies + ) + { + units = ModelUnits + }; return speckleRegion; } @@ -1271,10 +1482,7 @@ private CivilCalculatedLink CalculatedLinkToSpeckle(CalculatedLink link) specklePoints.Add(specklePoint); } - CivilCalculatedLink speckleLink = new(codes, specklePoints) - { - units = ModelUnits - }; + CivilCalculatedLink speckleLink = new(codes, specklePoints) { units = ModelUnits }; return speckleLink; } @@ -1286,10 +1494,8 @@ private CivilCalculatedPoint CalculatedPointToSpeckle(CalculatedPoint point) Vector normalBaseline = VectorToSpeckle(point.NormalToBaseline); Vector normalSubAssembly = VectorToSpeckle(point.NormalToSubassembly); Point soePoint = PointToSpeckle(point.StationOffsetElevationToBaseline); - CivilCalculatedPoint speckleCalculatedPoint = new(specklePoint, codes, normalBaseline, normalSubAssembly, soePoint) - { - units = ModelUnits - }; + CivilCalculatedPoint speckleCalculatedPoint = + new(specklePoint, codes, normalBaseline, normalSubAssembly, soePoint) { units = ModelUnits }; return speckleCalculatedPoint; } @@ -1319,7 +1525,15 @@ private CivilBaseline BaselineToSpeckle(CivilDB.Baseline baseline) var profile = Trans.GetObject(baseline.ProfileId, OpenMode.ForRead) as CivilDB.Profile; CivilProfile speckleProfile = ProfileToSpeckle(profile); - speckleBaseline = new(baseline.Name, speckleRegions, baseline.SortedStations().ToList(), baseline.StartStation, baseline.EndStation, speckleAlignment, speckleProfile) + speckleBaseline = new( + baseline.Name, + speckleRegions, + baseline.SortedStations().ToList(), + baseline.StartStation, + baseline.EndStation, + speckleAlignment, + speckleProfile + ) { units = ModelUnits }; @@ -1330,12 +1544,19 @@ private CivilBaseline BaselineToSpeckle(CivilDB.Baseline baseline) var featureline = Trans.GetObject(baseline.FeatureLineId, OpenMode.ForRead) as CivilDB.FeatureLine; Featureline speckleFeatureline = FeaturelineToSpeckle(featureline); - speckleBaseline = new(baseline.Name, speckleRegions, baseline.SortedStations().ToList(), baseline.StartStation, baseline.EndStation, speckleFeatureline) + speckleBaseline = new( + baseline.Name, + speckleRegions, + baseline.SortedStations().ToList(), + baseline.StartStation, + baseline.EndStation, + speckleFeatureline + ) { units = ModelUnits }; } - + return speckleBaseline; } @@ -1346,10 +1567,12 @@ public Base CorridorToSpeckle(Corridor corridor) foreach (CivilDB.Baseline baseline in corridor.Baselines) { CivilBaseline speckleBaseline = BaselineToSpeckle(baseline); - baselines.Add(speckleBaseline); + baselines.Add(speckleBaseline); // get the collection of featurelines for this baseline - foreach (FeatureLineCollection mainFeaturelineCollection in baseline.MainBaselineFeatureLines.FeatureLineCollectionMap) // main featurelines + foreach ( + FeatureLineCollection mainFeaturelineCollection in baseline.MainBaselineFeatureLines.FeatureLineCollectionMap + ) // main featurelines { foreach (CorridorFeatureLine featureline in mainFeaturelineCollection) { diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Geometry.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Geometry.cs index 385a38ec5e..f5f58e56e7 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Geometry.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Geometry.cs @@ -1,17 +1,16 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Drawing; - -using Autodesk.AutoCAD.Geometry; -using AcadGeo = Autodesk.AutoCAD.Geometry; +using System.Linq; using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Geometry; +using Objects.Utils; +using Speckle.Core.Kits; +using Speckle.Core.Logging; +using Speckle.Core.Models; using AcadBRep = Autodesk.AutoCAD.BoundaryRepresentation; using AcadDB = Autodesk.AutoCAD.DatabaseServices; - -using Speckle.Core.Models; - -using Objects.Utils; +using AcadGeo = Autodesk.AutoCAD.Geometry; using Arc = Objects.Geometry.Arc; using Box = Objects.Geometry.Box; using Circle = Objects.Geometry.Circle; @@ -28,8 +27,6 @@ using Spiral = Objects.Geometry.Spiral; using Transform = Objects.Other.Transform; using Vector = Objects.Geometry.Vector; -using Speckle.Core.Kits; -using Speckle.Core.Logging; namespace Objects.Converter.AutocadCivil; @@ -1468,8 +1465,10 @@ public Mesh MeshToSpeckle(SubDMesh mesh) } // colors - var colors = mesh.VertexColorArray - .Select(o => Color.FromArgb(Convert.ToInt32(o.Red), Convert.ToInt32(o.Green), Convert.ToInt32(o.Blue)).ToArgb()) + var colors = mesh + .VertexColorArray.Select(o => + Color.FromArgb(Convert.ToInt32(o.Red), Convert.ToInt32(o.Green), Convert.ToInt32(o.Blue)).ToArgb() + ) .ToList(); var speckleMesh = new Mesh(vertices, faces, colors, null, ModelUnits) diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs index f97cea6124..19960d5e1f 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs @@ -2,22 +2,20 @@ using System.Collections.Generic; using System.Linq; using System.Text; - +using Autodesk.AutoCAD.Colors; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Windows.Data; -using Autodesk.AutoCAD.Colors; -using AcadDB = Autodesk.AutoCAD.DatabaseServices; - -using Speckle.Core.Models; +using Objects.BuiltElements.Revit; +using Objects.Other; using Speckle.Core.Kits; +using Speckle.Core.Logging; +using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; -using Utilities = Speckle.Core.Models.Utilities; - -using Objects.Other; +using AcadDB = Autodesk.AutoCAD.DatabaseServices; using Arc = Objects.Geometry.Arc; -using BlockInstance = Objects.Other.BlockInstance; using BlockDefinition = Objects.Other.BlockDefinition; +using BlockInstance = Objects.Other.BlockInstance; using Dimension = Objects.Other.Dimension; using Hatch = Objects.Other.Hatch; using HatchLoop = Objects.Other.HatchLoop; @@ -25,8 +23,7 @@ using Line = Objects.Geometry.Line; using Point = Objects.Geometry.Point; using Text = Objects.Other.Text; -using Objects.BuiltElements.Revit; -using Speckle.Core.Logging; +using Utilities = Speckle.Core.Models.Utilities; namespace Objects.Converter.AutocadCivil; diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.cs index 96bd06d9f1..3918929e3a 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.cs @@ -1,12 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Objects.BuiltElements; using Objects.Other; using Speckle.Core.Kits; +using Speckle.Core.Logging; using Speckle.Core.Models; -using System; -using System.Collections.Generic; -using System.Linq; using Acad = Autodesk.AutoCAD; using AcadDB = Autodesk.AutoCAD.DatabaseServices; using Alignment = Objects.BuiltElements.Alignment; @@ -24,8 +25,6 @@ using Polycurve = Objects.Geometry.Polycurve; using Polyline = Objects.Geometry.Polyline; using Spiral = Objects.Geometry.Spiral; -using Speckle.Core.Logging; - #if CIVIL using CivilDB = Autodesk.Civil.DatabaseServices; #endif @@ -535,7 +534,7 @@ public bool CanConvertToSpeckle(object @object) default: { #if ADVANCESTEEL - return CanConvertASToSpeckle(o); + return CanConvertASToSpeckle(o); #else return false; #endif diff --git a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Civil.cs b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Civil.cs index e7f345d44e..d69b7e39bd 100644 --- a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Civil.cs +++ b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Civil.cs @@ -9,7 +9,6 @@ using System.Linq; using Alignment = Objects.BuiltElements.Alignment; using Station = Objects.BuiltElements.Station; - using Bentley.DgnPlatformNET; using Bentley.DgnPlatformNET.Elements; using Bentley.GeometryNET; @@ -41,7 +40,7 @@ public Base FeatureLineToSpeckle(CifGM.FeaturizedModelEntity entity) // alignments public Alignment AlignmentToSpeckle(CifGM.Alignment alignment) { - if(alignment.FeatureDefinition is null) + if (alignment.FeatureDefinition is null) { // An alignment without a feature definition is likely a partial peice of geometry being picked up erroneously upstream. // @@ -52,7 +51,6 @@ public Alignment AlignmentToSpeckle(CifGM.Alignment alignment) var _alignment = new Alignment(); - CifGM.StationFormatSettings settings = CifGM.StationFormatSettings.GetStationFormatSettingsForModel(Model); var stationFormatter = new CifGM.StationingFormatter(alignment); @@ -93,7 +91,7 @@ public Alignment AlignmentToSpeckle(CifGM.Alignment alignment) if (stationing != null) { _alignment.startStation = stationing.StartStation; - _alignment.endStation = alignment.LinearGeometry.Length + stationing.StartStation; // swap for end station + _alignment.endStation = alignment.LinearGeometry.Length + stationing.StartStation; // swap for end station var region = stationing.GetStationRegionFromDistanceAlong(stationing.StartStation); @@ -108,8 +106,14 @@ public Alignment AlignmentToSpeckle(CifGM.Alignment alignment) formattedStationEquations.Add(stnVal); // DistanceAlong represents Back Station/BackLocation, EquivalentStation represents Ahead Station - equations.AddRange(new List { stationEquation.DistanceAlong, stationEquation.DistanceAlong, stationEquation.EquivalentStation }); - + equations.AddRange( + new List + { + stationEquation.DistanceAlong, + stationEquation.DistanceAlong, + stationEquation.EquivalentStation + } + ); } _alignment.stationEquations = equations; _alignment[nameof(formattedStationEquations)] = formattedStationEquations; @@ -132,10 +136,8 @@ public CifGM.Alignment AlignmentToNative(Alignment alignment) if (alignment.curves?.Count > 0) { //Not 100% clear on how best to handle the conversion between multiple curves and single element - singleBaseCurve = alignment.curves.Count == 1 ? alignment.curves.Single() : new Polycurve() - { - segments = alignment.curves - }; + singleBaseCurve = + alignment.curves.Count == 1 ? alignment.curves.Single() : new Polycurve() { segments = alignment.curves }; } else if (alignment.baseCurve is not null) // this could be an old alignment using a basecurve { @@ -179,8 +181,6 @@ public Base ProfileToSpeckle(CifGM.Profile profile, string modelUnits = "m") { var curves = new List(); - - switch (profile.ProfileGeometry) { case ProfileParabola profileParabola: @@ -188,7 +188,7 @@ public Base ProfileToSpeckle(CifGM.Profile profile, string modelUnits = "m") /// This has thrown exceptions in the past, but should be resolved now that only /// the active profile is being exported, as it was throwing on isolated curve /// elements with no assigned feature properties. - /// + /// /// Pulled out as its own case so it's a bit clearer why the failure is happening /// if it reoccurs. diff --git a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Geometry.cs b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Geometry.cs index 6670027748..6dee8355dd 100644 --- a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Geometry.cs +++ b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Geometry.cs @@ -1,18 +1,15 @@ using System; using System.Collections.Generic; using System.Linq; - +using Bentley.DgnPlatformNET; +using Bentley.DgnPlatformNET.Elements; +using Bentley.GeometryNET; using Objects.Geometry; using Objects.Primitive; using Speckle.Core.Models; - -using Bentley.GeometryNET; -using Bentley.DgnPlatformNET.Elements; -using Bentley.DgnPlatformNET; +using Arc = Objects.Geometry.Arc; using BIM = Bentley.Interop.MicroStationDGN; using BMIU = Bentley.MstnPlatformNET.InteropServices.Utilities; - -using Arc = Objects.Geometry.Arc; using Box = Objects.Geometry.Box; using Circle = Objects.Geometry.Circle; using Curve = Objects.Geometry.Curve; diff --git a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.GridSystems.cs b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.GridSystems.cs index 1da28f88e7..caf984b8f1 100644 --- a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.GridSystems.cs +++ b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.GridSystems.cs @@ -1,14 +1,11 @@ using System; using System.Collections.Generic; using System.Text; - +using Bentley.DgnPlatformNET.Elements; +using Bentley.GeometryNET; using Objects.BuiltElements; using Objects.Geometry; using Speckle.Core.Models; - -using Bentley.DgnPlatformNET.Elements; -using Bentley.GeometryNET; - #if (OPENBUILDINGS) using Bentley.Building.Api; #endif @@ -82,9 +79,11 @@ public Base GridSystemsToSpeckle(ITFDrawingGrid drawingGrid, string units = null return null; } - for (ITFGridSystem gridSystem = gridSystems.AsTFGridSystem; - gridSystem != null; - gridSystems.GetNext("", out gridSystems), gridSystem = (gridSystems != null) ? gridSystems.AsTFGridSystem : null) + for ( + ITFGridSystem gridSystem = gridSystems.AsTFGridSystem; + gridSystem != null; + gridSystems.GetNext("", out gridSystems), gridSystem = (gridSystems != null) ? gridSystems.AsTFGridSystem : null + ) { gridSystem.GetGridCurves(0, out ITFGridCurveList curves); @@ -106,7 +105,11 @@ public Base GridSystemsToSpeckle(ITFDrawingGrid drawingGrid, string units = null double maximumCircularAngle = 0; List gridCurveList = new(); - for (ITFGridCurve gridCurve = curves.AsTFGridCurve; gridCurve != null; curves.GetNext("", out curves), gridCurve = curves != null ? curves.AsTFGridCurve : null) + for ( + ITFGridCurve gridCurve = curves.AsTFGridCurve; + gridCurve != null; + curves.GetNext("", out curves), gridCurve = curves != null ? curves.AsTFGridCurve : null + ) { gridCurveList.Add(gridCurve); gridCurve.GetType(0, out TFdGridCurveType curveType); @@ -225,23 +228,42 @@ public Base GridSystemsToSpeckle(ITFDrawingGrid drawingGrid, string units = null { case TFdGridCurveType.TFdGridCurveType_OrthogonalX: case TFdGridCurveType.TFdGridCurveType_OrthogonalY: - baseLine = GridCurveToSpeckle(gridCurve, origin, angle, minimumValueX, minimumValueY, maximumValueX, maximumValueY, u); + baseLine = GridCurveToSpeckle( + gridCurve, + origin, + angle, + minimumValueX, + minimumValueY, + maximumValueX, + maximumValueY, + u + ); break; case TFdGridCurveType.TFdGridCurveType_Circular: - Plane xy = new(new Point(origin.X, origin.Y, 0, u), new Vector(0, 0, 1, u), new Vector(1, 0, 0, u), new Vector(0, 1, 0, u), u); + Plane xy = + new( + new Point(origin.X, origin.Y, 0, u), + new Vector(0, 0, 1, u), + new Vector(1, 0, 0, u), + new Vector(0, 1, 0, u), + u + ); baseLine = new Arc(xy, gridValue, angle, maximumCircularAngle + angle, maximumCircularAngle, u); break; case TFdGridCurveType.TFdGridCurveType_Radial: Point startPoint = Translate(Rotate(new Point(0, 0, 0, u), angle), origin.X, origin.Y); - Point endPoint = Translate(Rotate(Rotate(new Point(maximumRadius, 0, 0, u), gridValue * UoR), angle), origin.X, origin.Y); + Point endPoint = Translate( + Rotate(Rotate(new Point(maximumRadius, 0, 0, u), gridValue * UoR), angle), + origin.X, + origin.Y + ); baseLine = new Line(startPoint, endPoint, u); break; default: continue; - } gridLines.Add(CreateGridLine(baseLine, label, u)); } @@ -265,7 +287,15 @@ private ICurve TransformCurve(ICurve c, DPoint3d origin, double angle) Point midPoint = Translate(Rotate(arc.midPoint, angle), origin.X, origin.Y); Point endPoint = Translate(Rotate(arc.endPoint, angle), origin.X, origin.Y); Plane plane = TransformPlane(arc.plane, origin, angle); - Arc transformed = new(plane, (double)arc.radius, (double)arc.startAngle + angle + Math.PI * 2, (double)arc.endAngle + angle + Math.PI * 2, (double)arc.angleRadians, arc.units); + Arc transformed = + new( + plane, + (double)arc.radius, + (double)arc.startAngle + angle + Math.PI * 2, + (double)arc.endAngle + angle + Math.PI * 2, + (double)arc.angleRadians, + arc.units + ); transformed.startPoint = startPoint; transformed.midPoint = midPoint; transformed.endPoint = endPoint; @@ -292,7 +322,16 @@ private Plane TransformPlane(Plane plane, DPoint3d origin, double angle) return new Plane(planeOrigin, plane.normal, xdir, ydir, plane.units); } - public static ICurve GridCurveToSpeckle(ITFGridCurve gridCurve, DPoint3d origin, double angle, double minimumValueX = 0, double minimumValueY = 0, double maximumValueX = 0, double maximumValueY = 0, string units = null) + public static ICurve GridCurveToSpeckle( + ITFGridCurve gridCurve, + DPoint3d origin, + double angle, + double minimumValueX = 0, + double minimumValueY = 0, + double maximumValueX = 0, + double maximumValueY = 0, + string units = null + ) { ICurve baseLine; @@ -301,7 +340,8 @@ public static ICurve GridCurveToSpeckle(ITFGridCurve gridCurve, DPoint3d origin, gridCurve.GetMaximumValue(0, out double maximumValue); gridCurve.GetValue(0, out double gridValue); - Point startPoint, endPoint; + Point startPoint, + endPoint; switch (curveType) { case (TFdGridCurveType.TFdGridCurveType_OrthogonalX): @@ -338,7 +378,6 @@ public static ICurve GridCurveToSpeckle(ITFGridCurve gridCurve, DPoint3d origin, default: throw new NotSupportedException("GridCurveType " + curveType + " not supported!"); - } return baseLine; } diff --git a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Utils.cs b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Utils.cs index f8d2271a75..5b45fdf68f 100644 --- a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Utils.cs +++ b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.Utils.cs @@ -1,23 +1,20 @@ using System; using System.Collections.Generic; -using System.Text; +using System.Diagnostics; using System.Linq; - -using Objects.Other; -using Speckle.Core.Kits; -using Speckle.Core.Models; - -using Bentley.DgnPlatformNET.DgnEC; -using Bentley.MstnPlatformNET; +using System.Text; using Bentley.DgnPlatformNET; -using Bentley.ECObjects.Schema; +using Bentley.DgnPlatformNET.DgnEC; +using Bentley.DgnPlatformNET.Elements; +using Bentley.EC.Persistence.Query; using Bentley.ECObjects; using Bentley.ECObjects.Instance; -using Bentley.EC.Persistence.Query; +using Bentley.ECObjects.Schema; using Bentley.GeometryNET; -using Bentley.DgnPlatformNET.Elements; - -using System.Diagnostics; +using Bentley.MstnPlatformNET; +using Objects.Other; +using Speckle.Core.Kits; +using Speckle.Core.Models; namespace Objects.Converter.Bentley; diff --git a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.cs b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.cs index ecdc6c45f7..74f91e0506 100644 --- a/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.cs +++ b/Objects/Converters/ConverterBentley/ConverterBentleyShared/ConverterBentley.cs @@ -1,3 +1,6 @@ +using System; +using System.Collections.Generic; +using System.Linq; using Bentley.DgnPlatformNET; using Bentley.DgnPlatformNET.DgnEC; using Bentley.DgnPlatformNET.Elements; @@ -11,9 +14,6 @@ using Objects.Primitive; using Speckle.Core.Kits; using Speckle.Core.Models; -using System; -using System.Collections.Generic; -using System.Linq; using Alignment = Objects.BuiltElements.Alignment; using Arc = Objects.Geometry.Arc; using Box = Objects.Geometry.Box; @@ -34,7 +34,6 @@ using Surface = Objects.Geometry.Surface; using Vector = Objects.Geometry.Vector; using View3D = Objects.BuiltElements.View3D; - #if(OPENBUILDINGS) using Bentley.Building.Api; #endif diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSI.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSI.cs index d6b06e1bd2..62745153b7 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSI.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSI.cs @@ -1,3 +1,7 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using ConverterCSIShared.Models; using CSiAPIv1; using Objects.BuiltElements; using Objects.Structural.Analysis; @@ -5,17 +9,13 @@ using Objects.Structural.CSI.Properties; using Objects.Structural.Geometry; using Objects.Structural.Loading; +using Objects.Structural.Materials; using Objects.Structural.Properties; using Objects.Structural.Results; using Speckle.Core.Kits; +using Speckle.Core.Kits.ConverterInterfaces; using Speckle.Core.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using Objects.Structural.Materials; using OSG = Objects.Structural.Geometry; -using Speckle.Core.Kits.ConverterInterfaces; -using ConverterCSIShared.Models; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSIUtils.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSIUtils.cs index 49ef57d0ea..fbac7716f3 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSIUtils.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/ConverterCSIUtils.cs @@ -1,9 +1,9 @@ +using System; using System.Collections.Generic; -using Objects.Structural.Geometry; +using System.Linq; using CSiAPIv1; using Objects.Structural.CSI.Analysis; -using System.Linq; -using System; +using Objects.Structural.Geometry; using Speckle.Core.Logging; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/Extensions/ICurveExtensions.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/Extensions/ICurveExtensions.cs index 6356305db9..b331fc9886 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/Extensions/ICurveExtensions.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/Extensions/ICurveExtensions.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using Objects.Geometry; using Objects; +using Objects.Geometry; namespace ConverterCSIShared.Extensions; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModel.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModel.cs index 9bbcc9109f..4cbd6f7dee 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModel.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModel.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; +using System.Linq; using Objects.Structural.Analysis; using Speckle.Core.Models; -using System.Linq; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModelUnits.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModelUnits.cs index 550bff8e2e..eddaf26b9b 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModelUnits.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Analysis/ConvertModelUnits.cs @@ -1,5 +1,5 @@ -using Objects.Structural.Analysis; using CSiAPIv1; +using Objects.Structural.Analysis; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertArea.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertArea.cs index 85bf8ea782..06676f0016 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertArea.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertArea.cs @@ -1,16 +1,16 @@ using System; using System.Collections.Generic; -using Objects.Structural.Geometry; -using Objects.Structural.CSI.Properties; -using Speckle.Core.Models; -using StructuralUtilities.PolygonMesher; using System.Linq; +using ConverterCSIShared.Extensions; +using Objects.Geometry; using Objects.Structural.CSI.Geometry; +using Objects.Structural.CSI.Properties; +using Objects.Structural.Geometry; using Objects.Structural.Properties; -using Objects.Geometry; -using ConverterCSIShared.Extensions; using Speckle.Core.Kits; using Speckle.Core.Logging; +using Speckle.Core.Models; +using StructuralUtilities.PolygonMesher; namespace Objects.Converter.CSI; @@ -65,9 +65,7 @@ public void UpdateArea(Element2D area, string name, ApplicationObject appObj) success = Model.EditArea.ChangeConnectivity(name, pointsUpdated.Count, ref refArray); if (success != 0) { - throw new ConversionException( - $"Failed to modify the connectivity of the area: {name}" - ); + throw new ConversionException($"Failed to modify the connectivity of the area: {name}"); } #else int tableVersion = 0; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertFrame.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertFrame.cs index ac1d02a656..7f7ee02bb1 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertFrame.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertFrame.cs @@ -1,14 +1,14 @@ using System; using System.Collections.Generic; +using System.Linq; +using CSiAPIv1; using Objects.Geometry; -using Objects.Structural.Geometry; -using Speckle.Core.Models; using Objects.Structural.CSI.Geometry; using Objects.Structural.CSI.Properties; -using System.Linq; -using CSiAPIv1; +using Objects.Structural.Geometry; using Speckle.Core.Kits; using Speckle.Core.Logging; +using Speckle.Core.Models; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertGridLines.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertGridLines.cs index d29a5810fd..a9f328fa7b 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertGridLines.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertGridLines.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -using Objects.Geometry; -using Objects.Structural.CSI.Geometry; -using Objects.BuiltElements; using ConverterCSIShared.Models; +using Objects.BuiltElements; +using Objects.Geometry; using Objects.Other; +using Objects.Structural.CSI.Geometry; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertLinks.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertLinks.cs index e1f6626b2e..27305b58c5 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertLinks.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertLinks.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; +using System.Linq; using Objects.Geometry; -using Objects.Structural.Geometry; -using Speckle.Core.Models; using Objects.Structural.CSI.Geometry; using Objects.Structural.CSI.Properties; -using System.Linq; -using Speckle.Core.Kits; +using Objects.Structural.Geometry; using Objects.Structural.Properties; +using Speckle.Core.Kits; +using Speckle.Core.Models; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertPoint.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertPoint.cs index b51a63a240..0419db13fe 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertPoint.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertPoint.cs @@ -1,14 +1,13 @@ using System; -using Objects.Structural.Geometry; -using Objects.Geometry; using System.Collections.Generic; +using System.Linq; +using CSiAPIv1; +using Objects.Geometry; using Objects.Structural.CSI.Geometry; using Objects.Structural.CSI.Properties; -using Speckle.Core.Models; - -using CSiAPIv1; -using System.Linq; +using Objects.Structural.Geometry; using Speckle.Core.Kits; +using Speckle.Core.Models; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertStories.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertStories.cs index da3afb8a3f..109d0aa0e3 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertStories.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertStories.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -using Objects.Structural.CSI.Analysis; using System.Linq; +using Objects.Structural.CSI.Analysis; using Speckle.Core.Kits; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertTendon.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertTendon.cs index 8804a6bd0c..bdf9ca883f 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertTendon.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Geometry/ConvertTendon.cs @@ -1,6 +1,6 @@ using System; -using Objects.Structural.CSI.Geometry; using Objects.Geometry; +using Objects.Structural.CSI.Geometry; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading1DElements.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading1DElements.cs index 08d8807006..4763d8e597 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading1DElements.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading1DElements.cs @@ -1,8 +1,8 @@ -using Objects.Structural.Loading; using System; using System.Collections.Generic; -using Objects.Structural.Geometry; using System.Linq; +using Objects.Structural.Geometry; +using Objects.Structural.Loading; using Speckle.Core.Kits; using Speckle.Core.Models; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading2DElements.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading2DElements.cs index a09ae0b88a..610ff56a36 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading2DElements.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/Loading2DElements.cs @@ -1,11 +1,11 @@ -using Objects.Structural.Loading; using System; using System.Collections.Generic; -using Objects.Structural.Geometry; using System.Linq; -using Speckle.Core.Models; using Objects.Structural.CSI.Loading; +using Objects.Structural.Geometry; +using Objects.Structural.Loading; using Speckle.Core.Kits; +using Speckle.Core.Models; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/LoadingNode.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/LoadingNode.cs index 0dcdb6891d..7479baa070 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/LoadingNode.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Loading/LoadingNode.cs @@ -1,7 +1,7 @@ -using Objects.Structural.Loading; using System.Collections.Generic; -using Objects.Structural.Geometry; using System.Linq; +using Objects.Structural.Geometry; +using Objects.Structural.Loading; using Speckle.Core.Models; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Materials/ConvertMaterials.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Materials/ConvertMaterials.cs index fd182e964e..7e25229905 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Materials/ConvertMaterials.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Materials/ConvertMaterials.cs @@ -1,6 +1,6 @@ -using Objects.Structural.Materials; -using CSiAPIv1; using System.Linq; +using CSiAPIv1; +using Objects.Structural.Materials; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/Convert1DProperty.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/Convert1DProperty.cs index b61452a353..cd6092bf38 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/Convert1DProperty.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/Convert1DProperty.cs @@ -1,9 +1,9 @@ #nullable enable using System; using System.Collections.Generic; +using System.Linq; using Objects.Structural.Properties; using Objects.Structural.Properties.Profiles; -using System.Linq; using Speckle.Core.Kits; using Speckle.Core.Logging; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/ConvertSectionProfile.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/ConvertSectionProfile.cs index 74642f6c6d..d1e5a9dd48 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/ConvertSectionProfile.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Properties/ConvertSectionProfile.cs @@ -1,6 +1,6 @@ -using Objects.Structural.Properties.Profiles; -using CSiAPIv1; using System.Linq; +using CSiAPIv1; +using Objects.Structural.Properties.Profiles; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Results/ConvertResults.cs b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Results/ConvertResults.cs index 8c8cc43043..da7f07314d 100644 --- a/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Results/ConvertResults.cs +++ b/Objects/Converters/ConverterCSI/ConverterCSIShared/PartialClasses/Results/ConvertResults.cs @@ -1,7 +1,7 @@ -using Objects.Structural.Loading; -using Speckle.Core.Models; using System; using System.Collections.Generic; +using Objects.Structural.Loading; +using Speckle.Core.Models; namespace Objects.Converter.CSI; diff --git a/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.Geometry.cs b/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.Geometry.cs index 3f5216366b..b7045edd43 100644 --- a/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.Geometry.cs +++ b/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.Geometry.cs @@ -39,8 +39,8 @@ public Dxfe.Mesh MeshToNative(Mesh mesh) => MeshTopologyResult topology, string edgeLayerName = "Mesh boundaries" ) => - topology.EdgeFaceConnection - .Where((kv) => kv.Value.Count == 1) + topology + .EdgeFaceConnection.Where((kv) => kv.Value.Count == 1) .Select(kv => { var (iA, iB) = kv.Key; @@ -56,8 +56,8 @@ public Dxfe.Mesh MeshToNative(Mesh mesh) => ) { var vertices = topology.Vertices.Select(VectorToNative).ToList(); - return topology.Faces - .Select(indices => + return topology + .Faces.Select(indices => { var points = indices.Select(i => vertices[i]).ToList(); Dxfe.Face3D face; diff --git a/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.cs b/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.cs index 0cbba085e3..5e901f8dc8 100644 --- a/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.cs +++ b/Objects/Converters/ConverterDxf/ConverterDxf/SpeckleDxfConverter.cs @@ -1,9 +1,9 @@ -using Objects.Geometry; -using Speckle.Core.Kits; -using Speckle.Core.Models; using System; using System.Collections.Generic; using System.Linq; +using Objects.Geometry; +using Speckle.Core.Kits; +using Speckle.Core.Models; using Dxf = Speckle.netDxf; using Line = Objects.Geometry.Line; using Mesh = Objects.Geometry.Mesh; diff --git a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Geometry.cs b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Geometry.cs index 77d50ca988..cb30c7df58 100644 --- a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Geometry.cs +++ b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Geometry.cs @@ -3,24 +3,24 @@ using System.Linq; using Autodesk.DesignScript.Geometry; using Objects.Geometry; -using Speckle.Core.Models; -using DS = Autodesk.DesignScript.Geometry; +using Objects.Other; using Objects.Primitive; -using Point = Objects.Geometry.Point; -using Vector = Objects.Geometry.Vector; -using Line = Objects.Geometry.Line; -using Plane = Objects.Geometry.Plane; -using Circle = Objects.Geometry.Circle; +using Objects.Utils; +using Speckle.Core.Kits; +using Speckle.Core.Logging; +using Speckle.Core.Models; using Arc = Objects.Geometry.Arc; -using Ellipse = Objects.Geometry.Ellipse; +using Circle = Objects.Geometry.Circle; using Curve = Objects.Geometry.Curve; +using DS = Autodesk.DesignScript.Geometry; +using Ellipse = Objects.Geometry.Ellipse; +using Line = Objects.Geometry.Line; using Mesh = Objects.Geometry.Mesh; -using Objects.Other; -using Objects.Utils; +using Plane = Objects.Geometry.Plane; +using Point = Objects.Geometry.Point; using Spiral = Objects.Geometry.Spiral; using Surface = Objects.Geometry.Surface; -using Speckle.Core.Kits; -using Speckle.Core.Logging; +using Vector = Objects.Geometry.Vector; namespace Objects.Converter.Dynamo; @@ -277,8 +277,8 @@ public DS.Curve PolylineToNative(Polyline polyline) var points = ArrayToPointList(polyline.value, polyline.units); if (polyline.closed) { - return DS.PolyCurve - .ByPoints(points) + return DS + .PolyCurve.ByPoints(points) .CloseWithLine() .SetDynamoProperties(GetDynamicMembersFromBase(polyline)); } @@ -721,8 +721,8 @@ public Mesh MeshToSpeckle(DS.Mesh mesh, string units = null) var vertices = PointListToFlatList(mesh.VertexPositions); var defaultColour = System.Drawing.Color.FromArgb(255, 100, 100, 100); - var faces = mesh.FaceIndices - .SelectMany(f => + var faces = mesh + .FaceIndices.SelectMany(f => { if (f.Count == 4) { @@ -912,17 +912,15 @@ public NurbsSurface SurfaceToNative(Surface surface) var controlPoints = surface.GetControlPoints(); points = controlPoints - .Select( - row => - row.Select( - p => - DS.Point.ByCoordinates( - ScaleToNative(p.x, p.units), - ScaleToNative(p.y, p.units), - ScaleToNative(p.z, p.units) - ) + .Select(row => + row.Select(p => + DS.Point.ByCoordinates( + ScaleToNative(p.x, p.units), + ScaleToNative(p.y, p.units), + ScaleToNative(p.z, p.units) ) - .ToArray() + ) + .ToArray() ) .ToArray(); diff --git a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.Revit.cs b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.Revit.cs index 34918061b0..b10c0c013b 100644 --- a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.Revit.cs +++ b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.Revit.cs @@ -7,7 +7,6 @@ namespace Objects.Converter.Dynamo { public partial class ConverterDynamo { - public string GetRevitDocUnits() { if (Doc != null) @@ -35,7 +34,6 @@ private string UnitsToSpeckle(DisplayUnitType type) default: throw new Speckle.Core.Logging.SpeckleException($"The Unit System \"{type}\" is unsupported."); } - } private DisplayUnitType _revitUnitsTypeId = DisplayUnitType.DUT_UNDEFINED; diff --git a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.cs b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.cs index 087e36a8b9..3b16d0cfea 100644 --- a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.cs +++ b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.Units.cs @@ -74,7 +74,6 @@ private string UnitsToSpeckle(DisplayUnitType type) default: throw new Speckle.Core.Logging.SpeckleException($"The Unit System \"{type}\" is unsupported."); } - } #else @@ -129,7 +128,6 @@ private string UnitsToSpeckle(ForgeTypeId typeId) throw new Speckle.Core.Logging.SpeckleException($"The Unit System \"{typeId}\" is unsupported."); } - #endif #endif diff --git a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.cs b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.cs index 85c312b79f..f3c4818676 100644 --- a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.cs +++ b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/ConverterDynamo.cs @@ -1,15 +1,9 @@ -#if REVIT -using Autodesk.Revit.DB; -using RD = Revit.Elements; //Dynamo for Revit nodes -using Objects.Converter.Revit; - -#endif -using Objects.Geometry; -using Speckle.Core.Kits; -using Speckle.Core.Models; using System; using System.Collections.Generic; using System.Linq; +using Objects.Geometry; +using Speckle.Core.Kits; +using Speckle.Core.Models; using Arc = Objects.Geometry.Arc; using Circle = Objects.Geometry.Circle; using Curve = Objects.Geometry.Curve; @@ -22,6 +16,11 @@ using Spiral = Objects.Geometry.Spiral; using Transform = Objects.Other.Transform; using Vector = Objects.Geometry.Vector; +#if REVIT +using Autodesk.Revit.DB; +using RD = Revit.Elements; //Dynamo for Revit nodes +using Objects.Converter.Revit; +#endif namespace Objects.Converter.Dynamo; diff --git a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/Utils.cs b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/Utils.cs index c9784c14fd..d335a635e5 100644 --- a/Objects/Converters/ConverterDynamo/ConverterDynamoShared/Utils.cs +++ b/Objects/Converters/ConverterDynamo/ConverterDynamoShared/Utils.cs @@ -1,7 +1,7 @@ -using Autodesk.DesignScript.Geometry; using System; using System.Collections.Generic; using System.Linq; +using Autodesk.DesignScript.Geometry; using Speckle.Core.Logging; using DS = Autodesk.DesignScript.Geometry; diff --git a/Objects/Converters/ConverterNavisworks/ConverterNavisworks/ConverterNavisworks.Geometry.cs b/Objects/Converters/ConverterNavisworks/ConverterNavisworks/ConverterNavisworks.Geometry.cs index 9e645a61b6..adce6648c0 100644 --- a/Objects/Converters/ConverterNavisworks/ConverterNavisworks/ConverterNavisworks.Geometry.cs +++ b/Objects/Converters/ConverterNavisworks/ConverterNavisworks/ConverterNavisworks.Geometry.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Linq; using System.DoubleNumerics; +using System.Linq; using Autodesk.Navisworks.Api; using Autodesk.Navisworks.Api.Interop.ComApi; using Objects.Geometry; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/ConversionUtils.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/ConversionUtils.cs index 307cca0e29..bce7a25202 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/ConversionUtils.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/ConversionUtils.cs @@ -512,8 +512,8 @@ public void SetInstanceParameters(Element revitElement, Base speckleElement, Lis } else { - revitParameters = revitElement.ParametersMap - .Cast() + revitParameters = revitElement + .ParametersMap.Cast() .Where(x => x != null && !x.IsReadOnly && !exclusions.Contains(GetParamInternalName(x))); } @@ -835,8 +835,8 @@ private DB.Transform GetReferencePointTransform(string type, Document doc) // note that the project base (ui) rotation is registered on the survey pt, not on the base point // retrieve the survey point rotation from the project point var angle = projectPoint.get_Parameter(BuiltInParameter.BASEPOINT_ANGLETON_PARAM)?.AsDouble() ?? 0; - referencePointTransform = DB.Transform - .CreateTranslation(surveyPoint.Position) + referencePointTransform = DB + .Transform.CreateTranslation(surveyPoint.Position) .Multiply(DB.Transform.CreateRotation(XYZ.BasisZ, angle)); break; case InternalOrigin: @@ -905,8 +905,8 @@ private void CreateVoids(DB.Element host, Base speckleElement) } //list of shafts part of this conversion set - var shafts = ContextObjects.Values - .SelectMany(x => x.Converted.Where(y => y is RevitShaft).Cast()) + var shafts = ContextObjects + .Values.SelectMany(x => x.Converted.Where(y => y is RevitShaft).Cast()) .ToList(); openings.AddRange(shafts); @@ -1137,8 +1137,8 @@ public WallLocationLine GetWallLocationLine(LocationLine location) opacity = 1 - (revitMaterial.Transparency / 100d), //metalness = revitMaterial.Shininess / 128d, //Looks like these are not valid conversions //roughness = 1 - (revitMaterial.Smoothness / 100d), - diffuse = System.Drawing.Color - .FromArgb(revitMaterial.Color.Red, revitMaterial.Color.Green, revitMaterial.Color.Blue) + diffuse = System + .Drawing.Color.FromArgb(revitMaterial.Color.Red, revitMaterial.Color.Green, revitMaterial.Color.Blue) .ToArgb() }; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.DxfImport.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.DxfImport.cs index cb0b8d1428..cbef7d48e3 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.DxfImport.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.DxfImport.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using DB = Autodesk.Revit.DB; using ConverterRevitShared.Revit; using Objects.Converters.DxfConverter; using Objects.Geometry; @@ -11,8 +10,9 @@ using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.netDxf.Entities; -using Mesh = Objects.Geometry.Mesh; +using DB = Autodesk.Revit.DB; using DirectShape = Objects.BuiltElements.Revit.DirectShape; +using Mesh = Objects.Geometry.Mesh; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.Previews.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.Previews.cs index 6f545fa737..ae3a25341f 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.Previews.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/ConverterRevit.Previews.cs @@ -1,7 +1,7 @@ -using Speckle.Core.Models; -using Speckle.Core.Models.Extensions; using System.Collections.Generic; using System.Linq; +using Speckle.Core.Models; +using Speckle.Core.Models.Extensions; using Mesh = Objects.Geometry.Mesh; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalStick.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalStick.cs index 2da7027efe..528c81afa7 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalStick.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalStick.cs @@ -205,8 +205,24 @@ private void SetAnalyticalProps(Element element, Element1D element1d, XYZ offset #if REVIT2020 || REVIT2021 || REVIT2022 var analyticalModel = (AnalyticalModelStick)element.GetAnalyticalModel(); - analyticalModel.SetReleases(true, releaseConvert(element1d.end1Releases.code[0]), releaseConvert(element1d.end1Releases.code[1]), releaseConvert(element1d.end1Releases.code[2]), releaseConvert(element1d.end1Releases.code[3]), releaseConvert(element1d.end1Releases.code[4]), releaseConvert(element1d.end1Releases.code[5])); - analyticalModel.SetReleases(false, releaseConvert(element1d.end2Releases.code[0]), releaseConvert(element1d.end2Releases.code[1]), releaseConvert(element1d.end2Releases.code[2]), releaseConvert(element1d.end2Releases.code[3]), releaseConvert(element1d.end2Releases.code[4]), releaseConvert(element1d.end2Releases.code[5])); + analyticalModel.SetReleases( + true, + releaseConvert(element1d.end1Releases.code[0]), + releaseConvert(element1d.end1Releases.code[1]), + releaseConvert(element1d.end1Releases.code[2]), + releaseConvert(element1d.end1Releases.code[3]), + releaseConvert(element1d.end1Releases.code[4]), + releaseConvert(element1d.end1Releases.code[5]) + ); + analyticalModel.SetReleases( + false, + releaseConvert(element1d.end2Releases.code[0]), + releaseConvert(element1d.end2Releases.code[1]), + releaseConvert(element1d.end2Releases.code[2]), + releaseConvert(element1d.end2Releases.code[3]), + releaseConvert(element1d.end2Releases.code[4]), + releaseConvert(element1d.end2Releases.code[5]) + ); analyticalModel.SetOffset(AnalyticalElementSelector.StartOrBase, offset1); analyticalModel.SetOffset(AnalyticalElementSelector.EndOrTop, offset2); #else @@ -277,11 +293,15 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick) speckleElement1D.baseLine = CurveToSpeckle(curves[0], revitStick.Document) as Objects.Geometry.Line; } - var coordinateSystem = revitStick.GetLocalCoordinateSystem(); if (coordinateSystem != null) { - speckleElement1D.localAxis = new Geometry.Plane(PointToSpeckle(coordinateSystem.Origin, revitStick.Document), VectorToSpeckle(coordinateSystem.BasisZ, revitStick.Document), VectorToSpeckle(coordinateSystem.BasisX, revitStick.Document), VectorToSpeckle(coordinateSystem.BasisY, revitStick.Document)); + speckleElement1D.localAxis = new Geometry.Plane( + PointToSpeckle(coordinateSystem.Origin, revitStick.Document), + VectorToSpeckle(coordinateSystem.BasisZ, revitStick.Document), + VectorToSpeckle(coordinateSystem.BasisX, revitStick.Document), + VectorToSpeckle(coordinateSystem.BasisY, revitStick.Document) + ); } var startOffset = revitStick.GetOffset(AnalyticalElementSelector.StartOrBase); @@ -300,10 +320,12 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick) var structMat = (DB.Material)stickFamily.Document.GetElement(stickFamily.StructuralMaterialId); if (structMat == null) { - structMat = (DB.Material)stickFamily.Document.GetElement(stickFamily.Symbol.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()); + structMat = (DB.Material) + stickFamily.Document.GetElement( + stickFamily.Symbol.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId() + ); } - prop.profile = speckleSection; prop.material = GetStructuralMaterial(structMat); prop.name = revitStick.Document.GetElement(revitStick.GetElementId()).Name; @@ -338,7 +360,6 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick) speckleElement1D.displayValue = GetElementDisplayValue(revitStick.Document.GetElement(revitStick.GetElementId())); return speckleElement1D; } - #else private Element1D AnalyticalStickToSpeckle(AnalyticalMember revitStick) { diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalSurface.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalSurface.cs index 52a8c5f97a..b7a30a37a5 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalSurface.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertAnalyticalSurface.cs @@ -226,17 +226,12 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalModelSurface revitSurface Element2DOutlineBuilder outlineBuilder = new(openings, edgePoints); - speckleElement2D.openings = openings.Select(polyLine => new Polycurve(ModelUnits) - { - segments = new() { polyLine } - }) - .ToList(); - - speckleElement2D.topology = outlineBuilder - .GetOutline() - .Select(p => new Node(p)) + speckleElement2D.openings = openings + .Select(polyLine => new Polycurve(ModelUnits) { segments = new() { polyLine } }) .ToList(); + speckleElement2D.topology = outlineBuilder.GetOutline().Select(p => new Node(p)).ToList(); + speckleElement2D.displayValue = GetElementDisplayValue(revitSurface); var prop = new Property2D(); @@ -256,7 +251,9 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalModelSurface revitSurface else if (structuralElement is DB.Wall) { var wall = structuralElement as DB.Wall; - structMaterial = wall.Document.GetElement(wall.WallType.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()) as DB.Material; + structMaterial = + wall.Document.GetElement(wall.WallType.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()) + as DB.Material; thickness = ScaleToSpeckle(wall.WallType.Width); memberType = MemberType2D.Wall; } diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertArea.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertArea.cs index 8c43b38e20..da8a846fb9 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertArea.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertArea.cs @@ -117,11 +117,10 @@ private static Mesh PolycurveToMesh(Polycurve polycurve) private static bool PointExists(List points, Point newPoint) { const double TOLERANCE = 1e-6; // Adjust this tolerance as needed - return points.Any( - p => - Math.Abs(p.x - newPoint.x) < TOLERANCE - && Math.Abs(p.y - newPoint.y) < TOLERANCE - && Math.Abs(p.z - newPoint.z) < TOLERANCE + return points.Any(p => + Math.Abs(p.x - newPoint.x) < TOLERANCE + && Math.Abs(p.y - newPoint.y) < TOLERANCE + && Math.Abs(p.z - newPoint.z) < TOLERANCE ); } } diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBeam.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBeam.cs index 03172bba44..53389ee638 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBeam.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBeam.cs @@ -1,10 +1,10 @@ +using System.Collections.Generic; +using System.Text.RegularExpressions; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Structure; using Objects.BuiltElements; using Objects.BuiltElements.Revit; using Speckle.Core.Models; -using System.Collections.Generic; -using System.Text.RegularExpressions; using DB = Autodesk.Revit.DB; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBlock.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBlock.cs index 39dc76d525..c741d10804 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBlock.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBlock.cs @@ -6,11 +6,11 @@ using System.Linq; using ConverterRevitShared.Revit; using Objects.BuiltElements.Revit; -using Speckle.Core.Models; -using Speckle.Core.Models.Extensions; using Objects.Other; using Speckle.Core.Kits; using Speckle.Core.Logging; +using Speckle.Core.Models; +using Speckle.Core.Models.Extensions; using DB = Autodesk.Revit.DB; namespace Objects.Converter.Revit; @@ -356,18 +356,17 @@ private static string GetFamilyNameFor(BlockDefinition definition) /// private static IEnumerable GetBlockDefinitionGeometry(BlockDefinition definition) { - return definition.geometry - .SelectMany( - b => - b switch - { - // This cast to Base is safe. Compiler just can't safely know ITransformable is only applied to Base objects. - Instance i => i.GetTransformedGeometry(), // Flattening inner instances here. - ITransformable bt => new List { bt }, - _ - => (b.GetDetachedProp("displayValue") as IList)?.OfType() - ?? Enumerable.Empty() - } + return definition + .geometry.SelectMany(b => + b switch + { + // This cast to Base is safe. Compiler just can't safely know ITransformable is only applied to Base objects. + Instance i => i.GetTransformedGeometry(), // Flattening inner instances here. + ITransformable bt => new List { bt }, + _ + => (b.GetDetachedProp("displayValue") as IList)?.OfType() + ?? Enumerable.Empty() + } ) .Where(bt => bt != null); } diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBrace.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBrace.cs index 8de864d03a..8c83cc4bb6 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBrace.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBrace.cs @@ -1,10 +1,10 @@ using System; +using System.Collections.Generic; using Autodesk.Revit.DB.Structure; using Objects.BuiltElements; using Objects.BuiltElements.Revit; -using Speckle.Core.Models; -using System.Collections.Generic; using Objects.Geometry; +using Speckle.Core.Models; using DB = Autodesk.Revit.DB; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBuildingPad.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBuildingPad.cs index d512ee597a..b8dbd69494 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBuildingPad.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertBuildingPad.cs @@ -1,7 +1,7 @@ -using Autodesk.Revit.DB; -using Objects.BuiltElements.Revit; using System.Collections.Generic; using System.Linq; +using Autodesk.Revit.DB; +using Objects.BuiltElements.Revit; using DB = Autodesk.Revit.DB.Architecture; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCableTray.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCableTray.cs index 2296362a9e..d98606248a 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCableTray.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCableTray.cs @@ -1,9 +1,9 @@ +using System.Collections.Generic; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Electrical; using ConverterRevitShared.Extensions; using Objects.BuiltElements.Revit; using Speckle.Core.Models; -using System.Collections.Generic; using DB = Autodesk.Revit.DB; using Line = Objects.Geometry.Line; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCeiling.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCeiling.cs index 3b3afba624..9438729c90 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCeiling.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCeiling.cs @@ -1,9 +1,8 @@ -using Autodesk.Revit.DB; -using Objects.BuiltElements.Revit; using System.Collections.Generic; using System.Linq; +using Autodesk.Revit.DB; +using Objects.BuiltElements.Revit; using DB = Autodesk.Revit.DB; - #if !REVIT2020 && !REVIT2021 using Ceiling = Objects.BuiltElements.Ceiling; using Speckle.Core.Logging; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertColumn.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertColumn.cs index 94efd55a14..9e68cc2704 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertColumn.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertColumn.cs @@ -1,9 +1,9 @@ +using System; +using System.Collections.Generic; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Structure; using Objects.BuiltElements.Revit; using Speckle.Core.Models; -using System; -using System.Collections.Generic; using Column = Objects.BuiltElements.Column; using DB = Autodesk.Revit.DB; using Line = Objects.Geometry.Line; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCombinableElement.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCombinableElement.cs index bd4ed5509f..794397fcd3 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCombinableElement.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCombinableElement.cs @@ -1,7 +1,7 @@ +using System.Collections.Generic; using Autodesk.Revit.DB; using Objects.BuiltElements.Revit; using Speckle.Core.Models; -using System.Collections.Generic; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertConduit.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertConduit.cs index f557963789..eb83ab2531 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertConduit.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertConduit.cs @@ -1,9 +1,9 @@ +using System.Collections.Generic; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Electrical; using ConverterRevitShared.Extensions; using Objects.BuiltElements.Revit; using Speckle.Core.Models; -using System.Collections.Generic; using DB = Autodesk.Revit.DB; using Line = Objects.Geometry.Line; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCurves.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCurves.cs index d24317b8e6..a23e3a34f0 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCurves.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertCurves.cs @@ -178,8 +178,8 @@ public ApplicationObject RoomBoundaryLineToNative(RoomBoundaryLine speckleCurve) try { View drawingView = GetCurvePlanView(speckleCurve, out bool isTempView); - var revitCurve = Doc.Create - .NewRoomBoundaryLines(NewSketchPlaneFromCurve(baseCurve.get_Item(0), Doc), baseCurve, drawingView) + var revitCurve = Doc + .Create.NewRoomBoundaryLines(NewSketchPlaneFromCurve(baseCurve.get_Item(0), Doc), baseCurve, drawingView) .get_Item(0); // Delete the temp view after drawing @@ -235,8 +235,8 @@ public ApplicationObject SpaceSeparationLineToNative(SpaceSeparationLine speckle try { - var res = Doc.Create - .NewSpaceBoundaryLines(NewSketchPlaneFromCurve(baseCurve.get_Item(0), Doc), baseCurve, Doc.ActiveView) + var res = Doc + .Create.NewSpaceBoundaryLines(NewSketchPlaneFromCurve(baseCurve.get_Item(0), Doc), baseCurve, Doc.ActiveView) .get_Item(0); appObj.Update(status: ApplicationObject.State.Created, createdId: res.UniqueId, convertedItem: res); } diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs index d40cfa6925..359ed2408c 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs @@ -126,8 +126,8 @@ public ApplicationObject DirectShapeToNative(DirectShape speckleDs, ToNativeMesh var converted = new List(); - speckleDs.baseGeometries - .ToList() + speckleDs + .baseGeometries.ToList() .ForEach(b => { switch (b) @@ -148,8 +148,8 @@ public ApplicationObject DirectShapeToNative(DirectShape speckleDs, ToNativeMesh ); } - var mesh = brep.displayValue.SelectMany( - m => MeshToNative(m, parentMaterial: brep["renderMaterial"] as RenderMaterial) + var mesh = brep.displayValue.SelectMany(m => + MeshToNative(m, parentMaterial: brep["renderMaterial"] as RenderMaterial) ); converted.AddRange(mesh); } diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectTeklaMeshElements.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectTeklaMeshElements.cs index cf3cbafbc8..a4b6716d75 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectTeklaMeshElements.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectTeklaMeshElements.cs @@ -1,5 +1,5 @@ -using Autodesk.Revit.DB; using System.Collections.Generic; +using Autodesk.Revit.DB; using Mesh = Objects.Geometry.Mesh; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFabricationPart.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFabricationPart.cs index 99c27e1f9c..07f48c4ee2 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFabricationPart.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFabricationPart.cs @@ -1,6 +1,6 @@ +using System.Collections.Generic; using Autodesk.Revit.DB; using Objects.BuiltElements.Revit; -using System.Collections.Generic; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFaceWall.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFaceWall.cs index ed33f35c26..7816e95674 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFaceWall.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFaceWall.cs @@ -1,15 +1,15 @@ -using Autodesk.Revit.DB; -using ConverterRevitShared.Revit; -using Objects.BuiltElements.Revit; -using Speckle.Core.Models; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using Autodesk.Revit.DB; +using ConverterRevitShared.Revit; +using Objects.BuiltElements.Revit; +using RevitSharedResources.Extensions.SpeckleExtensions; +using Speckle.Core.Logging; +using Speckle.Core.Models; using Speckle.Core.Models.Extensions; using DB = Autodesk.Revit.DB; -using Speckle.Core.Logging; -using RevitSharedResources.Extensions.SpeckleExtensions; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFitting.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFitting.cs index 8a7111fa2a..3851a7adb0 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFitting.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFitting.cs @@ -1,13 +1,13 @@ +using System; using System.Collections.Generic; -using DB = Autodesk.Revit.DB; -using Objects.BuiltElements.Revit; +using System.Linq; using Autodesk.Revit.DB; +using ConverterRevitShared.Extensions; +using Objects.BuiltElements.Revit; using Speckle.Core.Kits; -using Speckle.Core.Models; using Speckle.Core.Logging; -using System; -using ConverterRevitShared.Extensions; -using System.Linq; +using Speckle.Core.Models; +using DB = Autodesk.Revit.DB; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFreeformElement.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFreeformElement.cs index d23d76e7ce..d0657c6845 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFreeformElement.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertFreeformElement.cs @@ -149,10 +149,9 @@ public ApplicationObject FreeformElementToNativeFamily(Geometry.Mesh mesh) private IEnumerable GetSolidMeshes(IEnumerable meshes) { - var allMeshes = meshes.SelectMany( - m => - MeshToNative(m, DB.TessellatedShapeBuilderTarget.Solid, DB.TessellatedShapeBuilderFallback.Abort) - ?? new List() + var allMeshes = meshes.SelectMany(m => + MeshToNative(m, DB.TessellatedShapeBuilderTarget.Solid, DB.TessellatedShapeBuilderFallback.Abort) + ?? new List() ); var notNull = allMeshes.Where(m => m != null); var solids = notNull.Select(m => m as DB.Solid); diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertGeometry.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertGeometry.cs index 2448111106..f3223c6e3e 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertGeometry.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertGeometry.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; using System.DoubleNumerics; +using System.Linq; using Autodesk.Revit.DB; using Autodesk.Revit.DB.PointClouds; using Objects.Geometry; @@ -938,13 +938,12 @@ public XYZ[] ControlPointsToNative(List> controlPoints) var points = new DB.XYZ[count]; int p = 0; - controlPoints.ForEach( - row => - row.ForEach(pt => - { - var point = new Point(pt.x, pt.y, pt.z, pt.units); - points[p++] = PointToNative(point); - }) + controlPoints.ForEach(row => + row.ForEach(pt => + { + var point = new Point(pt.x, pt.y, pt.z, pt.units); + points[p++] = PointToNative(point); + }) ); return points; @@ -1162,7 +1161,9 @@ public Brep BrepToSpeckle(Solid solid, Document d, string units = null) { #if REVIT2020 - throw new Speckle.Core.Logging.SpeckleException("Converting BREPs to Speckle is currently only supported in Revit 2021 and above."); + throw new Speckle.Core.Logging.SpeckleException( + "Converting BREPs to Speckle is currently only supported in Revit 2021 and above." + ); #else // TODO: Incomplete implementation!! var u = units ?? ModelUnits; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMEPFamilyInstance.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMEPFamilyInstance.cs index 8a0a4dabf5..9ff3ada06d 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMEPFamilyInstance.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMEPFamilyInstance.cs @@ -1,14 +1,14 @@ -using DB = Autodesk.Revit.DB; -using Objects.BuiltElements.Revit; -using Autodesk.Revit.DB; -using System.Linq; using System; using System.Collections.Generic; -using Speckle.Core.Models; -using Speckle.Core.Kits; +using System.Linq; +using Autodesk.Revit.DB; +using Objects.BuiltElements.Revit; +using RevitSharedResources.Extensions.SpeckleExtensions; using RevitSharedResources.Models; +using Speckle.Core.Kits; using Speckle.Core.Logging; -using RevitSharedResources.Extensions.SpeckleExtensions; +using Speckle.Core.Models; +using DB = Autodesk.Revit.DB; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMaterialQuantities.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMaterialQuantities.cs index cbfe4df0df..d3c55ec1ab 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMaterialQuantities.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertMaterialQuantities.cs @@ -1,8 +1,8 @@ #nullable enable -using Autodesk.Revit.DB; -using Objects.Other; using System.Collections.Generic; using System.Linq; +using Autodesk.Revit.DB; +using Objects.Other; using DB = Autodesk.Revit.DB; namespace Objects.Converter.Revit; @@ -114,15 +114,15 @@ string units if (materialId != null) { solids = solids - .Where( - solid => solid.Volume > 0 && !solid.Faces.IsEmpty && solid.Faces.get_Item(0).MaterialElementId == materialId + .Where(solid => + solid.Volume > 0 && !solid.Faces.IsEmpty && solid.Faces.get_Item(0).MaterialElementId == materialId ) .ToList(); } double volume = solids.Sum(solid => solid.Volume); - IEnumerable areaOfLargestFaceInEachSolid = solids.Select( - solid => solid.Faces.Cast().Select(face => face.Area).Max() + IEnumerable areaOfLargestFaceInEachSolid = solids.Select(solid => + solid.Faces.Cast().Select(face => face.Area).Max() ); double area = areaOfLargestFaceInEachSolid.Sum(); return (area, volume); diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertNetwork.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertNetwork.cs index ee10fd51f1..113e3c3f49 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertNetwork.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertNetwork.cs @@ -87,13 +87,12 @@ public ApplicationObject NetworkToNative(Network speckleNetwork) } } - var connections = networkElement.links - .Cast() + var connections = networkElement + .links.Cast() .ToDictionary( l => l, l => - l.elements - .Cast() + l.elements.Cast() .FirstOrDefault(e => e.applicationId != networkElement.applicationId && e.isCurveBased) ); @@ -410,15 +409,13 @@ private void GetNetworkConnections(Element element, ref List net private bool IsConnectorBasedCreation(DB.FamilyInstance familyInstance) { var connectors = GetConnectors(familyInstance).Cast().ToArray(); - return connectors.All( - c => - connectors.All( - c1 => - (c1.Domain == Domain.DomainPiping && c1.PipeSystemType == c.PipeSystemType) - || (c1.Domain == Domain.DomainHvac && c1.DuctSystemType == c.DuctSystemType) - || (c1.Domain == Domain.DomainElectrical && c1.ElectricalSystemType == c.ElectricalSystemType) - || (c1.Domain == Domain.DomainCableTrayConduit) - ) + return connectors.All(c => + connectors.All(c1 => + (c1.Domain == Domain.DomainPiping && c1.PipeSystemType == c.PipeSystemType) + || (c1.Domain == Domain.DomainHvac && c1.DuctSystemType == c.DuctSystemType) + || (c1.Domain == Domain.DomainElectrical && c1.ElectricalSystemType == c.ElectricalSystemType) + || (c1.Domain == Domain.DomainCableTrayConduit) + ) ); } @@ -509,12 +506,12 @@ private Connector GetConnectorByPoint(Element element, XYZ point) switch (element) { case MEPCurve o: - return o.ConnectorManager.Connectors - .Cast() + return o + .ConnectorManager.Connectors.Cast() .FirstOrDefault(c => c.Origin.IsAlmostEqualTo(point, 0.00001)); case DB.FamilyInstance o: - return o.MEPModel?.ConnectorManager.Connectors - .Cast() + return o + .MEPModel?.ConnectorManager.Connectors.Cast() .FirstOrDefault(c => c.Origin.IsAlmostEqualTo(point, 0.00001)); default: return null; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProfileWall.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProfileWall.cs index fbb8ff4021..3429d73425 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProfileWall.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProfileWall.cs @@ -1,7 +1,7 @@ +using System.Collections.Generic; using Autodesk.Revit.DB; using Objects.BuiltElements.Revit; using Speckle.Core.Models; -using System.Collections.Generic; using DB = Autodesk.Revit.DB; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProjectInfo.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProjectInfo.cs index 8be332814f..86fa8409f8 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProjectInfo.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertProjectInfo.cs @@ -1,6 +1,6 @@ +using System.Collections.Generic; using Objects.BuiltElements.Revit; using Speckle.Core.Models; -using System.Collections.Generic; using DB = Autodesk.Revit.DB; using ProjectInfo = Objects.BuiltElements.Revit.ProjectInfo; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRevitElement.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRevitElement.cs index 24f2fba64a..a12f903309 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRevitElement.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRevitElement.cs @@ -1,10 +1,8 @@ using System.Collections.Generic; - +using System.Linq; using Autodesk.Revit.DB; - using Objects.BuiltElements.Revit; using RevitElementType = Objects.BuiltElements.Revit.RevitElementType; -using System.Linq; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRoom.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRoom.cs index 79c2186c2a..c0001c57c3 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRoom.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertRoom.cs @@ -1,7 +1,7 @@ +using System.Linq; using Autodesk.Revit.DB; using Objects.BuiltElements; using Speckle.Core.Models; -using System.Linq; using DB = Autodesk.Revit.DB.Architecture; using Point = Objects.Geometry.Point; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertStructuralModel.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertStructuralModel.cs index a791e725af..934a6f79c3 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertStructuralModel.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertStructuralModel.cs @@ -1,10 +1,10 @@ -using Objects.Structural.Geometry; -using Speckle.Core.Models; +using System; using Objects.Structural.Analysis; using Objects.Structural.CSI.Geometry; +using Objects.Structural.Geometry; using RevitSharedResources.Extensions.SpeckleExtensions; using Speckle.Core.Logging; -using System; +using Speckle.Core.Models; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopRail.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopRail.cs index f4f3295f2b..0bb7f81581 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopRail.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopRail.cs @@ -1,6 +1,6 @@ +using System.Collections.Generic; using Autodesk.Revit.DB.Architecture; using Objects.BuiltElements.Revit; -using System.Collections.Generic; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopography.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopography.cs index eeb252e5bc..b5484ab36a 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopography.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertTopography.cs @@ -1,10 +1,10 @@ +using System.Collections.Generic; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Architecture; using Objects.BuiltElements; using Objects.BuiltElements.Revit; using Objects.Utils; using Speckle.Core.Models; -using System.Collections.Generic; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertToposolid.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertToposolid.cs index c10e7a72d6..5e78736032 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertToposolid.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertToposolid.cs @@ -34,43 +34,45 @@ public ApplicationObject ToposolidToNative(RevitToposolid fromSpeckle) { curveLoops.Add(CurveArrayToCurveLoop(CurveToNative(curveArray.segments))); } - + var points = fromSpeckle.points.Select(x => PointToNative(x)).ToList(); - + // NOTE: if the level is null this will not create // there maybe something more elegant we can do to automatically drop to direct shape DB.Level level = ConvertLevelToRevit(fromSpeckle.level, out ApplicationObject.State state); - + var topoSolidType = GetElementType(fromSpeckle, appObj, out bool _); Toposolid revitToposolid = null; if (points.Count > 0) { - revitToposolid = Toposolid.Create(Doc, curveLoops, points, topoSolidType.Id, level?.Id); + revitToposolid = Toposolid.Create(Doc, curveLoops, points, topoSolidType.Id, level?.Id); } else { - revitToposolid = Toposolid.Create(Doc, curveLoops, topoSolidType.Id, level?.Id); + revitToposolid = Toposolid.Create(Doc, curveLoops, topoSolidType.Id, level?.Id); } SetInstanceParameters(revitToposolid, fromSpeckle); - appObj.Update(status: ApplicationObject.State.Created, createdId: revitToposolid.UniqueId, convertedItem: revitToposolid); + appObj.Update( + status: ApplicationObject.State.Created, + createdId: revitToposolid.UniqueId, + convertedItem: revitToposolid + ); return appObj; } private RevitToposolid ToposolidToSpeckle(Toposolid topoSolid, out List notes) - { + { var toSpeckle = new RevitToposolid(); notes = new List(); - + // we will store the list of interior points in order to recreate the Toposolid var slabShapeEditor = topoSolid.GetSlabShapeEditor(); var vertices = slabShapeEditor.SlabShapeVertices; - toSpeckle.points = vertices.Cast() - .Select(x => PointToSpeckle(x.Position, Doc)) - .ToList(); + toSpeckle.points = vertices.Cast().Select(x => PointToSpeckle(x.Position, Doc)).ToList(); var sketch = Doc.GetElement(topoSolid.SketchId) as Sketch; toSpeckle.profiles = GetSketchProfiles(sketch); @@ -81,18 +83,9 @@ private RevitToposolid ToposolidToSpeckle(Toposolid topoSolid, out List toSpeckle.family = type?.FamilyName; toSpeckle.type = type?.Name; - GetAllRevitParamsAndIds( - toSpeckle, - topoSolid, - new List - { - "LEVEL_PARAM", - } - ); + GetAllRevitParamsAndIds(toSpeckle, topoSolid, new List { "LEVEL_PARAM", }); - toSpeckle.displayValue = GetElementDisplayValue( - topoSolid, - new Options() { DetailLevel = ViewDetailLevel.Fine }); + toSpeckle.displayValue = GetElementDisplayValue(topoSolid, new Options() { DetailLevel = ViewDetailLevel.Fine }); GetHostedElements(toSpeckle, topoSolid, out List hostedNotes); if (hostedNotes.Any()) diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertView.Schedule.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertView.Schedule.cs index bf6de53479..73648c78de 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertView.Schedule.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertView.Schedule.cs @@ -125,8 +125,8 @@ Dictionary speckleIndexToRevitParameterDataMap return; } - var speckleObjectRowIndex = speckleTable.rowMetadata.FindIndex( - b => b["RevitApplicationIds"] is IList list && list.Contains(elementIds.First()) + var speckleObjectRowIndex = speckleTable.rowMetadata.FindIndex(b => + b["RevitApplicationIds"] is IList list && list.Contains(elementIds.First()) ); foreach (var kvp in speckleIndexToRevitParameterDataMap) diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/DirectShape.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/DirectShape.cs index 98b1e56246..20a24a9517 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/DirectShape.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/DirectShape.cs @@ -1,10 +1,10 @@ -using Autodesk.Revit.DB; -using Objects.BuiltElements.Revit; -using Speckle.Core.Models; -using System; +using System; using System.Collections.Generic; using System.Linq; +using Autodesk.Revit.DB; +using Objects.BuiltElements.Revit; using Objects.Geometry; +using Speckle.Core.Models; using DB = Autodesk.Revit.DB; using DirectShape = Objects.BuiltElements.Revit.DirectShape; using Mesh = Objects.Geometry.Mesh; @@ -27,8 +27,8 @@ public ApplicationPlaceholderObject DirectShapeToNative(DirectShape speckleDs) var converted = new List(); - speckleDs.baseGeometries - .ToList() + speckleDs + .baseGeometries.ToList() .ForEach(b => { switch (b) diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/Units.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/Units.cs index 1572b80614..7ad9d6bb29 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/Units.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/Units.cs @@ -114,7 +114,6 @@ private string UnitsToSpeckle(DisplayUnitType type) default: throw new Speckle.Core.Logging.SpeckleException($"The Unit System \"{type}\" is unsupported."); } - } public static DisplayUnitType UnitsToNative(string units) @@ -135,6 +134,7 @@ public static DisplayUnitType UnitsToNative(string units) throw new Speckle.Core.Logging.SpeckleException($"The Unit System \"{units}\" is unsupported."); } } + private static string UnitsToNativeString(DisplayUnitType unitType) { return unitType.ToString(); diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/Revit/ConnectionPair.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/Revit/ConnectionPair.cs index 2375212d41..8fdab4a3fa 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/Revit/ConnectionPair.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/Revit/ConnectionPair.cs @@ -1,6 +1,6 @@ -using Autodesk.Revit.DB; using System; using System.Collections.Generic; +using Autodesk.Revit.DB; namespace ConverterRevitShared.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitCommitObjectBuilder.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitCommitObjectBuilder.cs index ab0aeca082..6724dc3d1b 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitCommitObjectBuilder.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitCommitObjectBuilder.cs @@ -2,11 +2,11 @@ using System; using System.Collections.Generic; using System.Linq; -using Speckle.Core.Models; -using Autodesk.Revit.DB; using System.Text.RegularExpressions; +using Autodesk.Revit.DB; using Objects.Converter.Revit; using RevitSharedResources.Interfaces; +using Speckle.Core.Models; namespace ConverterRevitShared; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitElementTypeUtils.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitElementTypeUtils.cs index 43678de1c8..7511c681ae 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitElementTypeUtils.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitElementTypeUtils.cs @@ -3,12 +3,12 @@ using System.Collections.Generic; using System.Linq; using Autodesk.Revit.DB; +using RevitSharedResources.Extensions.SpeckleExtensions; using RevitSharedResources.Interfaces; +using Speckle.Core.Logging; using Speckle.Core.Models; -using OSG = Objects.Structural.Geometry; using DB = Autodesk.Revit.DB; -using Speckle.Core.Logging; -using RevitSharedResources.Extensions.SpeckleExtensions; +using OSG = Objects.Structural.Geometry; namespace Objects.Converter.Revit; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitVersionHelper.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitVersionHelper.cs index 35e2f9cbfd..8e9bfb9848 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitVersionHelper.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/RevitVersionHelper.cs @@ -1,5 +1,5 @@ -using Autodesk.Revit.DB; using System; +using Autodesk.Revit.DB; namespace Objects.Converter.Revit; @@ -38,7 +38,9 @@ public static double ConvertToInternalUnits(object value, string applicationUnit // therefore we need to check if the applicationUnit is in the wrong format ForgeTypeId sourceUnit = null; if ( - !string.IsNullOrEmpty(applicationUnit) && applicationUnit.Length >= 3 && applicationUnit.Substring(0, 3) == "DUT" + !string.IsNullOrEmpty(applicationUnit) + && applicationUnit.Length >= 3 + && applicationUnit.Substring(0, 3) == "DUT" ) { sourceUnit = DUTToForgeTypeId(applicationUnit); diff --git a/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/BrepTests.cs b/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/BrepTests.cs index 30a8993daa..9220cda202 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/BrepTests.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/BrepTests.cs @@ -1,11 +1,11 @@ -using Autodesk.Revit.DB; -using Objects.Converter.Revit; -using Objects.Geometry; -using Speckle.Core.Api; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Autodesk.Revit.DB; +using Objects.Converter.Revit; +using Objects.Geometry; +using Speckle.Core.Api; using Xunit; using Xunit.Abstractions; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleConversionTest.cs b/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleConversionTest.cs index a085dd7ee8..2afbd04d07 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleConversionTest.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleConversionTest.cs @@ -1,3 +1,7 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Autodesk.Revit.DB; using ConnectorRevit.Storage; using DesktopUI2.Models; @@ -6,10 +10,6 @@ using Speckle.ConnectorRevit.UI; using Speckle.Core.Logging; using Speckle.Core.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Xunit; using xUnitRevitUtils; using DB = Autodesk.Revit.DB; diff --git a/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleUtils.cs b/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleUtils.cs index bf56735030..44447165e6 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleUtils.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitTests/ConverterRevitTestsShared/SpeckleUtils.cs @@ -112,8 +112,8 @@ internal static void DeleteElement(object obj) internal static int GetSpeckleObjectTestNumber(DB.Element element) { - var param = element.Parameters - .Cast() + var param = element + .Parameters.Cast() .Where(el => el.Definition.Name == "SpeckleObjectTestNumber") .FirstOrDefault(); diff --git a/Objects/Converters/ConverterRevit/ConverterRevitTests/TestGenerator/Generator.cs b/Objects/Converters/ConverterRevit/ConverterRevitTests/TestGenerator/Generator.cs index d3d9c37029..9d0986aa29 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitTests/TestGenerator/Generator.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitTests/TestGenerator/Generator.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using Microsoft.CodeAnalysis; -using System.Linq; namespace TestGenerator; diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGh.Structural.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGh.Structural.cs index be6843f146..51252e9cca 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGh.Structural.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGh.Structural.cs @@ -1,31 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; using Grasshopper.Kernel.Types; using Objects.Geometry; using Objects.Primitive; -using Rhino.Geometry; using Rhino.Display; using Rhino.DocObjects; +using Rhino.Geometry; using Rhino.Geometry.Collections; -using Speckle.Core.Models; using Speckle.Core.Kits; -using System; -using System.Collections.Generic; -using System.Linq; -using Node = Objects.Structural.Geometry.Node; +using Speckle.Core.Models; +using Beam = Objects.BuiltElements.Beam; +using Ceiling = Objects.BuiltElements.Ceiling; +using Column = Objects.BuiltElements.Column; using Element1D = Objects.Structural.Geometry.Element1D; using Element2D = Objects.Structural.Geometry.Element2D; using Element3D = Objects.Structural.Geometry.Element3D; -using Column = Objects.BuiltElements.Column; -using Beam = Objects.BuiltElements.Beam; -using Wall = Objects.BuiltElements.Wall; using Floor = Objects.BuiltElements.Floor; -using Ceiling = Objects.BuiltElements.Ceiling; -using Roof = Objects.BuiltElements.Roof; +using Mesh = Objects.Geometry.Mesh; +using Node = Objects.Structural.Geometry.Node; using Opening = Objects.BuiltElements.Opening; using Point = Objects.Geometry.Point; -using Mesh = Objects.Geometry.Mesh; -using View3D = Objects.BuiltElements.View3D; using RH = Rhino.Geometry; +using Roof = Objects.BuiltElements.Roof; using RV = Objects.BuiltElements.Revit; +using View3D = Objects.BuiltElements.View3D; +using Wall = Objects.BuiltElements.Wall; namespace Objects.Converter.RhinoGh { diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/BrepEncoder.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/BrepEncoder.cs index adb2606fdc..63cd92adbc 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/BrepEncoder.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/BrepEncoder.cs @@ -134,7 +134,7 @@ double modelRelativeTolerance kinkyEdges += edges.Count - edgeCount; #if RHINO7_OR_GREATER - microEdges += edges.RemoveNakedMicroEdges(modelRelativeTolerance, true); + microEdges += edges.RemoveNakedMicroEdges(modelRelativeTolerance, true); #endif mergedEdges += edges.MergeAllEdges(modelAngleToleranceRadians) - edgeCount; } diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.GIS.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.GIS.cs index cc766f2784..9116c4b986 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.GIS.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.GIS.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; +using System.Linq; using Objects.GIS; +using Rhino.Geometry; using Speckle.Core.Models; using RH = Rhino.DocObjects; -using System.Linq; -using Rhino.Geometry; namespace Objects.Converter.RhinoGh; diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs index 1f5c20d0fc..4e5af67d49 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Geometry.cs @@ -1,6 +1,3 @@ -#if GRASSHOPPER -using Grasshopper.Kernel.Types; -#endif using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -17,6 +14,9 @@ using Speckle.Core.Models.Extensions; using Point = Objects.Geometry.Point; using RH = Rhino.Geometry; +#if GRASSHOPPER +using Grasshopper.Kernel.Types; +#endif namespace Objects.Converter.RhinoGh; @@ -686,33 +686,48 @@ public Mesh MeshToSpeckle(RH.Mesh mesh, string units = null) #if RHINO7_OR_GREATER public Mesh MeshToSpeckle(RH.SubD mesh, string units = null) - { - var u = units ?? ModelUnits; + { + var u = units ?? ModelUnits; - var vertices = new List(); - var subDVertices = new List(); - for(int i = 0 ; i < mesh.Vertices.Count; i++) - { - vertices.Add(mesh.Vertices.Find(i).ControlNetPoint); - subDVertices.Add(mesh.Vertices.Find(i)); - } - var verts = PointsToFlatList(vertices); + var vertices = new List(); + var subDVertices = new List(); + for (int i = 0; i < mesh.Vertices.Count; i++) + { + vertices.Add(mesh.Vertices.Find(i).ControlNetPoint); + subDVertices.Add(mesh.Vertices.Find(i)); + } + var verts = PointsToFlatList(vertices); - var Faces = mesh.Faces.SelectMany(face => + var Faces = mesh + .Faces.SelectMany(face => { if (face.VertexCount == 4) { - return new[] { 4, subDVertices.IndexOf(face.VertexAt(0)), subDVertices.IndexOf(face.VertexAt(1)), subDVertices.IndexOf(face.VertexAt(2)), subDVertices.IndexOf(face.VertexAt(3)) }; + return new[] + { + 4, + subDVertices.IndexOf(face.VertexAt(0)), + subDVertices.IndexOf(face.VertexAt(1)), + subDVertices.IndexOf(face.VertexAt(2)), + subDVertices.IndexOf(face.VertexAt(3)) + }; } - return new[] { 3, subDVertices.IndexOf(face.VertexAt(0)), subDVertices.IndexOf(face.VertexAt(1)), subDVertices.IndexOf(face.VertexAt(2)) }; - }).ToList(); + return new[] + { + 3, + subDVertices.IndexOf(face.VertexAt(0)), + subDVertices.IndexOf(face.VertexAt(1)), + subDVertices.IndexOf(face.VertexAt(2)) + }; + }) + .ToList(); - var speckleMesh = new Mesh(verts, Faces, null, null, u); - speckleMesh.bbox = BoxToSpeckle(new RH.Box(mesh.GetBoundingBox(true)), u); + var speckleMesh = new Mesh(verts, Faces, null, null, u); + speckleMesh.bbox = BoxToSpeckle(new RH.Box(mesh.GetBoundingBox(true)), u); - return speckleMesh; - } + return speckleMesh; + } #endif public RH.Mesh MeshToNative(Mesh mesh) @@ -772,9 +787,7 @@ public RH.Mesh MeshToNative(Mesh mesh) #if RHINO7_OR_GREATER // get receive mesh setting - var meshSetting = Settings.ContainsKey("receive-mesh") - ? Settings["receive-mesh"] - : string.Empty; + var meshSetting = Settings.ContainsKey("receive-mesh") ? Settings["receive-mesh"] : string.Empty; if (meshSetting == "Merge Coplanar Faces") { @@ -892,51 +905,42 @@ public Brep BrepToSpeckle(RH.Brep brep, string units = null, RH.Mesh previewMesh spcklBrep.Orientation = (BrepOrientation)brep.SolidOrientation; // Faces - spcklBrep.Faces = brep.Faces - .Select( - f => - new BrepFace( - spcklBrep, - f.SurfaceIndex, - f.Loops.Select(l => l.LoopIndex).ToList(), - f.OuterLoop.LoopIndex, - f.OrientationIsReversed - ) - ) + spcklBrep.Faces = brep + .Faces.Select(f => new BrepFace( + spcklBrep, + f.SurfaceIndex, + f.Loops.Select(l => l.LoopIndex).ToList(), + f.OuterLoop.LoopIndex, + f.OrientationIsReversed + )) .ToList(); // Edges - spcklBrep.Edges = brep.Edges - .Select( - edge => - new BrepEdge( - spcklBrep, - edge.EdgeCurveIndex, - edge.TrimIndices(), - edge.StartVertex?.VertexIndex ?? -1, - edge.EndVertex?.VertexIndex ?? -1, - edge.ProxyCurveIsReversed, - IntervalToSpeckle(edge.Domain) - ) - ) + spcklBrep.Edges = brep + .Edges.Select(edge => new BrepEdge( + spcklBrep, + edge.EdgeCurveIndex, + edge.TrimIndices(), + edge.StartVertex?.VertexIndex ?? -1, + edge.EndVertex?.VertexIndex ?? -1, + edge.ProxyCurveIsReversed, + IntervalToSpeckle(edge.Domain) + )) .ToList(); // Loops - spcklBrep.Loops = brep.Loops - .Select( - loop => - new BrepLoop( - spcklBrep, - loop.Face.FaceIndex, - loop.Trims.Select(t => t.TrimIndex).ToList(), - (BrepLoopType)loop.LoopType - ) - ) + spcklBrep.Loops = brep + .Loops.Select(loop => new BrepLoop( + spcklBrep, + loop.Face.FaceIndex, + loop.Trims.Select(t => t.TrimIndex).ToList(), + (BrepLoopType)loop.LoopType + )) .ToList(); // Trims - spcklBrep.Trims = brep.Trims - .Select(trim => + spcklBrep.Trims = brep + .Trims.Select(trim => { var t = new BrepTrim( spcklBrep, @@ -1039,8 +1043,7 @@ public RH.Brep BrepToNative(Brep brep, out List notes) { var f = newBrep.Faces[loop.FaceIndex]; var l = newBrep.Loops.Add((RH.BrepLoopType)loop.Type, f); - loop.Trims - .ToList() + loop.Trims.ToList() .ForEach(trim => { RH.BrepTrim rhTrim; @@ -1217,19 +1220,15 @@ public RH.NurbsSurface SurfaceToNative(Surface surface) // Create rhino surface var points = surface .GetControlPoints() - .Select( - l => - l.Select( - p => - new ControlPoint( - ScaleToNative(p.x, p.units), - ScaleToNative(p.y, p.units), - ScaleToNative(p.z, p.units), - p.weight, - p.units - ) - ) - .ToList() + .Select(l => + l.Select(p => new ControlPoint( + ScaleToNative(p.x, p.units), + ScaleToNative(p.y, p.units), + ScaleToNative(p.z, p.units), + p.weight, + p.units + )) + .ToList() ) .ToList(); @@ -1326,13 +1325,13 @@ private List GetCorrectKnots(List knots, int controlPointCount, #if GRASSHOPPER // Interval2d public Interval2d Interval2dToSpeckle(UVInterval interval) - { - return new Interval2d(IntervalToSpeckle(interval.U), IntervalToSpeckle(interval.V)); - } + { + return new Interval2d(IntervalToSpeckle(interval.U), IntervalToSpeckle(interval.V)); + } public UVInterval Interval2dToNative(Interval2d interval) - { - return new UVInterval(IntervalToNative(interval.u), IntervalToNative(interval.v)); - } + { + return new UVInterval(IntervalToNative(interval.u), IntervalToNative(interval.v)); + } #endif } diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Mappings.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Mappings.cs index 139bd1b056..a1b83b2ef9 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Mappings.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Mappings.cs @@ -3,15 +3,15 @@ using System; using System.Collections.Generic; using System.Linq; -using Rhino.DocObjects; -using RH = Rhino.Geometry; -using Speckle.Core.Api; -using Speckle.Core.Models; using Objects.BuiltElements; using Objects.BuiltElements.Revit; using Objects.Geometry; using Objects.Other; +using Rhino.DocObjects; +using Speckle.Core.Api; using Speckle.Core.Logging; +using Speckle.Core.Models; +using RH = Rhino.Geometry; namespace Objects.Converter.RhinoGh; @@ -221,13 +221,12 @@ private List GetSurfaceBrepEdges( { var bottomCrv = brpCurves .Where(o => o.IsLinear()) - ?.Where( - o => - new RH.Vector3d( - o.PointAtEnd.X - o.PointAtStart.X, - o.PointAtEnd.Y - o.PointAtStart.Y, - o.PointAtEnd.Z - o.PointAtStart.Z - ).IsPerpendicularTo(RH.Vector3d.ZAxis) + ?.Where(o => + new RH.Vector3d( + o.PointAtEnd.X - o.PointAtStart.X, + o.PointAtEnd.Y - o.PointAtStart.Y, + o.PointAtEnd.Z - o.PointAtStart.Z + ).IsPerpendicularTo(RH.Vector3d.ZAxis) ) ?.Aggregate((curMin, o) => curMin == null || o.PointAtStart.Z < curMin.PointAtStart.Z ? o : curMin); if (bottomCrv != null) diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Other.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Other.cs index bac2179410..119b2c16e0 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Other.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.Other.cs @@ -18,7 +18,6 @@ using RH = Rhino.DocObjects; using Transform = Rhino.Geometry.Transform; using Utilities = Speckle.Core.Models.Utilities; - #if RHINO7_OR_GREATER using Rhino.Render; #endif @@ -212,7 +211,10 @@ public Other.RenderMaterial RenderMaterialToSpeckle(RH.Material material) renderMaterial.opacity = 1 - material.Transparency; // for some reason some default material transparency props are 1 when they shouldn't be - use this hack for now - if ((renderMaterial.name.ToLower().Contains("glass") || renderMaterial.name.ToLower().Contains("gem")) && renderMaterial.opacity == 0) + if ( + (renderMaterial.name.ToLower().Contains("glass") || renderMaterial.name.ToLower().Contains("gem")) + && renderMaterial.opacity == 0 + ) { renderMaterial.opacity = 0.3; } @@ -254,7 +256,10 @@ public Other.RenderMaterial RenderMaterialToSpeckle(Rhino.Render.RenderMaterial renderMaterial.opacity = 1 - simulatedMaterial.Transparency; // for some reason some default material transparency props are 1 when they shouldn't be - use this hack for now - if ((renderMaterial.name.ToLower().Contains("glass") || renderMaterial.name.ToLower().Contains("gem")) && renderMaterial.opacity == 0) + if ( + (renderMaterial.name.ToLower().Contains("glass") || renderMaterial.name.ToLower().Contains("gem")) + && renderMaterial.opacity == 0 + ) { renderMaterial.opacity = 0.3; } diff --git a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.cs b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.cs index 7530e0e981..8d33b07b20 100644 --- a/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.cs +++ b/Objects/Converters/ConverterRhinoGh/ConverterRhinoGhShared/ConverterRhinoGh.cs @@ -13,7 +13,6 @@ using Objects.Structural.Geometry; using Rhino; using Rhino.Collections; - using Rhino.DocObjects; using Speckle.Core.Kits; using Speckle.Core.Logging; @@ -21,7 +20,6 @@ using Plane = Objects.Geometry.Plane; using RH = Rhino.Geometry; using Vector = Objects.Geometry.Vector; - #if GRASSHOPPER using Grasshopper.Kernel.Types; using Rhino.Display; @@ -32,7 +30,7 @@ namespace Objects.Converter.RhinoGh; public partial class ConverterRhinoGh : ISpeckleConverter { #if RHINO6 && GRASSHOPPER - public static string RhinoAppName = HostApplications.Grasshopper.GetVersion(HostAppVersion.v6); + public static string RhinoAppName = HostApplications.Grasshopper.GetVersion(HostAppVersion.v6); #elif RHINO7 && GRASSHOPPER public static string RhinoAppName = HostApplications.Grasshopper.GetVersion(HostAppVersion.v7); #elif RHINO8 && GRASSHOPPER @@ -40,7 +38,7 @@ public partial class ConverterRhinoGh : ISpeckleConverter #elif RHINO6 public static string RhinoAppName = HostApplications.Rhino.GetVersion(HostAppVersion.v6); #elif RHINO7 - public static string RhinoAppName = HostApplications.Rhino.GetVersion(HostAppVersion.v7); + public static string RhinoAppName = HostApplications.Rhino.GetVersion(HostAppVersion.v7); #elif RHINO8 public static string RhinoAppName = HostApplications.Rhino.GetVersion(HostAppVersion.v8); #endif diff --git a/Objects/Converters/ConverterRhinoGhTests/Geometry/BrepTests.cs b/Objects/Converters/ConverterRhinoGhTests/Geometry/BrepTests.cs index 887562e610..d9b7a908fa 100644 --- a/Objects/Converters/ConverterRhinoGhTests/Geometry/BrepTests.cs +++ b/Objects/Converters/ConverterRhinoGhTests/Geometry/BrepTests.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.IO; -using Rhino.Geometry; using Grasshopper.Kernel.Types; using Rhino; +using Rhino.Geometry; using Speckle.Core.Api; using Speckle.Core.Kits; using Xunit; diff --git a/Objects/Converters/ConverterRhinoGhTests/Geometry/MeshTest.cs b/Objects/Converters/ConverterRhinoGhTests/Geometry/MeshTest.cs index 252ae0d440..5d8287cc7a 100644 --- a/Objects/Converters/ConverterRhinoGhTests/Geometry/MeshTest.cs +++ b/Objects/Converters/ConverterRhinoGhTests/Geometry/MeshTest.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.IO; -using Rhino.Geometry; using Grasshopper.Kernel.Types; using Rhino; +using Rhino.Geometry; using Speckle.Core.Api; using Speckle.Core.Kits; using Xunit; diff --git a/Objects/Converters/ConverterRhinoGhTests/RhinoTestFixture.cs b/Objects/Converters/ConverterRhinoGhTests/RhinoTestFixture.cs index debb0c2557..b0a14e495f 100644 --- a/Objects/Converters/ConverterRhinoGhTests/RhinoTestFixture.cs +++ b/Objects/Converters/ConverterRhinoGhTests/RhinoTestFixture.cs @@ -1,7 +1,7 @@ -using Microsoft.Win32; -using System; +using System; using System.IO; using System.Reflection; +using Microsoft.Win32; using Xunit; namespace ConverterRhinoGhTests diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructureUtils.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructureUtils.cs index 7efd4c3f93..89f3a15edf 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructureUtils.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructureUtils.cs @@ -1,18 +1,18 @@ using System; +using System.Collections; using System.Collections.Generic; -using Tekla.Structures.Model; using System.Linq; +using Objects.BuiltElements.TeklaStructures; using Objects.Geometry; -using System.Collections; -using Tekla.Structures.Solid; -using Tekla.Structures.Catalogs; -using TSG = Tekla.Structures.Geometry3d; -using StructuralUtilities.PolygonMesher; -using Speckle.Core.Models; using Objects.Structural.Properties.Profiles; -using Tekla.Structures.Datatype; -using Objects.BuiltElements.TeklaStructures; using Speckle.Core.Logging; +using Speckle.Core.Models; +using StructuralUtilities.PolygonMesher; +using Tekla.Structures.Catalogs; +using Tekla.Structures.Datatype; +using Tekla.Structures.Model; +using Tekla.Structures.Solid; +using TSG = Tekla.Structures.Geometry3d; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructures.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructures.cs index 123fcf51d5..3a25b2fb8d 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructures.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/ConverterTeklaStructures.cs @@ -1,12 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; using Objects.Geometry; using Objects.Other; using Speckle.Core.Kits; using Speckle.Core.Models; using Speckle.Core.Models.Extensions; using Speckle.Core.Models.GraphTraversal; -using System; -using System.Collections.Generic; -using System.Linq; using Tekla.Structures.Model; using BE = Objects.BuiltElements; using GE = Objects.Geometry; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBeam.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBeam.cs index 1c9f0980ff..8bceca6768 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBeam.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBeam.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using Objects.Geometry; -using BE = Objects.BuiltElements; using Objects.BuiltElements.TeklaStructures; +using Objects.Geometry; using Tekla.Structures.Model; +using BE = Objects.BuiltElements; using TSG = Tekla.Structures.Geometry3d; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBolts.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBolts.cs index 12ed0c49c2..d74b5dd2ff 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBolts.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBolts.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -using Objects.Geometry; -using BE = Objects.BuiltElements; using System.Linq; +using Objects.Geometry; using Tekla.Structures.Model; +using BE = Objects.BuiltElements; using TSG = Tekla.Structures.Geometry3d; namespace Objects.Converter.TeklaStructures; @@ -111,8 +111,8 @@ public BE.TeklaStructures.Bolts BoltsToSpeckle(BoltGroup Bolts) speckleTeklaBolt.position = GetPositioning(Bolts.Position); // global bolt coordinates - speckleTeklaBolt.coordinates = Bolts.BoltPositions - .Cast() + speckleTeklaBolt.coordinates = Bolts + .BoltPositions.Cast() .Select(p => new Point(p.X, p.Y, p.Z, units)) .ToList(); diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBooleanPart.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBooleanPart.cs index dffb6ef6a9..0650ffe68b 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBooleanPart.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertBooleanPart.cs @@ -1,8 +1,8 @@ -using Objects.Geometry; -using BE = Objects.BuiltElements; -using Objects.BuiltElements.TeklaStructures; using System.Linq; +using Objects.BuiltElements.TeklaStructures; +using Objects.Geometry; using Tekla.Structures.Model; +using BE = Objects.BuiltElements; namespace Objects.Converter.TeklaStructures; @@ -14,7 +14,6 @@ public void BooleanPartToNative(BE.Opening opening) switch (opening) { case TeklaContourOpening contourOpening: - { var contourPlate = new ContourPlate(); contourPlate.Profile.ProfileString = contourOpening.cuttingPlate.profile.name; @@ -34,7 +33,6 @@ public void BooleanPartToNative(BE.Opening opening) } break; case TeklaBeamOpening beamOpening: - { var beam = new Beam(); var baseLine = beamOpening.cuttingBeam.baseLine as Line; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertContourPlate.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertContourPlate.cs index 3ead851cd0..70d8faf0e0 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertContourPlate.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertContourPlate.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; -using Objects.Geometry; -using BE = Objects.BuiltElements; -using Objects.BuiltElements.TeklaStructures; using System.Linq; +using Objects.BuiltElements.TeklaStructures; +using Objects.Geometry; using Speckle.Core.Models; using Tekla.Structures.Model; +using BE = Objects.BuiltElements; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertDirectShapeMesh.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertDirectShapeMesh.cs index 6b310c4363..8134b75e04 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertDirectShapeMesh.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertDirectShapeMesh.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -using GE = Objects.Geometry; -using Speckle.Core.Models; using System.Linq; using Speckle.Core.Kits; -using Tekla.Structures.Model; -using Tekla.Structures.Geometry3d; +using Speckle.Core.Models; using Tekla.Structures.Catalogs; +using Tekla.Structures.Geometry3d; +using Tekla.Structures.Model; +using GE = Objects.Geometry; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertFitting.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertFitting.cs index fed2abb0e1..591e18395d 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertFitting.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertFitting.cs @@ -1,6 +1,6 @@ using Objects.Geometry; -using BE = Objects.BuiltElements; using Tekla.Structures.Model; +using BE = Objects.BuiltElements; using TSG = Tekla.Structures.Geometry3d; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolyBeam.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolyBeam.cs index 5cb0cd3607..89ea69ccd8 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolyBeam.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolyBeam.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; +using Objects.BuiltElements.TeklaStructures; using Objects.Geometry; using Tekla.Structures.Model; -using Objects.BuiltElements.TeklaStructures; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolygonWelds.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolygonWelds.cs index 0b7ea7c419..c847690534 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolygonWelds.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertPolygonWelds.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Objects.Geometry; -using BE = Objects.BuiltElements; using Tekla.Structures.Model; +using BE = Objects.BuiltElements; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertRebar.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertRebar.cs index bd14bf52b4..cbf1a53823 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertRebar.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertRebar.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -using Objects.Geometry; using Objects.BuiltElements.TeklaStructures; +using Objects.Geometry; using Tekla.Structures.Model; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertSpiralBeam.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertSpiralBeam.cs index 5ca2e961cc..4f49303f0d 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertSpiralBeam.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertSpiralBeam.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -using Objects.Geometry; using Objects.BuiltElements.TeklaStructures; -using SpiralBeam = Objects.BuiltElements.TeklaStructures.SpiralBeam; +using Objects.Geometry; using Point = Objects.Geometry.Point; +using SpiralBeam = Objects.BuiltElements.TeklaStructures.SpiralBeam; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertWelds.cs b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertWelds.cs index 3345e36502..34081fd78d 100644 --- a/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertWelds.cs +++ b/Objects/Converters/ConverterTeklaStructures/ConverterTeklaStructuresShared/PartialClasses/ConvertWelds.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Objects.Geometry; -using BE = Objects.BuiltElements; using Tekla.Structures.Model; +using BE = Objects.BuiltElements; namespace Objects.Converter.TeklaStructures; diff --git a/Objects/Objects/BuiltElements/Archicad/ArchicadOpening.cs b/Objects/Objects/BuiltElements/Archicad/ArchicadOpening.cs index 3c501c95bf..93117b8cc8 100644 --- a/Objects/Objects/BuiltElements/Archicad/ArchicadOpening.cs +++ b/Objects/Objects/BuiltElements/Archicad/ArchicadOpening.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; +using Objects.Geometry; using Speckle.Core.Kits; using Speckle.Core.Models; -using Objects.Geometry; namespace Objects.BuiltElements.Archicad; diff --git a/Objects/Objects/BuiltElements/Revit/RevitRebar.cs b/Objects/Objects/BuiltElements/Revit/RevitRebar.cs index e84cdce399..801f2abd72 100644 --- a/Objects/Objects/BuiltElements/Revit/RevitRebar.cs +++ b/Objects/Objects/BuiltElements/Revit/RevitRebar.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; -using Speckle.Newtonsoft.Json; using Objects.Geometry; using Speckle.Core.Models; +using Speckle.Newtonsoft.Json; namespace Objects.BuiltElements.Revit; diff --git a/Objects/Objects/Geometry/Surface.cs b/Objects/Objects/Geometry/Surface.cs index 17e1a2c0cc..dcad0d6b05 100644 --- a/Objects/Objects/Geometry/Surface.cs +++ b/Objects/Objects/Geometry/Surface.cs @@ -177,15 +177,14 @@ public void SetControlPoints(List> value) List data = new(); countU = value.Count; countV = value[0].Count; - value.ForEach( - row => - row.ForEach(pt => - { - data.Add(pt.x); - data.Add(pt.y); - data.Add(pt.z); - data.Add(pt.weight); - }) + value.ForEach(row => + row.ForEach(pt => + { + data.Add(pt.x); + data.Add(pt.y); + data.Add(pt.z); + data.Add(pt.weight); + }) ); pointData = data; } diff --git a/Objects/Objects/ObjectsKit.cs b/Objects/Objects/ObjectsKit.cs index 81b4812a7d..7a0def994b 100644 --- a/Objects/Objects/ObjectsKit.cs +++ b/Objects/Objects/ObjectsKit.cs @@ -115,8 +115,8 @@ private static ISpeckleConverter LoadConverterFromDisk(string app) throw new SpeckleException($"No suitable converter instance found for {app}"); } - SpeckleLog.Logger - .ForContext() + SpeckleLog + .Logger.ForContext() .ForContext("basePath", basePath) .ForContext("app", app) .Information("Converter {converterName} successfully loaded from {path}", converterInstance.Name, path); diff --git a/global.json b/global.json index 36394634bd..f6ba4b7d13 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { "version": "8.0.0", - "rollForward": "latestFeature", + "rollForward": "latestMajor", "allowPrerelease": false } }