Skip to content

Commit

Permalink
can build agian
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhathcock committed Dec 3, 2024
1 parent 8954a93 commit d5f6323
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,11 @@ CancellationToken cancellationToken
// 7 - Create groups
if (unpackedRoot.GroupProxies != null)
{
<<<<<<< HEAD
List<ReceiveConversionResult> groupResults = groupBaker.CreateGroups(unpackedRoot.GroupProxies, applicationIdMap);
results.AddRange(groupResults);
=======
IReadOnlyCollection<ReceiveConversionResult> groupResults = _groupBaker.CreateGroups(
IReadOnlyCollection<ReceiveConversionResult> groupResults = groupBaker.CreateGroups(
unpackedRoot.GroupProxies,
applicationIdMap
);
results.UnionWith(groupResults);
>>>>>>> dev
}

return new HostObjectBuilderResult(bakedObjectIds, results);
Expand All @@ -156,13 +151,8 @@ private void PreReceiveDeepClean(string baseLayerPrefix)

private IReadOnlyCollection<Entity> ConvertObject(Base obj, Collection[] layerPath, string baseLayerNamePrefix)
{
<<<<<<< HEAD
string layerName = layerBaker.CreateLayerForReceive(layerPath, baseLayerNamePrefix);
var convertedEntities = new List<Entity>();
=======
string layerName = _layerBaker.CreateLayerForReceive(layerPath, baseLayerNamePrefix);
var convertedEntities = new HashSet<Entity>();
>>>>>>> dev

using var tr = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction();

Expand All @@ -187,13 +177,8 @@ private IReadOnlyCollection<Entity> ConvertObject(Base obj, Collection[] layerPa

private Entity BakeObject(Entity entity, Base originalObject, string layerName, Base? parentObject = null)
{
<<<<<<< HEAD
var objId = originalObject.applicationId ?? originalObject.id;
if (colorBaker.ObjectColorsIdMap.TryGetValue(objId, out AutocadColor? color))
=======
var objId = originalObject.applicationId ?? originalObject.id.NotNull();
if (_colorBaker.ObjectColorsIdMap.TryGetValue(objId, out AutocadColor? color))
>>>>>>> dev
if (colorBaker.ObjectColorsIdMap.TryGetValue(objId, out AutocadColor? color))
{
entity.Color = color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ ICSiApplicationService csiApplicationService
_csiApplicationService = csiApplicationService;
}

public async Task<RootObjectBuilderResult> Build(
public RootObjectBuilderResult Build(
IReadOnlyList<ICSiWrapper> csiObjects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken = default
IProgress<CardProgress> onOperationProgressed
)
{
using var activity = _activityFactory.Start("Build");
Expand All @@ -63,7 +62,6 @@ public async Task<RootObjectBuilderResult> Build(
foreach (ICSiWrapper csiObject in csiObjects)
{
using var _2 = _activityFactory.Start("Convert");
cancellationToken.ThrowIfCancellationRequested();

var result = ConvertCSiObject(csiObject, rootObjectCollection, sendInfo.ProjectId);
results.Add(result);
Expand All @@ -78,7 +76,6 @@ public async Task<RootObjectBuilderResult> Build(
throw new SpeckleException("Failed to convert all objects.");
}

await Task.Yield();
return new RootObjectBuilderResult(rootObjectCollection, results);
}

Expand Down
14 changes: 2 additions & 12 deletions Connectors/CSi/Speckle.Connectors.CSiShared/ServiceRegistration.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using Speckle.Connectors.Common;
<<<<<<< HEAD
using Speckle.Connectors.Common.Threading;
=======
using Speckle.Connectors.Common.Builders;
using Speckle.Connectors.Common.Operations;
>>>>>>> dev
using Speckle.Connectors.Common.Threading;
using Speckle.Connectors.CSiShared.Bindings;
using Speckle.Connectors.CSiShared.Builders;
using Speckle.Connectors.CSiShared.Filters;
using Speckle.Connectors.CSiShared.HostApp;
using Speckle.Connectors.DUI;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.WebView;
using Speckle.Converters.CSiShared;
Expand All @@ -28,15 +24,9 @@ public static IServiceCollection AddCSi(this IServiceCollection services)
services.AddSingleton<ICSiApplicationService, CSiApplicationService>();

services.AddConnectorUtils();
<<<<<<< HEAD
services.AddDUI<DefaultThreadContext, CSiSharedDocumentModelStore>();
=======
services.AddDUI<CSiDocumentModelStore>();
>>>>>>> dev
services.AddDUI<DefaultThreadContext, CSiDocumentModelStore>();
services.AddDUIView();

services.AddSingleton<DocumentModelStore, CSiDocumentModelStore>();

services.AddSingleton<IBinding, TestBinding>();
services.AddSingleton<IBinding, ConfigBinding>();
services.AddSingleton<IBinding, AccountBinding>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,69 +34,13 @@ public sealed class RevitHostObjectBuilder(
RootObjectUnpacker rootObjectUnpacker,
ILogger<RevitHostObjectBuilder> logger,
RevitToHostCacheSingleton revitToHostCacheSingleton,
ITypedConverter<(Base atomicObject, List<Matrix4x4> matrix), DirectShape> localToGlobalDirectShapeConverter
ITypedConverter<
(Base atomicObject, IReadOnlyCollection<Matrix4x4> matrix),
DirectShape
> localToGlobalDirectShapeConverter
) : IHostObjectBuilder, IDisposable
{
<<<<<<< HEAD
public HostObjectBuilderResult Build(
=======
private readonly IRootToHostConverter _converter;
private readonly IConverterSettingsStore<RevitConversionSettings> _converterSettings;
private readonly RevitToHostCacheSingleton _revitToHostCacheSingleton;
private readonly ITransactionManager _transactionManager;
private readonly ILocalToGlobalUnpacker _localToGlobalUnpacker;
private readonly RevitGroupBaker _groupBaker;
private readonly RevitMaterialBaker _materialBaker;
private readonly ILogger<RevitHostObjectBuilder> _logger;
private readonly ITypedConverter<
(Base atomicObject, IReadOnlyCollection<Matrix4x4> matrix),
DirectShape
> _localToGlobalDirectShapeConverter;

private readonly RootObjectUnpacker _rootObjectUnpacker;
private readonly ISdkActivityFactory _activityFactory;

public RevitHostObjectBuilder(
IRootToHostConverter converter,
IConverterSettingsStore<RevitConversionSettings> converterSettings,
ITransactionManager transactionManager,
ISdkActivityFactory activityFactory,
ILocalToGlobalUnpacker localToGlobalUnpacker,
RevitGroupBaker groupManager,
RevitMaterialBaker materialBaker,
RootObjectUnpacker rootObjectUnpacker,
ILogger<RevitHostObjectBuilder> logger,
RevitToHostCacheSingleton revitToHostCacheSingleton,
ITypedConverter<
(Base atomicObject, IReadOnlyCollection<Matrix4x4> matrix),
DirectShape
> localToGlobalDirectShapeConverter
)
{
_converter = converter;
_converterSettings = converterSettings;
_transactionManager = transactionManager;
_localToGlobalUnpacker = localToGlobalUnpacker;
_groupBaker = groupManager;
_materialBaker = materialBaker;
_rootObjectUnpacker = rootObjectUnpacker;
_logger = logger;
_revitToHostCacheSingleton = revitToHostCacheSingleton;
_localToGlobalDirectShapeConverter = localToGlobalDirectShapeConverter;
_activityFactory = activityFactory;
}

public Task<HostObjectBuilderResult> Build(
Base rootObject,
string projectName,
string modelName,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
) =>
RevitTask.RunAsync(() => BuildSync(rootObject, projectName, modelName, onOperationProgressed, cancellationToken));

private HostObjectBuilderResult BuildSync(
>>>>>>> dev
Base rootObject,
string projectName,
string modelName,
Expand Down

0 comments on commit d5f6323

Please sign in to comment.