diff --git a/src/RvtIO/Ifc/IfcExporter.Ifc4.cs b/src/RvtIO/Ifc/IfcExporter.Ifc4.cs
index 08f80aa8..36438eff 100644
--- a/src/RvtIO/Ifc/IfcExporter.Ifc4.cs
+++ b/src/RvtIO/Ifc/IfcExporter.Ifc4.cs
@@ -517,6 +517,11 @@ int EnsureDirection3D(double x, double y, double z)
newArgs = args + ",.NOTDEFINED.";
break;
+ case "IFCTRANSPORTELEMENT":
+ if (a.Length == 11)
+ newArgs = $"{string.Join(",", a.Take(8))},.NOTDEFINED.";
+ break;
+
case "IFCDOORSTYLE":
if (a.Length == 12)
{
diff --git a/src/RvtIO/Ifc/IfcExporter.PropertySetsCurrent.cs b/src/RvtIO/Ifc/IfcExporter.PropertySetsCurrent.cs
index ef255f57..3df3e171 100644
--- a/src/RvtIO/Ifc/IfcExporter.PropertySetsCurrent.cs
+++ b/src/RvtIO/Ifc/IfcExporter.PropertySetsCurrent.cs
@@ -24,7 +24,7 @@ public partial class IfcExporter
"Pset_ManufacturerTypeInformation", "Pset_MemberCommon", "Pset_PlateCommon",
"Pset_QuantityTakeOff", "Pset_RailingCommon", "Pset_ReinforcementBarPitchOfBeam",
"Pset_ReinforcementBarPitchOfSlab", "Pset_ReinforcementBarPitchOfWall", "Pset_SlabCommon",
- "Pset_StairFlightCommon", "Pset_WallCommon", "Pset_WindowCommon",
+ "Pset_StairFlightCommon", "Pset_TransportElementCommon", "Pset_WallCommon", "Pset_WindowCommon",
];
/// The element class lists of Pset_ConcreteElementGeneral that can occur as types.
@@ -44,7 +44,7 @@ internal static bool TypeReceivesPropertySetsCurrent(string typeClass, string in
"IFCMEMBERTYPE" => typeElem.CategoryId is CurtainWallMullionCategoryId or StructuralFramingCategoryId,
"IFCBEAMTYPE" or "IFCBUILDINGELEMENTPROXYTYPE" or "IFCCOLUMNTYPE" or "IFCCOVERINGTYPE"
or "IFCCURTAINWALLTYPE" or "IFCDOORSTYLE" or "IFCPLATETYPE" or "IFCRAILINGTYPE"
- or "IFCSLABTYPE" or "IFCSTAIRFLIGHTTYPE" or "IFCWALLTYPE" or "IFCWINDOWSTYLE"
+ or "IFCSLABTYPE" or "IFCSTAIRFLIGHTTYPE" or "IFCTRANSPORTELEMENTTYPE" or "IFCWALLTYPE" or "IFCWINDOWSTYLE"
or "IFCLIGHTFIXTURETYPE" => true,
"IFCDISTRIBUTIONELEMENTTYPE" => instanceIfcType == "IFCFLOWTERMINAL",
_ => false,
@@ -227,6 +227,9 @@ typeClass is "IFCWINDOWSTYLE" or "IFCDOORSTYLE"
case "IFCSTAIRFLIGHTTYPE":
Add("Pset_StairFlightCommon", 1, Identifier(), NosingLength());
break;
+ case "IFCTRANSPORTELEMENTTYPE":
+ Add("Pset_TransportElementCommon", 1, Identifier());
+ break;
case "IFCWALLTYPE":
Add("Pset_ReinforcementBarPitchOfWall", 1, Label());
Add("Pset_WallCommon", 1, Identifier(), HostThermalTransmittance(), IsExternal("Pset_WallCommon"), FireRating());
diff --git a/src/RvtIO/Ifc/IfcExporter.ReferenceCurrent.cs b/src/RvtIO/Ifc/IfcExporter.ReferenceCurrent.cs
index 9a550a48..01f74dd5 100644
--- a/src/RvtIO/Ifc/IfcExporter.ReferenceCurrent.cs
+++ b/src/RvtIO/Ifc/IfcExporter.ReferenceCurrent.cs
@@ -17,7 +17,7 @@ public partial class IfcExporter
{
"IFCFLOWFITTING" or "IFCFLOWCONTROLLER" or "IFCFLOWTERMINAL" =>
(element.ValidatedDistributionTypeReferenceName, element.ValidatedDistributionTypeReferenceIsBlocked),
- "IFCBUILDINGELEMENTPROXY" =>
+ "IFCBUILDINGELEMENTPROXY" or "IFCTRANSPORTELEMENT" =>
(element.ValidatedProxyTypeReferenceName, element.ValidatedProxyTypeReferenceIsBlocked),
// The element name of a beam can be another name of the instance; the type name of the product name is used, as for the classes above.
"IFCBEAM" => (null, false),
diff --git a/src/RvtIO/Ifc/IfcExporter.cs b/src/RvtIO/Ifc/IfcExporter.cs
index 6f62812f..302879b2 100644
--- a/src/RvtIO/Ifc/IfcExporter.cs
+++ b/src/RvtIO/Ifc/IfcExporter.cs
@@ -1945,6 +1945,8 @@ bool HasCompetingExactHostedWriterAuthority(
? "IFCWALL"
: CurrentProfile && elem.CategoryId == RampCategoryId
? "IFCRAMP"
+ : CurrentProfile && elem.CategoryId == VerticalCirculationCategoryId
+ ? "IFCTRANSPORTELEMENT"
: MapCategoryToIfcTypeForSchema(elem.CategoryId, _resolvedConfig.Schema)
?? (elem.CategoryId == null && elem.Transform != null && elem.TypeId > 0
? "IFCBUILDINGELEMENTPROXY"
@@ -4843,6 +4845,8 @@ fallbackSourceOwnerTagId is null
$"{S(productGlobalId)},{R(ownerHistId)},{S(elemName)},$,{S(elemTypeName)},{R(elemPlacementId)},{shapeArg},{S(elem.Id.ToString())},.{ResolveNativeStairShape(elem, referenceElementType, elemById, elementIdOccurrenceCounts, CurrentProfile)}.",
"IFCRAMP" =>
$"{S(productGlobalId)},{R(ownerHistId)},{S(elemName)},$,{S(elemTypeName)},{R(elemPlacementId)},{shapeArg},{S(elem.Id.ToString())},.NOTDEFINED.",
+ "IFCTRANSPORTELEMENT" =>
+ $"{S(productGlobalId)},{R(ownerHistId)},{S(elemName)},$,{S(elemTypeName)},{R(elemPlacementId)},{shapeArg},{S(elem.Id.ToString())},$,$,$",
"IFCSTAIRFLIGHT" =>
$"{S(productGlobalId)},{R(ownerHistId)},{S(elemName)},$,{S(elemTypeName)},{R(elemPlacementId)},{shapeArg},{S(elem.Id.ToString())},{(CurrentProfile ? StairFlightAttributes(elem, elemById, stairRuns) : "$,$,$,$")}",
"IFCCOLUMN" or "IFCBEAM" or "IFCMEMBER" or "IFCPLATE"
@@ -5017,6 +5021,13 @@ fallbackSourceOwnerTagId is null
w, elem, elemEntityId, ownerHistId,
quantityTakeOffReferenceValueId.Value);
}
+ if (quantityTakeOffReferenceValueId.HasValue
+ && ifcType == "IFCTRANSPORTELEMENT")
+ {
+ ExportTransportElementCommonPropertySet(
+ w, elem, elemEntityId, ownerHistId,
+ quantityTakeOffReferenceValueId.Value);
+ }
// The current profile has no such description (its sources never create
// Pset_ProvisionForVoid).
if (ifcType == "IFCBUILDINGELEMENTPROXY" && !CurrentProfile
@@ -7550,7 +7561,7 @@ private int CreateOpeningElement(
// Reused verbatim by Pset_BuildingElementProxyCommon.Reference
// (ExportBuildingElementProxyCommonPropertySet).
- if (ifcType == "IFCBUILDINGELEMENTPROXY")
+ if (ifcType is "IFCBUILDINGELEMENTPROXY" or "IFCTRANSPORTELEMENT")
{
if (element.ValidatedProxyTypeReferenceIsBlocked)
return null;
@@ -63284,7 +63295,7 @@ private int CreateEmptyShape(StepWriter w, int subCtxId)
or "IFCFLOWCONTROLLER" or "IFCFLOWFITTING" or "IFCFLOWSEGMENT" or "IFCFLOWTERMINAL"
or "IFCFOOTING" or "IFCFURNISHINGELEMENT" or "IFCMEMBER" or "IFCOPENINGELEMENT"
or "IFCPLATE" or "IFCRAILING" or "IFCRAMP" or "IFCRAMPFLIGHT"
- or "IFCROOF" or "IFCSLAB" or "IFCSTAIR" or "IFCSTAIRFLIGHT" or "IFCREINFORCINGMESH"
+ or "IFCROOF" or "IFCSLAB" or "IFCSTAIR" or "IFCSTAIRFLIGHT" or "IFCTRANSPORTELEMENT" or "IFCREINFORCINGMESH"
or "IFCWALL" or "IFCWALLSTANDARDCASE" or "IFCWINDOW" => true,
// IFCSITE, IFCBUILDING, IFCBUILDINGSTOREY, IFCSPACE (IfcSpatialStructureElement),
// IFCDISTRIBUTIONPORT (IfcPort), IFCANNOTATION, IFCGRID - IfcProducts, NOT IfcElements.
@@ -63491,19 +63502,37 @@ internal static bool ReceivesBuildingElementProxyCommonPropertySet(
return floor.CuttingElementIds?.Contains(elem.Id) != true;
}
+ private static void ExportCommonReferencePropertySet(
+ StepWriter w, Element elem, int elemEntityId, int ownerHistId,
+ int referenceValueId, string propertySetName, string guidSeedPrefix)
+ {
+ int psetId = w.Add("IFCPROPERTYSET",
+ $"{S(IfcGuid.FromName($"{guidSeedPrefix}-pset:{elem.Id}"))},{R(ownerHistId)},{S(propertySetName)},$,{StepWriter.List(R(referenceValueId))}");
+ w.Add("IFCRELDEFINESBYPROPERTIES",
+ $"{S(IfcGuid.FromName($"{guidSeedPrefix}-rel:{elem.Id}"))},{R(ownerHistId)},$,$,{StepWriter.List(R(elemEntityId))},{R(psetId)}");
+ }
+
///
/// Attaches the one-property occurrence-only Pset_BuildingElementProxyCommon to a selected
/// proxy that already emitted QTO.
///
private static void ExportBuildingElementProxyCommonPropertySet(
StepWriter w, Element elem, int elemEntityId, int ownerHistId,
- int referenceValueId)
- {
- int psetId = w.Add("IFCPROPERTYSET",
- $"{S(IfcGuid.FromName($"building-element-proxy-common-pset:{elem.Id}"))},{R(ownerHistId)},{S("Pset_BuildingElementProxyCommon")},$,{StepWriter.List(R(referenceValueId))}");
- w.Add("IFCRELDEFINESBYPROPERTIES",
- $"{S(IfcGuid.FromName($"building-element-proxy-common-rel:{elem.Id}"))},{R(ownerHistId)},$,$,{StepWriter.List(R(elemEntityId))},{R(psetId)}");
- }
+ int referenceValueId) =>
+ ExportCommonReferencePropertySet(
+ w, elem, elemEntityId, ownerHistId, referenceValueId,
+ "Pset_BuildingElementProxyCommon", "building-element-proxy-common");
+
+ ///
+ /// Attaches Pset_TransportElementCommon (Reference) to an IfcTransportElement that already
+ /// emitted QTO.
+ ///
+ private static void ExportTransportElementCommonPropertySet(
+ StepWriter w, Element elem, int elemEntityId, int ownerHistId,
+ int referenceValueId) =>
+ ExportCommonReferencePropertySet(
+ w, elem, elemEntityId, ownerHistId, referenceValueId,
+ "Pset_TransportElementCommon", "transport-element-common");
/// Dimensions in millimetres; null when the symbol is no box.
internal static (double Width, double Height, double Depth)? ResolveProvisionForVoidDimensions(
@@ -64247,7 +64276,7 @@ private static void ExportWallCommonPropertySet(
{
"IFCWALL", "IFCWALLSTANDARDCASE", "IFCCURTAINWALL", "IFCSLAB", "IFCROOF", "IFCFOOTING",
"IFCDOOR", "IFCWINDOW", "IFCBUILDINGELEMENTPROXY", "IFCRAILING", "IFCCOVERING",
- "IFCSTAIR", "IFCSTAIRFLIGHT", "IFCRAMP", "IFCCOLUMN", "IFCBEAM", "IFCMEMBER", "IFCPLATE",
+ "IFCSTAIR", "IFCSTAIRFLIGHT", "IFCRAMP", "IFCTRANSPORTELEMENT", "IFCCOLUMN", "IFCBEAM", "IFCMEMBER", "IFCPLATE",
"IFCFURNISHINGELEMENT", "IFCFLOWSEGMENT", "IFCFLOWTERMINAL", "IFCFLOWFITTING",
"IFCFLOWCONTROLLER", "IFCDISTRIBUTIONFLOWELEMENT", "IFCELECTRICDISTRIBUTIONBOARD",
"IFCOUTLET", "IFCSWITCHINGDEVICE", "IFCSITE", "IFCREINFORCINGMESH",
@@ -65344,6 +65373,7 @@ private static int GetOrAddPropertySingleValue(
private const int RoofCategoryId = -2000035;
private const int RoofSoffitCategoryId = -2001393;
private const int GutterCategoryId = -2001391;
+ private const int VerticalCirculationCategoryId = -2001052;
private const int CurtainSystemCategoryId = -2000090;
private const int MassExteriorWallCategoryId = -2003413;
private const int MassInteriorWallCategoryId = -2003412;
@@ -66712,6 +66742,7 @@ static double NamedDimension(Element e, Element? type, string token)
["IFCCURTAINWALL"] = "IFCCURTAINWALLTYPE",
["IFCBUILDINGELEMENTPROXY"] = "IFCBUILDINGELEMENTPROXYTYPE",
["IFCREINFORCINGMESH"] = "IFCTYPEPRODUCT",
+ ["IFCTRANSPORTELEMENT"] = "IFCTRANSPORTELEMENTTYPE",
["IFCFURNISHINGELEMENT"] = "IFCFURNITURETYPE",
["IFCSTAIRFLIGHT"] = "IFCSTAIRFLIGHTTYPE",
["IFCDOOR"] = "IFCDOORSTYLE",
@@ -66727,6 +66758,7 @@ static double NamedDimension(Element e, Element? type, string token)
"IFCWALLTYPE", "IFCSLABTYPE", "IFCMEMBERTYPE", "IFCPLATETYPE", "IFCCOLUMNTYPE",
"IFCBEAMTYPE", "IFCCOVERINGTYPE", "IFCRAILINGTYPE", "IFCCURTAINWALLTYPE",
"IFCBUILDINGELEMENTPROXYTYPE", "IFCSTAIRFLIGHTTYPE", "IFCSTAIRTYPE", "IFCRAMPTYPE", "IFCROOFTYPE",
+ "IFCTRANSPORTELEMENTTYPE",
"IFCLIGHTFIXTURETYPE", "IFCDUCTSEGMENTTYPE", "IFCPIPESEGMENTTYPE", "IFCCABLECARRIERSEGMENTTYPE", "IFCPIPEFITTINGTYPE",
"IFCCABLECARRIERFITTINGTYPE", "IFCVALVETYPE", "IFCDUCTFITTINGTYPE", "IFCAIRTERMINALTYPE",
"IFCELECTRICAPPLIANCETYPE", "IFCFIRESUPPRESSIONTERMINALTYPE",
@@ -67557,7 +67589,7 @@ private static Dictionary WriteTypeObjectsAndRelDefinesByTypeCoreFo
originalSymbolId = ownSymbolId;
}
if ((product.ifcType is "IFCMEMBER" or "IFCPLATE" or "IFCCOLUMN"
- or "IFCBUILDINGELEMENTPROXY" or "IFCREINFORCINGMESH" or "IFCFURNISHINGELEMENT"
+ or "IFCBUILDINGELEMENTPROXY" or "IFCTRANSPORTELEMENT" or "IFCREINFORCINGMESH" or "IFCFURNISHINGELEMENT"
or "IFCFLOWTERMINAL" or "IFCFLOWSEGMENT" or "IFCFLOWFITTING" or "IFCFLOWCONTROLLER"
or "IFCSLAB" or "IFCSTAIRFLIGHT" || currentProfile && product.ifcType == "IFCBEAM")
&& instElem.Geometry?.ExactMappedInstances is { Count: > 0 } mapped
@@ -67584,7 +67616,7 @@ private static Dictionary WriteTypeObjectsAndRelDefinesByTypeCoreFo
}
// A beam, column, and a proxy or furnishing element without a GInstance, is keyed by
// its type element and gets a type of its own when it carries geometry of its own.
- if (currentProfile && originalSymbolId == 0 && product.ifcType is "IFCBEAM" or "IFCCOLUMN" or "IFCBUILDINGELEMENTPROXY" or "IFCFURNISHINGELEMENT"
+ if (currentProfile && originalSymbolId == 0 && product.ifcType is "IFCBEAM" or "IFCCOLUMN" or "IFCBUILDINGELEMENTPROXY" or "IFCFURNISHINGELEMENT" or "IFCTRANSPORTELEMENT"
&& UsesInstanceGeometryOfTypeCurrent(instElem, canonicalType))
ownerId = instElem.Id;
// Each gutter has a type of its own.
@@ -67990,7 +68022,7 @@ internal static string ResolveProductFamilyAndTypeName(
if (ifcType == "IFCWINDOW" && element.CategoryId == -2000014)
return Own(element.ValidatedWindowTypeReferenceName, element.ValidatedWindowTypeReferenceIsExplicit,
element.ValidatedWindowTypeReferenceIsBlocked);
- if (ifcType == "IFCBUILDINGELEMENTPROXY")
+ if (ifcType is "IFCBUILDINGELEMENTPROXY" or "IFCTRANSPORTELEMENT")
return Own(element.ValidatedProxyTypeReferenceName, element.ValidatedProxyTypeReferenceIsExplicit,
element.ValidatedProxyTypeReferenceIsBlocked);
if ((ifcType == "IFCROOF" && element.CategoryId == -2000035)
diff --git a/tests/RvtIO.Tests/IfcTransportElementTests.cs b/tests/RvtIO.Tests/IfcTransportElementTests.cs
new file mode 100644
index 00000000..0104f58a
--- /dev/null
+++ b/tests/RvtIO.Tests/IfcTransportElementTests.cs
@@ -0,0 +1,171 @@
+using System.Text.RegularExpressions;
+using RvtIO.Geometry;
+using RvtIO.Ifc;
+using RvtIO.Model;
+using Xunit;
+
+namespace RvtIO.Tests;
+
+public class IfcTransportElementTests
+{
+ private const int PhaseId = 7;
+ private const int VerticalCirculationCategoryId = -2001052;
+
+ private static GeometryData BoxGeo()
+ {
+ double[][] pts = [[0, 0, 0], [4, 0, 0], [4, 3, 0], [0, 3, 0], [0, 0, 8], [4, 0, 8], [4, 3, 8], [0, 3, 8]];
+ int[][] faces = [[0, 3, 2, 1], [4, 5, 6, 7], [0, 1, 5, 4], [1, 2, 6, 5], [2, 3, 7, 6], [3, 0, 4, 7]];
+ return new GeometryData
+ {
+ BoundingBox = [0, 0, 0, 4, 3, 8],
+ Faces = faces.Select(idx => new GeoFace { OuterVertices = idx.Select(k => pts[k]).ToList() }).ToList(),
+ BrepSolids = [new GeoBrepSolid { IsClosed = true, FaceIndices = [0, 1, 2, 3, 4, 5] }],
+ };
+ }
+
+ private static RevitFileInfo Document(params Element[] extra)
+ {
+ var info = new RevitFileInfo { SerializedProjectPhaseIds = [PhaseId] };
+ info.Elements.Add(new Element { Id = PhaseId, CategoryId = -2000112, Name = "New Construction", NativeRootClassName = "ProjectPhase" });
+ info.Elements.Add(new Element
+ {
+ Id = 10, Name = "Level 1", IsNativeLevel = true,
+ SerializedFamilyId = -1, SerializedUnplacedOwnerId = -1, SerializedOwnerDbViewId = -1,
+ Parameters =
+ [
+ new Parameter { Id = -1007102, StorageType = StorageType.Double, Value = 0.0 },
+ new Parameter { Id = -1007111, StorageType = StorageType.Integer, Value = 1 },
+ ],
+ });
+ info.Elements.AddRange(extra);
+ return info;
+ }
+
+ private static Element TypeSymbol(int id, string name, string familyName, Guid? exportId = null) => new()
+ {
+ Id = id,
+ TypeId = -1,
+ CategoryId = VerticalCirculationCategoryId,
+ Category = "OST_VerticalCirculation",
+ Name = name,
+ FamilyName = familyName,
+ SerializedExportId = exportId,
+ };
+
+ private static Element TransportInstance(int id, int typeId, string name, string familyName, Guid? exportId = null) => new()
+ {
+ Id = id,
+ TypeId = typeId,
+ CategoryId = VerticalCirculationCategoryId,
+ Category = "OST_VerticalCirculation",
+ Name = name,
+ FamilyName = familyName,
+ SerializedExportId = exportId,
+ SerializedCreatedPhaseId = PhaseId,
+ SerializedDemolishedPhaseId = -1,
+ References = [PhaseId],
+ Parameters =
+ [
+ new Parameter { Id = -1002050, Value = typeId, StorageType = StorageType.ElementId, Definition = new Definition { Id = -1002050, Name = "ELEM_TYPE_PARAM" } },
+ new Parameter { Id = -1012100, Value = PhaseId, StorageType = StorageType.ElementId },
+ ],
+ BoundingBox = [0, 0, 0, 4, 3, 8],
+ Geometry = BoxGeo(),
+ };
+
+ private static string Export(RevitFileInfo info, IfcExporter? exporter = null)
+ {
+ string path = Path.Combine(Path.GetTempPath(), $"rvtio-transport-{Guid.NewGuid():N}.ifc");
+ try
+ {
+ (exporter ?? new IfcExporter { Profile = IfcProfile.Current }).Export(info, path);
+ return File.ReadAllText(path).Replace("\r\n", "\n");
+ }
+ finally
+ {
+ if (File.Exists(path)) File.Delete(path);
+ }
+ }
+
+ [Fact]
+ public void VerticalCirculation_ExportsAsIfcTransportElementAndTypeWithCommonPsetInCurrent()
+ {
+ var typeGuid = Guid.Parse("11111111-2222-3333-4444-555555555555");
+ var inst1Guid = Guid.Parse("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
+ var inst2Guid = Guid.Parse("bbbbbbbb-cccc-dddd-eeee-ffffffffffff");
+ var doc = Document(
+ TypeSymbol(200, "Passenger Lift", "Lift Family", typeGuid),
+ TransportInstance(101, 200, "Passenger Lift", "Lift Family", inst1Guid),
+ TransportInstance(102, 200, "Passenger Lift", "Lift Family", inst2Guid));
+
+ string ifc = Export(doc);
+
+ Assert.DoesNotContain("=IFCBUILDINGELEMENTPROXY(", ifc);
+ Assert.DoesNotContain("=IFCBUILDINGELEMENTPROXYTYPE(", ifc);
+ Assert.DoesNotContain("Pset_BuildingElementProxyCommon", ifc);
+
+ var elements = Regex.Matches(ifc, @"^#(\d+)=IFCTRANSPORTELEMENT\(([^\r\n]*)\);$", RegexOptions.Multiline);
+ Assert.Equal(2, elements.Count);
+ foreach (Match match in elements)
+ Assert.Matches(@",'10[12]',\$,\$,\$$", match.Groups[2].Value);
+
+ Assert.Contains($"'{IfcGuid.ToIfcGuid(inst1Guid)}'", elements[0].Groups[2].Value);
+ Assert.Contains($"'{IfcGuid.ToIfcGuid(inst2Guid)}'", elements[1].Groups[2].Value);
+
+ var typeMatch = Assert.Single(Regex.Matches(ifc, @"^#(\d+)=IFCTRANSPORTELEMENTTYPE\(([^\r\n]*)\);$", RegexOptions.Multiline));
+ string typeEntityId = typeMatch.Groups[1].Value;
+ string[] typeArgs = IfcExporter.SplitStepArguments(typeMatch.Groups[2].Value);
+ Assert.Equal("'200'", typeArgs[7]);
+ Assert.Equal("$", typeArgs[8]);
+ Assert.Equal(".NOTDEFINED.", typeArgs[9]);
+
+ var relType = Assert.Single(Regex.Matches(ifc, $@"^#\d+=IFCRELDEFINESBYTYPE\([^\r\n]*,\(#{elements[0].Groups[1].Value},#{elements[1].Groups[1].Value}\),#{typeEntityId}\);$", RegexOptions.Multiline));
+ Assert.True(relType.Success);
+
+ // Type carries QTO then Pset_TransportElementCommon; both occurrences carry both sets too.
+ var psetNames = Regex.Matches(ifc, @"^#(\d+)=IFCPROPERTYSET\([^,]+,[^,]+,'([^']+)',", RegexOptions.Multiline)
+ .Cast()
+ .ToDictionary(m => "#" + m.Groups[1].Value, m => m.Groups[2].Value);
+ string[] typePsetIds = typeArgs[5].Trim('(', ')').Split(',');
+ Assert.Equal(["Pset_QuantityTakeOff", "Pset_TransportElementCommon"], typePsetIds.Select(id => psetNames[id]));
+
+ int occTransportPsets = Regex.Matches(ifc, $@"IFCRELDEFINESBYPROPERTIES\([^\r\n]*,\(#(?:{elements[0].Groups[1].Value}|{elements[1].Groups[1].Value})\),(#\d+)\);", RegexOptions.Multiline)
+ .Cast()
+ .Count(m => psetNames[m.Groups[1].Value] == "Pset_TransportElementCommon");
+ Assert.Equal(2, occTransportPsets);
+ }
+
+ [Fact]
+ public void VerticalCirculation_LegacyProfileStaysProxy()
+ {
+ var doc = Document(
+ TypeSymbol(200, "Passenger Lift", "Lift Family"),
+ TransportInstance(101, 200, "Passenger Lift", "Lift Family"));
+
+ string ifc = Export(doc, new IfcExporter { Profile = IfcProfile.Legacy });
+
+ Assert.DoesNotContain("=IFCTRANSPORTELEMENT(", ifc);
+ Assert.Contains("=IFCBUILDINGELEMENTPROXY(", ifc);
+ }
+
+ [Fact]
+ public void VerticalCirculation_Ifc4UsesNineArgumentTransportElementWithPredefinedType()
+ {
+ var doc = Document(
+ TypeSymbol(200, "Escalator Type", "Escalator Family"),
+ TransportInstance(101, 200, "Escalator Type", "Escalator Family"));
+
+ string ifc = Export(doc, new IfcExporter(IfcExportConfiguration.FromPreset(IfcExportPresetKind.Ifc4ReferenceView12), null));
+
+ var elemMatch = Assert.Single(Regex.Matches(ifc, @"^#\d+=IFCTRANSPORTELEMENT\(([^\r\n]*)\);$", RegexOptions.Multiline));
+ string[] elemArgs = IfcExporter.SplitStepArguments(elemMatch.Groups[1].Value);
+ Assert.Equal(9, elemArgs.Length);
+ Assert.Equal("'101'", elemArgs[7]);
+ Assert.Equal(".NOTDEFINED.", elemArgs[8]);
+
+ var typeMatch = Assert.Single(Regex.Matches(ifc, @"^#\d+=IFCTRANSPORTELEMENTTYPE\(([^\r\n]*)\);$", RegexOptions.Multiline));
+ string[] typeArgs = IfcExporter.SplitStepArguments(typeMatch.Groups[1].Value);
+ Assert.Equal(10, typeArgs.Length);
+ Assert.Equal(".NOTDEFINED.", typeArgs[9]);
+ }
+}