Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/RvtIO/Ifc/IfcExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4646,7 +4646,8 @@ fallbackSourceOwnerTagId is null
elemPlacementId = w.Add("IFCLOCALPLACEMENT", $"{R(elemStoreyPlacementId)},{R(rampAxisId > 0 ? rampAxisId : axisId)}");
withFaces++;
}
else if (ifcType is "IFCWALLSTANDARDCASE" or "IFCWALL")
else if (ifcType is "IFCWALLSTANDARDCASE" or "IFCWALL"
&& !ProductRules.IsGeometrylessUnresolvedWall(elem))
{
// Walls: SweptSolid with profile from bottom face or GeoSolid
(shapeId, elemPlacementId) = CreateWallSweptSolid(
Expand Down
6 changes: 6 additions & 0 deletions src/RvtIO/Model/ProductRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ internal static bool IsValidatedStackedWallContainer(
&& type.Id == element.FamilyTypeId && type.CategoryId == -2003500
&& type.IsSerializedStackedWallType;

/// <summary>A wall whose own geometry carries no decoded faces or BRep solids, no location curve, and only an unresolved or unexpanded symbol placement.</summary>
internal static bool IsGeometrylessUnresolvedWall(Element element) =>
element.Location is not { CurveType: "Line" or "Arc" }
&& element.Geometry is { Faces.Count: 0, BrepSolids: not { Count: > 0 } } geometry
&& (geometry.UnresolvedSymbol || geometry.Instances is { Count: > 0 });

/// <summary>The last project phase of the authored phase order that is a phase element of the document, null when there is none.</summary>
internal static int? LastProjectPhase(RevitFileInfo info)
{
Expand Down
4 changes: 2 additions & 2 deletions src/RvtIO/Parsing/ElementBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8479,11 +8479,11 @@ InheritedTypeParameter Describe(uint id)
/// Compute extruded solid geometry for wall elements. Uses world-coordinate GRep face data when
/// available (the largest vertical face gives wall direction, position, length, and height).
/// </summary>
private static void ComputeWallSolids(List<Element> elements)
internal static void ComputeWallSolids(List<Element> elements)
{
foreach (var elem in elements)
{
if (elem.Category != "OST_Walls") continue;
if (elem.Category != "OST_Walls" || ProductRules.IsGeometrylessUnresolvedWall(elem)) continue;

double[]? bbox = elem.BoundingBox ?? elem.Geometry?.BoundingBox;
if (bbox == null || bbox.Length < 6) continue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using RvtIO.Ifc;
using RvtIO.Meshes;
using RvtIO.Model;
using RvtIO.Parsing;
using System.Text.RegularExpressions;
using Xunit;

Expand Down Expand Up @@ -958,6 +960,76 @@ private static GeometryData SolidPrism()
}).ToList(),
};

[Theory]
[InlineData(IfcProfile.Current)]
[InlineData(IfcProfile.Legacy)]
public void WallWithUnresolvedSymbolAndNoFaces_GetsNoSolid_IsNoGeometry_AndIsSuppressed(IfcProfile profile)
{
var wall = new Element
{
Id = 350,
TypeId = 351,
CategoryId = -2000011,
Category = "OST_Walls",
Name = "VoidInPlaceWall",
References = [3],
Parameters =
[
PhaseParameter(),
new Parameter { Id = -1002050, StorageType = StorageType.ElementId, Value = 351 },
new Parameter { Id = -1001000, Definition = new Definition { Name = "WALL_ATTR_WIDTH_PARAM" }, StorageType = StorageType.Double, Value = 1.0 },
],
BoundingBox = [0, 0, 0, 10, 4, 8],
Geometry = new GeometryData
{
BoundingBox = [0, 0, 0, 10, 4, 8],
UnresolvedSymbol = true,
Instances =
[
new GeoInstance
{
SymbolId = 351,
Transform = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
},
],
},
};
var symbol = new Element
{
Id = 351,
CategoryId = -2000011,
Category = "OST_Walls",
Name = "VoidInPlaceWall",
BoundingBox = [0, 0, 0, 10, 4, 8],
};
var info = new RevitFileInfo { Elements = [wall, symbol] };
ElementBuilder.ComputeWallSolids(info.Elements);

Assert.Null(wall.Geometry.Solids);

var mesh = Assert.Single(ElementMeshes.Extract(RvtDocument.FromInfo(info)).Elements);
Assert.Equal(wall.Id, mesh.ElementId);
Assert.Equal(MeshCoverage.NoGeometry, mesh.Coverage);

string path = TempIfcPath($"wall-unresolved-{profile}");
try
{
var diagnostics = new StringWriter();
var skipLog = new SkipLog();
new IfcExporter(diagnostics) { Profile = profile, SkipLog = skipLog }.Export(info, path);
string ifc = File.ReadAllText(path);

Assert.DoesNotContain("=IFCWALL(", ifc);
Assert.DoesNotContain("=IFCWALLSTANDARDCASE(", ifc);
Assert.DoesNotContain("=IFCEXTRUDEDAREASOLID(", ifc);
Assert.DoesNotContain("Pset_QuantityTakeOff", ifc);
Assert.Empty(Regex.Matches(ifc, @"#\d+=IFCRELCONTAINEDINSPATIALSTRUCTURE\("));
Assert.Contains(skipLog.Groups(), group => group.Reason == "geometryless-product" && group.Examples.Contains(wall.Id));
Assert.Contains("IFC geometry-less element products suppressed: 1 - IFCWALL=1", diagnostics.ToString());
}
finally { Cleanup(path); }
}

private static string TempIfcPath(string tag) =>
Path.Combine(Path.GetTempPath(), $"revitreader-{tag}-{Guid.NewGuid():N}.ifc");

Expand Down
Loading