Skip to content

Commit

Permalink
DUI3-149 Skippable GraphicsStyle clean up (#3508)
Browse files Browse the repository at this point in the history
* DUI3-149 Skippable GraphicsStyle clean up

* forgot a return!
  • Loading branch information
adamhathcock authored Jun 14, 2024
1 parent a18cba1 commit 9203263
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
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.22" />
<PackageReference Include="Speckle.Revit2023.Api" Version="0.1.1-preview.0.23" />
</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.22" />
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.23" />
</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.22, )",
"resolved": "0.1.1-preview.0.22",
"contentHash": "Z6bfEIKFYJtXPjHQYlGBjiQLekVOU7L//H9gaQIw3ba9jqJeYHx5AV0z6S83g04eGBKkNJC6EwBr+fspsK0f+w=="
"requested": "[0.1.1-preview.0.23, )",
"resolved": "0.1.1-preview.0.23",
"contentHash": "H66I9JRUGt1l1YS8aOdniRPDOixRPqua9puGrhGnTEKJ26kVlgkM3FpKfdAMFea4hf03hdqhnFVmNEwgA6mPHA=="
},
"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.22, )"
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.23, )"
}
},
"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.22, )"
"Speckle.Revit2023.Interfaces": "[0.1.1-preview.0.23, )"
}
},
"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.22" />
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.23" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,24 +294,24 @@ bool hasSymbolGeom
/// <summary>
/// We're caching a dictionary of graphic styles and their ids as it can be a costly operation doing Document.GetElement(solid.GraphicsStyleId) for every solid
/// </summary>
private readonly Dictionary<string, IRevitGraphicsStyle> _graphicStyleCache = new();
private readonly Dictionary<int, IRevitGraphicsStyle> _graphicStyleCache = new();

/// <summary>
/// Exclude light source cones and potentially other geometries by their graphic style
/// </summary>
private bool IsSkippableGraphicStyle(IRevitElementId id, IRevitDocument doc)
{
if (!_graphicStyleCache.ContainsKey(id.ToString()))
var graphicStyle = doc.GetElement(id)?.ToGraphicsStyle();
if (graphicStyle is null)
{
_graphicStyleCache.Add(id.ToString(), doc.GetElement(id).NotNull().ToGraphicsStyle().NotNull());
return false;
}
if (!_graphicStyleCache.ContainsKey(id.IntegerValue))
{
_graphicStyleCache.Add(id.IntegerValue, graphicStyle);
}

var graphicStyle = _graphicStyleCache[id.ToString()];

if (
graphicStyle != null
&& graphicStyle.GraphicsStyleCategory.Id.IntegerValue == (int)RevitBuiltInCategory.OST_LightingFixtureSource
)
if (graphicStyle.GraphicsStyleCategory.Id.IntegerValue == (int)RevitBuiltInCategory.OST_LightingFixtureSource)
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void AssignParametersToBase(IRevitElement target, Base @base)
AssignSpeckleParamToBaseObject(instanceParameters, paramBase);

// POC: Some elements can have an invalid element type ID, I don't think we want to continue here.
if (elementId != _revitElementIdUtils.InvalidElementId && target is not SOBE.Level) //ignore type props of levels..!
if (elementId.IntegerValue != _revitElementIdUtils.InvalidElementId.IntegerValue && target is not SOBE.Level) //ignore type props of levels..!
{
var elementType = target.Document.GetElement(elementId).NotNull();
// I don't think we should be adding the type parameters to the object like this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Base Convert(IRevitLocation target)
var point = target.ToLocationPoint();
if (point is not null)
{
_xyzConverter.Convert(point.Point);
return _xyzConverter.Convert(point.Point);
}
throw new SpeckleConversionException($"Unexpected location type {target.GetType()}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.22" />
<PackageReference Include="Speckle.Revit2023.Interfaces" Version="0.1.1-preview.0.23" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Sdk\Speckle.Autofac\Speckle.Autofac.csproj"/>
Expand Down

0 comments on commit 9203263

Please sign in to comment.