From 9c65d1ac7ec55c3567a6a495a250f09ba0ff8b8e Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Tue, 11 Jun 2024 16:37:36 +0100 Subject: [PATCH 01/25] feat(dui3): adds instance def and instance proxy classes to core --- Core/Core/Models/Instances/IInstanceComponent.cs | 9 +++++++++ .../Core/Models/Instances/InstanceDefinitionProxy.cs | 12 ++++++++++++ Core/Core/Models/Instances/InstanceProxy.cs | 10 ++++++++++ 3 files changed, 31 insertions(+) create mode 100644 Core/Core/Models/Instances/IInstanceComponent.cs create mode 100644 Core/Core/Models/Instances/InstanceDefinitionProxy.cs create mode 100644 Core/Core/Models/Instances/InstanceProxy.cs diff --git a/Core/Core/Models/Instances/IInstanceComponent.cs b/Core/Core/Models/Instances/IInstanceComponent.cs new file mode 100644 index 0000000000..9a4d24c493 --- /dev/null +++ b/Core/Core/Models/Instances/IInstanceComponent.cs @@ -0,0 +1,9 @@ +namespace Speckle.Core.Models.Instances; + +public interface IInstanceComponent +{ + /// + /// The maximum nesting depth at which this component (Instance or Instance Definition) was found. + /// + public int MaxDepth { get; set; } +} diff --git a/Core/Core/Models/Instances/InstanceDefinitionProxy.cs b/Core/Core/Models/Instances/InstanceDefinitionProxy.cs new file mode 100644 index 0000000000..47192b1251 --- /dev/null +++ b/Core/Core/Models/Instances/InstanceDefinitionProxy.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Speckle.Core.Models.Instances; + +/// +/// A proxy class for an instance definition. +/// +public class InstanceDefinitionProxy : Base, IInstanceComponent +{ + public List Objects { get; set; } // source app application ids for the objects + public int MaxDepth { get; set; } +} diff --git a/Core/Core/Models/Instances/InstanceProxy.cs b/Core/Core/Models/Instances/InstanceProxy.cs new file mode 100644 index 0000000000..6a1c8570c2 --- /dev/null +++ b/Core/Core/Models/Instances/InstanceProxy.cs @@ -0,0 +1,10 @@ +using System.DoubleNumerics; + +namespace Speckle.Core.Models.Instances; + +public class InstanceProxy : Base, IInstanceComponent +{ + public string DefinitionId { get; set; } + public Matrix4x4 Transform { get; set; } + public int MaxDepth { get; set; } +} From 06486549af67026adf81569a41daa3ad180ff5b0 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Tue, 11 Jun 2024 16:37:53 +0100 Subject: [PATCH 02/25] feat(dui3): rhino blocks send wip --- .../Bindings/RhinoSendBinding.cs | 10 ++ .../RhinoConnectorModule.cs | 5 +- .../HostApp/RhinoBlockManager.cs | 113 ++++++++++++++++++ .../Operations/Send/RhinoRootObjectBuilder.cs | 22 +++- 4 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs index 6f3b66e6ff..f6311a0dde 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Bindings/RhinoSendBinding.cs @@ -1,4 +1,5 @@ using Rhino; +using Rhino.Commands; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; @@ -71,6 +72,15 @@ private void SubscribeToRhinoEvents() Commands.RefreshSendFilters(); }; + Command.BeginCommand += (_, e) => + { + if (e.CommandEnglishName == "BlockEdit") + { + var selectedObject = RhinoDoc.ActiveDoc.Objects.GetSelectedObjects(false, false).First(); + ChangedObjectIds.Add(selectedObject.Id.ToString()); + } + }; + RhinoDoc.AddRhinoObject += (_, e) => { // NOTE: This does not work if rhino starts and opens a blank doc; diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs index 96d6aaa56b..a4fe04857e 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs @@ -63,12 +63,11 @@ public void Load(SpeckleContainerBuilder builder) builder.AddScoped(); builder.AddScoped(); - // register send conversion cache - builder.AddSingleton(); - // register send operation and dependencies builder.AddScoped>(); builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); + builder.AddSingleton(); + builder.AddTransient, RhinoBlockManager>(); builder.AddSingleton, RhinoRootObjectBuilder>(); } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs new file mode 100644 index 0000000000..6958181318 --- /dev/null +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs @@ -0,0 +1,113 @@ +using System.DoubleNumerics; +using Rhino.DocObjects; +using Speckle.Core.Models.Instances; + +namespace Speckle.Connectors.Rhino7.HostApp; + +/// +/// A utility class that helps manage host application blocks in send/receive operations. +/// +/// Host application object type, e.g. RhinoObject +public interface IBlockManager +{ + /// + /// Given a list of host application objects, it will unpack them into TODO: comment + /// + /// + BlockManagerUnpackResult UnpackSelection(IEnumerable objects); +} + +public record BlockManagerUnpackResult( + List AtomicObjects, + Dictionary InstanceProxies, + List InstanceDefinitionProxies +); + +/// +/// +/// +public class RhinoBlockManager : IBlockManager +{ + private Dictionary InstanceProxies { get; set; } = new(); + private Dictionary> InstanceProxiesByDefinitionId { get; set; } = new(); + private Dictionary DefinitionProxies { get; set; } = new(); + private Dictionary FlatAtomicObjects { get; set; } = new(); + + public BlockManagerUnpackResult UnpackSelection(IEnumerable objects) + { + foreach (var obj in objects) + { + if (obj is InstanceObject instanceObject) + { + UnpackInstance(instanceObject); + } + FlatAtomicObjects[obj.Id.ToString()] = obj; + } + return new(FlatAtomicObjects.Values.ToList(), InstanceProxies, DefinitionProxies.Values.ToList()); + } + + private void UnpackInstance(InstanceObject instance, int depth = 0) + { + var instanceId = instance.Id.ToString(); + var instanceDefinitionId = instance.InstanceDefinition.Id.ToString(); + InstanceProxies[instanceId] = new InstanceProxy() + { + applicationId = instanceId, + DefinitionId = instance.InstanceDefinition.Id.ToString(), + Transform = XFormToMatrix(instance.InstanceXform), + MaxDepth = depth + }; + + // For each block instance that has the same definition, we need to keep track of the "maximum depth" at which is found. + // This will enable on receive to create them in the correct order (descending by max depth, interleaved definitions and instances). + // We need to interleave the creation of definitions and instances, as some definitions may depend on instances. + if ( + !InstanceProxiesByDefinitionId.TryGetValue( + instanceDefinitionId, + out List instanceProxiesWithSameDefinition + ) + ) + { + instanceProxiesWithSameDefinition = new List(); + InstanceProxiesByDefinitionId[instanceDefinitionId] = instanceProxiesWithSameDefinition; + } + + // We ensure that all previous instance proxies that have the same definition are at this max depth. I kind of have a feeling this can be done more elegantly, but YOLO + foreach (var instanceProxy in instanceProxiesWithSameDefinition) + { + instanceProxy.MaxDepth = depth; + } + + instanceProxiesWithSameDefinition.Add(InstanceProxies[instanceId]); + + if (DefinitionProxies.TryGetValue(instanceDefinitionId, out InstanceDefinitionProxy value)) + { + value.MaxDepth = depth; + return; + } + + var definition = new InstanceDefinitionProxy + { + applicationId = instanceDefinitionId, + Objects = new List(), + MaxDepth = depth, + ["name"] = instance.InstanceDefinition.Name, + ["description"] = instance.InstanceDefinition.Description + }; + + DefinitionProxies[instance.InstanceDefinition.Id.ToString()] = definition; + + foreach (var obj in instance.InstanceDefinition.GetObjects()) + { + definition.Objects.Add(obj.Id.ToString()); + if (obj is InstanceObject localInstance) + { + UnpackInstance(localInstance, depth + 1); + } + FlatAtomicObjects[obj.Id.ToString()] = obj; + } + } + + private Matrix4x4 XFormToMatrix(Rhino.Geometry.Transform t) => + new(t.M00, t.M01, t.M02, t.M03, t.M10, t.M11, t.M12, t.M13, t.M20, t.M21, t.M22, t.M23, t.M30, t.M31, t.M32, t.M33); +} diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index 2d5996c97a..4157370070 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -5,6 +5,7 @@ using Speckle.Autofac.DependencyInjection; using Speckle.Converters.Common; using Speckle.Connectors.DUI.Models.Card.SendFilter; +using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Caching; using Speckle.Connectors.Utils.Conversion; @@ -20,11 +21,17 @@ public class RhinoRootObjectBuilder : IRootObjectBuilder { private readonly IUnitOfWorkFactory _unitOfWorkFactory; private readonly ISendConversionCache _sendConversionCache; + private readonly IBlockManager _blockManager; - public RhinoRootObjectBuilder(IUnitOfWorkFactory unitOfWorkFactory, ISendConversionCache sendConversionCache) + public RhinoRootObjectBuilder( + IUnitOfWorkFactory unitOfWorkFactory, + ISendConversionCache sendConversionCache, + IBlockManager blockManager + ) { _unitOfWorkFactory = unitOfWorkFactory; _sendConversionCache = sendConversionCache; + _blockManager = blockManager; } public RootObjectBuilderResult Build( @@ -51,10 +58,14 @@ private RootObjectBuilderResult ConvertObjects( Dictionary layerCollectionCache = new(); + var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _blockManager.UnpackSelection(rhinoObjects); + // POC: we should formalise this, sooner or later - or somehow fix it a bit more + rootObjectCollection["instanceDefintions"] = instanceDefinitionProxies; + // POC: Handle blocks. List results = new(rhinoObjects.Count); var cacheHitCount = 0; - foreach (RhinoObject rhinoObject in rhinoObjects) + foreach (RhinoObject rhinoObject in atomicObjects) { cancellationToken.ThrowIfCancellationRequested(); @@ -70,8 +81,11 @@ private RootObjectBuilderResult ConvertObjects( // What we actually do here is check if the object has been previously converted AND has not changed. // If that's the case, we insert in the host collection just its object reference which has been saved from the prior conversion. Base converted; - - if (_sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference value)) + if (rhinoObject is InstanceObject) + { + converted = instanceProxies[applicationId]; + } + else if (_sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference value)) { converted = value; cacheHitCount++; From 6313b22054f471c2077a68a4d0fdc89f310ea026 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Tue, 11 Jun 2024 20:09:50 +0100 Subject: [PATCH 03/25] feat(dui3): wip (works!) rhino blocks send & receive --- .../Models/Instances/IInstanceComponent.cs | 3 + .../Receive/RhinoHostObjectBuilder.cs | 172 ++++++++++++++++-- .../Operations/Send/RhinoRootObjectBuilder.cs | 3 +- 3 files changed, 166 insertions(+), 12 deletions(-) diff --git a/Core/Core/Models/Instances/IInstanceComponent.cs b/Core/Core/Models/Instances/IInstanceComponent.cs index 9a4d24c493..27d012af3b 100644 --- a/Core/Core/Models/Instances/IInstanceComponent.cs +++ b/Core/Core/Models/Instances/IInstanceComponent.cs @@ -1,5 +1,8 @@ namespace Speckle.Core.Models.Instances; +/// +/// Abstracts over and for sorting and grouping in receive operations. +/// public interface IInstanceComponent { /// diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 02f653f08a..d94613cb62 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -1,13 +1,16 @@ using System.Diagnostics.Contracts; +using System.DoubleNumerics; using Rhino; using Rhino.DocObjects; using Rhino.Geometry; +using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; using Speckle.Converters.Common; using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; +using Speckle.Core.Models.Instances; namespace Speckle.Connectors.Rhino7.Operations.Receive; @@ -16,16 +19,19 @@ public class RhinoHostObjectBuilder : IHostObjectBuilder private readonly IRootToHostConverter _converter; private readonly IConversionContextStack _contextStack; private readonly GraphTraversal _traverseFunction; + private readonly IBlockManager _blockManager; public RhinoHostObjectBuilder( IRootToHostConverter converter, IConversionContextStack contextStack, - GraphTraversal traverseFunction + GraphTraversal traverseFunction, + IBlockManager blockManager ) { _converter = converter; _contextStack = contextStack; _traverseFunction = traverseFunction; + _blockManager = blockManager; } public HostObjectBuilderResult Build( @@ -42,8 +48,8 @@ CancellationToken cancellationToken var objectsToConvert = _traverseFunction .TraverseWithProgress(rootObject, onOperationProgressed, cancellationToken) .Where(obj => obj.Current is not Collection); - - var conversionResults = BakeObjects(objectsToConvert, baseLayerName); + //var bbb = (rootObject["instanceDefintions"] as List).Cast().ToList(); + var conversionResults = BakeObjects(objectsToConvert, baseLayerName, onOperationProgressed); _contextStack.Current.Document.Views.Redraw(); @@ -51,11 +57,29 @@ CancellationToken cancellationToken } // POC: Potentially refactor out into an IObjectBaker. - private HostObjectBuilderResult BakeObjects(IEnumerable objectsGraph, string baseLayerName) + // POC: temp disable +#pragma warning disable CA1506 +#pragma warning disable CA1502 + private HostObjectBuilderResult BakeObjects( +#pragma warning restore CA1502 +#pragma warning restore CA1506 + IEnumerable objectsGraph, + string baseLayerName, + Action? onOperationProgressed + ) { RhinoDoc doc = _contextStack.Current.Document; var rootLayerIndex = _contextStack.Current.Document.Layers.Find(Guid.Empty, baseLayerName, RhinoMath.UnsetIntIndex); + // Cleanup blocks/definitions/instances before layers + foreach (var definition in doc.InstanceDefinitions) + { + if (!definition.IsDeleted && definition.Name.Contains(baseLayerName)) + { + doc.InstanceDefinitions.Delete(definition.Index, true, false); + } + } + // POC: We could move this out into a separate service for testing and re-use. // Cleans up any previously received objects if (rootLayerIndex != RhinoMath.UnsetIntIndex) @@ -85,32 +109,132 @@ private HostObjectBuilderResult BakeObjects(IEnumerable object var conversionResults = new List(); var bakedObjectIds = new List(); - foreach (TraversalContext tc in objectsGraph) + var instanceComponents = new List<(string[] layerPath, IInstanceComponent obj)>(); + var atomicObjects = new List<(string[] layerPath, Base obj)>(); + IEnumerable traversalContexts = objectsGraph as TraversalContext[] ?? objectsGraph.ToArray(); + + foreach (TraversalContext tc in traversalContexts) { - try + var path = GetLayerPath(tc); + var xxxx = tc.Current; + if (tc.Current is IInstanceComponent flocker) + { + instanceComponents.Add((path, flocker)); + } + else { - var path = GetLayerPath(tc); + // TODO: check this is correct re traversal, not fully sure where we landed + atomicObjects.Add((path, tc.Current)); + } + } + // Stage 1: Convert atomic objects + var applicationIdMap = new Dictionary(); // used in converting blocks in stage 2 + foreach (var (path, obj) in atomicObjects) + { + try + { var fullLayerName = string.Join(Layer.PathSeparator, path); var layerIndex = cache.TryGetValue(fullLayerName, out int value) ? value : GetAndCreateLayerFromPath(path, baseLayerName, cache); - var result = _converter.Convert(tc.Current); + var result = _converter.Convert(obj); - var conversionIds = HandleConversionResult(result, tc.Current, layerIndex); + var conversionIds = HandleConversionResult(result, obj, layerIndex); foreach (var r in conversionIds) { - conversionResults.Add(new(Status.SUCCESS, tc.Current, r, result.GetType().ToString())); + conversionResults.Add(new(Status.SUCCESS, obj, r, result.GetType().ToString())); bakedObjectIds.Add(r); } + + if (obj.applicationId != null) + { + // TODO: groups inside blocks? is that a thing? can we account for that? HOW CAN WE ACCOUNT FOR THAT? + // ie, what happens when we receive a block that contains one object that we need to explode in host app? + applicationIdMap[obj.applicationId] = conversionIds[0]; + } } catch (Exception ex) when (!ex.IsFatal()) { - conversionResults.Add(new(Status.ERROR, tc.Current, null, null, ex)); + conversionResults.Add(new(Status.ERROR, obj, null, null, ex)); } } + // Stage 2: Convert instances + // TODO: do not forget to add to report things + var sortedInstanceComponents = instanceComponents + .OrderByDescending(x => x.obj.MaxDepth) // Sort by max depth, so we start baking from the deepest element first + .ThenBy(x => x.obj is InstanceDefinitionProxy ? 0 : 1) // Ensure we bake the deepest definition first, then any instances that depend on it + .ToList(); + var definitionIdAndApplicationIdMap = new Dictionary(); + var count = 0; + + foreach (var (path, instanceOrDefinition) in sortedInstanceComponents) + { + onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count); + + if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) + { + var currentApplicationObjectsIds = definitionProxy.Objects + .Select(x => applicationIdMap.TryGetValue(x, out string value) ? value : null) + .Where(x => x is not null) + .ToList(); + + var definitionGeometryList = new List(); + var attributes = new List(); + + foreach (var id in currentApplicationObjectsIds) + { + var docObject = doc.Objects.FindId(new Guid(id)); + definitionGeometryList.Add(docObject.Geometry); + attributes.Add(docObject.Attributes); + } + + // POC: Currently we're relying on the definition name for identification if it's coming from speckle and from which model; could we do something else? + var defName = $"{baseLayerName} ({definitionProxy.applicationId})"; + var defIndex = doc.InstanceDefinitions.Add( + defName, + "No description", // POC: perhaps bring it along from source? We'd need to look at ACAD first + Point3d.Origin, + definitionGeometryList, + attributes + ); + + // POC: check on defIndex -1, means we haven't created anything - this is most likely an recoverable error at this stage + if (defIndex == -1) + { + // TODO: throw? there's no catch atm + // var x = "break"; + } + + if (definitionProxy.applicationId != null) + { + definitionIdAndApplicationIdMap[definitionProxy.applicationId] = defIndex; + } + + // Rhino deletes original objects on block creation - we should do the same. + doc.Objects.Delete(currentApplicationObjectsIds.Select(stringId => new Guid(stringId)), false); + bakedObjectIds.RemoveAll(id => currentApplicationObjectsIds.Contains(id)); + } + if ( + instanceOrDefinition is InstanceProxy instanceProxy + && definitionIdAndApplicationIdMap.TryGetValue(instanceProxy.DefinitionId, out int index) + ) + { + var transform = MatrixToTransform(instanceProxy.Transform); + var layerIndex = GetAndCreateLayerFromPath(path, baseLayerName, cache); + var id = doc.Objects.AddInstanceObject(index, transform, new ObjectAttributes() { LayerIndex = layerIndex }); + if (instanceProxy.applicationId != null) + { + applicationIdMap[instanceProxy.applicationId] = id.ToString(); + } + bakedObjectIds.Add(id.ToString()); + conversionResults.Add(new(Status.SUCCESS, instanceProxy, id.ToString(), "Instance (Block)")); + } + } + + // Stage 3: Return return new(bakedObjectIds, conversionResults); } @@ -184,4 +308,30 @@ private static string[] GetLayerPath(TraversalContext context) collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); return reverseOrderPath.Reverse().ToArray(); } + + // POC: Not too proud of this being here + private Rhino.Geometry.Transform MatrixToTransform(Matrix4x4 matrix) + { + var t = Rhino.Geometry.Transform.Identity; + t.M00 = matrix.M11; + t.M01 = matrix.M12; + t.M02 = matrix.M13; + t.M03 = matrix.M14; + + t.M10 = matrix.M21; + t.M11 = matrix.M22; + t.M12 = matrix.M23; + t.M13 = matrix.M24; + + t.M20 = matrix.M31; + t.M21 = matrix.M32; + t.M22 = matrix.M33; + t.M23 = matrix.M34; + + t.M30 = matrix.M41; + t.M31 = matrix.M42; + t.M32 = matrix.M43; + t.M33 = matrix.M44; + return t; + } } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index 4157370070..72a3da1ef4 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -60,7 +60,8 @@ private RootObjectBuilderResult ConvertObjects( var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _blockManager.UnpackSelection(rhinoObjects); // POC: we should formalise this, sooner or later - or somehow fix it a bit more - rootObjectCollection["instanceDefintions"] = instanceDefinitionProxies; + rootObjectCollection["@instanceDefintions"] = instanceDefinitionProxies; // this won't work re traversal on receive + rootObjectCollection.elements.AddRange(instanceDefinitionProxies); // hmmmm this does. question stands on how to properly do this // POC: Handle blocks. List results = new(rhinoObjects.Count); From 43471a24bc1f1d3afbc85c77f2712a8a204298c9 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Wed, 12 Jun 2024 18:32:38 +0100 Subject: [PATCH 04/25] some cleanup --- .../Receive/RhinoHostObjectBuilder.cs | 129 +++++++++++------- .../Operations/Send/RhinoRootObjectBuilder.cs | 4 +- 2 files changed, 80 insertions(+), 53 deletions(-) diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index d94613cb62..27c7adaa95 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -7,6 +7,7 @@ using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; using Speckle.Converters.Common; +using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; @@ -48,8 +49,17 @@ CancellationToken cancellationToken var objectsToConvert = _traverseFunction .TraverseWithProgress(rootObject, onOperationProgressed, cancellationToken) .Where(obj => obj.Current is not Collection); - //var bbb = (rootObject["instanceDefintions"] as List).Cast().ToList(); - var conversionResults = BakeObjects(objectsToConvert, baseLayerName, onOperationProgressed); + + var instanceDefinitionProxies = (rootObject["instanceDefinitionProxies"] as List) + ?.Cast() + .ToList(); + + var conversionResults = BakeObjects( + objectsToConvert, + instanceDefinitionProxies, + baseLayerName, + onOperationProgressed + ); _contextStack.Current.Document.Views.Redraw(); @@ -64,6 +74,7 @@ private HostObjectBuilderResult BakeObjects( #pragma warning restore CA1502 #pragma warning restore CA1506 IEnumerable objectsGraph, + List? instanceDefinitionProxies, string baseLayerName, Action? onOperationProgressed ) @@ -110,20 +121,26 @@ private HostObjectBuilderResult BakeObjects( var bakedObjectIds = new List(); var instanceComponents = new List<(string[] layerPath, IInstanceComponent obj)>(); + + // POC: these are not captured by traversal, so we need to readd them here + if (instanceDefinitionProxies != null && instanceDefinitionProxies.Count > 0) + { + var transformed = instanceDefinitionProxies.Select(proxy => (Array.Empty(), proxy as IInstanceComponent)); + instanceComponents.AddRange(transformed); + } + var atomicObjects = new List<(string[] layerPath, Base obj)>(); IEnumerable traversalContexts = objectsGraph as TraversalContext[] ?? objectsGraph.ToArray(); foreach (TraversalContext tc in traversalContexts) { var path = GetLayerPath(tc); - var xxxx = tc.Current; if (tc.Current is IInstanceComponent flocker) { instanceComponents.Add((path, flocker)); } else { - // TODO: check this is correct re traversal, not fully sure where we landed atomicObjects.Add((path, tc.Current)); } } @@ -173,64 +190,74 @@ private HostObjectBuilderResult BakeObjects( foreach (var (path, instanceOrDefinition) in sortedInstanceComponents) { onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count); - - if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) + try { - var currentApplicationObjectsIds = definitionProxy.Objects - .Select(x => applicationIdMap.TryGetValue(x, out string value) ? value : null) - .Where(x => x is not null) - .ToList(); + if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) + { + var currentApplicationObjectsIds = definitionProxy.Objects + .Select(x => applicationIdMap.TryGetValue(x, out string value) ? value : null) + .Where(x => x is not null) + .ToList(); - var definitionGeometryList = new List(); - var attributes = new List(); + var definitionGeometryList = new List(); + var attributes = new List(); - foreach (var id in currentApplicationObjectsIds) - { - var docObject = doc.Objects.FindId(new Guid(id)); - definitionGeometryList.Add(docObject.Geometry); - attributes.Add(docObject.Attributes); - } + foreach (var id in currentApplicationObjectsIds) + { + var docObject = doc.Objects.FindId(new Guid(id)); + definitionGeometryList.Add(docObject.Geometry); + attributes.Add(docObject.Attributes); + } - // POC: Currently we're relying on the definition name for identification if it's coming from speckle and from which model; could we do something else? - var defName = $"{baseLayerName} ({definitionProxy.applicationId})"; - var defIndex = doc.InstanceDefinitions.Add( - defName, - "No description", // POC: perhaps bring it along from source? We'd need to look at ACAD first - Point3d.Origin, - definitionGeometryList, - attributes - ); + // POC: Currently we're relying on the definition name for identification if it's coming from speckle and from which model; could we do something else? + var defName = $"{baseLayerName} ({definitionProxy.applicationId})"; + var defIndex = doc.InstanceDefinitions.Add( + defName, + "No description", // POC: perhaps bring it along from source? We'd need to look at ACAD first + Point3d.Origin, + definitionGeometryList, + attributes + ); + + // POC: check on defIndex -1, means we haven't created anything - this is most likely an recoverable error at this stage + if (defIndex == -1) + { + throw new ConversionException("Failed to create an instance defintion object."); + } - // POC: check on defIndex -1, means we haven't created anything - this is most likely an recoverable error at this stage - if (defIndex == -1) - { - // TODO: throw? there's no catch atm - // var x = "break"; + if (definitionProxy.applicationId != null) + { + definitionIdAndApplicationIdMap[definitionProxy.applicationId] = defIndex; + } + + // Rhino deletes original objects on block creation - we should do the same. + doc.Objects.Delete(currentApplicationObjectsIds.Select(stringId => new Guid(stringId)), false); + bakedObjectIds.RemoveAll(id => currentApplicationObjectsIds.Contains(id)); + conversionResults.RemoveAll( + conversionResult => currentApplicationObjectsIds.Contains(conversionResult.ResultId) // note: as in rhino created objects are deleted, highlighting them won't work + ); } - if (definitionProxy.applicationId != null) + if ( + instanceOrDefinition is InstanceProxy instanceProxy + && definitionIdAndApplicationIdMap.TryGetValue(instanceProxy.DefinitionId, out int index) + ) { - definitionIdAndApplicationIdMap[definitionProxy.applicationId] = defIndex; - } + var transform = MatrixToTransform(instanceProxy.Transform); + var layerIndex = GetAndCreateLayerFromPath(path, baseLayerName, cache); + var id = doc.Objects.AddInstanceObject(index, transform, new ObjectAttributes() { LayerIndex = layerIndex }); + if (instanceProxy.applicationId != null) + { + applicationIdMap[instanceProxy.applicationId] = id.ToString(); + } - // Rhino deletes original objects on block creation - we should do the same. - doc.Objects.Delete(currentApplicationObjectsIds.Select(stringId => new Guid(stringId)), false); - bakedObjectIds.RemoveAll(id => currentApplicationObjectsIds.Contains(id)); + bakedObjectIds.Add(id.ToString()); + conversionResults.Add(new(Status.SUCCESS, instanceProxy, id.ToString(), "Instance (Block)")); + } } - if ( - instanceOrDefinition is InstanceProxy instanceProxy - && definitionIdAndApplicationIdMap.TryGetValue(instanceProxy.DefinitionId, out int index) - ) + catch (Exception ex) when (!ex.IsFatal()) { - var transform = MatrixToTransform(instanceProxy.Transform); - var layerIndex = GetAndCreateLayerFromPath(path, baseLayerName, cache); - var id = doc.Objects.AddInstanceObject(index, transform, new ObjectAttributes() { LayerIndex = layerIndex }); - if (instanceProxy.applicationId != null) - { - applicationIdMap[instanceProxy.applicationId] = id.ToString(); - } - bakedObjectIds.Add(id.ToString()); - conversionResults.Add(new(Status.SUCCESS, instanceProxy, id.ToString(), "Instance (Block)")); + conversionResults.Add(new(Status.ERROR, instanceOrDefinition as Base ?? new Base(), null, null, ex)); } } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index 72a3da1ef4..352154aa56 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -59,9 +59,9 @@ private RootObjectBuilderResult ConvertObjects( Dictionary layerCollectionCache = new(); var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _blockManager.UnpackSelection(rhinoObjects); + // POC: we should formalise this, sooner or later - or somehow fix it a bit more - rootObjectCollection["@instanceDefintions"] = instanceDefinitionProxies; // this won't work re traversal on receive - rootObjectCollection.elements.AddRange(instanceDefinitionProxies); // hmmmm this does. question stands on how to properly do this + rootObjectCollection["@instanceDefinitionProxies"] = instanceDefinitionProxies; // this won't work re traversal on receive // POC: Handle blocks. List results = new(rhinoObjects.Count); From 0c07f756894f7c940964c04c79dc6165c4a7f36a Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Wed, 12 Jun 2024 21:27:38 +0100 Subject: [PATCH 05/25] wip fixes --- .../DependencyInjection/RhinoConnectorModule.cs | 12 ++++++------ .../HostApp/RhinoBlockManager.cs | 7 ++++++- .../Operations/Send/RhinoRootObjectBuilder.cs | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs index a4fe04857e..cb896f81f0 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs @@ -59,16 +59,16 @@ public void Load(SpeckleContainerBuilder builder) // binding dependencies builder.AddTransient(); - // register send filters - builder.AddScoped(); - builder.AddScoped(); - - // register send operation and dependencies + // register send and receive operation and dependencies builder.AddScoped>(); builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); + builder.AddScoped(); builder.AddSingleton(); + builder.AddTransient, RhinoRootObjectBuilder>(); builder.AddTransient, RhinoBlockManager>(); - builder.AddSingleton, RhinoRootObjectBuilder>(); + // register receive related deps + // Note: Receive operation is injected by builder.AddConnectorUtils() + builder.AddTransient(); } } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs index 6958181318..f4555699ff 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs @@ -5,7 +5,7 @@ namespace Speckle.Connectors.Rhino7.HostApp; /// -/// A utility class that helps manage host application blocks in send/receive operations. +/// A utility class that helps manage host application blocks in send/receive operations. This expects to be a transient dependendency. /// /// Host application object type, e.g. RhinoObject public interface IBlockManager @@ -28,6 +28,11 @@ List InstanceDefinitionProxies /// public class RhinoBlockManager : IBlockManager { + public RhinoBlockManager() + { + // TODO: test + } + private Dictionary InstanceProxies { get; set; } = new(); private Dictionary> InstanceProxiesByDefinitionId { get; set; } = new(); private Dictionary DefinitionProxies { get; set; } = new(); diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index 352154aa56..b3d2ac6c31 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -61,7 +61,7 @@ private RootObjectBuilderResult ConvertObjects( var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _blockManager.UnpackSelection(rhinoObjects); // POC: we should formalise this, sooner or later - or somehow fix it a bit more - rootObjectCollection["@instanceDefinitionProxies"] = instanceDefinitionProxies; // this won't work re traversal on receive + rootObjectCollection["instanceDefinitionProxies"] = instanceDefinitionProxies; // this won't work re traversal on receive // POC: Handle blocks. List results = new(rhinoObjects.Count); From 41375157d947cf9ccc8a7d5feb6d23cdf4bf2258 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Wed, 12 Jun 2024 21:53:20 +0100 Subject: [PATCH 06/25] wip cleanup --- .../Receive/RhinoHostObjectBuilder.cs | 80 +++++++++++-------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 27c7adaa95..08f14cebae 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -82,34 +82,7 @@ private HostObjectBuilderResult BakeObjects( RhinoDoc doc = _contextStack.Current.Document; var rootLayerIndex = _contextStack.Current.Document.Layers.Find(Guid.Empty, baseLayerName, RhinoMath.UnsetIntIndex); - // Cleanup blocks/definitions/instances before layers - foreach (var definition in doc.InstanceDefinitions) - { - if (!definition.IsDeleted && definition.Name.Contains(baseLayerName)) - { - doc.InstanceDefinitions.Delete(definition.Index, true, false); - } - } - - // POC: We could move this out into a separate service for testing and re-use. - // Cleans up any previously received objects - if (rootLayerIndex != RhinoMath.UnsetIntIndex) - { - Layer documentLayer = doc.Layers[rootLayerIndex]; - Layer[]? childLayers = documentLayer.GetChildren(); - if (childLayers != null) - { - using var layerNoDraw = new DisableRedrawScope(doc.Views); - foreach (var layer in childLayers) - { - var purgeSuccess = doc.Layers.Purge(layer.Index, true); - if (!purgeSuccess) - { - Console.WriteLine($"Failed to purge layer: {layer}"); - } - } - } - } + PreReceiveDeepClean(baseLayerName, rootLayerIndex); var cache = new Dictionary(); rootLayerIndex = doc.Layers.Add(new Layer { Name = baseLayerName }); @@ -146,9 +119,11 @@ private HostObjectBuilderResult BakeObjects( } // Stage 1: Convert atomic objects - var applicationIdMap = new Dictionary(); // used in converting blocks in stage 2 + var applicationIdMap = new Dictionary>(); // used in converting blocks in stage 2 + var count = 0; foreach (var (path, obj) in atomicObjects) { + onOperationProgressed?.Invoke("Converting objects", (double)++count / atomicObjects.Count); try { var fullLayerName = string.Join(Layer.PathSeparator, path); @@ -158,7 +133,7 @@ private HostObjectBuilderResult BakeObjects( var result = _converter.Convert(obj); - var conversionIds = HandleConversionResult(result, obj, layerIndex); + var conversionIds = HandleConversionResult(result, obj, layerIndex).ToList(); foreach (var r in conversionIds) { conversionResults.Add(new(Status.SUCCESS, obj, r, result.GetType().ToString())); @@ -169,7 +144,7 @@ private HostObjectBuilderResult BakeObjects( { // TODO: groups inside blocks? is that a thing? can we account for that? HOW CAN WE ACCOUNT FOR THAT? // ie, what happens when we receive a block that contains one object that we need to explode in host app? - applicationIdMap[obj.applicationId] = conversionIds[0]; + applicationIdMap[obj.applicationId] = conversionIds; } } catch (Exception ex) when (!ex.IsFatal()) @@ -185,8 +160,8 @@ private HostObjectBuilderResult BakeObjects( .ThenBy(x => x.obj is InstanceDefinitionProxy ? 0 : 1) // Ensure we bake the deepest definition first, then any instances that depend on it .ToList(); var definitionIdAndApplicationIdMap = new Dictionary(); - var count = 0; + count = 0; foreach (var (path, instanceOrDefinition) in sortedInstanceComponents) { onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count); @@ -195,8 +170,9 @@ private HostObjectBuilderResult BakeObjects( if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) { var currentApplicationObjectsIds = definitionProxy.Objects - .Select(x => applicationIdMap.TryGetValue(x, out string value) ? value : null) + .Select(x => applicationIdMap.TryGetValue(x, out List value) ? value : null) .Where(x => x is not null) + .SelectMany(id => id) .ToList(); var definitionGeometryList = new List(); @@ -234,7 +210,8 @@ private HostObjectBuilderResult BakeObjects( doc.Objects.Delete(currentApplicationObjectsIds.Select(stringId => new Guid(stringId)), false); bakedObjectIds.RemoveAll(id => currentApplicationObjectsIds.Contains(id)); conversionResults.RemoveAll( - conversionResult => currentApplicationObjectsIds.Contains(conversionResult.ResultId) // note: as in rhino created objects are deleted, highlighting them won't work + conversionResult => + conversionResult.ResultId != null && currentApplicationObjectsIds.Contains(conversionResult.ResultId) // note: as in rhino created objects are deleted, highlighting them won't work ); } @@ -248,7 +225,7 @@ instanceOrDefinition is InstanceProxy instanceProxy var id = doc.Objects.AddInstanceObject(index, transform, new ObjectAttributes() { LayerIndex = layerIndex }); if (instanceProxy.applicationId != null) { - applicationIdMap[instanceProxy.applicationId] = id.ToString(); + applicationIdMap[instanceProxy.applicationId] = new List() { id.ToString() }; } bakedObjectIds.Add(id.ToString()); @@ -265,6 +242,39 @@ instanceOrDefinition is InstanceProxy instanceProxy return new(bakedObjectIds, conversionResults); } + private void PreReceiveDeepClean(string baseLayerName, int rootLayerIndex) + { + var doc = _contextStack.Current.Document; + + // Cleanup blocks/definitions/instances before layers + foreach (var definition in doc.InstanceDefinitions) + { + if (!definition.IsDeleted && definition.Name.Contains(baseLayerName)) + { + doc.InstanceDefinitions.Delete(definition.Index, true, false); + } + } + + // Cleans up any previously received objects + if (rootLayerIndex != RhinoMath.UnsetIntIndex) + { + Layer documentLayer = doc.Layers[rootLayerIndex]; + Layer[]? childLayers = documentLayer.GetChildren(); + if (childLayers != null) + { + using var layerNoDraw = new DisableRedrawScope(doc.Views); + foreach (var layer in childLayers) + { + var purgeSuccess = doc.Layers.Purge(layer.Index, true); + if (!purgeSuccess) + { + Console.WriteLine($"Failed to purge layer: {layer}"); + } + } + } + } + } + private IReadOnlyList HandleConversionResult(object conversionResult, Base originalObject, int layerIndex) { var doc = _contextStack.Current.Document; From 96be32df765a8c3dd9fe84cedb67f4f7c8bb48d2 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Wed, 12 Jun 2024 22:01:28 +0100 Subject: [PATCH 07/25] wip scaffolds acad --- .../HostApp/AutocadBlockManager.cs | 9 ++++++ ...Speckle.Connectors.AutocadShared.projitems | 1 + .../RhinoConnectorModule.cs | 3 +- .../HostApp/RhinoBlockManager.cs | 28 ++++--------------- .../Receive/RhinoHostObjectBuilder.cs | 8 +++--- .../Operations/Send/RhinoRootObjectBuilder.cs | 14 ++++++---- .../Instances/IInstanceObjectsManager.cs | 22 +++++++++++++++ 7 files changed, 51 insertions(+), 34 deletions(-) create mode 100644 DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs create mode 100644 DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs new file mode 100644 index 0000000000..85c57dd266 --- /dev/null +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs @@ -0,0 +1,9 @@ +using Speckle.Connectors.Utils.Instances; + +namespace Speckle.Connectors.Autocad.HostApp; + +public class AutocadInstanceObjectManager : IInstanceObjectsManager +{ + // TODO + public UnpackResult UnpackSelection(IEnumerable objects) => throw new NotImplementedException(); +} diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems index d45686060d..7207746cfa 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems @@ -15,6 +15,7 @@ + diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs index cb896f81f0..587b0c2f6d 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs @@ -20,6 +20,7 @@ using Speckle.Connectors.Utils; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Caching; +using Speckle.Connectors.Utils.Instances; using Speckle.Connectors.Utils.Operations; using Speckle.Core.Models.GraphTraversal; @@ -65,7 +66,7 @@ public void Load(SpeckleContainerBuilder builder) builder.AddScoped(); builder.AddSingleton(); builder.AddTransient, RhinoRootObjectBuilder>(); - builder.AddTransient, RhinoBlockManager>(); + builder.AddTransient, RhinoInstanceObjectsManager>(); // register receive related deps // Note: Receive operation is injected by builder.AddConnectorUtils() diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs index f4555699ff..2c2c23d710 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs @@ -1,36 +1,18 @@ using System.DoubleNumerics; using Rhino.DocObjects; +using Speckle.Connectors.Utils.Instances; using Speckle.Core.Models.Instances; namespace Speckle.Connectors.Rhino7.HostApp; -/// -/// A utility class that helps manage host application blocks in send/receive operations. This expects to be a transient dependendency. -/// -/// Host application object type, e.g. RhinoObject -public interface IBlockManager -{ - /// - /// Given a list of host application objects, it will unpack them into TODO: comment - /// - /// - BlockManagerUnpackResult UnpackSelection(IEnumerable objects); -} - -public record BlockManagerUnpackResult( - List AtomicObjects, - Dictionary InstanceProxies, - List InstanceDefinitionProxies -); - /// /// /// -public class RhinoBlockManager : IBlockManager +public class RhinoInstanceObjectsManager : IInstanceObjectsManager { - public RhinoBlockManager() + public RhinoInstanceObjectsManager() { - // TODO: test + // TODO: remove } private Dictionary InstanceProxies { get; set; } = new(); @@ -38,7 +20,7 @@ public RhinoBlockManager() private Dictionary DefinitionProxies { get; set; } = new(); private Dictionary FlatAtomicObjects { get; set; } = new(); - public BlockManagerUnpackResult UnpackSelection(IEnumerable objects) + public UnpackResult UnpackSelection(IEnumerable objects) { foreach (var obj in objects) { diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 08f14cebae..672bde53d5 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -3,9 +3,9 @@ using Rhino; using Rhino.DocObjects; using Rhino.Geometry; -using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; +using Speckle.Connectors.Utils.Instances; using Speckle.Converters.Common; using Speckle.Core.Kits; using Speckle.Core.Logging; @@ -20,19 +20,19 @@ public class RhinoHostObjectBuilder : IHostObjectBuilder private readonly IRootToHostConverter _converter; private readonly IConversionContextStack _contextStack; private readonly GraphTraversal _traverseFunction; - private readonly IBlockManager _blockManager; + private readonly IInstanceObjectsManager _instanceObjectsManager; public RhinoHostObjectBuilder( IRootToHostConverter converter, IConversionContextStack contextStack, GraphTraversal traverseFunction, - IBlockManager blockManager + IInstanceObjectsManager instanceObjectsManager ) { _converter = converter; _contextStack = contextStack; _traverseFunction = traverseFunction; - _blockManager = blockManager; + _instanceObjectsManager = instanceObjectsManager; } public HostObjectBuilderResult Build( diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index b3d2ac6c31..0b9e9fc074 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -5,10 +5,10 @@ using Speckle.Autofac.DependencyInjection; using Speckle.Converters.Common; using Speckle.Connectors.DUI.Models.Card.SendFilter; -using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Caching; using Speckle.Connectors.Utils.Conversion; +using Speckle.Connectors.Utils.Instances; using Speckle.Connectors.Utils.Operations; using Speckle.Core.Logging; @@ -21,17 +21,17 @@ public class RhinoRootObjectBuilder : IRootObjectBuilder { private readonly IUnitOfWorkFactory _unitOfWorkFactory; private readonly ISendConversionCache _sendConversionCache; - private readonly IBlockManager _blockManager; + private readonly IInstanceObjectsManager _instanceObjectsManager; public RhinoRootObjectBuilder( IUnitOfWorkFactory unitOfWorkFactory, ISendConversionCache sendConversionCache, - IBlockManager blockManager + IInstanceObjectsManager instanceObjectsManager ) { _unitOfWorkFactory = unitOfWorkFactory; _sendConversionCache = sendConversionCache; - _blockManager = blockManager; + _instanceObjectsManager = instanceObjectsManager; } public RootObjectBuilderResult Build( @@ -58,7 +58,9 @@ private RootObjectBuilderResult ConvertObjects( Dictionary layerCollectionCache = new(); - var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _blockManager.UnpackSelection(rhinoObjects); + var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _instanceObjectsManager.UnpackSelection( + rhinoObjects + ); // POC: we should formalise this, sooner or later - or somehow fix it a bit more rootObjectCollection["instanceDefinitionProxies"] = instanceDefinitionProxies; // this won't work re traversal on receive @@ -123,7 +125,7 @@ private RootObjectBuilderResult ConvertObjects( } /// - /// Returns the host collection based on the provided layer. If it's not found, it will be created and hosted within the the rootObjectCollection. + /// Returns the host collection based on the provided layer. If it's not found, it will be created and hosted within the rootObjectCollection. /// /// /// diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs new file mode 100644 index 0000000000..2397fa83fb --- /dev/null +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs @@ -0,0 +1,22 @@ +using Speckle.Core.Models.Instances; + +namespace Speckle.Connectors.Utils.Instances; + +/// +/// A utility class that helps manage host application blocks in send/receive operations. This expects to be a transient dependendency. +/// +/// Host application object type, e.g. RhinoObject +public interface IInstanceObjectsManager +{ + /// + /// Given a list of host application objects, it will unpack them into TODO: comment + /// + /// + UnpackResult UnpackSelection(IEnumerable objects); +} + +public record UnpackResult( + List AtomicObjects, + Dictionary InstanceProxies, + List InstanceDefinitionProxies +); From 1e92a17824f9b94dbd849bae3877b83ff0b659ee Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Fri, 14 Jun 2024 08:18:21 +0100 Subject: [PATCH 08/25] wip acad send instances and co --- .../AutocadConnectorModule.cs | 2 + .../HostApp/AutocadBlockManager.cs | 9 --- .../HostApp/AutocadInstanceObjectManager.cs | 78 +++++++++++++++++++ .../Send/AutocadRootObjectBuilder.cs | 10 ++- ...Speckle.Connectors.AutocadShared.projitems | 2 +- .../RhinoConnectorModule.cs | 10 +-- .../ConverterAutocadCivil.Other.cs | 2 +- 7 files changed, 95 insertions(+), 18 deletions(-) delete mode 100644 DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs create mode 100644 DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs index f4a970b1d0..214d039295 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs @@ -15,6 +15,7 @@ using Speckle.Connectors.Utils; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Caching; +using Speckle.Connectors.Utils.Instances; using Speckle.Connectors.Utils.Operations; using Speckle.Core.Models.GraphTraversal; @@ -62,5 +63,6 @@ public void Load(SpeckleContainerBuilder builder) // register send conversion cache builder.AddSingleton(); + builder.AddScoped, AutocadInstanceObjectManager>(); } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs deleted file mode 100644 index 85c57dd266..0000000000 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadBlockManager.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Speckle.Connectors.Utils.Instances; - -namespace Speckle.Connectors.Autocad.HostApp; - -public class AutocadInstanceObjectManager : IInstanceObjectsManager -{ - // TODO - public UnpackResult UnpackSelection(IEnumerable objects) => throw new NotImplementedException(); -} diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs new file mode 100644 index 0000000000..7644cec7e1 --- /dev/null +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -0,0 +1,78 @@ +using Autodesk.AutoCAD.DatabaseServices; +using Speckle.Connectors.Autocad.Operations.Send; +using Speckle.Connectors.Utils.Instances; +using Speckle.Core.Models.Instances; + +namespace Speckle.Connectors.Autocad.HostApp; + +public class AutocadInstanceObjectManager : IInstanceObjectsManager +{ + private Dictionary InstanceProxies { get; set; } = new(); + private Dictionary> InstanceProxiesByDefinitionId { get; set; } = new(); + private Dictionary DefinitionProxies { get; set; } = new(); + private Dictionary FlatAtomicObjects { get; set; } = new(); + + public UnpackResult UnpackSelection(IEnumerable objects) + { + // POC: Dim enjoys controlling transactions clearly, it's not immediate how we're dealing with stuff in TransactionContext + // where does it start, can we batch more stuff in it?, performance implications? document locking? + using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); + + foreach (var obj in objects) + { + // TODO: maybe get the dynamic blocks out as "exploded", or handle them separately anyway - for now excluding + // let's solve the simple case for now + // TODO: idea: dynamic blocks could fallback to a rhino "group" - could we fake it with a displayValue[] hack + if (obj.Root is BlockReference blockReference && !blockReference.IsDynamicBlock) + { + UnpackInstance(blockReference, 0, transaction); + } + + FlatAtomicObjects[obj.ApplicationId] = obj; + } + return new(FlatAtomicObjects.Values.ToList(), InstanceProxies, DefinitionProxies.Values.ToList()); + } + + private void UnpackInstance(BlockReference instance, int depth, Transaction transaction) + { + var instanceId = instance.Id.ToString(); + var defintionId = instance.BlockTableRecord; + + // TODO: magical depth assignment for: + // - instances + // - defs + + + + if (DefinitionProxies.TryGetValue(defintionId.ToString(), out InstanceDefinitionProxy value)) + { + value.MaxDepth = depth; + return; // exit fast - we've parsed this one so no need to go further + } + + var definition = (BlockTableRecord)transaction.GetObject(defintionId, OpenMode.ForRead); + // definition.Origin + var definitionProxy = new InstanceDefinitionProxy() + { + applicationId = defintionId.ToString(), + Objects = new(), + MaxDepth = depth, + ["name"] = definition.Name, + ["comments"] = definition.Comments, + ["units"] = definition.Units // ? not sure needed? + }; + + // Go through each definition object + foreach (ObjectId id in definition) + { + var obj = transaction.GetObject(id, OpenMode.ForRead); + if (obj is BlockReference blockReference && !blockReference.IsDynamicBlock) + { + UnpackInstance(blockReference, depth + 1, transaction); + } + FlatAtomicObjects[id.ToString()] = new(obj, id.ToString()); + } + + DefinitionProxies[defintionId.ToString()] = definitionProxy; + } +} diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs index 3073a07b25..e3b2adec23 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using Autodesk.AutoCAD.DatabaseServices; +using Speckle.Connectors.Autocad.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Caching; using Speckle.Connectors.Utils.Conversion; @@ -15,11 +16,17 @@ public class AutocadRootObjectBuilder : IRootObjectBuilder private readonly IRootToSpeckleConverter _converter; private readonly string[] _documentPathSeparator = { "\\" }; private readonly ISendConversionCache _sendConversionCache; + private readonly AutocadInstanceObjectManager _instanceObjectManager; - public AutocadRootObjectBuilder(IRootToSpeckleConverter converter, ISendConversionCache sendConversionCache) + public AutocadRootObjectBuilder( + IRootToSpeckleConverter converter, + ISendConversionCache sendConversionCache, + AutocadInstanceObjectManager instanceObjectManager + ) { _converter = converter; _sendConversionCache = sendConversionCache; + _instanceObjectManager = instanceObjectManager; } public RootObjectBuilderResult Build( @@ -48,7 +55,6 @@ public RootObjectBuilderResult Build( foreach (var (dbObject, applicationId) in objects) { ct.ThrowIfCancellationRequested(); - try { Base converted; diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems index 7207746cfa..48afea17e1 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems @@ -15,7 +15,7 @@ - + diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs index bbde83c438..43f754f05e 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs @@ -60,18 +60,18 @@ public void Load(SpeckleContainerBuilder builder) // binding dependencies builder.AddTransient(); - // register send and receive operation and dependencies - builder.AddScoped>(); - builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); + // register send filters builder.AddScoped(); + builder.AddScoped(); + + // register send conversion cache builder.AddSingleton(); - builder.AddTransient, RhinoRootObjectBuilder>(); - builder.AddTransient, RhinoInstanceObjectsManager>(); // register send operation and dependencies builder.AddScoped>(); builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); builder.AddScoped, RhinoRootObjectBuilder>(); + builder.AddScoped, RhinoInstanceObjectsManager>(); } } diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs index 338ac88f40..e15f6e521b 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs @@ -446,7 +446,7 @@ public BlockInstance BlockReferenceToSpeckle(BlockReference reference) var btrObjId = reference.BlockTableRecord; if (reference.IsDynamicBlock) { - btrObjId = + btrObjId =(BlockTableRecord) reference.AnonymousBlockTableRecord != ObjectId.Null ? reference.AnonymousBlockTableRecord : reference.DynamicBlockTableRecord; From 6d3b3db623abd38d92fcf36d8f9c201e416c7800 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Fri, 14 Jun 2024 08:55:30 +0100 Subject: [PATCH 09/25] wip acad - getting close to wrapping up send --- .../HostApp/AutocadInstanceObjectManager.cs | 66 ++++++++++++++++--- .../Send/AutocadRootObjectBuilder.cs | 18 +++-- .../HostApp/RhinoBlockManager.cs | 1 + .../Receive/RhinoHostObjectBuilder.cs | 1 + 4 files changed, 71 insertions(+), 15 deletions(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 7644cec7e1..9b1e4060e7 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -1,3 +1,4 @@ +using System.DoubleNumerics; using Autodesk.AutoCAD.DatabaseServices; using Speckle.Connectors.Autocad.Operations.Send; using Speckle.Connectors.Utils.Instances; @@ -35,26 +36,50 @@ public UnpackResult UnpackSelection(IEnumerable instanceProxiesWithSameDefinition + ) + ) + { + instanceProxiesWithSameDefinition = new List(); + InstanceProxiesByDefinitionId[definitionId.ToString()] = instanceProxiesWithSameDefinition; + } + // We ensure that all previous instance proxies that have the same definition are at this max depth. I kind of have a feeling this can be done more elegantly, but YOLO + foreach (var instanceProxy in instanceProxiesWithSameDefinition) + { + instanceProxy.MaxDepth = depth; + } + + instanceProxiesWithSameDefinition.Add(InstanceProxies[instanceIdString]); - if (DefinitionProxies.TryGetValue(defintionId.ToString(), out InstanceDefinitionProxy value)) + if (DefinitionProxies.TryGetValue(definitionId.ToString(), out InstanceDefinitionProxy value)) { value.MaxDepth = depth; return; // exit fast - we've parsed this one so no need to go further } - var definition = (BlockTableRecord)transaction.GetObject(defintionId, OpenMode.ForRead); + var definition = (BlockTableRecord)transaction.GetObject(definitionId, OpenMode.ForRead); // definition.Origin var definitionProxy = new InstanceDefinitionProxy() { - applicationId = defintionId.ToString(), + applicationId = definitionId.ToString(), Objects = new(), MaxDepth = depth, ["name"] = definition.Name, @@ -73,6 +98,29 @@ private void UnpackInstance(BlockReference instance, int depth, Transaction tran FlatAtomicObjects[id.ToString()] = new(obj, id.ToString()); } - DefinitionProxies[defintionId.ToString()] = definitionProxy; + DefinitionProxies[definitionId.ToString()] = definitionProxy; + } + + // TODO: units? i think not here + private Matrix4x4 GetMatrix(double[] t) + { + return new Matrix4x4( + t[0], + t[1], + t[2], + t[3], + t[4], + t[5], + t[6], + t[7], + t[8], + t[9], + t[10], + t[11], + t[12], + t[13], + t[14], + t[15] + ); } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs index e3b2adec23..6e218b1add 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs @@ -1,9 +1,9 @@ using System.Diagnostics; using Autodesk.AutoCAD.DatabaseServices; -using Speckle.Connectors.Autocad.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Caching; using Speckle.Connectors.Utils.Conversion; +using Speckle.Connectors.Utils.Instances; using Speckle.Connectors.Utils.Operations; using Speckle.Converters.Common; using Speckle.Core.Logging; @@ -16,17 +16,17 @@ public class AutocadRootObjectBuilder : IRootObjectBuilder private readonly IRootToSpeckleConverter _converter; private readonly string[] _documentPathSeparator = { "\\" }; private readonly ISendConversionCache _sendConversionCache; - private readonly AutocadInstanceObjectManager _instanceObjectManager; + private readonly IInstanceObjectsManager _instanceObjectsManager; public AutocadRootObjectBuilder( IRootToSpeckleConverter converter, ISendConversionCache sendConversionCache, - AutocadInstanceObjectManager instanceObjectManager + IInstanceObjectsManager instanceObjectManager ) { _converter = converter; _sendConversionCache = sendConversionCache; - _instanceObjectManager = instanceObjectManager; + _instanceObjectsManager = instanceObjectManager; } public RootObjectBuilderResult Build( @@ -50,14 +50,20 @@ public RootObjectBuilderResult Build( Dictionary collectionCache = new(); int count = 0; - List results = new(objects.Count); + var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _instanceObjectsManager.UnpackSelection(objects); + // TODO: setup def proxies on root obj + + List results = new(); var cacheHitCount = 0; - foreach (var (dbObject, applicationId) in objects) + + foreach (var (dbObject, applicationId) in atomicObjects) { ct.ThrowIfCancellationRequested(); try { Base converted; + // NOTE TO DIM: I left out here + // I need to: check for instance proxies first and bypass conv if (_sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference value)) { converted = value; diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs index 2c2c23d710..0c0d3350c9 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs @@ -95,6 +95,7 @@ out List instanceProxiesWithSameDefinition } } + // TODO: units! this is a "big" question as we're crossing into converter territory (to a certain extent) private Matrix4x4 XFormToMatrix(Rhino.Geometry.Transform t) => new(t.M00, t.M01, t.M02, t.M03, t.M10, t.M11, t.M12, t.M13, t.M20, t.M21, t.M22, t.M23, t.M30, t.M31, t.M32, t.M33); } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 672bde53d5..f8077b1a8b 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -347,6 +347,7 @@ private static string[] GetLayerPath(TraversalContext context) } // POC: Not too proud of this being here + // TODO: units! this is a "big" question as we're crossing into converter territory (to a certain extent) private Rhino.Geometry.Transform MatrixToTransform(Matrix4x4 matrix) { var t = Rhino.Geometry.Transform.Identity; From 31da29f4ac76351576d1f070897ffb1655825c47 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sat, 15 Jun 2024 20:21:01 +0100 Subject: [PATCH 10/25] wip - units --- Core/Core/Models/Instances/InstanceProxy.cs | 1 + .../HostApp/AutocadInstanceObjectManager.cs | 11 ++++-- .../HostApp/Extensions/AcadUnitsExtension.cs | 39 +++++++++++++++++++ .../Send/AutocadRootObjectBuilder.cs | 13 ++++--- ...Speckle.Connectors.AutocadShared.projitems | 1 + .../Extensions/RhinoUnitsExtension.cs | 37 ++++++++++++++++++ .../HostApp/RhinoBlockManager.cs | 13 +++++-- .../Receive/RhinoHostObjectBuilder.cs | 21 ++++++---- .../Operations/Send/RhinoRootObjectBuilder.cs | 3 ++ 9 files changed, 120 insertions(+), 19 deletions(-) create mode 100644 DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/Extensions/AcadUnitsExtension.cs create mode 100644 DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Extensions/RhinoUnitsExtension.cs diff --git a/Core/Core/Models/Instances/InstanceProxy.cs b/Core/Core/Models/Instances/InstanceProxy.cs index 6a1c8570c2..13fd33bbb1 100644 --- a/Core/Core/Models/Instances/InstanceProxy.cs +++ b/Core/Core/Models/Instances/InstanceProxy.cs @@ -6,5 +6,6 @@ public class InstanceProxy : Base, IInstanceComponent { public string DefinitionId { get; set; } public Matrix4x4 Transform { get; set; } + public string Units { get; set; } = Kits.Units.Meters; public int MaxDepth { get; set; } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 9b1e4060e7..dcc31cdb12 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -1,5 +1,6 @@ using System.DoubleNumerics; using Autodesk.AutoCAD.DatabaseServices; +using Speckle.Connectors.Autocad.HostApp.Extensions; using Speckle.Connectors.Autocad.Operations.Send; using Speckle.Connectors.Utils.Instances; using Speckle.Core.Models.Instances; @@ -36,7 +37,7 @@ public UnpackResult UnpackSelection(IEnumerable instanceProxiesWithSameDefinition foreach (ObjectId id in definition) { var obj = transaction.GetObject(id, OpenMode.ForRead); + var handleIdString = obj.Handle.Value.ToString(); + definitionProxy.Objects.Add(handleIdString); + if (obj is BlockReference blockReference && !blockReference.IsDynamicBlock) { UnpackInstance(blockReference, depth + 1, transaction); } - FlatAtomicObjects[id.ToString()] = new(obj, id.ToString()); + FlatAtomicObjects[handleIdString] = new(obj, handleIdString); } DefinitionProxies[definitionId.ToString()] = definitionProxy; diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/Extensions/AcadUnitsExtension.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/Extensions/AcadUnitsExtension.cs new file mode 100644 index 0000000000..f4ee8e3a66 --- /dev/null +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/Extensions/AcadUnitsExtension.cs @@ -0,0 +1,39 @@ +using Autodesk.AutoCAD.DatabaseServices; +using Speckle.Core.Kits; +using Speckle.Core.Logging; + +namespace Speckle.Connectors.Autocad.HostApp.Extensions; + +public static class AcadUnitsExtension +{ + public static string ToSpeckleString(this UnitsValue units) + { + switch (units) + { + case UnitsValue.Millimeters: + return Units.Millimeters; + case UnitsValue.Centimeters: + return Units.Centimeters; + case UnitsValue.Meters: + return Units.Meters; + case UnitsValue.Kilometers: + return Units.Kilometers; + case UnitsValue.Inches: + case UnitsValue.USSurveyInch: + return Units.Inches; + case UnitsValue.Feet: + case UnitsValue.USSurveyFeet: + return Units.Feet; + case UnitsValue.Yards: + case UnitsValue.USSurveyYard: + return Units.Yards; + case UnitsValue.Miles: + case UnitsValue.USSurveyMile: + return Units.Miles; + case UnitsValue.Undefined: + return Units.None; + default: + throw new SpeckleException($"The Unit System \"{units}\" is unsupported."); + } + } +} diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs index 6e218b1add..56ac1751b1 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs @@ -8,6 +8,7 @@ using Speckle.Converters.Common; using Speckle.Core.Logging; using Speckle.Core.Models; +using Speckle.Core.Models.Instances; namespace Speckle.Connectors.Autocad.Operations.Send; @@ -51,7 +52,7 @@ public RootObjectBuilderResult Build( int count = 0; var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _instanceObjectsManager.UnpackSelection(objects); - // TODO: setup def proxies on root obj + modelWithLayers["instanceDefinitionProxies"] = instanceDefinitionProxies; List results = new(); var cacheHitCount = 0; @@ -62,9 +63,11 @@ public RootObjectBuilderResult Build( try { Base converted; - // NOTE TO DIM: I left out here - // I need to: check for instance proxies first and bypass conv - if (_sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference value)) + if (dbObject is BlockReference && instanceProxies.TryGetValue(applicationId, out InstanceProxy instanceProxy)) + { + converted = instanceProxy; + } + else if (_sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference value)) { converted = value; cacheHitCount++; @@ -96,7 +99,7 @@ public RootObjectBuilderResult Build( // POC: add logging } - onOperationProgressed?.Invoke("Converting", (double)++count / objects.Count); + onOperationProgressed?.Invoke("Converting", (double)++count / atomicObjects.Count); } // POC: Log would be nice, or can be removed. diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems index 48afea17e1..c662f321a1 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Speckle.Connectors.AutocadShared.projitems @@ -22,6 +22,7 @@ + diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Extensions/RhinoUnitsExtension.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Extensions/RhinoUnitsExtension.cs new file mode 100644 index 0000000000..2d431afadc --- /dev/null +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Extensions/RhinoUnitsExtension.cs @@ -0,0 +1,37 @@ +using Rhino; +using Speckle.Core.Kits; +using Speckle.Core.Logging; + +namespace Speckle.Connectors.Rhino7.Extensions; + +public static class RhinoUnitsExtension +{ + public static string ToSpeckleString(this UnitSystem unitSystem) + { + switch (unitSystem) + { + case UnitSystem.None: + return Units.Meters; + case UnitSystem.Millimeters: + return Units.Millimeters; + case UnitSystem.Centimeters: + return Units.Centimeters; + case UnitSystem.Meters: + return Units.Meters; + case UnitSystem.Kilometers: + return Units.Kilometers; + case UnitSystem.Inches: + return Units.Inches; + case UnitSystem.Feet: + return Units.Feet; + case UnitSystem.Yards: + return Units.Yards; + case UnitSystem.Miles: + return Units.Miles; + case UnitSystem.Unset: + return Units.Meters; + default: + throw new SpeckleException($"The Unit System \"{unitSystem}\" is unsupported."); + } + } +} diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs index 0c0d3350c9..1a56f47ebb 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs @@ -1,6 +1,9 @@ using System.DoubleNumerics; +using Rhino; using Rhino.DocObjects; +using Speckle.Connectors.Rhino7.Extensions; using Speckle.Connectors.Utils.Instances; +using Speckle.Converters.Common; using Speckle.Core.Models.Instances; namespace Speckle.Connectors.Rhino7.HostApp; @@ -10,9 +13,11 @@ namespace Speckle.Connectors.Rhino7.HostApp; /// public class RhinoInstanceObjectsManager : IInstanceObjectsManager { - public RhinoInstanceObjectsManager() + private readonly IConversionContextStack _contextStack; + + public RhinoInstanceObjectsManager(IConversionContextStack contextStack) { - // TODO: remove + _contextStack = contextStack; } private Dictionary InstanceProxies { get; set; } = new(); @@ -37,12 +42,14 @@ private void UnpackInstance(InstanceObject instance, int depth = 0) { var instanceId = instance.Id.ToString(); var instanceDefinitionId = instance.InstanceDefinition.Id.ToString(); + InstanceProxies[instanceId] = new InstanceProxy() { applicationId = instanceId, DefinitionId = instance.InstanceDefinition.Id.ToString(), Transform = XFormToMatrix(instance.InstanceXform), - MaxDepth = depth + MaxDepth = depth, + Units = _contextStack.Current.Document.ModelUnitSystem.ToSpeckleString() }; // For each block instance that has the same definition, we need to keep track of the "maximum depth" at which is found. diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index f8077b1a8b..fd15582864 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -3,6 +3,7 @@ using Rhino; using Rhino.DocObjects; using Rhino.Geometry; +using Speckle.Connectors.Rhino7.Extensions; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; using Speckle.Connectors.Utils.Instances; @@ -220,7 +221,7 @@ instanceOrDefinition is InstanceProxy instanceProxy && definitionIdAndApplicationIdMap.TryGetValue(instanceProxy.DefinitionId, out int index) ) { - var transform = MatrixToTransform(instanceProxy.Transform); + var transform = MatrixToTransform(instanceProxy.Transform, instanceProxy.Units); var layerIndex = GetAndCreateLayerFromPath(path, baseLayerName, cache); var id = doc.Objects.AddInstanceObject(index, transform, new ObjectAttributes() { LayerIndex = layerIndex }); if (instanceProxy.applicationId != null) @@ -346,25 +347,29 @@ private static string[] GetLayerPath(TraversalContext context) return reverseOrderPath.Reverse().ToArray(); } - // POC: Not too proud of this being here - // TODO: units! this is a "big" question as we're crossing into converter territory (to a certain extent) - private Rhino.Geometry.Transform MatrixToTransform(Matrix4x4 matrix) + // POC: Not too proud of this being here, will be moving soon to the instance manager + private Transform MatrixToTransform(Matrix4x4 matrix, string units) { - var t = Rhino.Geometry.Transform.Identity; + var conversionFactor = Units.GetConversionFactor( + units, + _contextStack.Current.Document.ModelUnitSystem.ToSpeckleString() + ); + + var t = Transform.Identity; t.M00 = matrix.M11; t.M01 = matrix.M12; t.M02 = matrix.M13; - t.M03 = matrix.M14; + t.M03 = matrix.M14 * conversionFactor; t.M10 = matrix.M21; t.M11 = matrix.M22; t.M12 = matrix.M23; - t.M13 = matrix.M24; + t.M13 = matrix.M24 * conversionFactor; t.M20 = matrix.M31; t.M21 = matrix.M32; t.M22 = matrix.M33; - t.M23 = matrix.M34; + t.M23 = matrix.M34 * conversionFactor; t.M30 = matrix.M41; t.M31 = matrix.M42; diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index 0b9e9fc074..7cc0272bb5 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -22,15 +22,18 @@ public class RhinoRootObjectBuilder : IRootObjectBuilder private readonly IUnitOfWorkFactory _unitOfWorkFactory; private readonly ISendConversionCache _sendConversionCache; private readonly IInstanceObjectsManager _instanceObjectsManager; + private readonly IConversionContextStack _contextStack; public RhinoRootObjectBuilder( IUnitOfWorkFactory unitOfWorkFactory, ISendConversionCache sendConversionCache, + IConversionContextStack contextStack, IInstanceObjectsManager instanceObjectsManager ) { _unitOfWorkFactory = unitOfWorkFactory; _sendConversionCache = sendConversionCache; + _contextStack = contextStack; _instanceObjectsManager = instanceObjectsManager; } From c69a7812cd91c274ad47fb56aa1167e8c7d5de37 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sun, 16 Jun 2024 11:33:54 +0100 Subject: [PATCH 11/25] feat(dui3): blocks poc wip: adds rhino layer manager, moves instance baking to instance manager, etc. --- .../HostApp/AutocadInstanceObjectManager.cs | 9 +- .../HostApp/AutocadLayerManager.cs | 2 +- .../Receive/AutocadHostObjectBuilder.cs | 2 +- .../RhinoConnectorModule.cs | 1 + .../HostApp/RhinoBlockManager.cs | 108 -------- .../HostApp/RhinoInstanceObjectsManager.cs | 247 ++++++++++++++++++ .../HostApp/RhinoLayerManager.cs | 130 +++++++++ .../Receive/RhinoHostObjectBuilder.cs | 156 ++--------- .../Operations/Send/RhinoRootObjectBuilder.cs | 65 +---- .../Instances/IInstanceObjectsManager.cs | 14 + 10 files changed, 428 insertions(+), 306 deletions(-) delete mode 100644 DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs create mode 100644 DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs create mode 100644 DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index dcc31cdb12..23e1b4e1de 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -106,7 +106,14 @@ out List instanceProxiesWithSameDefinition DefinitionProxies[definitionId.ToString()] = definitionProxy; } - // TODO: units? i think not here + // TODO: implement + public BakeResult BakeInstances( + List<(string[] layerPath, IInstanceComponent obj)> instanceComponents, + Dictionary> applicationIdMap, + string baseLayerName, + Action? onOperationProgressed + ) => throw new NotImplementedException(); + private Matrix4x4 GetMatrix(double[] t) { return new Matrix4x4( diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs index 7fb81ccd82..4a0452a16d 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs @@ -23,7 +23,7 @@ public AutocadLayerManager(AutocadContext autocadContext) /// Prefix to add layer name. /// list of entries to concat with hyphen. /// Full layer name with provided prefix and path. - public string LayerFullName(string baseLayerPrefix, string path) + public string GetFullLayerName(string baseLayerPrefix, string path) { var layerFullName = baseLayerPrefix + string.Join("-", path); return _autocadContext.RemoveInvalidChars(layerFullName); diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index e5b720aad7..cad61d949f 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -114,6 +114,6 @@ private string GetLayerPath(TraversalContext context, string baseLayerPrefix) string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); string[] path = collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); - return _autocadLayerManager.LayerFullName(baseLayerPrefix, string.Join("-", path)); //TODO: reverse path? + return _autocadLayerManager.GetFullLayerName(baseLayerPrefix, string.Join("-", path)); //TODO: reverse path? } } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs index 43f754f05e..a72bee9597 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs @@ -73,5 +73,6 @@ public void Load(SpeckleContainerBuilder builder) builder.AddScoped, RhinoRootObjectBuilder>(); builder.AddScoped, RhinoInstanceObjectsManager>(); + builder.AddScoped(); } } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs deleted file mode 100644 index 1a56f47ebb..0000000000 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoBlockManager.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.DoubleNumerics; -using Rhino; -using Rhino.DocObjects; -using Speckle.Connectors.Rhino7.Extensions; -using Speckle.Connectors.Utils.Instances; -using Speckle.Converters.Common; -using Speckle.Core.Models.Instances; - -namespace Speckle.Connectors.Rhino7.HostApp; - -/// -/// -/// -public class RhinoInstanceObjectsManager : IInstanceObjectsManager -{ - private readonly IConversionContextStack _contextStack; - - public RhinoInstanceObjectsManager(IConversionContextStack contextStack) - { - _contextStack = contextStack; - } - - private Dictionary InstanceProxies { get; set; } = new(); - private Dictionary> InstanceProxiesByDefinitionId { get; set; } = new(); - private Dictionary DefinitionProxies { get; set; } = new(); - private Dictionary FlatAtomicObjects { get; set; } = new(); - - public UnpackResult UnpackSelection(IEnumerable objects) - { - foreach (var obj in objects) - { - if (obj is InstanceObject instanceObject) - { - UnpackInstance(instanceObject); - } - FlatAtomicObjects[obj.Id.ToString()] = obj; - } - return new(FlatAtomicObjects.Values.ToList(), InstanceProxies, DefinitionProxies.Values.ToList()); - } - - private void UnpackInstance(InstanceObject instance, int depth = 0) - { - var instanceId = instance.Id.ToString(); - var instanceDefinitionId = instance.InstanceDefinition.Id.ToString(); - - InstanceProxies[instanceId] = new InstanceProxy() - { - applicationId = instanceId, - DefinitionId = instance.InstanceDefinition.Id.ToString(), - Transform = XFormToMatrix(instance.InstanceXform), - MaxDepth = depth, - Units = _contextStack.Current.Document.ModelUnitSystem.ToSpeckleString() - }; - - // For each block instance that has the same definition, we need to keep track of the "maximum depth" at which is found. - // This will enable on receive to create them in the correct order (descending by max depth, interleaved definitions and instances). - // We need to interleave the creation of definitions and instances, as some definitions may depend on instances. - if ( - !InstanceProxiesByDefinitionId.TryGetValue( - instanceDefinitionId, - out List instanceProxiesWithSameDefinition - ) - ) - { - instanceProxiesWithSameDefinition = new List(); - InstanceProxiesByDefinitionId[instanceDefinitionId] = instanceProxiesWithSameDefinition; - } - - // We ensure that all previous instance proxies that have the same definition are at this max depth. I kind of have a feeling this can be done more elegantly, but YOLO - foreach (var instanceProxy in instanceProxiesWithSameDefinition) - { - instanceProxy.MaxDepth = depth; - } - - instanceProxiesWithSameDefinition.Add(InstanceProxies[instanceId]); - - if (DefinitionProxies.TryGetValue(instanceDefinitionId, out InstanceDefinitionProxy value)) - { - value.MaxDepth = depth; - return; - } - - var definition = new InstanceDefinitionProxy - { - applicationId = instanceDefinitionId, - Objects = new List(), - MaxDepth = depth, - ["name"] = instance.InstanceDefinition.Name, - ["description"] = instance.InstanceDefinition.Description - }; - - DefinitionProxies[instance.InstanceDefinition.Id.ToString()] = definition; - - foreach (var obj in instance.InstanceDefinition.GetObjects()) - { - definition.Objects.Add(obj.Id.ToString()); - if (obj is InstanceObject localInstance) - { - UnpackInstance(localInstance, depth + 1); - } - FlatAtomicObjects[obj.Id.ToString()] = obj; - } - } - - // TODO: units! this is a "big" question as we're crossing into converter territory (to a certain extent) - private Matrix4x4 XFormToMatrix(Rhino.Geometry.Transform t) => - new(t.M00, t.M01, t.M02, t.M03, t.M10, t.M11, t.M12, t.M13, t.M20, t.M21, t.M22, t.M23, t.M30, t.M31, t.M32, t.M33); -} diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs new file mode 100644 index 0000000000..8bb90205bf --- /dev/null +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs @@ -0,0 +1,247 @@ +using System.DoubleNumerics; +using Rhino; +using Rhino.DocObjects; +using Rhino.Geometry; +using Speckle.Connectors.Rhino7.Extensions; +using Speckle.Connectors.Utils.Conversion; +using Speckle.Connectors.Utils.Instances; +using Speckle.Converters.Common; +using Speckle.Core.Kits; +using Speckle.Core.Logging; +using Speckle.Core.Models; +using Speckle.Core.Models.Instances; + +namespace Speckle.Connectors.Rhino7.HostApp; + +/// +/// +/// Expects to be a scoped dependency per send or receive operation. +/// +public class RhinoInstanceObjectsManager : IInstanceObjectsManager +{ + private readonly IConversionContextStack _contextStack; + private readonly Dictionary _instanceProxies = new(); + private readonly Dictionary> _instanceProxiesByDefinitionId = new(); + private readonly Dictionary _definitionProxies = new(); + private readonly Dictionary _flatAtomicObjects = new(); + private readonly RhinoLayerManager _layerManager; + + public RhinoInstanceObjectsManager( + IConversionContextStack contextStack, + RhinoLayerManager layerManager + ) + { + _contextStack = contextStack; + _layerManager = layerManager; + } + + public UnpackResult UnpackSelection(IEnumerable objects) + { + foreach (var obj in objects) + { + if (obj is InstanceObject instanceObject) + { + UnpackInstance(instanceObject); + } + _flatAtomicObjects[obj.Id.ToString()] = obj; + } + return new(_flatAtomicObjects.Values.ToList(), _instanceProxies, _definitionProxies.Values.ToList()); + } + + private void UnpackInstance(InstanceObject instance, int depth = 0) + { + var instanceId = instance.Id.ToString(); + var instanceDefinitionId = instance.InstanceDefinition.Id.ToString(); + + _instanceProxies[instanceId] = new InstanceProxy() + { + applicationId = instanceId, + DefinitionId = instance.InstanceDefinition.Id.ToString(), + Transform = XFormToMatrix(instance.InstanceXform), + MaxDepth = depth, + Units = _contextStack.Current.Document.ModelUnitSystem.ToSpeckleString() + }; + + // For each block instance that has the same definition, we need to keep track of the "maximum depth" at which is found. + // This will enable on receive to create them in the correct order (descending by max depth, interleaved definitions and instances). + // We need to interleave the creation of definitions and instances, as some definitions may depend on instances. + if ( + !_instanceProxiesByDefinitionId.TryGetValue( + instanceDefinitionId, + out List instanceProxiesWithSameDefinition + ) + ) + { + instanceProxiesWithSameDefinition = new List(); + _instanceProxiesByDefinitionId[instanceDefinitionId] = instanceProxiesWithSameDefinition; + } + + // We ensure that all previous instance proxies that have the same definition are at this max depth. I kind of have a feeling this can be done more elegantly, but YOLO + foreach (var instanceProxy in instanceProxiesWithSameDefinition) + { + instanceProxy.MaxDepth = depth; + } + + instanceProxiesWithSameDefinition.Add(_instanceProxies[instanceId]); + + if (_definitionProxies.TryGetValue(instanceDefinitionId, out InstanceDefinitionProxy value)) + { + value.MaxDepth = depth; + return; + } + + var definition = new InstanceDefinitionProxy + { + applicationId = instanceDefinitionId, + Objects = new List(), + MaxDepth = depth, + ["name"] = instance.InstanceDefinition.Name, + ["description"] = instance.InstanceDefinition.Description + }; + + _definitionProxies[instance.InstanceDefinition.Id.ToString()] = definition; + + foreach (var obj in instance.InstanceDefinition.GetObjects()) + { + definition.Objects.Add(obj.Id.ToString()); + if (obj is InstanceObject localInstance) + { + UnpackInstance(localInstance, depth + 1); + } + _flatAtomicObjects[obj.Id.ToString()] = obj; + } + } + + /// + /// Bakes in the host app doc instances. Assumes constituent atomic objects already present in the host app. + /// + /// Instance definitions and instances that need creating. + /// A dict mapping { original application id -> [resulting application ids post conversion] } + /// + public BakeResult BakeInstances( + List<(string[] layerPath, IInstanceComponent obj)> instanceComponents, + Dictionary> applicationIdMap, + string baseLayerName, + Action? onOperationProgressed + ) + { + var doc = _contextStack.Current.Document; + var sortedInstanceComponents = instanceComponents + .OrderByDescending(x => x.obj.MaxDepth) // Sort by max depth, so we start baking from the deepest element first + .ThenBy(x => x.obj is InstanceDefinitionProxy ? 0 : 1) // Ensure we bake the deepest definition first, then any instances that depend on it + .ToList(); + var definitionIdAndApplicationIdMap = new Dictionary(); + + var count = 0; + var conversionResults = new List(); + var createdObjectIds = new List(); + var consumedObjectIds = new List(); + foreach (var (path, instanceOrDefinition) in sortedInstanceComponents) + { + onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count); + try + { + if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) + { + var currentApplicationObjectsIds = definitionProxy.Objects + .Select(x => applicationIdMap.TryGetValue(x, out List value) ? value : null) + .Where(x => x is not null) + .SelectMany(id => id) + .ToList(); + + var definitionGeometryList = new List(); + var attributes = new List(); + + foreach (var id in currentApplicationObjectsIds) + { + var docObject = doc.Objects.FindId(new Guid(id)); + definitionGeometryList.Add(docObject.Geometry); + attributes.Add(docObject.Attributes); + } + + // POC: Currently we're relying on the definition name for identification if it's coming from speckle and from which model; could we do something else? + var defName = $"{baseLayerName} ({definitionProxy.applicationId})"; + var defIndex = doc.InstanceDefinitions.Add( + defName, + "No description", // POC: perhaps bring it along from source? We'd need to look at ACAD first + Point3d.Origin, + definitionGeometryList, + attributes + ); + + // POC: check on defIndex -1, means we haven't created anything - this is most likely an recoverable error at this stage + if (defIndex == -1) + { + throw new ConversionException("Failed to create an instance defintion object."); + } + + if (definitionProxy.applicationId != null) + { + definitionIdAndApplicationIdMap[definitionProxy.applicationId] = defIndex; + } + + // Rhino deletes original objects on block creation - we should do the same. + doc.Objects.Delete(currentApplicationObjectsIds.Select(stringId => new Guid(stringId)), false); + consumedObjectIds.AddRange(currentApplicationObjectsIds); + createdObjectIds.RemoveAll(id => consumedObjectIds.Contains(id)); // in case we've consumed some existing instances + } + + if ( + instanceOrDefinition is InstanceProxy instanceProxy + && definitionIdAndApplicationIdMap.TryGetValue(instanceProxy.DefinitionId, out int index) + ) + { + var transform = MatrixToTransform(instanceProxy.Transform, instanceProxy.Units); + var layerIndex = _layerManager.GetAndCreateLayerFromPath(path, baseLayerName); + var id = doc.Objects.AddInstanceObject(index, transform, new ObjectAttributes() { LayerIndex = layerIndex }); + if (instanceProxy.applicationId != null) + { + applicationIdMap[instanceProxy.applicationId] = new List() { id.ToString() }; + } + + createdObjectIds.Add(id.ToString()); + conversionResults.Add(new(Status.SUCCESS, instanceProxy, id.ToString(), "Instance (Block)")); + } + } + catch (Exception ex) when (!ex.IsFatal()) + { + conversionResults.Add(new(Status.ERROR, instanceOrDefinition as Base ?? new Base(), null, null, ex)); + } + } + + return new(createdObjectIds, consumedObjectIds, conversionResults); + } + + private Matrix4x4 XFormToMatrix(Transform t) => + new(t.M00, t.M01, t.M02, t.M03, t.M10, t.M11, t.M12, t.M13, t.M20, t.M21, t.M22, t.M23, t.M30, t.M31, t.M32, t.M33); + + private Transform MatrixToTransform(Matrix4x4 matrix, string units) + { + var conversionFactor = Units.GetConversionFactor( + units, + _contextStack.Current.Document.ModelUnitSystem.ToSpeckleString() + ); + + var t = Transform.Identity; + t.M00 = matrix.M11; + t.M01 = matrix.M12; + t.M02 = matrix.M13; + t.M03 = matrix.M14 * conversionFactor; + + t.M10 = matrix.M21; + t.M11 = matrix.M22; + t.M12 = matrix.M23; + t.M13 = matrix.M24 * conversionFactor; + + t.M20 = matrix.M31; + t.M21 = matrix.M32; + t.M22 = matrix.M33; + t.M23 = matrix.M34 * conversionFactor; + + t.M30 = matrix.M41; + t.M31 = matrix.M42; + t.M32 = matrix.M43; + t.M33 = matrix.M44; + return t; + } +} diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs new file mode 100644 index 0000000000..dd01037582 --- /dev/null +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs @@ -0,0 +1,130 @@ +using System.Diagnostics.Contracts; +using Rhino; +using Rhino.DocObjects; +using Speckle.Converters.Common; +using Speckle.Core.Models; +using Speckle.Core.Models.GraphTraversal; + +namespace Speckle.Connectors.Rhino7.HostApp; + +/// +/// Utility class managing layer creation and/or extraction from rhino. Expects to be a scoped dependency per send or receive operation. +/// +public class RhinoLayerManager +{ + private readonly IConversionContextStack _contextStack; + private readonly Dictionary _hostLayerCache; + private readonly Dictionary _layerCollectionCache; + + public RhinoLayerManager(IConversionContextStack contextStack) + { + _contextStack = contextStack; + _hostLayerCache = new(); + _layerCollectionCache = new(); + } + + /// + /// Creates the base layer and adds it to the cache. + /// + /// + public void CreateBaseLayer(string baseLayerName) + { + var index = _contextStack.Current.Document.Layers.Add(new Layer { Name = baseLayerName }); + _hostLayerCache.Add(baseLayerName, index); + } + + /// + /// For receive: Use this method to construct layers in the host app when receiving.. + /// + /// + /// + /// + public int GetAndCreateLayerFromPath(string[] path, string baseLayerName) + { + var fullLayerName = string.Join(Layer.PathSeparator, path); + if (_hostLayerCache.TryGetValue(fullLayerName, out int existingLayerIndex)) + { + return existingLayerIndex; + } + + var currentLayerName = baseLayerName; + RhinoDoc currentDocument = _contextStack.Current.Document; + + var previousLayer = currentDocument.Layers.FindName(currentLayerName); + foreach (var layerName in path) + { + currentLayerName = baseLayerName + Layer.PathSeparator + layerName; + currentLayerName = currentLayerName.Replace("{", "").Replace("}", ""); // Rhino specific cleanup for gh (see RemoveInvalidRhinoChars) + if (_hostLayerCache.TryGetValue(currentLayerName, out int value)) + { + previousLayer = currentDocument.Layers.FindIndex(value); + continue; + } + + var cleanNewLayerName = layerName.Replace("{", "").Replace("}", ""); + var newLayer = new Layer { Name = cleanNewLayerName, ParentLayerId = previousLayer.Id }; + var index = currentDocument.Layers.Add(newLayer); + _hostLayerCache.Add(currentLayerName, index); + previousLayer = currentDocument.Layers.FindIndex(index); // note we need to get the correct id out, hence why we're double calling this + } + return previousLayer.Index; + } + + /// + /// For send: Use this method to construct the root commit object while converting objects. + /// Returns the host collection corresponding to the provided layer. If it's the first time that it is being asked for, it will be created and stored in the root object collection. + /// + /// The layer you want the equivalent collection for. + /// The root object that will be sent to Speckle, and will host all collections. + /// + public Collection GetHostObjectCollection(Layer layer, Collection rootObjectCollection) + { + if (_layerCollectionCache.TryGetValue(layer.Index, out Collection value)) + { + return value; + } + + var names = layer.FullPath.Split(new[] { Layer.PathSeparator }, StringSplitOptions.None); + var path = names[0]; + var index = 0; + var previousCollection = rootObjectCollection; + foreach (var layerName in names) + { + var existingLayerIndex = RhinoDoc.ActiveDoc.Layers.FindByFullPath(path, -1); + Collection? childCollection = null; + if (_layerCollectionCache.TryGetValue(existingLayerIndex, out Collection? collection)) + { + childCollection = collection; + } + else + { + childCollection = new Collection(layerName, "layer") + { + applicationId = RhinoDoc.ActiveDoc.Layers[existingLayerIndex].Id.ToString() + }; + previousCollection.elements.Add(childCollection); + _layerCollectionCache[existingLayerIndex] = childCollection; + } + + previousCollection = childCollection; + + if (index < names.Length - 1) + { + path += Layer.PathSeparator + names[index + 1]; + } + index++; + } + + _layerCollectionCache[layer.Index] = previousCollection; + return previousCollection; + } + + [Pure] + public string[] GetLayerPath(TraversalContext context) + { + string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); + string[] reverseOrderPath = + collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); + return reverseOrderPath.Reverse().ToArray(); + } +} diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index fd15582864..7da588bc9e 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -1,9 +1,9 @@ -using System.Diagnostics.Contracts; using System.DoubleNumerics; using Rhino; using Rhino.DocObjects; using Rhino.Geometry; using Speckle.Connectors.Rhino7.Extensions; +using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; using Speckle.Connectors.Utils.Instances; @@ -22,17 +22,20 @@ public class RhinoHostObjectBuilder : IHostObjectBuilder private readonly IConversionContextStack _contextStack; private readonly GraphTraversal _traverseFunction; private readonly IInstanceObjectsManager _instanceObjectsManager; + private readonly RhinoLayerManager _layerManager; public RhinoHostObjectBuilder( IRootToHostConverter converter, IConversionContextStack contextStack, GraphTraversal traverseFunction, + RhinoLayerManager layerManager, IInstanceObjectsManager instanceObjectsManager ) { _converter = converter; _contextStack = contextStack; _traverseFunction = traverseFunction; + _layerManager = layerManager; _instanceObjectsManager = instanceObjectsManager; } @@ -67,13 +70,7 @@ CancellationToken cancellationToken return conversionResults; } - // POC: Potentially refactor out into an IObjectBaker. - // POC: temp disable -#pragma warning disable CA1506 -#pragma warning disable CA1502 private HostObjectBuilderResult BakeObjects( -#pragma warning restore CA1502 -#pragma warning restore CA1506 IEnumerable objectsGraph, List? instanceDefinitionProxies, string baseLayerName, @@ -81,13 +78,10 @@ private HostObjectBuilderResult BakeObjects( ) { RhinoDoc doc = _contextStack.Current.Document; - var rootLayerIndex = _contextStack.Current.Document.Layers.Find(Guid.Empty, baseLayerName, RhinoMath.UnsetIntIndex); + var rootLayerIndex = _contextStack.Current.Document.Layers.Find(Guid.Empty, baseLayerName, RhinoMath.UnsetIntIndex); PreReceiveDeepClean(baseLayerName, rootLayerIndex); - - var cache = new Dictionary(); - rootLayerIndex = doc.Layers.Add(new Layer { Name = baseLayerName }); - cache.Add(baseLayerName, rootLayerIndex); + _layerManager.CreateBaseLayer(baseLayerName); using var noDraw = new DisableRedrawScope(doc.Views); @@ -108,7 +102,7 @@ private HostObjectBuilderResult BakeObjects( foreach (TraversalContext tc in traversalContexts) { - var path = GetLayerPath(tc); + var path = _layerManager.GetLayerPath(tc); if (tc.Current is IInstanceComponent flocker) { instanceComponents.Add((path, flocker)); @@ -120,20 +114,15 @@ private HostObjectBuilderResult BakeObjects( } // Stage 1: Convert atomic objects - var applicationIdMap = new Dictionary>(); // used in converting blocks in stage 2 + var applicationIdMap = new Dictionary>(); // used in converting blocks in stage 2. keeps track of original app id => resulting new app ids post baking var count = 0; foreach (var (path, obj) in atomicObjects) { onOperationProgressed?.Invoke("Converting objects", (double)++count / atomicObjects.Count); try { - var fullLayerName = string.Join(Layer.PathSeparator, path); - var layerIndex = cache.TryGetValue(fullLayerName, out int value) - ? value - : GetAndCreateLayerFromPath(path, baseLayerName, cache); - + var layerIndex = _layerManager.GetAndCreateLayerFromPath(path, baseLayerName); var result = _converter.Convert(obj); - var conversionIds = HandleConversionResult(result, obj, layerIndex).ToList(); foreach (var r in conversionIds) { @@ -155,89 +144,17 @@ private HostObjectBuilderResult BakeObjects( } // Stage 2: Convert instances - // TODO: do not forget to add to report things - var sortedInstanceComponents = instanceComponents - .OrderByDescending(x => x.obj.MaxDepth) // Sort by max depth, so we start baking from the deepest element first - .ThenBy(x => x.obj is InstanceDefinitionProxy ? 0 : 1) // Ensure we bake the deepest definition first, then any instances that depend on it - .ToList(); - var definitionIdAndApplicationIdMap = new Dictionary(); - - count = 0; - foreach (var (path, instanceOrDefinition) in sortedInstanceComponents) - { - onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count); - try - { - if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) - { - var currentApplicationObjectsIds = definitionProxy.Objects - .Select(x => applicationIdMap.TryGetValue(x, out List value) ? value : null) - .Where(x => x is not null) - .SelectMany(id => id) - .ToList(); - - var definitionGeometryList = new List(); - var attributes = new List(); - - foreach (var id in currentApplicationObjectsIds) - { - var docObject = doc.Objects.FindId(new Guid(id)); - definitionGeometryList.Add(docObject.Geometry); - attributes.Add(docObject.Attributes); - } - - // POC: Currently we're relying on the definition name for identification if it's coming from speckle and from which model; could we do something else? - var defName = $"{baseLayerName} ({definitionProxy.applicationId})"; - var defIndex = doc.InstanceDefinitions.Add( - defName, - "No description", // POC: perhaps bring it along from source? We'd need to look at ACAD first - Point3d.Origin, - definitionGeometryList, - attributes - ); - - // POC: check on defIndex -1, means we haven't created anything - this is most likely an recoverable error at this stage - if (defIndex == -1) - { - throw new ConversionException("Failed to create an instance defintion object."); - } - - if (definitionProxy.applicationId != null) - { - definitionIdAndApplicationIdMap[definitionProxy.applicationId] = defIndex; - } - - // Rhino deletes original objects on block creation - we should do the same. - doc.Objects.Delete(currentApplicationObjectsIds.Select(stringId => new Guid(stringId)), false); - bakedObjectIds.RemoveAll(id => currentApplicationObjectsIds.Contains(id)); - conversionResults.RemoveAll( - conversionResult => - conversionResult.ResultId != null && currentApplicationObjectsIds.Contains(conversionResult.ResultId) // note: as in rhino created objects are deleted, highlighting them won't work - ); - } - - if ( - instanceOrDefinition is InstanceProxy instanceProxy - && definitionIdAndApplicationIdMap.TryGetValue(instanceProxy.DefinitionId, out int index) - ) - { - var transform = MatrixToTransform(instanceProxy.Transform, instanceProxy.Units); - var layerIndex = GetAndCreateLayerFromPath(path, baseLayerName, cache); - var id = doc.Objects.AddInstanceObject(index, transform, new ObjectAttributes() { LayerIndex = layerIndex }); - if (instanceProxy.applicationId != null) - { - applicationIdMap[instanceProxy.applicationId] = new List() { id.ToString() }; - } + var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = _instanceObjectsManager.BakeInstances( + instanceComponents, + applicationIdMap, + baseLayerName, + onOperationProgressed + ); - bakedObjectIds.Add(id.ToString()); - conversionResults.Add(new(Status.SUCCESS, instanceProxy, id.ToString(), "Instance (Block)")); - } - } - catch (Exception ex) when (!ex.IsFatal()) - { - conversionResults.Add(new(Status.ERROR, instanceOrDefinition as Base ?? new Base(), null, null, ex)); - } - } + bakedObjectIds.RemoveAll(id => consumedObjectIds.Contains(id)); // remove all objects that have been "consumed" + bakedObjectIds.AddRange(createdInstanceIds); // add instance ids + conversionResults.RemoveAll(result => result.ResultId != null && consumedObjectIds.Contains(result.ResultId)); // remove all conversion results for atomic objects that have been consumed (POC: not that cool, but prevents problems on object highlighting) + conversionResults.AddRange(instanceConversionResults); // add instance conversion results to our list // Stage 3: Return return new(bakedObjectIds, conversionResults); @@ -312,41 +229,6 @@ private Group BakeObjectsAsGroup(string groupName, IEnumerable lis return group; } - // POC: This is the original DUI3 function, this will grow over time as we add more conversions that are missing, so it should be refactored out into an ILayerManager or some sort of service. - private int GetAndCreateLayerFromPath(string[] path, string baseLayerName, Dictionary cache) - { - var currentLayerName = baseLayerName; - RhinoDoc currentDocument = _contextStack.Current.Document; - - var previousLayer = currentDocument.Layers.FindName(currentLayerName); - foreach (var layerName in path) - { - currentLayerName = baseLayerName + Layer.PathSeparator + layerName; - currentLayerName = currentLayerName.Replace("{", "").Replace("}", ""); // Rhino specific cleanup for gh (see RemoveInvalidRhinoChars) - if (cache.TryGetValue(currentLayerName, out int value)) - { - previousLayer = currentDocument.Layers.FindIndex(value); - continue; - } - - var cleanNewLayerName = layerName.Replace("{", "").Replace("}", ""); - var newLayer = new Layer { Name = cleanNewLayerName, ParentLayerId = previousLayer.Id }; - var index = currentDocument.Layers.Add(newLayer); - cache.Add(currentLayerName, index); - previousLayer = currentDocument.Layers.FindIndex(index); // note we need to get the correct id out, hence why we're double calling this - } - return previousLayer.Index; - } - - [Pure] - private static string[] GetLayerPath(TraversalContext context) - { - string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); - string[] reverseOrderPath = - collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); - return reverseOrderPath.Reverse().ToArray(); - } - // POC: Not too proud of this being here, will be moving soon to the instance manager private Transform MatrixToTransform(Matrix4x4 matrix, string units) { diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index 7cc0272bb5..2d61867232 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -5,6 +5,7 @@ using Speckle.Autofac.DependencyInjection; using Speckle.Converters.Common; using Speckle.Connectors.DUI.Models.Card.SendFilter; +using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Caching; using Speckle.Connectors.Utils.Conversion; @@ -23,17 +24,20 @@ public class RhinoRootObjectBuilder : IRootObjectBuilder private readonly ISendConversionCache _sendConversionCache; private readonly IInstanceObjectsManager _instanceObjectsManager; private readonly IConversionContextStack _contextStack; + private readonly RhinoLayerManager _layerManager; public RhinoRootObjectBuilder( IUnitOfWorkFactory unitOfWorkFactory, ISendConversionCache sendConversionCache, IConversionContextStack contextStack, + RhinoLayerManager layerManager, IInstanceObjectsManager instanceObjectsManager ) { _unitOfWorkFactory = unitOfWorkFactory; _sendConversionCache = sendConversionCache; _contextStack = contextStack; + _layerManager = layerManager; _instanceObjectsManager = instanceObjectsManager; } @@ -56,7 +60,7 @@ private RootObjectBuilderResult ConvertObjects( using var uow = _unitOfWorkFactory.Resolve(); var converter = uow.Service; - var rootObjectCollection = new Collection { name = RhinoDoc.ActiveDoc.Name ?? "Unnamed document" }; + var rootObjectCollection = new Collection { name = _contextStack.Current.Document.Name ?? "Unnamed document" }; int count = 0; Dictionary layerCollectionCache = new(); @@ -75,10 +79,9 @@ private RootObjectBuilderResult ConvertObjects( { cancellationToken.ThrowIfCancellationRequested(); - // POC: This uses the ActiveDoc but it is bad practice to do so. A context object should be injected that would contain the Doc. - var layer = RhinoDoc.ActiveDoc.Layers[rhinoObject.Attributes.LayerIndex]; + var layer = _contextStack.Current.Document.Layers[rhinoObject.Attributes.LayerIndex]; - var collectionHost = GetHostObjectCollection(layerCollectionCache, layer, rootObjectCollection); + var collectionHost = _layerManager.GetHostObjectCollection(layer, rootObjectCollection); var applicationId = rhinoObject.Id.ToString(); try @@ -126,58 +129,4 @@ private RootObjectBuilderResult ConvertObjects( // 5. profit return new(rootObjectCollection, results); } - - /// - /// Returns the host collection based on the provided layer. If it's not found, it will be created and hosted within the rootObjectCollection. - /// - /// - /// - /// - /// - private Collection GetHostObjectCollection( - Dictionary layerCollectionCache, - Layer layer, - Collection rootObjectCollection - ) - { - // POC: This entire implementation should be broken down and potentially injected in. - if (layerCollectionCache.TryGetValue(layer.Index, out Collection value)) - { - return value; - } - - var names = layer.FullPath.Split(new[] { Layer.PathSeparator }, StringSplitOptions.None); - var path = names[0]; - var index = 0; - var previousCollection = rootObjectCollection; - foreach (var layerName in names) - { - var existingLayerIndex = RhinoDoc.ActiveDoc.Layers.FindByFullPath(path, -1); - Collection? childCollection = null; - if (layerCollectionCache.TryGetValue(existingLayerIndex, out Collection? collection)) - { - childCollection = collection; - } - else - { - childCollection = new Collection(layerName, "layer") - { - applicationId = RhinoDoc.ActiveDoc.Layers[existingLayerIndex].Id.ToString() - }; - previousCollection.elements.Add(childCollection); - layerCollectionCache[existingLayerIndex] = childCollection; - } - - previousCollection = childCollection; - - if (index < names.Length - 1) - { - path += Layer.PathSeparator + names[index + 1]; - } - index++; - } - - layerCollectionCache[layer.Index] = previousCollection; - return previousCollection; - } } diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs index 2397fa83fb..53def687f1 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs @@ -1,3 +1,4 @@ +using Speckle.Connectors.Utils.Conversion; using Speckle.Core.Models.Instances; namespace Speckle.Connectors.Utils.Instances; @@ -13,6 +14,13 @@ public interface IInstanceObjectsManager /// /// UnpackResult UnpackSelection(IEnumerable objects); + + BakeResult BakeInstances( + List<(string[] layerPath, IInstanceComponent obj)> instanceComponents, + Dictionary> applicationIdMap, + string baseLayerName, + Action? onOperationProgressed + ); } public record UnpackResult( @@ -20,3 +28,9 @@ public record UnpackResult( Dictionary InstanceProxies, List InstanceDefinitionProxies ); + +public record BakeResult( + List CreatedInstanceIds, + List ConsumedObjectIds, + List InstanceConversionResults +); From 5c1c56025949c29b58d6f531220b816a1aec5f3a Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sun, 16 Jun 2024 12:49:47 +0100 Subject: [PATCH 12/25] feat(dui3): blocks poc WIP - acad receive --- .../HostApp/AutocadInstanceObjectManager.cs | 28 +++++- .../Receive/AutocadHostObjectBuilder.cs | 86 ++++++++++++++++--- .../Receive/RhinoHostObjectBuilder.cs | 48 ++--------- .../Instances/IInstanceObjectsManager.cs | 1 + 4 files changed, 107 insertions(+), 56 deletions(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 23e1b4e1de..b6aaeaac12 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -106,13 +106,37 @@ out List instanceProxiesWithSameDefinition DefinitionProxies[definitionId.ToString()] = definitionProxy; } - // TODO: implement public BakeResult BakeInstances( List<(string[] layerPath, IInstanceComponent obj)> instanceComponents, Dictionary> applicationIdMap, string baseLayerName, Action? onOperationProgressed - ) => throw new NotImplementedException(); + ) + { + var sortedInstanceComponents = instanceComponents + .OrderByDescending(x => x.obj.MaxDepth) // Sort by max depth, so we start baking from the deepest element first + .ThenBy(x => x.obj is InstanceDefinitionProxy ? 0 : 1) // Ensure we bake the deepest definition first, then any instances that depend on it + .ToList(); + + foreach (var (path, instanceOrDefinition) in sortedInstanceComponents) + { + if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) + { + // TODO + var currentApplicationObjectIds = definitionProxy.Objects + .Select(id => applicationIdMap.TryGetValue(id, out List value) ? value : null) + .Where(x => x is not null) + .SelectMany(id => id) + .ToList(); + } + else if (instanceOrDefinition is InstanceProxy instanceProxy) + { + // TODO + } + } + + throw new NotImplementedException(); // TODO: remove + } private Matrix4x4 GetMatrix(double[] t) { diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index cad61d949f..6d54a556f6 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -1,30 +1,40 @@ using Autodesk.AutoCAD.DatabaseServices; using Speckle.Connectors.Autocad.HostApp; using Speckle.Connectors.Autocad.HostApp.Extensions; +using Speckle.Connectors.Autocad.Operations.Send; using Speckle.Core.Models; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; +using Speckle.Connectors.Utils.Instances; using Speckle.Converters.Common; using Speckle.Core.Logging; using Speckle.Core.Models.GraphTraversal; +using Speckle.Core.Models.Instances; namespace Speckle.Connectors.Autocad.Operations.Receive; +/// +/// Expects to be a scoped dependency per receive operation. +/// public class AutocadHostObjectBuilder : IHostObjectBuilder { private readonly AutocadLayerManager _autocadLayerManager; private readonly IRootToHostConverter _converter; private readonly GraphTraversal _traversalFunction; + private readonly HashSet _uniqueLayerNames = new(); + private readonly IInstanceObjectsManager _instanceObjectsManager; public AutocadHostObjectBuilder( IRootToHostConverter converter, GraphTraversal traversalFunction, - AutocadLayerManager autocadLayerManager + AutocadLayerManager autocadLayerManager, + IInstanceObjectsManager instanceObjectsManager ) { _converter = converter; _traversalFunction = traversalFunction; _autocadLayerManager = autocadLayerManager; + _instanceObjectsManager = instanceObjectsManager; } public HostObjectBuilderResult Build( @@ -43,20 +53,63 @@ CancellationToken cancellationToken //TODO: make the layerManager handle \/ ? string baseLayerPrefix = $"SPK-{projectName}-{modelName}-"; - HashSet uniqueLayerNames = new(); List results = new(); List bakedObjectIds = new(); - foreach (var tc in _traversalFunction.TraverseWithProgress(rootObject, onOperationProgressed, cancellationToken)) + + var objectGraph = _traversalFunction.Traverse(rootObject).Where(obj => obj.Current is not Collection); + + var instanceDefinitionProxies = (rootObject["instanceDefinitionProxies"] as List) + ?.Cast() + .ToList(); + + var instanceComponents = new List<(string[] path, IInstanceComponent obj)>(); + // POC: these are not captured by traversal, so we need to re-add them here + if (instanceDefinitionProxies != null && instanceDefinitionProxies.Count > 0) + { + var transformed = instanceDefinitionProxies.Select(proxy => (Array.Empty(), proxy as IInstanceComponent)); + instanceComponents.AddRange(transformed); + } + + var atomicObjects = new List<(string layerName, Base obj)>(); + + foreach (TraversalContext tc in objectGraph) + { + var layerName = GetLayerPath(tc, baseLayerPrefix); + if (tc.Current is IInstanceComponent instanceComponent) + { + instanceComponents.Add((new string[] { layerName }, instanceComponent)); + } + else + { + atomicObjects.Add((layerName, tc.Current)); + } + } + + // Stage 1: Convert atomic objects + Dictionary> applicationIdMap = new(); + foreach (var (layerName, atomicObject) in atomicObjects) { try { - var convertedObjects = ConvertObject(tc, baseLayerPrefix, uniqueLayerNames).ToList(); + var convertedObjects = ConvertObject(atomicObject, layerName).ToList(); + + if (atomicObject.applicationId != null) + { + applicationIdMap[atomicObject.applicationId] = convertedObjects + .Select(ent => ent.ObjectId.ToString()) + .ToList(); + } results.AddRange( convertedObjects.Select( e => - new ReceiveConversionResult(Status.SUCCESS, tc.Current, e.Handle.Value.ToString(), e.GetType().ToString()) + new ReceiveConversionResult( + Status.SUCCESS, + atomicObject, + e.Handle.Value.ToString(), + e.GetType().ToString() + ) ) ); @@ -64,24 +117,30 @@ CancellationToken cancellationToken } catch (Exception ex) when (!ex.IsFatal()) { - results.Add(new(Status.ERROR, tc.Current, null, null, ex)); + results.Add(new(Status.ERROR, atomicObject, null, null, ex)); } } + // Stage 2: Convert instances + var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = _instanceObjectsManager.BakeInstances( + instanceComponents, + applicationIdMap, + baseLayerPrefix, + onOperationProgressed + ); + return new(bakedObjectIds, results); } - private IEnumerable ConvertObject(TraversalContext tc, string baseLayerPrefix, ISet uniqueLayerNames) + private IEnumerable ConvertObject(Base obj, string layerName) { using TransactionContext transactionContext = TransactionContext.StartTransaction( Application.DocumentManager.MdiActiveDocument ); - string layerFullName = GetLayerPath(tc, baseLayerPrefix); - - if (uniqueLayerNames.Add(layerFullName)) + if (_uniqueLayerNames.Add(layerName)) { - _autocadLayerManager.CreateLayerOrPurge(layerFullName); + _autocadLayerManager.CreateLayerOrPurge(layerName); } //POC: this transaction used to be called in the converter, We've moved it here to unify converter implementation @@ -89,7 +148,7 @@ private IEnumerable ConvertObject(TraversalContext tc, string baseLayerP object converted; using (var tr = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction()) { - converted = _converter.Convert(tc.Current); + converted = _converter.Convert(obj); tr.Commit(); } @@ -103,8 +162,7 @@ private IEnumerable ConvertObject(TraversalContext tc, string baseLayerP continue; } - conversionResult.AppendToDb(layerFullName); - + conversionResult.AppendToDb(layerName); yield return conversionResult; } } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 7da588bc9e..82177385c8 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -1,14 +1,11 @@ -using System.DoubleNumerics; using Rhino; using Rhino.DocObjects; using Rhino.Geometry; -using Speckle.Connectors.Rhino7.Extensions; using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; using Speckle.Connectors.Utils.Instances; using Speckle.Converters.Common; -using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; @@ -16,6 +13,9 @@ namespace Speckle.Connectors.Rhino7.Operations.Receive; +/// +/// Expects to be a scoped dependency per receive operation. +/// public class RhinoHostObjectBuilder : IHostObjectBuilder { private readonly IRootToHostConverter _converter; @@ -98,14 +98,14 @@ private HostObjectBuilderResult BakeObjects( } var atomicObjects = new List<(string[] layerPath, Base obj)>(); - IEnumerable traversalContexts = objectsGraph as TraversalContext[] ?? objectsGraph.ToArray(); - foreach (TraversalContext tc in traversalContexts) + // Split up the instances from the non-instances + foreach (TraversalContext tc in objectsGraph) { var path = _layerManager.GetLayerPath(tc); - if (tc.Current is IInstanceComponent flocker) + if (tc.Current is IInstanceComponent instanceComponent) { - instanceComponents.Add((path, flocker)); + instanceComponents.Add((path, instanceComponent)); } else { @@ -114,6 +114,7 @@ private HostObjectBuilderResult BakeObjects( } // Stage 1: Convert atomic objects + // Note: this can become encapsulated later in an "atomic object baker" of sorts, if needed. var applicationIdMap = new Dictionary>(); // used in converting blocks in stage 2. keeps track of original app id => resulting new app ids post baking var count = 0; foreach (var (path, obj) in atomicObjects) @@ -132,8 +133,6 @@ private HostObjectBuilderResult BakeObjects( if (obj.applicationId != null) { - // TODO: groups inside blocks? is that a thing? can we account for that? HOW CAN WE ACCOUNT FOR THAT? - // ie, what happens when we receive a block that contains one object that we need to explode in host app? applicationIdMap[obj.applicationId] = conversionIds; } } @@ -228,35 +227,4 @@ private Group BakeObjectsAsGroup(string groupName, IEnumerable lis var group = _contextStack.Current.Document.Groups.FindIndex(groupIndex); return group; } - - // POC: Not too proud of this being here, will be moving soon to the instance manager - private Transform MatrixToTransform(Matrix4x4 matrix, string units) - { - var conversionFactor = Units.GetConversionFactor( - units, - _contextStack.Current.Document.ModelUnitSystem.ToSpeckleString() - ); - - var t = Transform.Identity; - t.M00 = matrix.M11; - t.M01 = matrix.M12; - t.M02 = matrix.M13; - t.M03 = matrix.M14 * conversionFactor; - - t.M10 = matrix.M21; - t.M11 = matrix.M22; - t.M12 = matrix.M23; - t.M13 = matrix.M24 * conversionFactor; - - t.M20 = matrix.M31; - t.M21 = matrix.M32; - t.M22 = matrix.M33; - t.M23 = matrix.M34 * conversionFactor; - - t.M30 = matrix.M41; - t.M31 = matrix.M42; - t.M32 = matrix.M43; - t.M33 = matrix.M44; - return t; - } } diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs index 53def687f1..b6336a9ebe 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs @@ -5,6 +5,7 @@ namespace Speckle.Connectors.Utils.Instances; /// /// A utility class that helps manage host application blocks in send/receive operations. This expects to be a transient dependendency. +/// POC: could be split into two - instance unpacker and instance baker. /// /// Host application object type, e.g. RhinoObject public interface IInstanceObjectsManager From 4460265e2f807c61bf031d17d035cd4731dcb00b Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sun, 16 Jun 2024 18:40:53 +0100 Subject: [PATCH 13/25] wip acad instance receives --- .../AutocadConnectorModule.cs | 3 +- .../HostApp/AutocadInstanceObjectManager.cs | 156 ++++++++++++++++-- .../Receive/AutocadHostObjectBuilder.cs | 59 ++++++- .../Send/AutocadRootObjectBuilder.cs | 4 +- .../RhinoConnectorModule.cs | 2 +- .../HostApp/RhinoInstanceObjectsManager.cs | 2 +- .../Receive/RhinoHostObjectBuilder.cs | 4 +- .../Operations/Send/RhinoRootObjectBuilder.cs | 4 +- .../Instances/IInstanceObjectsManager.cs | 11 +- 9 files changed, 207 insertions(+), 38 deletions(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs index 214d039295..0ebccc6741 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs @@ -1,3 +1,4 @@ +using Autodesk.AutoCAD.DatabaseServices; using Speckle.Autofac; using Speckle.Autofac.DependencyInjection; using Speckle.Connectors.Autocad.Bindings; @@ -63,6 +64,6 @@ public void Load(SpeckleContainerBuilder builder) // register send conversion cache builder.AddSingleton(); - builder.AddScoped, AutocadInstanceObjectManager>(); + builder.AddScoped>, AutocadInstanceObjectManager>(); } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index b6aaeaac12..049c5e0710 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -1,13 +1,22 @@ using System.DoubleNumerics; using Autodesk.AutoCAD.DatabaseServices; +using Autodesk.AutoCAD.Geometry; using Speckle.Connectors.Autocad.HostApp.Extensions; using Speckle.Connectors.Autocad.Operations.Send; +using Speckle.Connectors.Utils.Conversion; using Speckle.Connectors.Utils.Instances; +using Speckle.Core.Kits; +using Speckle.Core.Logging; +using Speckle.Core.Models; using Speckle.Core.Models.Instances; namespace Speckle.Connectors.Autocad.HostApp; -public class AutocadInstanceObjectManager : IInstanceObjectsManager +/// +/// +/// Expects to be a scoped dependency per send or receive operation. +/// +public class AutocadInstanceObjectManager : IInstanceObjectsManager> { private Dictionary InstanceProxies { get; set; } = new(); private Dictionary> InstanceProxiesByDefinitionId { get; set; } = new(); @@ -16,15 +25,10 @@ public class AutocadInstanceObjectManager : IInstanceObjectsManager UnpackSelection(IEnumerable objects) { - // POC: Dim enjoys controlling transactions clearly, it's not immediate how we're dealing with stuff in TransactionContext - // where does it start, can we batch more stuff in it?, performance implications? document locking? using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); foreach (var obj in objects) { - // TODO: maybe get the dynamic blocks out as "exploded", or handle them separately anyway - for now excluding - // let's solve the simple case for now - // TODO: idea: dynamic blocks could fallback to a rhino "group" - could we fake it with a displayValue[] hack if (obj.Root is BlockReference blockReference && !blockReference.IsDynamicBlock) { UnpackInstance(blockReference, 0, transaction); @@ -108,7 +112,7 @@ out List instanceProxiesWithSameDefinition public BakeResult BakeInstances( List<(string[] layerPath, IInstanceComponent obj)> instanceComponents, - Dictionary> applicationIdMap, + Dictionary> applicationIdMap, string baseLayerName, Action? onOperationProgressed ) @@ -118,24 +122,73 @@ public BakeResult BakeInstances( .ThenBy(x => x.obj is InstanceDefinitionProxy ? 0 : 1) // Ensure we bake the deepest definition first, then any instances that depend on it .ToList(); + var definitionIdAndApplicationIdMap = new Dictionary(); + + using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); + var conversionResults = new List(); + var createdObjectIds = new List(); + var consumedObjectIds = new List(); + var count = 0; + foreach (var (path, instanceOrDefinition) in sortedInstanceComponents) { - if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy) + try { - // TODO - var currentApplicationObjectIds = definitionProxy.Objects - .Select(id => applicationIdMap.TryGetValue(id, out List value) ? value : null) - .Where(x => x is not null) - .SelectMany(id => id) - .ToList(); + onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count); + if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy && definitionProxy.applicationId != null) + { + // TODO: create definition (block table record) + var constituentEntities = definitionProxy.Objects + .Select(id => applicationIdMap.TryGetValue(id, out List value) ? value : null) + .Where(x => x is not null) + .SelectMany(ent => ent) + .ToList(); + + var record = new BlockTableRecord(); + var objectIds = new ObjectIdCollection(); + record.Name = baseLayerName + definitionProxy.applicationId; + foreach (var entity in constituentEntities) + { + // record.AppendEntity(entity); + objectIds.Add(entity.ObjectId); + } + + using var blockTable = (BlockTable) + transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.BlockTableId, OpenMode.ForWrite); + var id = blockTable.Add(record); + + record.AssumeOwnershipOf(objectIds); + + definitionIdAndApplicationIdMap[definitionProxy.applicationId] = id; + transaction.AddNewlyCreatedDBObject(record, true); + } + else if ( + instanceOrDefinition is InstanceProxy instanceProxy + && definitionIdAndApplicationIdMap.TryGetValue(instanceProxy.DefinitionId, out ObjectId definitionId) + ) + { + var matrix3d = GetMatrix3d(instanceProxy.Transform, instanceProxy.Units); + var insertionPoint = Point3d.Origin.TransformBy(matrix3d); + + var modelSpaceBlockTableRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace( + OpenMode.ForWrite + ); + + var blockRef = new BlockReference(insertionPoint, definitionId) { BlockTransform = matrix3d }; + modelSpaceBlockTableRecord.AppendEntity(blockRef); + transaction.AddNewlyCreatedDBObject(blockRef, true); + conversionResults.Add( + new(Status.SUCCESS, instanceProxy, blockRef.Handle.Value.ToString(), "Instance (Block)") + ); + } } - else if (instanceOrDefinition is InstanceProxy instanceProxy) + catch (Exception ex) when (!ex.IsFatal()) { - // TODO + conversionResults.Add(new(Status.ERROR, instanceOrDefinition as Base ?? new Base(), null, null, ex)); } } - - throw new NotImplementedException(); // TODO: remove + transaction.Commit(); + return new(new List(), new List(), conversionResults); } private Matrix4x4 GetMatrix(double[] t) @@ -159,4 +212,71 @@ private Matrix4x4 GetMatrix(double[] t) t[15] ); } + + private Matrix3d GetMatrix3d(Matrix4x4 matrix, string units) + { + var sf = Units.GetConversionFactor( + units, + Application.DocumentManager.CurrentDocument.Database.Insunits.ToSpeckleString() + ); + + var scaledTransform = new[] + { + matrix.M11, + matrix.M12, + matrix.M13, + matrix.M14 * sf, + matrix.M21, + matrix.M22, + matrix.M23, + matrix.M24 * sf, + matrix.M31, + matrix.M32, + matrix.M33, + matrix.M34 * sf, + matrix.M41, + matrix.M42, + matrix.M43, + matrix.M44 + }; + + var m3d = new Matrix3d(scaledTransform); + if (!m3d.IsScaledOrtho()) + { + m3d = new Matrix3d(MakePerpendicular(m3d)); + } + + return m3d; + } + + // https://forums.autodesk.com/t5/net/set-blocktransform-values/m-p/6452121#M49479 + private static double[] MakePerpendicular(Matrix3d matrix) + { + // Get the basis vectors of the matrix + Vector3d right = new(matrix[0, 0], matrix[1, 0], matrix[2, 0]); + Vector3d up = new(matrix[0, 1], matrix[1, 1], matrix[2, 1]); + + Vector3d newForward = right.CrossProduct(up).GetNormal(); + Vector3d newUp = newForward.CrossProduct(right).GetNormal(); + + return new[] + { + right.X, + newUp.X, + newForward.X, + matrix[0, 3], + right.Y, + newUp.Y, + newForward.Y, + matrix[1, 3], + right.Z, + newUp.Z, + newForward.Z, + matrix[2, 3], + 0.0, + 0.0, + 0.0, + matrix[3, 3], + }; + } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index 6d54a556f6..17c9b627e4 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -22,13 +22,13 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder private readonly IRootToHostConverter _converter; private readonly GraphTraversal _traversalFunction; private readonly HashSet _uniqueLayerNames = new(); - private readonly IInstanceObjectsManager _instanceObjectsManager; + private readonly IInstanceObjectsManager> _instanceObjectsManager; public AutocadHostObjectBuilder( IRootToHostConverter converter, GraphTraversal traversalFunction, AutocadLayerManager autocadLayerManager, - IInstanceObjectsManager instanceObjectsManager + IInstanceObjectsManager> instanceObjectsManager ) { _converter = converter; @@ -54,6 +54,8 @@ CancellationToken cancellationToken //TODO: make the layerManager handle \/ ? string baseLayerPrefix = $"SPK-{projectName}-{modelName}-"; + PreReceiveDeepClean(baseLayerPrefix); + List results = new(); List bakedObjectIds = new(); @@ -87,7 +89,7 @@ CancellationToken cancellationToken } // Stage 1: Convert atomic objects - Dictionary> applicationIdMap = new(); + Dictionary> applicationIdMap = new(); foreach (var (layerName, atomicObject) in atomicObjects) { try @@ -96,9 +98,7 @@ CancellationToken cancellationToken if (atomicObject.applicationId != null) { - applicationIdMap[atomicObject.applicationId] = convertedObjects - .Select(ent => ent.ObjectId.ToString()) - .ToList(); + applicationIdMap[atomicObject.applicationId] = convertedObjects; } results.AddRange( @@ -129,9 +129,56 @@ CancellationToken cancellationToken onOperationProgressed ); + results.AddRange(instanceConversionResults); return new(bakedObjectIds, results); } + private void PreReceiveDeepClean(string baseLayerPrefix) + { + using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); + + // Step 1: purge instances and instance definitions + var instanceDefinitionsToDelete = new Dictionary(); + var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForWrite); + foreach (var objectId in modelSpaceRecord) + { + var obj = transaction.GetObject(objectId, OpenMode.ForRead) as BlockReference; + if (obj == null) + { + continue; + } + + var definition = transaction.GetObject(obj.BlockTableRecord, OpenMode.ForRead) as BlockTableRecord; + // POC: this is tightly coupled with a naming convention for definitions in the Instance object manager + if (definition != null && definition.Name.Contains(baseLayerPrefix)) + { + obj.UpgradeOpen(); + obj.Erase(); + instanceDefinitionsToDelete[obj.BlockTableRecord.ToString()] = definition; + } + } + + foreach (var def in instanceDefinitionsToDelete.Values) + { + def.UpgradeOpen(); + def.Erase(); + } + + // Step 2: layers and normal objects + var layerTable = (LayerTable) + transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.LayerTableId, OpenMode.ForRead); + + foreach (var layerId in layerTable) + { + var layer = (LayerTableRecord)transaction.GetObject(layerId, OpenMode.ForRead); + if (layer.Name.Contains(baseLayerPrefix)) + { + _autocadLayerManager.CreateLayerOrPurge(layer.Name); + } + } + transaction.Commit(); + } + private IEnumerable ConvertObject(Base obj, string layerName) { using TransactionContext transactionContext = TransactionContext.StartTransaction( diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs index 56ac1751b1..c7c025633e 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs @@ -17,12 +17,12 @@ public class AutocadRootObjectBuilder : IRootObjectBuilder private readonly IRootToSpeckleConverter _converter; private readonly string[] _documentPathSeparator = { "\\" }; private readonly ISendConversionCache _sendConversionCache; - private readonly IInstanceObjectsManager _instanceObjectsManager; + private readonly IInstanceObjectsManager> _instanceObjectsManager; public AutocadRootObjectBuilder( IRootToSpeckleConverter converter, ISendConversionCache sendConversionCache, - IInstanceObjectsManager instanceObjectManager + IInstanceObjectsManager> instanceObjectManager ) { _converter = converter; diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs index a72bee9597..1c07027e1d 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/DependencyInjection/RhinoConnectorModule.cs @@ -72,7 +72,7 @@ public void Load(SpeckleContainerBuilder builder) builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); builder.AddScoped, RhinoRootObjectBuilder>(); - builder.AddScoped, RhinoInstanceObjectsManager>(); + builder.AddScoped>, RhinoInstanceObjectsManager>(); builder.AddScoped(); } } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs index 8bb90205bf..8f21aa55d3 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs @@ -17,7 +17,7 @@ namespace Speckle.Connectors.Rhino7.HostApp; /// /// Expects to be a scoped dependency per send or receive operation. /// -public class RhinoInstanceObjectsManager : IInstanceObjectsManager +public class RhinoInstanceObjectsManager : IInstanceObjectsManager> { private readonly IConversionContextStack _contextStack; private readonly Dictionary _instanceProxies = new(); diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 82177385c8..8b1f36ae96 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -21,7 +21,7 @@ public class RhinoHostObjectBuilder : IHostObjectBuilder private readonly IRootToHostConverter _converter; private readonly IConversionContextStack _contextStack; private readonly GraphTraversal _traverseFunction; - private readonly IInstanceObjectsManager _instanceObjectsManager; + private readonly IInstanceObjectsManager> _instanceObjectsManager; private readonly RhinoLayerManager _layerManager; public RhinoHostObjectBuilder( @@ -29,7 +29,7 @@ public RhinoHostObjectBuilder( IConversionContextStack contextStack, GraphTraversal traverseFunction, RhinoLayerManager layerManager, - IInstanceObjectsManager instanceObjectsManager + IInstanceObjectsManager> instanceObjectsManager ) { _converter = converter; diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index 2d61867232..4a1a4e50bd 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -22,7 +22,7 @@ public class RhinoRootObjectBuilder : IRootObjectBuilder { private readonly IUnitOfWorkFactory _unitOfWorkFactory; private readonly ISendConversionCache _sendConversionCache; - private readonly IInstanceObjectsManager _instanceObjectsManager; + private readonly IInstanceObjectsManager> _instanceObjectsManager; private readonly IConversionContextStack _contextStack; private readonly RhinoLayerManager _layerManager; @@ -31,7 +31,7 @@ public RhinoRootObjectBuilder( ISendConversionCache sendConversionCache, IConversionContextStack contextStack, RhinoLayerManager layerManager, - IInstanceObjectsManager instanceObjectsManager + IInstanceObjectsManager> instanceObjectsManager ) { _unitOfWorkFactory = unitOfWorkFactory; diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs index b6336a9ebe..2ce3e8a21e 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs @@ -4,21 +4,22 @@ namespace Speckle.Connectors.Utils.Instances; /// -/// A utility class that helps manage host application blocks in send/receive operations. This expects to be a transient dependendency. +/// A utility class that helps manage host application blocks in send/receive operations. This expects to be a scoped dependendency per send/receive operation. /// POC: could be split into two - instance unpacker and instance baker. /// -/// Host application object type, e.g. RhinoObject -public interface IInstanceObjectsManager +/// Host application object type, e.g. RhinoObject +/// The type of the applicationIdMap values. +public interface IInstanceObjectsManager { /// /// Given a list of host application objects, it will unpack them into TODO: comment /// /// - UnpackResult UnpackSelection(IEnumerable objects); + UnpackResult UnpackSelection(IEnumerable objects); BakeResult BakeInstances( List<(string[] layerPath, IInstanceComponent obj)> instanceComponents, - Dictionary> applicationIdMap, + Dictionary applicationIdMap, string baseLayerName, Action? onOperationProgressed ); From f6ff940584509bb749c3581bf028cb9e2bad7680 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sun, 16 Jun 2024 19:30:51 +0100 Subject: [PATCH 14/25] acad blocks - receive ok --- .../Bindings/AutocadBasicConnectorBinding.cs | 45 ++++++++++++------- .../HostApp/AutocadInstanceObjectManager.cs | 6 +++ .../Receive/AutocadHostObjectBuilder.cs | 2 +- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs index a87ea7f70d..7ddcb736a4 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs @@ -8,6 +8,7 @@ using Speckle.Core.Credentials; using Speckle.Connectors.Autocad.HostApp.Extensions; using Speckle.Connectors.Utils; +using Speckle.Core.Logging; namespace Speckle.Connectors.Autocad.Bindings; @@ -108,34 +109,48 @@ public void HighlightModel(string modelCardId) return; } - HighlightObjectsOnView(objectIds); + HighlightObjectsOnView(objectIds, modelCardId); } - private void HighlightObjectsOnView(ObjectId[] objectIds) + private void HighlightObjectsOnView(ObjectId[] objectIds, string? modelCardId = null) { var doc = Application.DocumentManager.MdiActiveDocument; Parent.RunOnMainThread(() => { - doc.Editor.SetImpliedSelection(Array.Empty()); // Deselects - doc.Editor.SetImpliedSelection(objectIds); // Selects - doc.Editor.UpdateScreen(); + try + { + doc.Editor.SetImpliedSelection(Array.Empty()); // Deselects + doc.Editor.SetImpliedSelection(objectIds); // Selects + doc.Editor.UpdateScreen(); + + Extents3d selectedExtents = new(); - Extents3d selectedExtents = new(); + var tr = doc.TransactionManager.StartTransaction(); + foreach (ObjectId objectId in objectIds) + { + var entity = (Entity)tr.GetObject(objectId, OpenMode.ForRead); + if (entity != null) + { + selectedExtents.AddExtents(entity.GeometricExtents); + } + } - var tr = doc.TransactionManager.StartTransaction(); - foreach (ObjectId objectId in objectIds) + doc.Editor.Zoom(selectedExtents); + tr.Commit(); + Autodesk.AutoCAD.Internal.Utils.FlushGraphics(); + } + catch (Exception ex) when (!ex.IsFatal()) { - var entity = (Entity)tr.GetObject(objectId, OpenMode.ForRead); - if (entity != null) + if (modelCardId != null) + { + Commands.SetModelError(modelCardId, new OperationCanceledException("Failed to highlight objects.")); + } + else { - selectedExtents.AddExtents(entity.GeometricExtents); + //??? } } - - doc.Editor.Zoom(selectedExtents); - tr.Commit(); - Autodesk.AutoCAD.Internal.Utils.FlushGraphics(); }); } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 049c5e0710..7b44027de5 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -176,6 +176,12 @@ instanceOrDefinition is InstanceProxy instanceProxy var blockRef = new BlockReference(insertionPoint, definitionId) { BlockTransform = matrix3d }; modelSpaceBlockTableRecord.AppendEntity(blockRef); + + if (instanceProxy.applicationId != null) + { + applicationIdMap[instanceProxy.applicationId] = new List() { blockRef }; + } + transaction.AddNewlyCreatedDBObject(blockRef, true); conversionResults.Add( new(Status.SUCCESS, instanceProxy, blockRef.Handle.Value.ToString(), "Instance (Block)") diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index 17c9b627e4..e9f135bf00 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -139,7 +139,7 @@ private void PreReceiveDeepClean(string baseLayerPrefix) // Step 1: purge instances and instance definitions var instanceDefinitionsToDelete = new Dictionary(); - var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForWrite); + var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForRead); foreach (var objectId in modelSpaceRecord) { var obj = transaction.GetObject(objectId, OpenMode.ForRead) as BlockReference; From e08d946a7ba69a61515c5b2b49b2f68a2dbb0468 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sun, 16 Jun 2024 21:04:14 +0100 Subject: [PATCH 15/25] =?UTF-8?q?feat(dui3):=20acad=20receive=20blocks=20?= =?UTF-8?q?=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit more testing still needed! --- .../HostApp/AutocadInstanceObjectManager.cs | 6 +++++- .../Operations/Receive/AutocadHostObjectBuilder.cs | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 7b44027de5..bfb4dc89d2 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -161,6 +161,9 @@ public BakeResult BakeInstances( definitionIdAndApplicationIdMap[definitionProxy.applicationId] = id; transaction.AddNewlyCreatedDBObject(record, true); + var consumedEntitiesHandleValues = constituentEntities.Select(ent => ent.Handle.Value.ToString()).ToArray(); + consumedObjectIds.AddRange(consumedEntitiesHandleValues); + createdObjectIds.RemoveAll(newId => consumedEntitiesHandleValues.Contains(newId)); } else if ( instanceOrDefinition is InstanceProxy instanceProxy @@ -186,6 +189,7 @@ instanceOrDefinition is InstanceProxy instanceProxy conversionResults.Add( new(Status.SUCCESS, instanceProxy, blockRef.Handle.Value.ToString(), "Instance (Block)") ); + createdObjectIds.Add(blockRef.Handle.Value.ToString()); } } catch (Exception ex) when (!ex.IsFatal()) @@ -194,7 +198,7 @@ instanceOrDefinition is InstanceProxy instanceProxy } } transaction.Commit(); - return new(new List(), new List(), conversionResults); + return new(createdObjectIds, consumedObjectIds, conversionResults); } private Matrix4x4 GetMatrix(double[] t) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index e9f135bf00..0f27e4c3fe 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -129,7 +129,11 @@ CancellationToken cancellationToken onOperationProgressed ); + bakedObjectIds.RemoveAll(id => consumedObjectIds.Contains(id)); + bakedObjectIds.AddRange(createdInstanceIds); + results.RemoveAll(result => result.ResultId != null && consumedObjectIds.Contains(result.ResultId)); results.AddRange(instanceConversionResults); + return new(bakedObjectIds, results); } From 6cca93d9a42f7c6fb441a4015dd277b36503e75b Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sun, 16 Jun 2024 21:11:02 +0100 Subject: [PATCH 16/25] feat(dui3): blocks poc minor refactors --- .../HostApp/AutocadInstanceObjectManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index bfb4dc89d2..3eb340a642 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -135,7 +135,7 @@ public BakeResult BakeInstances( try { onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count); - if (instanceOrDefinition is InstanceDefinitionProxy definitionProxy && definitionProxy.applicationId != null) + if (instanceOrDefinition is InstanceDefinitionProxy { applicationId: not null } definitionProxy) { // TODO: create definition (block table record) var constituentEntities = definitionProxy.Objects From 97d3f6569bd94ab168687b583e8207254538f884 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Sun, 16 Jun 2024 22:01:38 +0100 Subject: [PATCH 17/25] feat(dui3): acad blocks proper cleanup --- .../HostApp/AutocadInstanceObjectManager.cs | 1 - .../Receive/AutocadHostObjectBuilder.cs | 45 ++++++++++++++----- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 3eb340a642..659b481335 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -156,7 +156,6 @@ public BakeResult BakeInstances( using var blockTable = (BlockTable) transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.BlockTableId, OpenMode.ForWrite); var id = blockTable.Add(record); - record.AssumeOwnershipOf(objectIds); definitionIdAndApplicationIdMap[definitionProxy.applicationId] = id; diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index 0f27e4c3fe..f7446815d5 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -55,10 +55,11 @@ CancellationToken cancellationToken string baseLayerPrefix = $"SPK-{projectName}-{modelName}-"; PreReceiveDeepClean(baseLayerPrefix); - List results = new(); List bakedObjectIds = new(); + // return new(bakedObjectIds, results); + var objectGraph = _traversalFunction.Traverse(rootObject).Where(obj => obj.Current is not Collection); var instanceDefinitionProxies = (rootObject["instanceDefinitionProxies"] as List) @@ -143,22 +144,42 @@ private void PreReceiveDeepClean(string baseLayerPrefix) // Step 1: purge instances and instance definitions var instanceDefinitionsToDelete = new Dictionary(); - var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForRead); - foreach (var objectId in modelSpaceRecord) + using var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForRead); + using var blockTable = (BlockTable) + transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.BlockTableId, OpenMode.ForWrite); + + // Recurses through a given block table record and purges inner instances as required. + void TraverseAndClean(BlockTableRecord btr) { - var obj = transaction.GetObject(objectId, OpenMode.ForRead) as BlockReference; - if (obj == null) + foreach (var objectId in btr) { - continue; + var obj = transaction.GetObject(objectId, OpenMode.ForRead) as BlockReference; + if (obj == null) + { + continue; + } + var definition = (BlockTableRecord)transaction.GetObject(obj.BlockTableRecord, OpenMode.ForRead); + // POC: this is tightly coupled with a naming convention for definitions in the Instance object manager + if (definition.Name.Contains(baseLayerPrefix)) + { + obj.UpgradeOpen(); + obj.Erase(); + TraverseAndClean(definition); + instanceDefinitionsToDelete[obj.BlockTableRecord.ToString()] = definition; + } } + } - var definition = transaction.GetObject(obj.BlockTableRecord, OpenMode.ForRead) as BlockTableRecord; - // POC: this is tightly coupled with a naming convention for definitions in the Instance object manager - if (definition != null && definition.Name.Contains(baseLayerPrefix)) + TraverseAndClean(modelSpaceRecord); + + // cleanup potentially orphaned definitions + foreach (var btrId in blockTable) + { + var btr = (BlockTableRecord)transaction.GetObject(btrId, OpenMode.ForRead); + if (btr.Name.Contains(baseLayerPrefix)) { - obj.UpgradeOpen(); - obj.Erase(); - instanceDefinitionsToDelete[obj.BlockTableRecord.ToString()] = definition; + TraverseAndClean(btr); + instanceDefinitionsToDelete[btr.Name] = btr; } } From ba4556e20fade7ebf37812a39c8fadb3b2fa4e53 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Mon, 17 Jun 2024 18:15:24 +0100 Subject: [PATCH 18/25] feat(dui3): blocks poc ready(ish) rhino & acad --- .../HostApp/AutocadInstanceObjectManager.cs | 58 ++++++++++++++++++- .../Receive/AutocadHostObjectBuilder.cs | 51 +--------------- .../HostApp/RhinoInstanceObjectsManager.cs | 11 ++++ .../Receive/RhinoHostObjectBuilder.cs | 12 +--- .../Instances/IInstanceObjectsManager.cs | 19 +++++- 5 files changed, 88 insertions(+), 63 deletions(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index 659b481335..e4647f301d 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -176,12 +176,12 @@ instanceOrDefinition is InstanceProxy instanceProxy OpenMode.ForWrite ); - var blockRef = new BlockReference(insertionPoint, definitionId) { BlockTransform = matrix3d }; + var blockRef = new BlockReference(insertionPoint, definitionId) { BlockTransform = matrix3d }; // TODO: Bake on correct layer modelSpaceBlockTableRecord.AppendEntity(blockRef); if (instanceProxy.applicationId != null) { - applicationIdMap[instanceProxy.applicationId] = new List() { blockRef }; + applicationIdMap[instanceProxy.applicationId] = new List { blockRef }; } transaction.AddNewlyCreatedDBObject(blockRef, true); @@ -200,6 +200,60 @@ instanceOrDefinition is InstanceProxy instanceProxy return new(createdObjectIds, consumedObjectIds, conversionResults); } + public void PurgeInstances(string namePrefix) + { + using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); + + // Step 1: purge instances and instance definitions + var instanceDefinitionsToDelete = new Dictionary(); + using var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForRead); + using var blockTable = (BlockTable) + transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.BlockTableId, OpenMode.ForWrite); + + // Recurses through a given block table record and purges inner instances as required. + void TraverseAndClean(BlockTableRecord btr) + { + foreach (var objectId in btr) + { + var obj = transaction.GetObject(objectId, OpenMode.ForRead) as BlockReference; + if (obj == null) + { + continue; + } + var definition = (BlockTableRecord)transaction.GetObject(obj.BlockTableRecord, OpenMode.ForRead); + // POC: this is tightly coupled with a naming convention for definitions in the Instance object manager + if (definition.Name.Contains(namePrefix)) + { + obj.UpgradeOpen(); + obj.Erase(); + TraverseAndClean(definition); + instanceDefinitionsToDelete[obj.BlockTableRecord.ToString()] = definition; + } + } + } + + TraverseAndClean(modelSpaceRecord); + + // cleanup potentially orphaned definitions (if user deletes an instance reference, we don't reach composing definitions anymore - as such, we need to go through each btr too) + foreach (var btrId in blockTable) + { + var btr = (BlockTableRecord)transaction.GetObject(btrId, OpenMode.ForRead); + if (btr.Name.Contains(namePrefix)) + { + TraverseAndClean(btr); + instanceDefinitionsToDelete[btr.Name] = btr; + } + } + + foreach (var def in instanceDefinitionsToDelete.Values) + { + def.UpgradeOpen(); + def.Erase(); + } + + transaction.Commit(); + } + private Matrix4x4 GetMatrix(double[] t) { return new Matrix4x4( diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index f7446815d5..7aa4dd2a52 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -140,56 +140,9 @@ CancellationToken cancellationToken private void PreReceiveDeepClean(string baseLayerPrefix) { - using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); - - // Step 1: purge instances and instance definitions - var instanceDefinitionsToDelete = new Dictionary(); - using var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForRead); - using var blockTable = (BlockTable) - transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.BlockTableId, OpenMode.ForWrite); - - // Recurses through a given block table record and purges inner instances as required. - void TraverseAndClean(BlockTableRecord btr) - { - foreach (var objectId in btr) - { - var obj = transaction.GetObject(objectId, OpenMode.ForRead) as BlockReference; - if (obj == null) - { - continue; - } - var definition = (BlockTableRecord)transaction.GetObject(obj.BlockTableRecord, OpenMode.ForRead); - // POC: this is tightly coupled with a naming convention for definitions in the Instance object manager - if (definition.Name.Contains(baseLayerPrefix)) - { - obj.UpgradeOpen(); - obj.Erase(); - TraverseAndClean(definition); - instanceDefinitionsToDelete[obj.BlockTableRecord.ToString()] = definition; - } - } - } + _instanceObjectsManager.PurgeInstances(baseLayerPrefix); - TraverseAndClean(modelSpaceRecord); - - // cleanup potentially orphaned definitions - foreach (var btrId in blockTable) - { - var btr = (BlockTableRecord)transaction.GetObject(btrId, OpenMode.ForRead); - if (btr.Name.Contains(baseLayerPrefix)) - { - TraverseAndClean(btr); - instanceDefinitionsToDelete[btr.Name] = btr; - } - } - - foreach (var def in instanceDefinitionsToDelete.Values) - { - def.UpgradeOpen(); - def.Erase(); - } - - // Step 2: layers and normal objects + using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); var layerTable = (LayerTable) transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.LayerTableId, OpenMode.ForRead); diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs index 8f21aa55d3..fbf3db4cf2 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs @@ -212,6 +212,17 @@ instanceOrDefinition is InstanceProxy instanceProxy return new(createdObjectIds, consumedObjectIds, conversionResults); } + public void PurgeInstances(string namePrefix) + { + foreach (var definition in _contextStack.Current.Document.InstanceDefinitions) + { + if (!definition.IsDeleted && definition.Name.Contains(namePrefix)) + { + _contextStack.Current.Document.InstanceDefinitions.Delete(definition.Index, true, false); + } + } + } + private Matrix4x4 XFormToMatrix(Transform t) => new(t.M00, t.M01, t.M02, t.M03, t.M10, t.M11, t.M12, t.M13, t.M20, t.M21, t.M22, t.M23, t.M30, t.M31, t.M32, t.M33); diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 8b1f36ae96..623083d717 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -161,17 +161,9 @@ private HostObjectBuilderResult BakeObjects( private void PreReceiveDeepClean(string baseLayerName, int rootLayerIndex) { - var doc = _contextStack.Current.Document; - - // Cleanup blocks/definitions/instances before layers - foreach (var definition in doc.InstanceDefinitions) - { - if (!definition.IsDeleted && definition.Name.Contains(baseLayerName)) - { - doc.InstanceDefinitions.Delete(definition.Index, true, false); - } - } + _instanceObjectsManager.PurgeInstances(baseLayerName); + var doc = _contextStack.Current.Document; // Cleans up any previously received objects if (rootLayerIndex != RhinoMath.UnsetIntIndex) { diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs index 2ce3e8a21e..532e42ed0e 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/Instances/IInstanceObjectsManager.cs @@ -12,17 +12,32 @@ namespace Speckle.Connectors.Utils.Instances; public interface IInstanceObjectsManager { /// - /// Given a list of host application objects, it will unpack them into TODO: comment + /// Given a list of host application objects, it will unpack them into atomic objects, instance proxies and instance proxy definitions. /// - /// + /// Raw selection from the host application. UnpackResult UnpackSelection(IEnumerable objects); + /// + /// Will bake a set of instance components (instances and instance definitions) in the host app. + /// + /// + /// + /// + /// + /// BakeResult BakeInstances( List<(string[] layerPath, IInstanceComponent obj)> instanceComponents, Dictionary applicationIdMap, string baseLayerName, Action? onOperationProgressed ); + + /// + /// Cleans up previously baked instances and associated definitions containing the `namePrefix` in their name. + /// Note: this is based on the convention that all defintions have their name set to a model based prefix. + /// + /// The name prefix to search and delete by. + void PurgeInstances(string namePrefix); } public record UnpackResult( From 6ae0a3f9d486d7ac33a46e28f880dc4464be1401 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Mon, 17 Jun 2024 18:43:16 +0100 Subject: [PATCH 19/25] chore(dui3): reverts accidental change --- .../ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs index e15f6e521b..338ac88f40 100644 --- a/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs +++ b/Objects/Converters/ConverterAutocadCivil/ConverterAutocadCivilShared/ConverterAutocadCivil.Other.cs @@ -446,7 +446,7 @@ public BlockInstance BlockReferenceToSpeckle(BlockReference reference) var btrObjId = reference.BlockTableRecord; if (reference.IsDynamicBlock) { - btrObjId =(BlockTableRecord) + btrObjId = reference.AnonymousBlockTableRecord != ObjectId.Null ? reference.AnonymousBlockTableRecord : reference.DynamicBlockTableRecord; From bfd5d2100e32fe30f263ff7bbb71b1aa18a31bd0 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Mon, 17 Jun 2024 18:43:35 +0100 Subject: [PATCH 20/25] feat(dui3): adds comments/docs --- .../Models/Instances/IInstanceComponent.cs | 2 +- .../Instances/InstanceDefinitionProxy.cs | 7 +++++++ Core/Core/Models/Instances/InstanceProxy.cs | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Core/Core/Models/Instances/IInstanceComponent.cs b/Core/Core/Models/Instances/IInstanceComponent.cs index 27d012af3b..c8e52e7ac9 100644 --- a/Core/Core/Models/Instances/IInstanceComponent.cs +++ b/Core/Core/Models/Instances/IInstanceComponent.cs @@ -6,7 +6,7 @@ namespace Speckle.Core.Models.Instances; public interface IInstanceComponent { /// - /// The maximum nesting depth at which this component (Instance or Instance Definition) was found. + /// The maximum "depth" at which this or was found. It's important to get right: as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them, starting with definitions first. /// public int MaxDepth { get; set; } } diff --git a/Core/Core/Models/Instances/InstanceDefinitionProxy.cs b/Core/Core/Models/Instances/InstanceDefinitionProxy.cs index 47192b1251..e50dca8961 100644 --- a/Core/Core/Models/Instances/InstanceDefinitionProxy.cs +++ b/Core/Core/Models/Instances/InstanceDefinitionProxy.cs @@ -7,6 +7,13 @@ namespace Speckle.Core.Models.Instances; /// public class InstanceDefinitionProxy : Base, IInstanceComponent { + /// + /// The original ids of the objects that are part of this definition, as present in the source host app. On receive, they will be mapped to corresponding newly created definition ids. + /// public List Objects { get; set; } // source app application ids for the objects + + /// + /// The maximum "depth" at which this instance was found. It's important to get right: as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them. + /// public int MaxDepth { get; set; } } diff --git a/Core/Core/Models/Instances/InstanceProxy.cs b/Core/Core/Models/Instances/InstanceProxy.cs index 13fd33bbb1..fcbac9dcae 100644 --- a/Core/Core/Models/Instances/InstanceProxy.cs +++ b/Core/Core/Models/Instances/InstanceProxy.cs @@ -2,10 +2,28 @@ namespace Speckle.Core.Models.Instances; +/// +/// A proxy class for an instance (e.g, a rhino block, or an autocad block reference). +/// public class InstanceProxy : Base, IInstanceComponent { + /// + /// The definition id as present in the original host app. On receive, it will be mapped to the newly created definition id. + /// public string DefinitionId { get; set; } + + /// + /// The transform of the instance reference. + /// public Matrix4x4 Transform { get; set; } + + /// + /// The units of the host application file. + /// public string Units { get; set; } = Kits.Units.Meters; + + /// + /// The maximum "depth" at which this instance was found. It's important to get right: as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them. + /// public int MaxDepth { get; set; } } From 536fc6eedc013f6ed90f74e6eaab5d73c6aaf986 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Tue, 18 Jun 2024 12:57:54 +0100 Subject: [PATCH 21/25] chore(dui3): comments --- Core/Core/Models/Instances/IInstanceComponent.cs | 2 +- Core/Core/Models/Instances/InstanceDefinitionProxy.cs | 3 --- Core/Core/Models/Instances/InstanceProxy.cs | 3 --- .../Operations/Receive/AutocadHostObjectBuilder.cs | 3 +++ .../Operations/Send/AutocadRootObjectBuilder.cs | 1 + .../Operations/Receive/RhinoHostObjectBuilder.cs | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Core/Core/Models/Instances/IInstanceComponent.cs b/Core/Core/Models/Instances/IInstanceComponent.cs index c8e52e7ac9..9a6478607d 100644 --- a/Core/Core/Models/Instances/IInstanceComponent.cs +++ b/Core/Core/Models/Instances/IInstanceComponent.cs @@ -6,7 +6,7 @@ namespace Speckle.Core.Models.Instances; public interface IInstanceComponent { /// - /// The maximum "depth" at which this or was found. It's important to get right: as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them, starting with definitions first. + /// The maximum "depth" at which this or was found. On receive, as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them, starting with definitions first. /// public int MaxDepth { get; set; } } diff --git a/Core/Core/Models/Instances/InstanceDefinitionProxy.cs b/Core/Core/Models/Instances/InstanceDefinitionProxy.cs index e50dca8961..0fde842faa 100644 --- a/Core/Core/Models/Instances/InstanceDefinitionProxy.cs +++ b/Core/Core/Models/Instances/InstanceDefinitionProxy.cs @@ -12,8 +12,5 @@ public class InstanceDefinitionProxy : Base, IInstanceComponent /// public List Objects { get; set; } // source app application ids for the objects - /// - /// The maximum "depth" at which this instance was found. It's important to get right: as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them. - /// public int MaxDepth { get; set; } } diff --git a/Core/Core/Models/Instances/InstanceProxy.cs b/Core/Core/Models/Instances/InstanceProxy.cs index fcbac9dcae..5fa18496e9 100644 --- a/Core/Core/Models/Instances/InstanceProxy.cs +++ b/Core/Core/Models/Instances/InstanceProxy.cs @@ -22,8 +22,5 @@ public class InstanceProxy : Base, IInstanceComponent /// public string Units { get; set; } = Kits.Units.Meters; - /// - /// The maximum "depth" at which this instance was found. It's important to get right: as instances can be composed of other instances, we need to start from the deepest instance elements first when reconstructing them. - /// public int MaxDepth { get; set; } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index 7aa4dd2a52..61be6856b9 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -62,6 +62,7 @@ CancellationToken cancellationToken var objectGraph = _traversalFunction.Traverse(rootObject).Where(obj => obj.Current is not Collection); + // POC: these are not captured by traversal, so we need to re-add them here var instanceDefinitionProxies = (rootObject["instanceDefinitionProxies"] as List) ?.Cast() .ToList(); @@ -91,8 +92,10 @@ CancellationToken cancellationToken // Stage 1: Convert atomic objects Dictionary> applicationIdMap = new(); + var count = 0; foreach (var (layerName, atomicObject) in atomicObjects) { + onOperationProgressed?.Invoke("Converting objects", (double)++count / atomicObjects.Count); try { var convertedObjects = ConvertObject(atomicObject, layerName).ToList(); diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs index c7c025633e..5c09948f3b 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBuilder.cs @@ -52,6 +52,7 @@ public RootObjectBuilderResult Build( int count = 0; var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _instanceObjectsManager.UnpackSelection(objects); + // POC: until we formalise a bit more the root object modelWithLayers["instanceDefinitionProxies"] = instanceDefinitionProxies; List results = new(); diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 623083d717..a3353295d1 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -90,7 +90,7 @@ private HostObjectBuilderResult BakeObjects( var instanceComponents = new List<(string[] layerPath, IInstanceComponent obj)>(); - // POC: these are not captured by traversal, so we need to readd them here + // POC: these are not captured by traversal, so we need to re-add them here if (instanceDefinitionProxies != null && instanceDefinitionProxies.Count > 0) { var transformed = instanceDefinitionProxies.Select(proxy => (Array.Empty(), proxy as IInstanceComponent)); From 399144106f46f16f3178613904113c6a02425491 Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Mon, 24 Jun 2024 16:57:10 +0100 Subject: [PATCH 22/25] fix(dui3): throws ex upwards --- .../Bindings/AutocadBasicConnectorBinding.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs index 7ddcb736a4..a30179a2cb 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs @@ -148,7 +148,9 @@ private void HighlightObjectsOnView(ObjectId[] objectIds, string? modelCardId = } else { - //??? + // This will happen, in some cases, where we highlight individual objects. Should be caught by the top level handler and not + // crash the host app. + throw; } } }); From 6ffe0543fb611f13903dcb57232f8e54be16513f Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Tue, 25 Jun 2024 17:44:23 +0100 Subject: [PATCH 23/25] fix(dui3): blocks correctly handled in acad --- .../AutocadConnectorModule.cs | 3 +- .../HostApp/AutocadInstanceObjectManager.cs | 55 ++++++++---- .../HostApp/AutocadLayerManager.cs | 85 ++++++++++++++----- .../Receive/AutocadHostObjectBuilder.cs | 36 ++------ 4 files changed, 111 insertions(+), 68 deletions(-) diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs index 0ebccc6741..e77f804492 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/AutocadConnectorModule.cs @@ -37,9 +37,10 @@ public void Load(SpeckleContainerBuilder builder) builder.AddSingleton(new AutocadDocumentManager()); // TODO: Dependent to TransactionContext, can be moved to AutocadContext builder.AddSingleton(); builder.AddSingleton(); - builder.AddSingleton(); builder.AddSingleton(); + builder.AddScoped(); + // Operations builder.AddScoped>(); builder.AddSingleton(DefaultTraversal.CreateTraversalFunc()); diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs index e4647f301d..11067f52ba 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceObjectManager.cs @@ -18,11 +18,17 @@ namespace Speckle.Connectors.Autocad.HostApp; /// public class AutocadInstanceObjectManager : IInstanceObjectsManager> { + private readonly AutocadLayerManager _autocadLayerManager; private Dictionary InstanceProxies { get; set; } = new(); private Dictionary> InstanceProxiesByDefinitionId { get; set; } = new(); private Dictionary DefinitionProxies { get; set; } = new(); private Dictionary FlatAtomicObjects { get; set; } = new(); + public AutocadInstanceObjectManager(AutocadLayerManager autocadLayerManager) + { + _autocadLayerManager = autocadLayerManager; + } + public UnpackResult UnpackSelection(IEnumerable objects) { using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); @@ -146,7 +152,16 @@ public BakeResult BakeInstances( var record = new BlockTableRecord(); var objectIds = new ObjectIdCollection(); - record.Name = baseLayerName + definitionProxy.applicationId; + record.Name = baseLayerName; + if (definitionProxy["name"] is string name) + { + record.Name += name; + } + else + { + record.Name += definitionProxy.applicationId; + } + foreach (var entity in constituentEntities) { // record.AppendEntity(entity); @@ -175,8 +190,13 @@ instanceOrDefinition is InstanceProxy instanceProxy var modelSpaceBlockTableRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace( OpenMode.ForWrite ); + _autocadLayerManager.CreateLayerForReceive(path[0]); + var blockRef = new BlockReference(insertionPoint, definitionId) + { + BlockTransform = matrix3d, + Layer = path[0], + }; - var blockRef = new BlockReference(insertionPoint, definitionId) { BlockTransform = matrix3d }; // TODO: Bake on correct layer modelSpaceBlockTableRecord.AppendEntity(blockRef); if (instanceProxy.applicationId != null) @@ -200,17 +220,17 @@ instanceOrDefinition is InstanceProxy instanceProxy return new(createdObjectIds, consumedObjectIds, conversionResults); } + /// + /// Cleans up any previously created instances. + /// POC: This function will not be able to delete block definitions if the user creates a new one composed out of received definitions. + /// + /// public void PurgeInstances(string namePrefix) { using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); - - // Step 1: purge instances and instance definitions var instanceDefinitionsToDelete = new Dictionary(); - using var modelSpaceRecord = Application.DocumentManager.CurrentDocument.Database.GetModelSpace(OpenMode.ForRead); - using var blockTable = (BlockTable) - transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.BlockTableId, OpenMode.ForWrite); - // Recurses through a given block table record and purges inner instances as required. + // Helper function that recurses through a given block table record's constituent objects and purges inner instances as required. void TraverseAndClean(BlockTableRecord btr) { foreach (var objectId in btr) @@ -221,24 +241,27 @@ void TraverseAndClean(BlockTableRecord btr) continue; } var definition = (BlockTableRecord)transaction.GetObject(obj.BlockTableRecord, OpenMode.ForRead); - // POC: this is tightly coupled with a naming convention for definitions in the Instance object manager - if (definition.Name.Contains(namePrefix)) + if (obj.IsErased) { - obj.UpgradeOpen(); - obj.Erase(); TraverseAndClean(definition); - instanceDefinitionsToDelete[obj.BlockTableRecord.ToString()] = definition; + continue; } + + obj.UpgradeOpen(); + obj.Erase(); + TraverseAndClean(definition); + instanceDefinitionsToDelete[obj.BlockTableRecord.ToString()] = definition; } } - TraverseAndClean(modelSpaceRecord); + using var blockTable = (BlockTable) + transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.BlockTableId, OpenMode.ForRead); - // cleanup potentially orphaned definitions (if user deletes an instance reference, we don't reach composing definitions anymore - as such, we need to go through each btr too) + // deep clean definitions foreach (var btrId in blockTable) { var btr = (BlockTableRecord)transaction.GetObject(btrId, OpenMode.ForRead); - if (btr.Name.Contains(namePrefix)) + if (btr.Name.Contains(namePrefix)) // POC: this is tightly coupled with a naming convention for definitions in the instance object manager { TraverseAndClean(btr); instanceDefinitionsToDelete[btr.Name] = btr; diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs index 4a0452a16d..d172bea860 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerManager.cs @@ -1,48 +1,45 @@ using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.LayerManager; +using Speckle.Core.Models; +using Speckle.Core.Models.GraphTraversal; namespace Speckle.Connectors.Autocad.HostApp; +/// +/// Expects to be a scoped dependency for a given operation and helps with layer creation and cleanup. +/// public class AutocadLayerManager { private readonly AutocadContext _autocadContext; private readonly string _layerFilterName = "Speckle"; // POC: Will be addressed to move it into AutocadContext! - private Document Doc => Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument; + private Document Doc => Application.DocumentManager.MdiActiveDocument; + private readonly HashSet _uniqueLayerNames = new(); public AutocadLayerManager(AutocadContext autocadContext) { _autocadContext = autocadContext; } - /// - /// Constructs layer name with prefix and valid characters. - /// - /// Prefix to add layer name. - /// list of entries to concat with hyphen. - /// Full layer name with provided prefix and path. - public string GetFullLayerName(string baseLayerPrefix, string path) - { - var layerFullName = baseLayerPrefix + string.Join("-", path); - return _autocadContext.RemoveInvalidChars(layerFullName); - } - /// /// Will create a layer with the provided name, or, if it finds an existing one, will "purge" all objects from it. /// This ensures we're creating the new objects we've just received rather than overlaying them. /// /// Name to search layer for purge and create. - public void CreateLayerOrPurge(string layerName) + public void CreateLayerForReceive(string layerName) { - // POC: Will be addressed to move it into AutocadContext! - Document doc = Application.DocumentManager.MdiActiveDocument; - doc.LockDocument(); - using Transaction transaction = doc.TransactionManager.StartTransaction(); + if (!_uniqueLayerNames.Add(layerName)) + { + return; + } + + Doc.LockDocument(); + using Transaction transaction = Doc.TransactionManager.StartTransaction(); LayerTable? layerTable = - transaction.TransactionManager.GetObject(doc.Database.LayerTableId, OpenMode.ForRead) as LayerTable; + transaction.TransactionManager.GetObject(Doc.Database.LayerTableId, OpenMode.ForRead) as LayerTable; LayerTableRecord layerTableRecord = new() { Name = layerName }; bool hasLayer = layerTable != null && layerTable.Has(layerName); @@ -50,7 +47,7 @@ public void CreateLayerOrPurge(string layerName) { TypedValue[] tvs = { new((int)DxfCode.LayerName, layerName) }; SelectionFilter selectionFilter = new(tvs); - SelectionSet selectionResult = doc.Editor.SelectAll(selectionFilter).Value; + SelectionSet selectionResult = Doc.Editor.SelectAll(selectionFilter).Value; if (selectionResult == null) { return; @@ -69,7 +66,38 @@ public void CreateLayerOrPurge(string layerName) transaction.Commit(); } - // POC: Consider to extract somehow in factory or service! + public void DeleteAllLayersByPrefix(string prefix) + { + Doc.LockDocument(); + using Transaction transaction = Doc.TransactionManager.StartTransaction(); + + var layerTable = (LayerTable)transaction.TransactionManager.GetObject(Doc.Database.LayerTableId, OpenMode.ForRead); + foreach (var layerId in layerTable) + { + var layer = (LayerTableRecord)transaction.GetObject(layerId, OpenMode.ForRead); + var layerName = layer.Name; + if (layer.Name.Contains(prefix)) + { + // Delete objects from this layer + TypedValue[] tvs = { new((int)DxfCode.LayerName, layerName) }; + SelectionFilter selectionFilter = new(tvs); + SelectionSet selectionResult = Doc.Editor.SelectAll(selectionFilter).Value; + if (selectionResult == null) + { + return; + } + foreach (SelectedObject selectedObject in selectionResult) + { + transaction.GetObject(selectedObject.ObjectId, OpenMode.ForWrite).Erase(); + } + // Delete layer + layer.UpgradeOpen(); + layer.Erase(); + } + } + transaction.Commit(); + } + /// /// Creates a layer filter for the just received model, grouped under a top level filter "Speckle". Note: manual close and open of the layer properties panel required (it's an acad thing). /// This comes in handy to quickly access the layers created for this specific model. @@ -114,4 +142,19 @@ public void CreateLayerFilter(string projectName, string modelName) groupFilter.NestedFilters.Add(layerFilter); Doc.Database.LayerFilters = layerFilterTree; } + + /// + /// Gets a valid layer name for a given context. + /// + /// + /// + /// + public string GetLayerPath(TraversalContext context, string baseLayerPrefix) + { + string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).Reverse().ToArray(); + string[] path = collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); + + var name = baseLayerPrefix + string.Join("-", path); + return _autocadContext.RemoveInvalidChars(name); + } } diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index 61be6856b9..3e2e44c0fe 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -21,7 +21,8 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder private readonly AutocadLayerManager _autocadLayerManager; private readonly IRootToHostConverter _converter; private readonly GraphTraversal _traversalFunction; - private readonly HashSet _uniqueLayerNames = new(); + + // private readonly HashSet _uniqueLayerNames = new(); private readonly IInstanceObjectsManager> _instanceObjectsManager; public AutocadHostObjectBuilder( @@ -55,6 +56,7 @@ CancellationToken cancellationToken string baseLayerPrefix = $"SPK-{projectName}-{modelName}-"; PreReceiveDeepClean(baseLayerPrefix); + List results = new(); List bakedObjectIds = new(); @@ -79,7 +81,7 @@ CancellationToken cancellationToken foreach (TraversalContext tc in objectGraph) { - var layerName = GetLayerPath(tc, baseLayerPrefix); + var layerName = _autocadLayerManager.GetLayerPath(tc, baseLayerPrefix); if (tc.Current is IInstanceComponent instanceComponent) { instanceComponents.Add((new string[] { layerName }, instanceComponent)); @@ -143,21 +145,8 @@ CancellationToken cancellationToken private void PreReceiveDeepClean(string baseLayerPrefix) { + _autocadLayerManager.DeleteAllLayersByPrefix(baseLayerPrefix); _instanceObjectsManager.PurgeInstances(baseLayerPrefix); - - using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); - var layerTable = (LayerTable) - transaction.GetObject(Application.DocumentManager.CurrentDocument.Database.LayerTableId, OpenMode.ForRead); - - foreach (var layerId in layerTable) - { - var layer = (LayerTableRecord)transaction.GetObject(layerId, OpenMode.ForRead); - if (layer.Name.Contains(baseLayerPrefix)) - { - _autocadLayerManager.CreateLayerOrPurge(layer.Name); - } - } - transaction.Commit(); } private IEnumerable ConvertObject(Base obj, string layerName) @@ -166,13 +155,8 @@ private IEnumerable ConvertObject(Base obj, string layerName) Application.DocumentManager.MdiActiveDocument ); - if (_uniqueLayerNames.Add(layerName)) - { - _autocadLayerManager.CreateLayerOrPurge(layerName); - } + _autocadLayerManager.CreateLayerForReceive(layerName); - //POC: this transaction used to be called in the converter, We've moved it here to unify converter implementation - //POC: Is this transaction 100% needed? we are already inside a transaction? object converted; using (var tr = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction()) { @@ -194,12 +178,4 @@ private IEnumerable ConvertObject(Base obj, string layerName) yield return conversionResult; } } - - private string GetLayerPath(TraversalContext context, string baseLayerPrefix) - { - string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); - string[] path = collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); - - return _autocadLayerManager.GetFullLayerName(baseLayerPrefix, string.Join("-", path)); //TODO: reverse path? - } } From 88cb939d819c7d79343056a4076a45fd1e27caa6 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Thu, 27 Jun 2024 17:57:22 +0100 Subject: [PATCH 24/25] update core reference and fix to not use interfaces --- .../packages.lock.json | 20 +- .../packages.lock.json | 20 +- .../packages.lock.json | 20 +- .../packages.lock.json | 20 +- .../HostApp/RhinoInstanceObjectsManager.cs | 9 +- .../HostApp/RhinoLayerManager.cs | 16 +- .../Receive/RhinoHostObjectBuilder.cs | 12 +- .../Operations/Send/RhinoRootObjectBuilder.cs | 6 +- .../packages.lock.json | 25 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../packages.lock.json | 16 +- .../packages.lock.json | 27 +- .../packages.lock.json | 16 +- .../packages.lock.json | 20 +- .../Speckle.Connectors.DUI/packages.lock.json | 8 +- DUI3-DX/Directory.Packages.props | 4 +- .../packages.lock.json | 6 +- .../packages.lock.json | 16 +- .../packages.lock.json | 468 ++++++++++++++++++ .../packages.lock.json | 14 +- 26 files changed, 644 insertions(+), 211 deletions(-) create mode 100644 DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json diff --git a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json index e890a9f47a..b975016a9b 100644 --- a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json +++ b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json @@ -383,7 +383,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )", + "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -399,7 +399,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "speckle.converters.arcgis3": { @@ -421,7 +421,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -455,9 +455,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -479,11 +479,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } }, "System.Threading.Tasks.Dataflow": { diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json index 68bcf35809..0fff9ad56a 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json @@ -436,7 +436,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )", + "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -452,7 +452,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "speckle.converters.autocad2023": { @@ -474,7 +474,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -511,9 +511,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -535,11 +535,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } }, "System.Threading.Tasks.Dataflow": { diff --git a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json index b6c4d13a4c..71a6fee082 100644 --- a/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json +++ b/DUI3-DX/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json @@ -439,7 +439,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )", + "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -455,7 +455,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "speckle.converters.autocad2024": { @@ -477,7 +477,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -520,9 +520,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -544,11 +544,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } }, "System.Threading.Tasks.Dataflow": { diff --git a/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json b/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json index 0a002c7391..503e92ef50 100644 --- a/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json +++ b/DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json @@ -454,7 +454,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )", + "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -463,14 +463,14 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "speckle.converters.common": { "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -517,9 +517,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -541,11 +541,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } }, "Speckle.Revit.API": { diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs index 67ef531f43..e79073bddf 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoInstanceObjectsManager.cs @@ -5,12 +5,10 @@ using Speckle.Connectors.Rhino7.Extensions; using Speckle.Connectors.Utils.Conversion; using Speckle.Connectors.Utils.Instances; -using Speckle.Converters.Common; using Speckle.Core.Kits; using Speckle.Core.Logging; using Speckle.Core.Models; using Speckle.Core.Models.Instances; -using Speckle.Rhino7.Interfaces; namespace Speckle.Connectors.Rhino7.HostApp; @@ -20,19 +18,14 @@ namespace Speckle.Connectors.Rhino7.HostApp; /// public class RhinoInstanceObjectsManager : IInstanceObjectsManager> { - private readonly IConversionContextStack _contextStack; private readonly Dictionary _instanceProxies = new(); private readonly Dictionary> _instanceProxiesByDefinitionId = new(); private readonly Dictionary _definitionProxies = new(); private readonly Dictionary _flatAtomicObjects = new(); private readonly RhinoLayerManager _layerManager; - public RhinoInstanceObjectsManager( - IConversionContextStack contextStack, - RhinoLayerManager layerManager - ) + public RhinoInstanceObjectsManager(RhinoLayerManager layerManager) { - _contextStack = contextStack; _layerManager = layerManager; } diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs index 7b6e7d9dba..55323bf099 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/HostApp/RhinoLayerManager.cs @@ -1,10 +1,8 @@ using System.Diagnostics.Contracts; using Rhino; using Rhino.DocObjects; -using Speckle.Converters.Common; using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; -using Speckle.Rhino7.Interfaces; namespace Speckle.Connectors.Rhino7.HostApp; @@ -13,16 +11,8 @@ namespace Speckle.Connectors.Rhino7.HostApp; /// public class RhinoLayerManager { - private readonly IConversionContextStack _contextStack; - private readonly Dictionary _hostLayerCache; - private readonly Dictionary _layerCollectionCache; - - public RhinoLayerManager(IConversionContextStack contextStack) - { - _contextStack = contextStack; - _hostLayerCache = new(); - _layerCollectionCache = new(); - } + private readonly Dictionary _hostLayerCache = new(); + private readonly Dictionary _layerCollectionCache = new(); /// /// Creates the base layer and adds it to the cache. @@ -79,7 +69,7 @@ public int GetAndCreateLayerFromPath(string[] path, string baseLayerName) /// The layer you want the equivalent collection for. /// The root object that will be sent to Speckle, and will host all collections. /// - public Collection GetHostObjectCollection(IRhinoLayer layer, Collection rootObjectCollection) + public Collection GetHostObjectCollection(Layer layer, Collection rootObjectCollection) { if (_layerCollectionCache.TryGetValue(layer.Index, out Collection value)) { diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 17c04c16a8..1967f3a2bf 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -1,4 +1,6 @@ +using Rhino; using Rhino.DocObjects; +using Rhino.Geometry; using Speckle.Connectors.Rhino7.HostApp; using Speckle.Connectors.Utils.Builders; using Speckle.Connectors.Utils.Conversion; @@ -8,7 +10,6 @@ using Speckle.Core.Models; using Speckle.Core.Models.GraphTraversal; using Speckle.Core.Models.Instances; -using Speckle.Rhino7.Interfaces; namespace Speckle.Connectors.Rhino7.Operations.Receive; @@ -23,15 +24,13 @@ public class RhinoHostObjectBuilder : IHostObjectBuilder private readonly IInstanceObjectsManager> _instanceObjectsManager; private readonly RhinoLayerManager _layerManager; - private readonly IRhinoDocFactory _rhinoDocFactory; public RhinoHostObjectBuilder( IRootToHostConverter converter, - IConversionContextStack contextStack, + IConversionContextStack contextStack, GraphTraversal traverseFunction, RhinoLayerManager layerManager, - IInstanceObjectsManager> instanceObjectsManager, - IRhinoDocFactory rhinoDocFactory + IInstanceObjectsManager> instanceObjectsManager ) { _converter = converter; @@ -39,7 +38,6 @@ IRhinoDocFactory rhinoDocFactory _traverseFunction = traverseFunction; _layerManager = layerManager; _instanceObjectsManager = instanceObjectsManager; - _rhinoDocFactory = rhinoDocFactory; } public HostObjectBuilderResult Build( @@ -168,7 +166,7 @@ private void PreReceiveDeepClean(string baseLayerName, int rootLayerIndex) var doc = _contextStack.Current.Document; // Cleans up any previously received objects - if (rootLayerIndex != _rhinoDocFactory.UnsetIntIndex) + if (rootLayerIndex != RhinoMath.UnsetIntIndex) { var documentLayer = doc.Layers[rootLayerIndex]; var childLayers = documentLayer.GetChildren(); diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs index b2fe1a43ef..03d01c8568 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Send/RhinoRootObjectBuilder.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using Rhino; using Rhino.DocObjects; using Speckle.Core.Models; using Speckle.Autofac.DependencyInjection; @@ -11,7 +12,6 @@ using Speckle.Connectors.Utils.Instances; using Speckle.Connectors.Utils.Operations; using Speckle.Core.Logging; -using Speckle.Rhino7.Interfaces; namespace Speckle.Connectors.Rhino7.Operations.Send; @@ -23,13 +23,13 @@ public class RhinoRootObjectBuilder : IRootObjectBuilder private readonly IUnitOfWorkFactory _unitOfWorkFactory; private readonly ISendConversionCache _sendConversionCache; private readonly IInstanceObjectsManager> _instanceObjectsManager; - private readonly IConversionContextStack _contextStack; + private readonly IConversionContextStack _contextStack; private readonly RhinoLayerManager _layerManager; public RhinoRootObjectBuilder( IUnitOfWorkFactory unitOfWorkFactory, ISendConversionCache sendConversionCache, - IConversionContextStack contextStack, + IConversionContextStack contextStack, RhinoLayerManager layerManager, IInstanceObjectsManager> instanceObjectsManager ) diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json index 42b0399f3e..53de68cb60 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json @@ -285,11 +285,6 @@ "resolved": "13.0.2", "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" }, - "Speckle.Revit2023.Interfaces": { - "type": "Transitive", - "resolved": "0.1.1-preview.0.24", - "contentHash": "BSVpOUJc9g6ISrw8GxvtkglTlITpHEDYNOhxv1ZPbckBsI0yO36JiphhQV4q57ERqD9PpCozUJkVhlCaxWeS6A==" - }, "SQLitePCLRaw.bundle_e_sqlite3": { "type": "Transitive", "resolved": "2.1.4", @@ -449,7 +444,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )", + "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -465,14 +460,14 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "speckle.converters.common": { "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -516,9 +511,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -540,11 +535,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } }, "System.Threading.Tasks.Dataflow": { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3.DependencyInjection/packages.lock.json b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3.DependencyInjection/packages.lock.json index 383e499052..9f83e4c13d 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3.DependencyInjection/packages.lock.json +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3.DependencyInjection/packages.lock.json @@ -370,7 +370,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -394,9 +394,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -418,11 +418,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json index 18027e4d25..b77f27c0be 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json @@ -363,7 +363,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -374,9 +374,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -398,11 +398,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json b/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json index e9931ee09e..e51635ea86 100644 --- a/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json +++ b/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023.DependencyInjection/packages.lock.json @@ -374,7 +374,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -402,9 +402,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -426,11 +426,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023/packages.lock.json b/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023/packages.lock.json index b114e8a7c5..3c281f9dcf 100644 --- a/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023/packages.lock.json +++ b/DUI3-DX/Converters/Autocad/2023/Speckle.Converters.Autocad2023/packages.lock.json @@ -364,7 +364,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -379,9 +379,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -403,11 +403,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json b/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json index 8eee516ff1..fe9923d926 100644 --- a/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json +++ b/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024.DependencyInjection/packages.lock.json @@ -374,7 +374,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -402,9 +402,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -426,11 +426,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024/packages.lock.json b/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024/packages.lock.json index 5ef4059ca1..0a1d936cee 100644 --- a/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024/packages.lock.json +++ b/DUI3-DX/Converters/Autocad/2024/Speckle.Converters.Autocad2024/packages.lock.json @@ -364,7 +364,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -379,9 +379,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -403,11 +403,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.DependencyInjection/packages.lock.json b/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.DependencyInjection/packages.lock.json index a1186a3a61..254754bd42 100644 --- a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.DependencyInjection/packages.lock.json +++ b/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.DependencyInjection/packages.lock.json @@ -358,7 +358,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -387,9 +387,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -411,11 +411,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } }, "Speckle.Revit.API": { diff --git a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json b/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json index 0fbae10307..742efddba5 100644 --- a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json +++ b/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json @@ -364,7 +364,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -379,9 +379,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -403,11 +403,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7.DependencyInjection/packages.lock.json b/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7.DependencyInjection/packages.lock.json index 63c5d403f2..8094f14468 100644 --- a/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7.DependencyInjection/packages.lock.json +++ b/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7.DependencyInjection/packages.lock.json @@ -216,11 +216,6 @@ "resolved": "13.0.2", "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" }, - "Speckle.Revit2023.Interfaces": { - "type": "Transitive", - "resolved": "0.1.1-preview.0.24", - "contentHash": "BSVpOUJc9g6ISrw8GxvtkglTlITpHEDYNOhxv1ZPbckBsI0yO36JiphhQV4q57ERqD9PpCozUJkVhlCaxWeS6A==" - }, "SQLitePCLRaw.bundle_e_sqlite3": { "type": "Transitive", "resolved": "2.1.4", @@ -369,7 +364,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "speckle.converters.common.dependencyinjection": { @@ -396,17 +391,11 @@ "System.Memory": "4.5.5" } }, - "RhinoCommon": { - "type": "CentralTransitive", - "requested": "[7.13.21348.13001, )", - "resolved": "7.13.21348.13001", - "contentHash": "JQdaNw61ddBqIe08E9O4N/grwrN1hjDHcYW7tWylwCZyFR7SepoCD4NS+6LN6+oSQhNbhLi9Bf+hQOFYFdRAEA==" - }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -428,11 +417,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json b/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json index 57b03cf40e..98fcfe0158 100644 --- a/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json +++ b/DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json @@ -364,7 +364,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -379,9 +379,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -403,11 +403,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json b/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json index 9529e2c9c7..ff084cdbee 100644 --- a/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json +++ b/DUI3-DX/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json @@ -426,7 +426,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )", + "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -435,7 +435,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -460,9 +460,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -865,7 +865,7 @@ "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", "Speckle.Connectors.Utils": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )", + "Speckle.Core": "[3.0.1-alpha.14, )", "System.Threading.Tasks.Dataflow": "[6.0.0, )" } }, @@ -874,7 +874,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -895,9 +895,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json b/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json index d1e30f591b..9f44602e71 100644 --- a/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json +++ b/DUI3-DX/DUI3/Speckle.Connectors.DUI/packages.lock.json @@ -39,9 +39,9 @@ }, "Speckle.Core": { "type": "Direct", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -538,7 +538,7 @@ "dependencies": { "Serilog.Extensions.Logging": "[7.0.0, )", "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Core": "[3.0.1-alpha.11, )" + "Speckle.Core": "[3.0.1-alpha.14, )" } }, "Serilog.Extensions.Logging": { diff --git a/DUI3-DX/Directory.Packages.props b/DUI3-DX/Directory.Packages.props index ece50df9a0..f8e92452ff 100644 --- a/DUI3-DX/Directory.Packages.props +++ b/DUI3-DX/Directory.Packages.props @@ -16,8 +16,8 @@ - - + + diff --git a/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json b/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json index 2b72b82db0..990763d412 100644 --- a/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json +++ b/DUI3-DX/Sdk/Speckle.Connectors.Utils/packages.lock.json @@ -48,9 +48,9 @@ }, "Speckle.Core": { "type": "Direct", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", diff --git a/DUI3-DX/Sdk/Speckle.Converters.Common.DependencyInjection/packages.lock.json b/DUI3-DX/Sdk/Speckle.Converters.Common.DependencyInjection/packages.lock.json index 19523196d8..cb39bea478 100644 --- a/DUI3-DX/Sdk/Speckle.Converters.Common.DependencyInjection/packages.lock.json +++ b/DUI3-DX/Sdk/Speckle.Converters.Common.DependencyInjection/packages.lock.json @@ -464,7 +464,7 @@ "type": "Project", "dependencies": { "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" + "Speckle.Objects": "[3.0.1-alpha.14, )" } }, "Microsoft.Extensions.Logging.Abstractions": { @@ -479,9 +479,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -503,11 +503,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } } } diff --git a/DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json b/DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json new file mode 100644 index 0000000000..25241e1d85 --- /dev/null +++ b/DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json @@ -0,0 +1,468 @@ +{ + "version": 2, + "dependencies": { + ".NETFramework,Version=v4.8": { + "FluentAssertions": { + "type": "Direct", + "requested": "[6.12.0, )", + "resolved": "6.12.0", + "contentHash": "ZXhHT2YwP9lajrwSKbLlFqsmCCvFJMoRSK9t7sImfnCyd0OB3MhgxdoMcVqxbq1iyxD6mD2fiackWmBb7ayiXQ==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.0" + } + }, + "Microsoft.NET.Test.Sdk": { + "type": "Direct", + "requested": "[17.10.0, )", + "resolved": "17.10.0", + "contentHash": "0/2HeACkaHEYU3wc83YlcD2Fi4LMtECJjqrtvw0lPi9DCEa35zSPt1j4fuvM8NagjDqJuh1Ja35WcRtn1Um6/A==", + "dependencies": { + "Microsoft.CodeCoverage": "17.10.0" + } + }, + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "Moq": { + "type": "Direct", + "requested": "[4.20.70, )", + "resolved": "4.20.70", + "contentHash": "4rNnAwdpXJBuxqrOCzCyICXHSImOTRktCgCWXWykuF1qwoIsVvEnR7PjbMk/eLOxWvhmj5Kwt+kDV3RGUYcNwg==", + "dependencies": { + "Castle.Core": "5.1.1", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "NUnit": { + "type": "Direct", + "requested": "[4.1.0, )", + "resolved": "4.1.0", + "contentHash": "MT/DpAhjtiytzhTgTqIhBuWx4y26PKfDepYUHUM+5uv4TsryHC2jwFo5e6NhWkApCm/G6kZ80dRjdJFuAxq3rg==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "NUnit.Analyzers": { + "type": "Direct", + "requested": "[4.2.0, )", + "resolved": "4.2.0", + "contentHash": "4fJojPkzdoa4nB2+p6U+fITvPnVvwWSnsmiJ/Dl30xqiL3oxNbYvfeSLVd91hOmEjoUqSwN3Z7j1aFedjqWbUA==" + }, + "PolySharp": { + "type": "Direct", + "requested": "[1.14.1, )", + "resolved": "1.14.1", + "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" + }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, + "Speckle.Revit2023.Interfaces": { + "type": "Direct", + "requested": "[0.1.1-preview.0.28, )", + "resolved": "0.1.1-preview.0.28", + "contentHash": "7szXg/vRvP3Wdrn2ZGriVOfsw+bddlpVorBkCIhSHHs5qVTTG8IAIrI1l9dO0/aullaTMF+Xgxm9x3w1aXPiuA==" + }, + "Castle.Core": { + "type": "Transitive", + "resolved": "5.1.1", + "contentHash": "rpYtIczkzGpf+EkZgDr9CClTdemhsrwA/W5hMoPjLkRFnXzH44zDLoovXeKtmxb1ykXK9aJVODSpiJml8CTw2g==" + }, + "GraphQL.Client": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0", + "GraphQL.Client.Abstractions.Websocket": "6.0.0", + "System.Net.WebSockets.Client.Managed": "1.0.22", + "System.Reactive": "5.0.0" + } + }, + "GraphQL.Client.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==", + "dependencies": { + "GraphQL.Primitives": "6.0.0" + } + }, + "GraphQL.Client.Abstractions.Websocket": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0" + } + }, + "GraphQL.Primitives": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.CodeCoverage": { + "type": "Transitive", + "resolved": "17.10.0", + "contentHash": "yC7oSlnR54XO5kOuHlVOKtxomNNN1BWXX8lK1G2jaPXT9sUok7kCOoA4Pgs0qyFaCtMrNsprztYMeoEGqCm4uA==" + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==" + }, + "Microsoft.Data.Sqlite": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==", + "dependencies": { + "Microsoft.Data.Sqlite.Core": "7.0.5", + "SQLitePCLRaw.bundle_e_sqlite3": "2.1.4" + } + }, + "Microsoft.Data.Sqlite.Core": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "Polly": { + "type": "Transitive", + "resolved": "7.2.3", + "contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ==" + }, + "Polly.Contrib.WaitAndRetry": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA==" + }, + "Polly.Extensions.Http": { + "type": "Transitive", + "resolved": "3.0.0", + "contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==", + "dependencies": { + "Polly": "7.1.0" + } + }, + "Sentry": { + "type": "Transitive", + "resolved": "3.33.0", + "contentHash": "8vbD2o6IR2wrRrkSiRbnodWGWUOqIlwYtzpjvPNOb5raJdOf+zxMwfS8f6nx9bmrTTfDj7KrCB8C/5OuicAc8A==", + "dependencies": { + "System.Reflection.Metadata": "5.0.0", + "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", + "System.Text.Json": "5.0.2" + } + }, + "Sentry.Serilog": { + "type": "Transitive", + "resolved": "3.33.0", + "contentHash": "V8BU7QGWg2qLYfNPqtuTBhC1opysny5l+Ifp6J6PhOeAxU0FssR7nYfbJVetrnLIoh2rd3DlJ6hHYYQosQYcUQ==", + "dependencies": { + "Sentry": "3.33.0", + "Serilog": "2.7.1" + } + }, + "Serilog": { + "type": "Transitive", + "resolved": "2.12.0", + "contentHash": "xaiJLIdu6rYMKfQMYUZgTy8YK7SMZjB4Yk50C/u//Z4OsvxkUfSPJy4nknfvwAC34yr13q7kcyh4grbwhSxyZg==" + }, + "Serilog.Enrichers.ClientInfo": { + "type": "Transitive", + "resolved": "1.3.0", + "contentHash": "mTc7PM+wC9Hr7LWSwqt5mmnlAr7RJs+eTb3PGPRhwdOackk95MkhUZognuxXEdlW19HAFNmEBTSBY5DfLwM8jQ==", + "dependencies": { + "Serilog": "2.4.0" + } + }, + "Serilog.Exceptions": { + "type": "Transitive", + "resolved": "8.4.0", + "contentHash": "nc/+hUw3lsdo0zCj0KMIybAu7perMx79vu72w0za9Nsi6mWyNkGXxYxakAjWB7nEmYL6zdmhEQRB4oJ2ALUeug==", + "dependencies": { + "Serilog": "2.8.0" + } + }, + "Serilog.Formatting.Compact": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "pNroKVjo+rDqlxNG5PXkRLpfSCuDOBY0ri6jp9PLe505ljqwhwZz8ospy2vWhQlFu5GkIesh3FcDs4n7sWZODA==", + "dependencies": { + "Serilog": "2.8.0" + } + }, + "Serilog.Sinks.Console": { + "type": "Transitive", + "resolved": "4.1.0", + "contentHash": "K6N5q+5fetjnJPvCmkWOpJ/V8IEIoMIB1s86OzBrbxwTyHxdx3pmz4H+8+O/Dc/ftUX12DM1aynx/dDowkwzqg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.File": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Serilog.Sinks.PeriodicBatching": { + "type": "Transitive", + "resolved": "3.1.0", + "contentHash": "NDWR7m3PalVlGEq3rzoktrXikjFMLmpwF0HI4sowo8YDdU+gqPlTHlDQiOGxHfB0sTfjPA9JjA7ctKG9zqjGkw==", + "dependencies": { + "Serilog": "2.0.0" + } + }, + "Serilog.Sinks.Seq": { + "type": "Transitive", + "resolved": "5.2.2", + "contentHash": "1Csmo5ua7NKUe0yXUx+zsRefjAniPWcXFhUXxXG8pwo0iMiw2gjn9SOkgYnnxbgWqmlGv236w0N/dHc2v5XwMg==", + "dependencies": { + "Serilog": "2.12.0", + "Serilog.Formatting.Compact": "1.1.0", + "Serilog.Sinks.File": "5.0.0", + "Serilog.Sinks.PeriodicBatching": "3.1.0" + } + }, + "SerilogTimings": { + "type": "Transitive", + "resolved": "3.0.1", + "contentHash": "Zs28eTgszAMwpIrbBnWHBI50yuxL50p/dmAUWmy75+axdZYK/Sjm5/5m1N/CisR8acJUhTVcjPZrsB1P5iv0Uw==", + "dependencies": { + "Serilog": "2.10.0" + } + }, + "Speckle.Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.2", + "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" + }, + "SQLitePCLRaw.bundle_e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==", + "dependencies": { + "SQLitePCLRaw.lib.e_sqlite3": "2.1.4", + "SQLitePCLRaw.provider.dynamic_cdecl": "2.1.4" + } + }, + "SQLitePCLRaw.core": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==", + "dependencies": { + "System.Memory": "4.5.3" + } + }, + "SQLitePCLRaw.lib.e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg==" + }, + "SQLitePCLRaw.provider.dynamic_cdecl": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "ZsaKKhgYF9B1fvcnOGKl3EycNAwd9CRWX7v0rEfuPWhQQ5Jjpvf2VEHahiLIGHio3hxi3EIKFJw9KvyowWOUAw==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "System.Buffers": { + "type": "Transitive", + "resolved": "4.5.1", + "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" + }, + "System.Collections.Immutable": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==", + "dependencies": { + "System.Memory": "4.5.4" + } + }, + "System.DoubleNumerics": { + "type": "Transitive", + "resolved": "3.1.3", + "contentHash": "KRKEM/L3KBodjA9VOg3EifFVWUY6EOqaMB05UvPEDm7Zeby/kZW+4kdWUEPzW6xtkwf46p661L9NrbeeQhtLzw==", + "dependencies": { + "NETStandard.Library": "1.6.1" + } + }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + } + }, + "System.Net.WebSockets.Client.Managed": { + "type": "Transitive", + "resolved": "1.0.22", + "contentHash": "WqEOxPlXjuZrIjUtXNE9NxEfU/n5E35iV2PtoZdJSUC4tlrqwHnTee+wvMIM4OUaJWmwrymeqcgYrE0IkGAgLA==", + "dependencies": { + "System.Buffers": "4.4.0", + "System.Numerics.Vectors": "4.4.0" + } + }, + "System.Numerics.Vectors": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" + }, + "System.Reactive": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==", + "dependencies": { + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "System.Reflection.Metadata": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==", + "dependencies": { + "System.Collections.Immutable": "5.0.0" + } + }, + "System.Runtime.CompilerServices.Unsafe": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==" + }, + "System.Runtime.InteropServices.RuntimeInformation": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==" + }, + "System.Text.Encodings.Web": { + "type": "Transitive", + "resolved": "5.0.1", + "contentHash": "KmJ+CJXizDofbq6mpqDoRRLcxgOd2z9X3XoFNULSbvbqVRZkFX3istvr+MUjL6Zw1RT+RNdoI4GYidIINtgvqQ==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4" + } + }, + "System.Text.Json": { + "type": "Transitive", + "resolved": "5.0.2", + "contentHash": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "5.0.0", + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Numerics.Vectors": "4.5.0", + "System.Runtime.CompilerServices.Unsafe": "5.0.0", + "System.Text.Encodings.Web": "5.0.1", + "System.Threading.Tasks.Extensions": "4.5.4", + "System.ValueTuple": "4.5.0" + } + }, + "System.Threading.Tasks.Extensions": { + "type": "Transitive", + "resolved": "4.5.4", + "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "4.5.3" + } + }, + "System.ValueTuple": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==" + }, + "speckle.autofac": { + "type": "Project", + "dependencies": { + "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )" + } + }, + "speckle.converters.common": { + "type": "Project", + "dependencies": { + "Speckle.Autofac": "[2.0.999-local, )", + "Speckle.Objects": "[3.0.1-alpha.11, )" + } + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "CentralTransitive", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.5" + } + }, + "Speckle.Core": { + "type": "CentralTransitive", + "requested": "[3.0.1-alpha.11, )", + "resolved": "3.0.1-alpha.11", + "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "dependencies": { + "GraphQL.Client": "6.0.0", + "Microsoft.CSharp": "4.7.0", + "Microsoft.Data.Sqlite": "7.0.5", + "Polly": "7.2.3", + "Polly.Contrib.WaitAndRetry": "1.1.1", + "Polly.Extensions.Http": "3.0.0", + "Sentry": "3.33.0", + "Sentry.Serilog": "3.33.0", + "Serilog": "2.12.0", + "Serilog.Enrichers.ClientInfo": "1.3.0", + "Serilog.Exceptions": "8.4.0", + "Serilog.Sinks.Console": "4.1.0", + "Serilog.Sinks.Seq": "5.2.2", + "SerilogTimings": "3.0.1", + "Speckle.Newtonsoft.Json": "13.0.2", + "System.DoubleNumerics": "3.1.3" + } + }, + "Speckle.Objects": { + "type": "CentralTransitive", + "requested": "[3.0.1-alpha.11, )", + "resolved": "3.0.1-alpha.11", + "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "dependencies": { + "Speckle.Core": "3.0.1-alpha.11" + } + } + } + } +} \ No newline at end of file diff --git a/DUI3-DX/Sdk/Speckle.Converters.Common/packages.lock.json b/DUI3-DX/Sdk/Speckle.Converters.Common/packages.lock.json index 0bd34a6305..23035de679 100644 --- a/DUI3-DX/Sdk/Speckle.Converters.Common/packages.lock.json +++ b/DUI3-DX/Sdk/Speckle.Converters.Common/packages.lock.json @@ -35,11 +35,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "z38LGryMvh7iU1uBW+4uo5DwsB3CwRgLt2uFexWFx3mPSid+A0l5XcJzOgLwgFhNl6B42Ryz4ezBsddTp1Uc/g==", "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" + "Speckle.Core": "3.0.1-alpha.14" } }, "GraphQL.Client": { @@ -472,9 +472,9 @@ }, "Speckle.Core": { "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", + "requested": "[3.0.1-alpha.14, )", + "resolved": "3.0.1-alpha.14", + "contentHash": "RzQPVIGFFkKvG56YLr8ACtiwdWJE6IJ9vCQ4qHa0PIsUEpfzAIAi59jnzqtByOFC0FiFrFPow9bkfzylaZorAA==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", From 52d1c657ab022163909f2be137f8b3b972ebd545 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Thu, 27 Jun 2024 18:13:00 +0100 Subject: [PATCH 25/25] remove extra files --- .../XyzConversionToPointTests.cs | 59 --- .../packages.lock.json | 468 ------------------ 2 files changed, 527 deletions(-) delete mode 100644 DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/XyzConversionToPointTests.cs delete mode 100644 DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json diff --git a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/XyzConversionToPointTests.cs b/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/XyzConversionToPointTests.cs deleted file mode 100644 index 471ca0be47..0000000000 --- a/DUI3-DX/Converters/Revit/Speckle.Converters.Revit2023.Tests/XyzConversionToPointTests.cs +++ /dev/null @@ -1,59 +0,0 @@ -using FluentAssertions; -using Moq; -using NUnit.Framework; -using Speckle.Converters.Common; -using Speckle.Converters.RevitShared.Services; -using Speckle.Converters.RevitShared.ToSpeckle; -using Speckle.Revit.Interfaces; - -namespace Speckle.Converters.Revit2023.Tests; - -public class XyzConversionToPointTests -{ - private readonly MockRepository _repository = new(MockBehavior.Strict); - - private readonly Mock> _revitConversionContextStack; - private readonly Mock _scalingServiceToSpeckle; - - public XyzConversionToPointTests() - { - _revitConversionContextStack = _repository.Create>(); - _scalingServiceToSpeckle = _repository.Create(); - } - - [TearDown] - public void Verify() => _repository.VerifyAll(); - - [Test] - public void Convert_Point() - { - var x = 3.1; - var y = 3.2; - var z = 3.3; - var xScaled = 4.1; - var yScaled = 4.2; - var zScaled = 4.3; - var xyz = _repository.Create(); - xyz.Setup(x => x.X).Returns(x); - xyz.Setup(x => x.Y).Returns(y); - xyz.Setup(x => x.Z).Returns(z); - - var units = "units"; - var conversionContext = _repository.Create>(); - conversionContext.Setup(x => x.SpeckleUnits).Returns(units); - - _scalingServiceToSpeckle.Setup(a => a.ScaleLength(x)).Returns(xScaled); - _scalingServiceToSpeckle.Setup(a => a.ScaleLength(y)).Returns(yScaled); - _scalingServiceToSpeckle.Setup(a => a.ScaleLength(z)).Returns(zScaled); - - _revitConversionContextStack.Setup(x => x.Current).Returns(conversionContext.Object); - - var converter = new XyzConversionToPoint(_scalingServiceToSpeckle.Object, _revitConversionContextStack.Object); - var point = converter.Convert(xyz.Object); - - point.x.Should().Be(xScaled); - point.y.Should().Be(yScaled); - point.z.Should().Be(zScaled); - point.units.Should().Be(units); - } -} diff --git a/DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json b/DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json deleted file mode 100644 index 25241e1d85..0000000000 --- a/DUI3-DX/Sdk/Speckle.Converters.Common.Tests/packages.lock.json +++ /dev/null @@ -1,468 +0,0 @@ -{ - "version": 2, - "dependencies": { - ".NETFramework,Version=v4.8": { - "FluentAssertions": { - "type": "Direct", - "requested": "[6.12.0, )", - "resolved": "6.12.0", - "contentHash": "ZXhHT2YwP9lajrwSKbLlFqsmCCvFJMoRSK9t7sImfnCyd0OB3MhgxdoMcVqxbq1iyxD6mD2fiackWmBb7ayiXQ==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.0" - } - }, - "Microsoft.NET.Test.Sdk": { - "type": "Direct", - "requested": "[17.10.0, )", - "resolved": "17.10.0", - "contentHash": "0/2HeACkaHEYU3wc83YlcD2Fi4LMtECJjqrtvw0lPi9DCEa35zSPt1j4fuvM8NagjDqJuh1Ja35WcRtn1Um6/A==", - "dependencies": { - "Microsoft.CodeCoverage": "17.10.0" - } - }, - "Microsoft.SourceLink.GitHub": { - "type": "Direct", - "requested": "[8.0.0, )", - "resolved": "8.0.0", - "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", - "dependencies": { - "Microsoft.Build.Tasks.Git": "8.0.0", - "Microsoft.SourceLink.Common": "8.0.0" - } - }, - "Moq": { - "type": "Direct", - "requested": "[4.20.70, )", - "resolved": "4.20.70", - "contentHash": "4rNnAwdpXJBuxqrOCzCyICXHSImOTRktCgCWXWykuF1qwoIsVvEnR7PjbMk/eLOxWvhmj5Kwt+kDV3RGUYcNwg==", - "dependencies": { - "Castle.Core": "5.1.1", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "NUnit": { - "type": "Direct", - "requested": "[4.1.0, )", - "resolved": "4.1.0", - "contentHash": "MT/DpAhjtiytzhTgTqIhBuWx4y26PKfDepYUHUM+5uv4TsryHC2jwFo5e6NhWkApCm/G6kZ80dRjdJFuAxq3rg==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "NUnit.Analyzers": { - "type": "Direct", - "requested": "[4.2.0, )", - "resolved": "4.2.0", - "contentHash": "4fJojPkzdoa4nB2+p6U+fITvPnVvwWSnsmiJ/Dl30xqiL3oxNbYvfeSLVd91hOmEjoUqSwN3Z7j1aFedjqWbUA==" - }, - "PolySharp": { - "type": "Direct", - "requested": "[1.14.1, )", - "resolved": "1.14.1", - "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" - }, - "Speckle.InterfaceGenerator": { - "type": "Direct", - "requested": "[0.9.5, )", - "resolved": "0.9.5", - "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" - }, - "Speckle.Revit2023.Interfaces": { - "type": "Direct", - "requested": "[0.1.1-preview.0.28, )", - "resolved": "0.1.1-preview.0.28", - "contentHash": "7szXg/vRvP3Wdrn2ZGriVOfsw+bddlpVorBkCIhSHHs5qVTTG8IAIrI1l9dO0/aullaTMF+Xgxm9x3w1aXPiuA==" - }, - "Castle.Core": { - "type": "Transitive", - "resolved": "5.1.1", - "contentHash": "rpYtIczkzGpf+EkZgDr9CClTdemhsrwA/W5hMoPjLkRFnXzH44zDLoovXeKtmxb1ykXK9aJVODSpiJml8CTw2g==" - }, - "GraphQL.Client": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==", - "dependencies": { - "GraphQL.Client.Abstractions": "6.0.0", - "GraphQL.Client.Abstractions.Websocket": "6.0.0", - "System.Net.WebSockets.Client.Managed": "1.0.22", - "System.Reactive": "5.0.0" - } - }, - "GraphQL.Client.Abstractions": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==", - "dependencies": { - "GraphQL.Primitives": "6.0.0" - } - }, - "GraphQL.Client.Abstractions.Websocket": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==", - "dependencies": { - "GraphQL.Client.Abstractions": "6.0.0" - } - }, - "GraphQL.Primitives": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA==" - }, - "Microsoft.Bcl.AsyncInterfaces": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "Microsoft.Build.Tasks.Git": { - "type": "Transitive", - "resolved": "8.0.0", - "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" - }, - "Microsoft.CodeCoverage": { - "type": "Transitive", - "resolved": "17.10.0", - "contentHash": "yC7oSlnR54XO5kOuHlVOKtxomNNN1BWXX8lK1G2jaPXT9sUok7kCOoA4Pgs0qyFaCtMrNsprztYMeoEGqCm4uA==" - }, - "Microsoft.CSharp": { - "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==" - }, - "Microsoft.Data.Sqlite": { - "type": "Transitive", - "resolved": "7.0.5", - "contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==", - "dependencies": { - "Microsoft.Data.Sqlite.Core": "7.0.5", - "SQLitePCLRaw.bundle_e_sqlite3": "2.1.4" - } - }, - "Microsoft.Data.Sqlite.Core": { - "type": "Transitive", - "resolved": "7.0.5", - "contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==", - "dependencies": { - "SQLitePCLRaw.core": "2.1.4" - } - }, - "Microsoft.SourceLink.Common": { - "type": "Transitive", - "resolved": "8.0.0", - "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" - }, - "Polly": { - "type": "Transitive", - "resolved": "7.2.3", - "contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ==" - }, - "Polly.Contrib.WaitAndRetry": { - "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA==" - }, - "Polly.Extensions.Http": { - "type": "Transitive", - "resolved": "3.0.0", - "contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==", - "dependencies": { - "Polly": "7.1.0" - } - }, - "Sentry": { - "type": "Transitive", - "resolved": "3.33.0", - "contentHash": "8vbD2o6IR2wrRrkSiRbnodWGWUOqIlwYtzpjvPNOb5raJdOf+zxMwfS8f6nx9bmrTTfDj7KrCB8C/5OuicAc8A==", - "dependencies": { - "System.Reflection.Metadata": "5.0.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Text.Json": "5.0.2" - } - }, - "Sentry.Serilog": { - "type": "Transitive", - "resolved": "3.33.0", - "contentHash": "V8BU7QGWg2qLYfNPqtuTBhC1opysny5l+Ifp6J6PhOeAxU0FssR7nYfbJVetrnLIoh2rd3DlJ6hHYYQosQYcUQ==", - "dependencies": { - "Sentry": "3.33.0", - "Serilog": "2.7.1" - } - }, - "Serilog": { - "type": "Transitive", - "resolved": "2.12.0", - "contentHash": "xaiJLIdu6rYMKfQMYUZgTy8YK7SMZjB4Yk50C/u//Z4OsvxkUfSPJy4nknfvwAC34yr13q7kcyh4grbwhSxyZg==" - }, - "Serilog.Enrichers.ClientInfo": { - "type": "Transitive", - "resolved": "1.3.0", - "contentHash": "mTc7PM+wC9Hr7LWSwqt5mmnlAr7RJs+eTb3PGPRhwdOackk95MkhUZognuxXEdlW19HAFNmEBTSBY5DfLwM8jQ==", - "dependencies": { - "Serilog": "2.4.0" - } - }, - "Serilog.Exceptions": { - "type": "Transitive", - "resolved": "8.4.0", - "contentHash": "nc/+hUw3lsdo0zCj0KMIybAu7perMx79vu72w0za9Nsi6mWyNkGXxYxakAjWB7nEmYL6zdmhEQRB4oJ2ALUeug==", - "dependencies": { - "Serilog": "2.8.0" - } - }, - "Serilog.Formatting.Compact": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "pNroKVjo+rDqlxNG5PXkRLpfSCuDOBY0ri6jp9PLe505ljqwhwZz8ospy2vWhQlFu5GkIesh3FcDs4n7sWZODA==", - "dependencies": { - "Serilog": "2.8.0" - } - }, - "Serilog.Sinks.Console": { - "type": "Transitive", - "resolved": "4.1.0", - "contentHash": "K6N5q+5fetjnJPvCmkWOpJ/V8IEIoMIB1s86OzBrbxwTyHxdx3pmz4H+8+O/Dc/ftUX12DM1aynx/dDowkwzqg==", - "dependencies": { - "Serilog": "2.10.0" - } - }, - "Serilog.Sinks.File": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", - "dependencies": { - "Serilog": "2.10.0" - } - }, - "Serilog.Sinks.PeriodicBatching": { - "type": "Transitive", - "resolved": "3.1.0", - "contentHash": "NDWR7m3PalVlGEq3rzoktrXikjFMLmpwF0HI4sowo8YDdU+gqPlTHlDQiOGxHfB0sTfjPA9JjA7ctKG9zqjGkw==", - "dependencies": { - "Serilog": "2.0.0" - } - }, - "Serilog.Sinks.Seq": { - "type": "Transitive", - "resolved": "5.2.2", - "contentHash": "1Csmo5ua7NKUe0yXUx+zsRefjAniPWcXFhUXxXG8pwo0iMiw2gjn9SOkgYnnxbgWqmlGv236w0N/dHc2v5XwMg==", - "dependencies": { - "Serilog": "2.12.0", - "Serilog.Formatting.Compact": "1.1.0", - "Serilog.Sinks.File": "5.0.0", - "Serilog.Sinks.PeriodicBatching": "3.1.0" - } - }, - "SerilogTimings": { - "type": "Transitive", - "resolved": "3.0.1", - "contentHash": "Zs28eTgszAMwpIrbBnWHBI50yuxL50p/dmAUWmy75+axdZYK/Sjm5/5m1N/CisR8acJUhTVcjPZrsB1P5iv0Uw==", - "dependencies": { - "Serilog": "2.10.0" - } - }, - "Speckle.Newtonsoft.Json": { - "type": "Transitive", - "resolved": "13.0.2", - "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" - }, - "SQLitePCLRaw.bundle_e_sqlite3": { - "type": "Transitive", - "resolved": "2.1.4", - "contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==", - "dependencies": { - "SQLitePCLRaw.lib.e_sqlite3": "2.1.4", - "SQLitePCLRaw.provider.dynamic_cdecl": "2.1.4" - } - }, - "SQLitePCLRaw.core": { - "type": "Transitive", - "resolved": "2.1.4", - "contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==", - "dependencies": { - "System.Memory": "4.5.3" - } - }, - "SQLitePCLRaw.lib.e_sqlite3": { - "type": "Transitive", - "resolved": "2.1.4", - "contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg==" - }, - "SQLitePCLRaw.provider.dynamic_cdecl": { - "type": "Transitive", - "resolved": "2.1.4", - "contentHash": "ZsaKKhgYF9B1fvcnOGKl3EycNAwd9CRWX7v0rEfuPWhQQ5Jjpvf2VEHahiLIGHio3hxi3EIKFJw9KvyowWOUAw==", - "dependencies": { - "SQLitePCLRaw.core": "2.1.4" - } - }, - "System.Buffers": { - "type": "Transitive", - "resolved": "4.5.1", - "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" - }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==", - "dependencies": { - "System.Memory": "4.5.4" - } - }, - "System.DoubleNumerics": { - "type": "Transitive", - "resolved": "3.1.3", - "contentHash": "KRKEM/L3KBodjA9VOg3EifFVWUY6EOqaMB05UvPEDm7Zeby/kZW+4kdWUEPzW6xtkwf46p661L9NrbeeQhtLzw==", - "dependencies": { - "NETStandard.Library": "1.6.1" - } - }, - "System.Memory": { - "type": "Transitive", - "resolved": "4.5.5", - "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "4.5.3" - } - }, - "System.Net.WebSockets.Client.Managed": { - "type": "Transitive", - "resolved": "1.0.22", - "contentHash": "WqEOxPlXjuZrIjUtXNE9NxEfU/n5E35iV2PtoZdJSUC4tlrqwHnTee+wvMIM4OUaJWmwrymeqcgYrE0IkGAgLA==", - "dependencies": { - "System.Buffers": "4.4.0", - "System.Numerics.Vectors": "4.4.0" - } - }, - "System.Numerics.Vectors": { - "type": "Transitive", - "resolved": "4.5.0", - "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" - }, - "System.Reactive": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==", - "dependencies": { - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Reflection.Metadata": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==", - "dependencies": { - "System.Collections.Immutable": "5.0.0" - } - }, - "System.Runtime.CompilerServices.Unsafe": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==" - }, - "System.Runtime.InteropServices.RuntimeInformation": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==" - }, - "System.Text.Encodings.Web": { - "type": "Transitive", - "resolved": "5.0.1", - "contentHash": "KmJ+CJXizDofbq6mpqDoRRLcxgOd2z9X3XoFNULSbvbqVRZkFX3istvr+MUjL6Zw1RT+RNdoI4GYidIINtgvqQ==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4" - } - }, - "System.Text.Json": { - "type": "Transitive", - "resolved": "5.0.2", - "contentHash": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "5.0.0", - "System.Buffers": "4.5.1", - "System.Memory": "4.5.4", - "System.Numerics.Vectors": "4.5.0", - "System.Runtime.CompilerServices.Unsafe": "5.0.0", - "System.Text.Encodings.Web": "5.0.1", - "System.Threading.Tasks.Extensions": "4.5.4", - "System.ValueTuple": "4.5.0" - } - }, - "System.Threading.Tasks.Extensions": { - "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "4.5.3" - } - }, - "System.ValueTuple": { - "type": "Transitive", - "resolved": "4.5.0", - "contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==" - }, - "speckle.autofac": { - "type": "Project", - "dependencies": { - "Microsoft.Extensions.Logging.Abstractions": "[7.0.0, )" - } - }, - "speckle.converters.common": { - "type": "Project", - "dependencies": { - "Speckle.Autofac": "[2.0.999-local, )", - "Speckle.Objects": "[3.0.1-alpha.11, )" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "CentralTransitive", - "requested": "[7.0.0, )", - "resolved": "7.0.0", - "contentHash": "kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==", - "dependencies": { - "System.Buffers": "4.5.1", - "System.Memory": "4.5.5" - } - }, - "Speckle.Core": { - "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "Zt2dBJLlfziEACYCHThbhKypSjhoA01rTw9BzNI72c/BDyftXIz70Tetq/8ZMEqQnKqfmRyYADsAdWKxpdV0Hg==", - "dependencies": { - "GraphQL.Client": "6.0.0", - "Microsoft.CSharp": "4.7.0", - "Microsoft.Data.Sqlite": "7.0.5", - "Polly": "7.2.3", - "Polly.Contrib.WaitAndRetry": "1.1.1", - "Polly.Extensions.Http": "3.0.0", - "Sentry": "3.33.0", - "Sentry.Serilog": "3.33.0", - "Serilog": "2.12.0", - "Serilog.Enrichers.ClientInfo": "1.3.0", - "Serilog.Exceptions": "8.4.0", - "Serilog.Sinks.Console": "4.1.0", - "Serilog.Sinks.Seq": "5.2.2", - "SerilogTimings": "3.0.1", - "Speckle.Newtonsoft.Json": "13.0.2", - "System.DoubleNumerics": "3.1.3" - } - }, - "Speckle.Objects": { - "type": "CentralTransitive", - "requested": "[3.0.1-alpha.11, )", - "resolved": "3.0.1-alpha.11", - "contentHash": "YR7sei3OQBAi8R/kIu8bEmg5ELDIJK6l5fhOgdnqA9ZvD/fvmRb+09z8lIUTDsgdAdvYU/A/x9VxH9OGPbp9Kw==", - "dependencies": { - "Speckle.Core": "3.0.1-alpha.11" - } - } - } - } -} \ No newline at end of file