Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ProxyMap class that is source generated #3507

Merged
merged 36 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8f181f0
Initial commit from converter-tests
adamhathcock Jun 12, 2024
907e7ee
tests now run
adamhathcock Jun 12, 2024
f7de9ac
adding more to proxy map
adamhathcock Jun 12, 2024
b430010
switch to FluentAssertions
adamhathcock Jun 12, 2024
c95677e
fix IRevitLevel conversions
adamhathcock Jun 12, 2024
4b5fbf2
more cast handling
adamhathcock Jun 12, 2024
6153576
use proxymap for ofclass
adamhathcock Jun 13, 2024
11e51de
update revit interfaces
adamhathcock Jun 13, 2024
9895c11
fmt
adamhathcock Jun 13, 2024
1ca2756
add more proxies
adamhathcock Jun 13, 2024
d5ef59c
better handling for wrapped types
adamhathcock Jun 13, 2024
373a4da
fix the RevitContext
adamhathcock Jun 13, 2024
daaac4b
inject interfaces
adamhathcock Jun 13, 2024
44cebf8
Merge remote-tracking branch 'origin/dui3/alpha' into convert-revit-c…
adamhathcock Jun 13, 2024
9438634
convert to new way of casting
adamhathcock Jun 13, 2024
c9f4035
update and rejigger dependencies
adamhathcock Jun 13, 2024
d426b90
handle null elements
adamhathcock Jun 13, 2024
09d1a43
proxy map is also proxy aware
adamhathcock Jun 13, 2024
1e3df18
fmt
adamhathcock Jun 13, 2024
5ff2481
change namespaces
adamhathcock Jun 13, 2024
3e780ac
updates to proxies
adamhathcock Jun 13, 2024
193bd20
Merge remote-tracking branch 'origin/dui3/alpha' into convert-revit-c…
adamhathcock Jun 13, 2024
e284981
more cast changes
adamhathcock Jun 13, 2024
10e7114
another cast issue fixed
adamhathcock Jun 13, 2024
041bb5c
update nugets
adamhathcock Jun 13, 2024
fd019d4
fmt
adamhathcock Jun 13, 2024
18b4d98
add System.IO to make CI happy?
adamhathcock Jun 13, 2024
ba55c8b
Merge branch 'dui3/alpha' into convert-revit-converters
adamhathcock Jun 13, 2024
fc2745f
Bumping proxy API and using source gen ProxyMap
adamhathcock Jun 13, 2024
f510d49
fmt
adamhathcock Jun 13, 2024
808232c
putting root back
adamhathcock Jun 14, 2024
4099052
use IProxyMapper in root converter
adamhathcock Jun 14, 2024
3452145
bump host apis
adamhathcock Jun 14, 2024
8674c61
revert registration change
adamhathcock Jun 14, 2024
f1c905b
remove sendselection
adamhathcock Jun 14, 2024
f33b4ef
Merge remote-tracking branch 'origin/dui3/alpha' into DNX-300
adamhathcock Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Speckle.Connectors.Revit.HostApp;
using Speckle.Connectors.Revit.Operations.Send;
using Speckle.Connectors.Revit.Plugin;
using Speckle.Connectors.Revit2023.Converters;
using Speckle.Connectors.RevitShared.Helpers;
using Speckle.Connectors.Utils;
using Speckle.Connectors.Utils.Builders;
Expand Down Expand Up @@ -73,6 +72,5 @@ public void Load(SpeckleContainerBuilder builder)

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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public RootObjectBuilderResult Build(
throw new SpeckleException("Family Environment documents are not supported.");
}

var revitElements = new List<Element>(); // = _contextStack.Current.Document.GetElements(sendSelection.SelectedItems).ToList();
var revitElements = new List<Element>();

foreach (var id in objects)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ public void Load(SpeckleContainerBuilder builder)
builder.AddScoped<IHostedElementConversionToSpeckle, HostedElementConversionToSpeckle>();
builder.AddScoped<IParameterObjectAssigner, ParameterObjectAssigner>();
builder.AddScoped<ISlopeArrowExtractor, SlopeArrowExtractor>();
builder.AddScoped<SendSelection>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Speckle.Revit2023.Api" Version="0.1.1-preview.0.20" />
<PackageReference Include="Speckle.Revit2023.Api" Version="0.1.1-preview.0.22" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Sdk\Speckle.Converters.Common.DependencyInjection\Speckle.Converters.Common.DependencyInjection.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0"/>
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.20" />
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.22" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
},
"Speckle.Revit2023.Interfaces": {
"type": "Direct",
"requested": "[0.1.1-preview.0.20, )",
"resolved": "0.1.1-preview.0.20",
"contentHash": "L/8btGlDejt6OCe8Lee05N3ztKV+pz24WAU9fwXRHEeWMgSe+bqq477Jmk641QFcKmcWK25XJlprlHiCh4pAdQ=="
"requested": "[0.1.1-preview.0.22, )",
"resolved": "0.1.1-preview.0.22",
"contentHash": "Z6bfEIKFYJtXPjHQYlGBjiQLekVOU7L//H9gaQIw3ba9jqJeYHx5AV0z6S83g04eGBKkNJC6EwBr+fspsK0f+w=="
},
"Castle.Core": {
"type": "Transitive",
Expand Down Expand Up @@ -499,7 +499,7 @@
"dependencies": {
"Speckle.Autofac": "[2.0.999-local, )",
"Speckle.Objects": "[2.0.999-local, )",
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.20, )"
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.22, )"
}
},
"speckle.converters.common.dependencyinjection": {
Expand All @@ -513,7 +513,7 @@
"type": "Project",
"dependencies": {
"Speckle.Converters.Common": "[2.0.999-local, )",
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.20, )"
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.22, )"
}
},
"Speckle.Core": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Import Project="..\Speckle.Converters.RevitShared\Speckle.Converters.RevitShared.projitems" Label="Shared" />

<ItemGroup>
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.20" />
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.22" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,3 @@ public double GetSlopeArrowHeadOffset(IRevitModelLine slopeArrow, double tailOff
return headOffset;
}
}

// POC: why do we need this send selection?
// why does conversion need to know about selection in this way?
public class SendSelection
{
private readonly HashSet<string> _selectedItemIds;

public SendSelection(IEnumerable<string> selectedItemIds)
{
_selectedItemIds = new HashSet<string>(selectedItemIds);
}

public bool Contains(string elementId) => _selectedItemIds.Contains(elementId);

public IReadOnlyCollection<string> SelectedItems => _selectedItemIds.ToList().AsReadOnly();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Speckle.Converters.Common;
using Speckle.InterfaceGenerator;
using Speckle.Revit.Interfaces;
Expand Down Expand Up @@ -32,7 +32,6 @@ public class ReferencePointConverter : IReferencePointConverter
private readonly IRevitTransformUtils _transformUtils;
private readonly IRevitFilterFactory _revitFilterFactory;
private readonly IRevitXYZUtils _revitXyzUtils;
private readonly IProxyMap _proxyMap;

private readonly Dictionary<string, IRevitTransform> _docTransforms = new();

Expand All @@ -41,16 +40,14 @@ public ReferencePointConverter(
IRevitConversionSettings revitSettings,
IRevitFilterFactory revitFilterFactory,
IRevitTransformUtils transformUtils,
IRevitXYZUtils revitXyzUtils,
IProxyMap proxyMap
IRevitXYZUtils revitXyzUtils
)
{
_contextStack = contextStack;
_revitSettings = revitSettings;
_revitFilterFactory = revitFilterFactory;
_transformUtils = transformUtils;
_revitXyzUtils = revitXyzUtils;
_proxyMap = proxyMap;
}

// POC: the original allowed for the document to be passed in
Expand Down Expand Up @@ -92,7 +89,7 @@ public IRevitTransform GetReferencePointTransform(string referencePointSetting)
// POC: bogus disposal below
var points = _revitFilterFactory
.CreateFilteredElementCollector(_contextStack.Current.Document)
.OfClass<IRevitBasePoint>(_proxyMap)
.OfClass<IRevitBasePoint>()
.ToList();

var projectPoint = NotNullExtensions.NotNull(points.FirstOrDefault(o => o.IsShared == false), "No projectPoint");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ namespace Speckle.Converters.Common;
public class RootToSpeckleConverter : IRootToSpeckleConverter
{
private readonly IFactory<IToSpeckleTopLevelConverter> _toSpeckle;
private readonly IProxyMap _proxyMap;
private readonly IProxyMapper _proxyMapper;

public RootToSpeckleConverter(IFactory<IToSpeckleTopLevelConverter> toSpeckle, IProxyMap proxyMap)
public RootToSpeckleConverter(IFactory<IToSpeckleTopLevelConverter> toSpeckle, IProxyMapper proxyMapper)
{
_toSpeckle = toSpeckle;
_proxyMap = proxyMap;
_proxyMapper = proxyMapper;
}

public Base Convert(object target)
{
Type revitType = target.GetType();
var wrapper = _proxyMap.WrapIfExists(revitType, target);
var wrapper = _proxyMapper.WrapIfExists(revitType, target);
if (wrapper == null)
{
throw new NotSupportedException($"No wrapper found for Revit type: {revitType.Name}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.20" />
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.22" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Sdk\Speckle.Autofac\Speckle.Autofac.csproj"/>
Expand Down
Loading