diff --git a/data/Dwelling.r2019.om_v5.5.0.vim b/data/Dwelling.r2019.om_v5.5.0.vim
deleted file mode 100644
index b043fa7c..00000000
--- a/data/Dwelling.r2019.om_v5.5.0.vim
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bbefdb5bd6fa39560a9bd90f7aaa3e8f41571f53b2fe403224720da091ce4c44
-size 173716608
diff --git a/data/Dwelling.r2024.om_v5.6.0.vim b/data/Dwelling.r2024.om_v5.6.0.vim
new file mode 100644
index 00000000..3696b525
--- /dev/null
+++ b/data/Dwelling.r2024.om_v5.6.0.vim
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:51b1abb830ae812e5cfd308cd2831f0ace311c5f2a59051e8d36040fde39b0a6
+size 174016000
diff --git a/data/Empty.vim b/data/Empty.vim
new file mode 100644
index 00000000..92c947ba
--- /dev/null
+++ b/data/Empty.vim
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3bee5682edaa4acc58804ab74dc828bbbf43e193af6210df5d6835e2b72ae3c6
+size 112832
diff --git a/data/IfcTest.vim b/data/IfcTest.vim
new file mode 100644
index 00000000..5863f39b
--- /dev/null
+++ b/data/IfcTest.vim
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b858418ca89f4069f104b511255acc15f35732d1b800cf305c3c51f1fcf16ecd
+size 2569856
diff --git a/data/Tiny_House_Imperial.r2024.om_v5.6.0.vim b/data/Tiny_House_Imperial.r2024.om_v5.6.0.vim
new file mode 100644
index 00000000..12647a18
--- /dev/null
+++ b/data/Tiny_House_Imperial.r2024.om_v5.6.0.vim
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3eaa3ec172edb4e28f89a967503f5729bd8139b05a301ba6fa27f4cfad8f0f4c
+size 258368
diff --git a/data/Tiny_House_Metric.r2024.om_v5.6.0.vim b/data/Tiny_House_Metric.r2024.om_v5.6.0.vim
new file mode 100644
index 00000000..7dfefcb0
--- /dev/null
+++ b/data/Tiny_House_Metric.r2024.om_v5.6.0.vim
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0938059220cb7021be649ea290d61ca494d68f8b6fe4ad443c6f500be903882a
+size 267328
diff --git a/data/Wolford_Residence.navis2023.om_v5.6.0.vim b/data/Wolford_Residence.navis2023.om_v5.6.0.vim
new file mode 100644
index 00000000..d2c19858
--- /dev/null
+++ b/data/Wolford_Residence.navis2023.om_v5.6.0.vim
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:90244209bd047c5b961f984bc82436636a9c87f35ac60e375a4b556e342160cb
+size 16759232
diff --git a/data/Wolford_Residence.r2025.om_v5.6.0.vim b/data/Wolford_Residence.r2025.om_v5.6.0.vim
new file mode 100644
index 00000000..8ff74323
--- /dev/null
+++ b/data/Wolford_Residence.r2025.om_v5.6.0.vim
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5c4a43132b7000e98fef90a4e18ae59fb21a4d53441eec72ac84840e4176e466
+size 8506560
diff --git a/src/cs/math3d/Vim.Math3D/Constants.cs b/src/cs/math3d/Vim.Math3D/Constants.cs
index 634eddbd..1b91fe5f 100644
--- a/src/cs/math3d/Vim.Math3D/Constants.cs
+++ b/src/cs/math3d/Vim.Math3D/Constants.cs
@@ -28,9 +28,5 @@ public static class Constants
public const double DegreesToRadians = 0.017453292519943295769236907684886;
public const double OneTenthOfADegree = DegreesToRadians / 10;
-
- // TODO: BUG: these two values are inverted dumb-dumb
- public const double MmToFeet = 0.00328084;
- public const double FeetToMm = 1 / MmToFeet;
}
}
diff --git a/src/cs/math3d/Vim.Math3D/StructsPartial.cs b/src/cs/math3d/Vim.Math3D/StructsPartial.cs
index b64e68b5..a30b4aef 100644
--- a/src/cs/math3d/Vim.Math3D/StructsPartial.cs
+++ b/src/cs/math3d/Vim.Math3D/StructsPartial.cs
@@ -234,6 +234,16 @@ public partial struct DVector3
public Vector3 Vector3
=> new Vector3((float)X, (float)Y, (float)Z);
+ ///
+ /// Transforms a vector by the given matrix.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public DVector3 Transform(DMatrix4x4 matrix)
+ => new DVector3(
+ X * matrix.M11 + Y * matrix.M21 + Z * matrix.M31 + matrix.M41,
+ X * matrix.M12 + Y * matrix.M22 + Z * matrix.M32 + matrix.M42,
+ X * matrix.M13 + Y * matrix.M23 + Z * matrix.M33 + matrix.M43);
+
///
/// Computes the cross product of two vectors.
///
diff --git a/src/cs/samples/Vim.Gltf.Converter/GltfToVimStore.cs b/src/cs/samples/Vim.Gltf.Converter/GltfToVimStore.cs
index a0478335..7112b16a 100644
--- a/src/cs/samples/Vim.Gltf.Converter/GltfToVimStore.cs
+++ b/src/cs/samples/Vim.Gltf.Converter/GltfToVimStore.cs
@@ -7,6 +7,7 @@
using Vim.Format;
using Vim.Format.ObjectModel;
using Vim.Math3d;
+using Vim.Util;
namespace Vim.Gltf.Converter
{
@@ -21,7 +22,7 @@ public class GltfToVimStore : ObjectModelStore
private const string GeneratorString = "Vim.Gltf.Converter";
// NOTE: In GLTF, units are assumed to be in meters however in VIM they are in feet.
- public const float MetersToFeet = 3.280839895f;
+ public const float MetersToFeet = (float) Units.MetersToFeetRatio;
///
/// Converts a GLTF file into a VIM file.
@@ -73,20 +74,20 @@ private void VisitGltf()
/// Stores a default empty display unit entity.
///
private DisplayUnit StoreDefaultDisplayUnit()
- => ObjectModelBuilder.Add(DisplayUnit.Empty);
+ => ObjectModelBuilder.DisplayUnitBuilder.Add(DisplayUnit.Empty).Entity;
///
/// Since GLTF does not contain Category information, we will store a single default Category
/// entity which will be applied to all elements.
///
private Category StoreDefaultCategory()
- => ObjectModelBuilder.Add(new Category
+ => ObjectModelBuilder.CategoryBuilder.Add(new Category
{
Id = VimConstants.SyntheticCategoryId,
BuiltInCategory = "GLTF_CATEGORY",
Name = "GLTF Object",
CategoryType = "GLTF",
- });
+ }).Entity;
///
/// Since GLTF does not contain Family information, we will store a single default Family
@@ -96,18 +97,18 @@ private Family StoreDefaultFamily(
BimDocument bimDocument,
Category category)
{
- var familyElement = ObjectModelBuilder.Add(new Element
+ var familyElement = ObjectModelBuilder.ElementBuilder.Add(new Element
{
Id = VimConstants.SyntheticElementId,
Name = "GLTF Family",
_BimDocument = { Index = bimDocument.Index },
_Category = { Index = category.Index }
- });
+ }).Entity;
- return ObjectModelBuilder.Add(new Family
+ return ObjectModelBuilder.FamilyBuilder.Add(new Family
{
_Element = { Index = familyElement.Index },
- });
+ }).Entity;
}
///
@@ -119,19 +120,19 @@ private FamilyType StoreDefaultFamilyType(
Category category,
Family family)
{
- var familyTypeElement = ObjectModelBuilder.Add(new Element
+ var familyTypeElement = ObjectModelBuilder.ElementBuilder.Add(new Element
{
Id = VimConstants.SyntheticElementId,
Name = "GLTF Family Type",
_BimDocument = { Index = bimDocument.Index },
_Category = { Index = category.Index }
- });
+ }).Entity;
- return ObjectModelBuilder.Add(new FamilyType
+ return ObjectModelBuilder.FamilyTypeBuilder.Add(new FamilyType
{
_Element = { Index = familyTypeElement.Index },
_Family = { Index = family.Index }
- });
+ }).Entity;
}
///
@@ -140,15 +141,15 @@ private FamilyType StoreDefaultFamilyType(
private BimDocument StoreGltfModel(string gltfFilePath, SharpGLTF.Schema2.ModelRoot gltfModel, Category category)
{
// Create a BIM document representing the GLTF model.
- var bimDocument = ObjectModelBuilder.Add(new BimDocument
+ var bimDocument = ObjectModelBuilder.BimDocumentBuilder.Add(new BimDocument
{
Title = Path.GetFileNameWithoutExtension(gltfFilePath),
Name = Path.GetFileName(gltfFilePath),
PathName = gltfFilePath,
- });
+ }).Entity;
// Create an element to hold the BIM document's parameters.
- var elementEntity = ObjectModelBuilder.Add(bimDocument.CreateParameterHolderElement());
+ var elementEntity = ObjectModelBuilder.ElementBuilder.Add(bimDocument.CreateParameterHolderElement()).Entity;
elementEntity._Category.Index = category.Index;
elementEntity._BimDocument.Index = bimDocument.Index;
bimDocument._Element.Index = elementEntity.Index;
@@ -167,14 +168,14 @@ private BimDocument StoreGltfModel(string gltfFilePath, SharpGLTF.Schema2.ModelR
private void StoreParameter(Element elementEntity, string name, string value)
{
// Get (or add) the cached parameter descriptor associated with the name.
- var parameterDescriptor = ObjectModelBuilder.GetOrAdd(name, _ => new ParameterDescriptor()
+ var parameterDescriptor = ObjectModelBuilder.ParameterDescriptorBuilder.GetOrAdd(name, _ => new ParameterDescriptor()
{
Name = name,
_DisplayUnit = { Index = _defaultDisplayUnit.Index },
}).Entity;
// Store the parameter value. We use AddUntracked because it doesn't waste time doing a cache lookup.
- ObjectModelBuilder.AddUntracked(new Parameter
+ ObjectModelBuilder.ParameterBuilder.AddUntracked(new Parameter
{
Values = (value, value),
_ParameterDescriptor = { Index = parameterDescriptor.Index },
@@ -191,15 +192,15 @@ private void StoreGltfScene(
Category category)
{
// For illustrative purposes, we'll convert a GLTF scene into a Site entity.
- var siteElement = ObjectModelBuilder.Add(new Element()
+ var siteElement = ObjectModelBuilder.ElementBuilder.Add(new Element()
{
Id = gltfScene.LogicalIndex,
Name = gltfScene.Name,
_BimDocument = { Index = bimDocument.Index },
_Category = { Index = category.Index },
- });
+ }).Entity;
- ObjectModelBuilder.Add(new Site
+ ObjectModelBuilder.SiteBuilder.Add(new Site
{
_Element = { Index = siteElement.Index }
});
@@ -232,13 +233,13 @@ private void StoreGltfNode(
FamilyType familyType)
{
// Create the element associated to the node.
- var familyInstanceElement = ObjectModelBuilder.Add(new Element
+ var familyInstanceElement = ObjectModelBuilder.ElementBuilder.Add(new Element
{
Id = gltfNode.LogicalIndex,
Name = gltfNode.Name,
_BimDocument = { Index = bimDocument.Index },
_Category = { Index = category.Index },
- });
+ }).Entity;
// Store some sample parameters related to the GLTF node.
StoreParameter(familyInstanceElement, nameof(gltfNode.IsSkinJoint), gltfNode.IsSkinJoint.ToString());
@@ -246,7 +247,7 @@ private void StoreGltfNode(
StoreParameter(familyInstanceElement, nameof(gltfNode.IsTransformAnimated), gltfNode.IsTransformAnimated.ToString());
// Create a family instance pointing to the element and family type.
- ObjectModelBuilder.Add(new FamilyInstance
+ ObjectModelBuilder.FamilyInstanceBuilder.Add(new FamilyInstance
{
_Element = { Index = familyInstanceElement.Index },
_FamilyType = { Index = familyType.Index }
@@ -268,7 +269,7 @@ private void StoreGltfNode(
// Store the node associated to the geometric instance.
// This ordered 1:1 relationship connects the entities with the geometric instances.
- ObjectModelBuilder.Add(new Vim.Format.ObjectModel.Node
+ ObjectModelBuilder.NodeBuilder.Add(new Vim.Format.ObjectModel.Node
{
_Element = { Index = familyInstanceElement.Index },
});
@@ -368,9 +369,9 @@ private int StoreGltfMaterial(
BimDocument bimDocument,
Category category)
{
- var getOrAddResult = ObjectModelBuilder.GetOrAdd(
+ var getOrAddResult = ObjectModelBuilder.MaterialBuilder.GetOrAdd(
gltfMaterial.LogicalIndex,
- _ =>
+ () =>
{
var maybeChannel = gltfMaterial.FindChannel("BaseColor") ?? gltfMaterial.FindChannel("Diffuse");
if (maybeChannel == null)
@@ -388,13 +389,13 @@ private int StoreGltfMaterial(
return materialIndex; // If the GetOrAdd operation already contained the material, then return early.
// The material entity was just added so apply an Element to it.
- var materialElement = ObjectModelBuilder.Add(new Element()
+ var materialElement = ObjectModelBuilder.ElementBuilder.Add(new Element()
{
Id = VimConstants.SyntheticElementId,
Name = gltfMaterial.Name,
_BimDocument = { Index = bimDocument.Index },
_Category = { Index = category.Index },
- });
+ }).Entity;
// Connect the material entity to the element we created.
material._Element.Index = materialElement.Index;
diff --git a/src/cs/samples/Vim.Gltf.Converter/VimToGltfStore.cs b/src/cs/samples/Vim.Gltf.Converter/VimToGltfStore.cs
index b9882039..24ad224e 100644
--- a/src/cs/samples/Vim.Gltf.Converter/VimToGltfStore.cs
+++ b/src/cs/samples/Vim.Gltf.Converter/VimToGltfStore.cs
@@ -14,12 +14,12 @@ namespace Vim.Gltf.Converter
///
public class VimToGltfStore
{
- public const float FeetToMeters = 1.0f / 3.280839895f;
+
///
/// Converts the given VIM file into a GLTF (.glb) file.
///
- public static void Convert(string vimFilePath, string gltfFilePath, float scale = FeetToMeters, bool validateGltf = true)
+ public static void Convert(string vimFilePath, string gltfFilePath, float scale = (float) Util.Units.FeetToMetersRatio, bool validateGltf = true)
{
var vim = VimScene.LoadVim(vimFilePath);
diff --git a/src/cs/util/Vim.Util.Tests/FeetAndInchParsingTests.cs b/src/cs/util/Vim.Util.Tests/FeetAndInchParsingTests.cs
deleted file mode 100644
index a26a3041..00000000
--- a/src/cs/util/Vim.Util.Tests/FeetAndInchParsingTests.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using NUnit.Framework;
-using System.Collections.Generic;
-
-namespace Vim.Util.Tests
-{
- [TestFixture]
- public static class FeetAndInchParsingTests
- {
- public record TestCase(string Input, bool ExpectSuccess, double? ExpectedDecimalInches = null)
- {
- public override string ToString()
- => $"Input: {Input}, ExpectSuccess: {ExpectSuccess}, DecimalInches: {ExpectedDecimalInches}";
- }
-
- // Test cases inspired from question here: https://stackoverflow.com/q/22794466
- // Implementation follows from question answer: https://stackoverflow.com/a/22819580
- public static IEnumerable TestCases = new TestCase[]
- {
- new (null, false),
- new ("", false),
- new (" ", false),
- new ("abc", false),
- new ("0", false),
- new ("12.5'", true, 150.0),
- new ("11\"", true, 11.0),
- new ("3/16\"", true, 0.1875),
- new ("11' 11\"", true, 143.0),
- new ("11'11\"", true, 143.0),
- new ("12'-11\"", true, 155.0),
- new ("12' 11 3/16\"", true, 155.1875),
- new ("12' 11-1/2\"", true, 155.5),
- new ("12' 11 1/2\"", true, 155.5),
- new ("121103", true, 155.1875),
- new ("-11'11\"", true, -143.0),
- };
-
- [TestCaseSource(nameof(TestCases))]
- public static void Test(TestCase args)
- {
- var success = StringFormatting.TryParseFeetAndInchesToDecimalInches(args.Input, out var decimalInches);
- Assert.AreEqual(args.ExpectSuccess, success);
-
- if (args.ExpectSuccess == false)
- return;
-
- Assert.AreEqual(args.ExpectedDecimalInches, decimalInches);
- }
- }
-}
diff --git a/src/cs/util/Vim.Util.Tests/UnitsTests.cs b/src/cs/util/Vim.Util.Tests/UnitsTests.cs
new file mode 100644
index 00000000..b08677ec
--- /dev/null
+++ b/src/cs/util/Vim.Util.Tests/UnitsTests.cs
@@ -0,0 +1,129 @@
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace Vim.Util.Tests;
+
+[TestFixture]
+public static class UnitsTests
+{
+ public record DecimalInchParsingTestCase(string Input, bool ExpectSuccess, double? ExpectedDecimalInches = null)
+ {
+ public override string ToString()
+ => $"Input: {Input}, ExpectSuccess: {ExpectSuccess}, DecimalInches: {ExpectedDecimalInches}";
+ }
+
+ // Test cases inspired from question here: https://stackoverflow.com/q/22794466
+ // Implementation follows from question answer: https://stackoverflow.com/a/22819580
+ public static IEnumerable DecimalInchParsingTestCases = new DecimalInchParsingTestCase[]
+ {
+ new (null, false),
+ new ("", false),
+ new (" ", false),
+ new ("abc", false),
+ new ("0", false),
+ new ("12.5'", true, 150.0),
+ new ("11\"", true, 11.0),
+ new ("3/16\"", true, 0.1875),
+ new ("11' 11\"", true, 143.0),
+ new ("11'11\"", true, 143.0),
+ new ("12'-11\"", true, 155.0),
+ new ("12' 11 3/16\"", true, 155.1875),
+ new ("-12' 11 3/16\"", true, -(12d * 12d + 11d + 3d/16d)),
+ new ("12' 11-1/2\"", true, 155.5),
+ new ("12' 11 1/2\"", true, 155.5),
+ new ("121103", true, 155.1875),
+ new ("-11'11\"", true, -143.0),
+ };
+
+ [TestCaseSource(nameof(DecimalInchParsingTestCases))]
+ public static void TestParseToDecimalInches(DecimalInchParsingTestCase args)
+ {
+ var success = Units.TryParseFeetAndInchesToDecimalInches(args.Input, out var decimalInches);
+ Assert.AreEqual(args.ExpectSuccess, success);
+
+ if (args.ExpectSuccess == false)
+ return;
+
+ Assert.AreEqual(args.ExpectedDecimalInches, decimalInches);
+ }
+
+ //-----------------------------------------------------------------------------
+
+ public record FeetAndFractionalInchTestCase(
+ double? Feet,
+ string Expected,
+ string FeetFormatting = "",
+ string PositivePrefix = "",
+ string NegativePrefix = "-");
+
+ public static IEnumerable FeetAndFractionalInchTestCases = new FeetAndFractionalInchTestCase[]
+ {
+ new (null, ""),
+ new (0d, "0'"),
+ new (0d, "+0'", PositivePrefix: "+"),
+ new (1d, "1'"),
+ new (1d, "0001'", "0000"),
+ new (-1d, "-1'"),
+ new (-1d, "-0001'", "0000"),
+ new (1.5d, "1' 6\""),
+ new (-1.5d, "-1' 6\""),
+ new (150d, "150'"),
+ new (-150d, "-150'"),
+ new (11d / 12d, "11\""),
+ new (-11d / 12d, "-11\""),
+ new (3d / 16d / 12d, "3/16\""),
+ new (-3d / 16d / 12d, "-3/16\""),
+ new (11d + 11d / 12d, "11' 11\""),
+ new (-(11d + 11d / 12d), "-11' 11\""),
+ new (1d/16d/12d, "1/16\""),
+ new (-1d/16d/12d, "-1/16\""),
+ new (99d + 0d / 12d + 1d/16d/12d, "99' 1/16\""),
+ new (-(99d + 0d / 12d + 1d/16d/12d), "-99' 1/16\""),
+ new (12d + 11d / 12d + 3d/16d/12d, "12' 11 3/16\""),
+ new (12d + 11d / 12d + 3d/16d/12d, "00012' 11 3/16\"", "00000"),
+ new (12d + 11d / 12d + 3d/16d/12d, " 00012' 11 3/16\"", "00000", " "),
+ new (12d + 11d / 12d + 3d/16d/12d, "+00012' 11 3/16\"", "00000", "+"),
+ new (120000d + 11d / 12d + 3d/16d/12d, "+120000' 11 3/16\"", "00000", "+"),
+ new (-(12d + 11d / 12d + 3d/16d/12d), "-12' 11 3/16\""),
+ new (-(12d + 11d / 12d + 3d/16d/12d), "-00012' 11 3/16\"", "00000"),
+ new (-(12d + 11d / 12d + 3d/16d/12d), "~00012' 11 3/16\"", "00000", "+", "~"),
+ };
+
+ [TestCaseSource(nameof(FeetAndFractionalInchTestCases))]
+ public static void ValidateToFeetAndFractionalInchesString(FeetAndFractionalInchTestCase testCase)
+ {
+ Assert.AreEqual(testCase.Expected, Units.ToFeetAndFractionalInchesString(testCase.Feet, testCase.FeetFormatting, testCase.PositivePrefix, testCase.NegativePrefix));
+ }
+
+ //-----------------------------------------------------------------------------
+
+ public record MetersTestCase(
+ double? Meters,
+ string Expected,
+ string MetersFormatting = "",
+ string PositivePrefix = "",
+ string NegativePrefix = "-");
+
+ public static IEnumerable ToMetersStringTestCases = new MetersTestCase[]
+ {
+ new (null, ""),
+ new (0d, "0m"),
+ new (0d, "+0m", PositivePrefix: "+"),
+ new (1d, "1m"),
+ new (1d, "+1m", PositivePrefix: "+"),
+ new (-1d, "-1m"),
+ new (10d, "10m"),
+ new (10d, "+10m", PositivePrefix: "+"),
+ new (10d, "+0010.00m", MetersFormatting: "0000.00", "+"),
+ new (10.12345d, "+0010.12m", MetersFormatting: "0000.00", "+"),
+ new (-10.12345d, "-0010.12m", MetersFormatting: "0000.00", "+"),
+ new (-10.12345d, "~0010.12m", MetersFormatting: "0000.00", "+", "~"),
+ new (999999.12345d, "+999999.12345m", MetersFormatting: "0000.00000", "+"),
+ };
+
+ [TestCaseSource(nameof(ToMetersStringTestCases))]
+ public static void ValidateToMetersString(MetersTestCase testCase)
+ {
+ Assert.AreEqual(testCase.Expected, Units.ToMetersString(testCase.Meters, testCase.MetersFormatting, testCase.PositivePrefix, testCase.NegativePrefix));
+ }
+}
diff --git a/src/cs/util/Vim.Util.Tests/VimFormatRepoPaths.cs b/src/cs/util/Vim.Util.Tests/VimFormatRepoPaths.cs
index 2a76d8b7..2abe8de2 100644
--- a/src/cs/util/Vim.Util.Tests/VimFormatRepoPaths.cs
+++ b/src/cs/util/Vim.Util.Tests/VimFormatRepoPaths.cs
@@ -8,7 +8,6 @@ namespace Vim.Util.Tests
///
public static class VimFormatRepoPaths
{
-
///
/// This value ProjDir is set by a pre-build step to our projects folder
/// We use it to set our Repo dir (which is the parent of this folder)
@@ -22,14 +21,18 @@ public static class VimFormatRepoPaths
public static string DataDir => Path.Combine(RootDir, "data");
///
- /// Returns the file path to the highest versioned mechanical room file among the version snapshots.
+ /// Returns the file path to the highest versioned file among the version snapshots.
+ /// Files matched by the pattern are ordered by name in ascending order.
///
- public static string GetLatestWolfordResidenceVim()
+ public static string GetDataFilePath(string filePattern, bool last)
{
- var matchingVim = Directory.GetFiles(DataDir, "Wolford_Residence*.vim", SearchOption.AllDirectories).FirstOrDefault();
+ var matches = Directory.GetFiles(DataDir, filePattern, SearchOption.AllDirectories)
+ .OrderBy(f => f);
+
+ var matchingVim = last ? matches.LastOrDefault() : matches.FirstOrDefault();
if (matchingVim == null)
- throw new FileNotFoundException($"Could not find the latest Wolford Residence VIM.");
+ throw new FileNotFoundException($"Could not find any files matching the pattern: {filePattern}");
return matchingVim;
}
diff --git a/src/cs/util/Vim.Util/Disposer.cs b/src/cs/util/Vim.Util/Disposer.cs
index e4de54a4..22bbf005 100644
--- a/src/cs/util/Vim.Util/Disposer.cs
+++ b/src/cs/util/Vim.Util/Disposer.cs
@@ -4,12 +4,21 @@ namespace Vim.Util
{
public sealed class Disposer : IDisposable
{
+ private bool _isDisposed = false;
+
readonly Action OnDispose;
public Disposer(Action onDispose)
=> OnDispose = onDispose;
public void Dispose()
- => OnDispose();
+ {
+ if (_isDisposed)
+ return;
+
+ _isDisposed = true;
+
+ OnDispose();
+ }
}
}
diff --git a/src/cs/util/Vim.Util/FractionConverter.cs b/src/cs/util/Vim.Util/FractionConverter.cs
new file mode 100644
index 00000000..ee530baf
--- /dev/null
+++ b/src/cs/util/Vim.Util/FractionConverter.cs
@@ -0,0 +1,221 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+namespace Vim.Util
+{
+ public static class FractionConverter
+ {
+ // Adapted from: https://www.codeproject.com/Tips/623477/Convert-Decimal-to-Fraction-and-Vice-Versa-in-Csha
+
+ public const double OneSixteenth = 0.0625d;
+ private const double Tolerance = 0.0000001d;
+
+ ///
+ /// Convert and round to 1/16
+ ///
+ public static string ToFractionString(double inValue, bool skipRounding = false, double decimalPlaces = OneSixteenth)
+ {
+ var value = inValue;
+
+ if (!skipRounding)
+ value = RoundTo(inValue, decimalPlaces);
+
+ // get the whole value of the fraction
+ var wholePart = Math.Truncate(value);
+
+ if (Math.Abs(wholePart - value) < Tolerance)
+ return value.ToString(CultureInfo.InvariantCulture);
+
+ // get the fractional value
+ var fractionPart = value - wholePart;
+
+ // initialize a numerator and denomintar
+ uint numerator = 0;
+ uint denominator = 1;
+
+ // ensure that there is actual a fraction
+ if (fractionPart > 0d)
+ {
+ // convert the value to a string so that
+ // you can count the number of decimal places there are
+ var strFraction = fractionPart
+ .ToString(CultureInfo.InvariantCulture)
+ .Remove(0, 2);
+
+ // store the number of decimal places
+ var intFractLength = (uint)strFraction.Length;
+
+ // set the numerator to have the proper amount of zeros
+ numerator = (uint)Math.Pow(10, intFractLength);
+
+ // parse the fraction value to an integer that equals
+ // [fraction value] * 10^[number of decimal places]
+ uint.TryParse(strFraction, out denominator);
+
+ // get the greatest common divisor for both numbers
+ var gcd = GreatestCommonDivisor(denominator, numerator);
+
+ // divide the numerator and the denominator by the greatest common divisor
+ numerator = numerator / gcd;
+ denominator = denominator / gcd;
+ }
+
+ // create a string builder
+ var stringBuilder = new StringBuilder();
+
+ // add the whole number if it's greater than 0
+ if (wholePart > 0d)
+ {
+ stringBuilder.Append(wholePart);
+ }
+
+ // add the fraction if it's greater than 0
+ if (fractionPart > 0d)
+ {
+ if (stringBuilder.Length > 0)
+ {
+ stringBuilder.Append(" ");
+ }
+
+ stringBuilder.Append(denominator);
+ stringBuilder.Append("/");
+ stringBuilder.Append(numerator);
+ }
+
+ return stringBuilder.ToString();
+ }
+
+ // Converts fraction to decimal.
+ // There are two formats a fraction greater than 1 can consist of
+ // which this function will work for:
+ // Example: 4-1/2 or 4 1/2
+ // Fractions less than 1 are in the format of 1/2, etc..
+ public static double ParseFraction(string value)
+ {
+ string[] dparse;
+ string[] fparse;
+ var whole = "0";
+ var dec = "";
+ double result = 0;
+
+ // check for '-' or ' ' separator between whole number and fraction
+ dparse = value.Contains('-') ? value.Split('-') : value.Split(' ');
+ var pcount = dparse.Count();
+
+ // fraction greater than one.
+ if (pcount == 2)
+ {
+ whole = dparse[0];
+ dec = dparse[1];
+ }
+ // whole number or fraction less than 1.
+ else if (pcount == 1)
+ {
+ dec = dparse[0];
+ }
+
+ // split out fractional part of value passed in.
+ fparse = dec.Split('/');
+
+ // check for fraction.
+ if (fparse.Count() == 2)
+ {
+ try
+ {
+ var d0 = Convert.ToDouble(fparse[0]); // convert numerator
+ var d1 = Convert.ToDouble(fparse[1]); // convert denominator
+ result = d0 / d1; // divide the fraction (converts to decimal)
+ var dWhole = Convert.ToDouble(whole); // convert whole number part to decimal.
+
+ result = dWhole + result; // add whole number
+ // and fractional part and we're done.
+ }
+ catch (Exception e)
+ {
+ result = 0;
+ }
+ }
+ else
+ // there is no fractional part of the input.
+ {
+ try
+ {
+ result = Convert.ToDouble(whole + dec);
+ }
+ catch (Exception e)
+ {
+ // bad input so return 0.
+ result = 0;
+ }
+ }
+
+ return result;
+ }
+
+ private static uint GreatestCommonDivisor(uint valA, uint valB)
+ {
+ // return 0 if both values are 0 (no GSD)
+ if (valA == 0 &&
+ valB == 0)
+ {
+ return 0;
+ }
+ // return value b if only a == 0
+ else if (valA == 0 &&
+ valB != 0)
+ {
+ return valB;
+ }
+ // return value a if only b == 0
+ else if (valA != 0 && valB == 0)
+ {
+ return valA;
+ }
+ // actually find the GSD
+ else
+ {
+ var first = valA;
+ var second = valB;
+
+ while (first != second)
+ {
+ if (first > second)
+ {
+ first = first - second;
+ }
+ else
+ {
+ second = second - first;
+ }
+ }
+
+ return first;
+ }
+
+ }
+
+ // Rounds a number to the nearest decimal.
+ // For instance, carpenters do not want to see a number like 4/5.
+ // That means nothing to them
+ // and you'll have an angry carpenter on your hands
+ // if you ask them cut a 2x4 to 36 and 4/5 inches.
+ // So, we would want to convert to the nearest 1/16 of an inch.
+ // Example: RoundTo(0.8, 0.0625) Rounds 4/5 to 13/16 or 0.8125.
+ private static double RoundTo(double val, double places)
+ {
+ var sPlaces = ToFractionString(places, true);
+ var s = sPlaces.Split('/');
+
+ if (s.Count() == 2)
+ {
+ var nPlaces = System.Convert.ToInt32(s[1]);
+ var d = Math.Round(val * nPlaces);
+ return d / nPlaces;
+ }
+
+ return val;
+ }
+ }
+}
diff --git a/src/cs/util/Vim.Util/StringFormatting.cs b/src/cs/util/Vim.Util/StringFormatting.cs
index 6e4ba6ad..1a03ae2b 100644
--- a/src/cs/util/Vim.Util/StringFormatting.cs
+++ b/src/cs/util/Vim.Util/StringFormatting.cs
@@ -1,5 +1,4 @@
using System;
-using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -41,40 +40,6 @@ public static string BytesToString(long byteCount, int numPlacesToRound = 1)
return $"{(Math.Sign(byteCount) * num).ToString($"F{numPlacesToRound}")}{ByteSuffixes[place]}";
}
- // https://stackoverflow.com/questions/22794466/parsing-all-possible-types-of-varying-architectural-dimension-input
- // https://stackoverflow.com/questions/6157865/c-sharp-function-to-convert-text-input-of-feet-inches-meters-centimeters-millime
-
- public static Regex FeetAndInchesRegex
- = new Regex(
- "^\\s*(?-)?\\s*(((?\\d+)(?\\d{2})(?\\d{2}))|((?[\\d.]+)')?[\\s-]*((?\\d+)?[\\s-]*((?\\d+)/(?\\d+))?\")?)\\s*$",
- RegexOptions.Compiled);
-
- public static Regex NumberAndUnitsRegex
- = new Regex("^\\s*(?-?[0-9]*[.]?[0-9]+)([\\s]+(?[a-zA-Z°²³$£%/*^@#`]*))?\\s*$", RegexOptions.Compiled);
-
- ///
- /// Parses the input string and outputs the value in decimal inches upon success
- ///
- public static bool TryParseFeetAndInchesToDecimalInches(string input, out double value)
- {
- value = 0;
- if (string.IsNullOrWhiteSpace(input))
- return false;
-
- var m = FeetAndInchesRegex.Match(input);
- if (!m.Success)
- return false;
-
- var sign = m.Groups["minus"].Success ? -1 : 1;
- var feet = m.Groups["feet"].Success ? double.Parse(m.Groups["feet"].Value, CultureInfo.InvariantCulture) : 0;
- var inch = m.Groups["inch"].Success ? Convert.ToInt32(m.Groups["inch"].Value) : 0;
- var sixt = m.Groups["sixt"].Success ? Convert.ToInt32(m.Groups["sixt"].Value) : 0;
- var numer = m.Groups["numer"].Success ? Convert.ToInt32(m.Groups["numer"].Value) : 0;
- var denom = m.Groups["denom"].Success ? Convert.ToInt32(m.Groups["denom"].Value) : 1;
- value = sign * (feet * 12 + inch + sixt / 16.0 + numer / Convert.ToDouble(denom));
- return true;
- }
-
///
/// The normalized DateTime format, suitable for inclusion in a filename.
///
diff --git a/src/cs/util/Vim.Util/Units.cs b/src/cs/util/Vim.Util/Units.cs
new file mode 100644
index 00000000..41286016
--- /dev/null
+++ b/src/cs/util/Vim.Util/Units.cs
@@ -0,0 +1,175 @@
+using System;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace Vim.Util
+{
+ public static class Units
+ {
+ public const double MetersToFeetRatio = 3.280839895d;
+ public const double FeetToMetersRatio = 1.0d / MetersToFeetRatio;
+
+ public const double SquareMetersToSquareFeetRatio = 10.7639d;
+ public const double SquareFeetToSquareMetersRatio = 1.0d / SquareMetersToSquareFeetRatio;
+
+ public const double CubicMetersToCubicFeetRatio = 35.3147d;
+ public const double CubicFeetToCubicMetersRatio = 1.0d / CubicMetersToCubicFeetRatio;
+
+ public const double RadiansToDegreesRatio = 180d / Math.PI;
+ public const double DegreesToRadiansRatio = 1.0d / RadiansToDegreesRatio;
+
+ public const int GoodEnoughRoundingDigits = 4;
+
+ public static double? ConvertMeasure(double? source, double sourceToDestinationRatio, int digitRounding = -1)
+ {
+ if (source == null)
+ return null;
+
+ var destination = sourceToDestinationRatio * source.Value;
+
+ return digitRounding < 0
+ ? destination
+ : Math.Round(destination, digitRounding);
+ }
+
+ public static double? FeetToMeters(double? feet, int digitRounding = -1)
+ => ConvertMeasure(feet, FeetToMetersRatio, digitRounding);
+
+ public static double? SquareFeetToSquareMeters(double? squareFeet, int digitRounding = -1)
+ => ConvertMeasure(squareFeet, SquareFeetToSquareMetersRatio, digitRounding);
+
+ public static double? CubicFeetToCubicMeters(double? cubicFeet, int digitRounding = -1)
+ => ConvertMeasure(cubicFeet, CubicFeetToCubicMetersRatio, digitRounding);
+
+ public static double? RadiansToDegrees(double? radians, int digitRounding = -1)
+ => ConvertMeasure(radians, RadiansToDegreesRatio, digitRounding);
+
+ public static double? DegreesToRadians(double? degrees, int digitRounding = -1)
+ => ConvertMeasure(degrees, DegreesToRadiansRatio, digitRounding);
+
+ public static string ToFeetAndFractionalInchesString(
+ double? feet,
+ string feetFormatString = "",
+ string positivePrefix = "",
+ string negativePrefix = "-")
+ => feet.HasValue
+ ? FormatAsFractionalFeetAndInches(feet.Value, feetFormatString, positivePrefix, negativePrefix)
+ : "";
+
+ public static string ToPaddedString(
+ double? inValue,
+ string suffix = "",
+ string formatString = "",
+ string positiveSign = "",
+ string negativeSign = "-")
+ {
+ if (!inValue.HasValue)
+ return "";
+
+ var value = inValue.Value;
+ var absValue = Math.Abs(value);
+
+ var sb = new StringBuilder();
+
+ sb.Append(value < 0 ? negativeSign : positiveSign);
+ sb.Append(absValue.ToString(formatString));
+ sb.Append(suffix);
+
+ return sb.ToString();
+ }
+
+ public static string ToDecimalFeetString(
+ double? feet,
+ string formatString = "",
+ string positiveSign = "",
+ string negativeSign = "-")
+ => ToPaddedString(feet, "ft", formatString, positiveSign, negativeSign);
+
+ public static string ToMetersString(
+ double? meters,
+ string formatString = "",
+ string positiveSign = "",
+ string negativeSign = "-")
+ => ToPaddedString(meters, "m", formatString, positiveSign, negativeSign);
+
+ ///
+ /// Converts a value to fractional feet and inches.
+ /// Examples:
+ /// 12.1667 converts to 12' 2".
+ /// 4 converts to 4'.
+ /// 0.1667 converts to 2".
+ ///
+ public static string FormatAsFractionalFeetAndInches(
+ double value,
+ string feetFormatString = "",
+ string positiveSign = "",
+ string negativeSign = "-",
+ bool skipRounding = false,
+ double decimalPlaces = FractionConverter.OneSixteenth)
+ {
+ if (value == 0)
+ return $"{positiveSign}{0.ToString(feetFormatString)}'";
+
+ var absValue = Math.Abs(value);
+
+ var feet = Math.Floor(absValue);
+ var inchesDecimal = Math.Round((absValue - feet) * 12, 2);
+
+ var sb = new StringBuilder();
+
+ sb.Append(value < 0 ? negativeSign : positiveSign);
+
+ if (feet != 0)
+ sb.Append($"{feet.ToString(feetFormatString)}'");
+
+ if (inchesDecimal != 0)
+ {
+ if (feet != 0)
+ sb.Append(" ");
+
+ sb.Append($"{FractionConverter.ToFractionString(inchesDecimal, skipRounding, decimalPlaces)}\"");
+ }
+
+ var result = sb.ToString().TrimEnd();
+
+ return string.IsNullOrWhiteSpace(result)
+ ? $"{positiveSign}{0.ToString(feetFormatString)}'"
+ : result;
+ }
+
+ // https://stackoverflow.com/questions/22794466/parsing-all-possible-types-of-varying-architectural-dimension-input
+ // https://stackoverflow.com/questions/6157865/c-sharp-function-to-convert-text-input-of-feet-inches-meters-centimeters-millime
+
+ public static Regex FeetAndInchesRegex
+ = new Regex(
+ "^\\s*(?-)?\\s*(((?\\d+)(?\\d{2})(?\\d{2}))|((?[\\d.]+)')?[\\s-]*((?\\d+)?[\\s-]*((?\\d+)/(?\\d+))?\")?)\\s*$",
+ RegexOptions.Compiled);
+
+ public static Regex NumberAndUnitsRegex
+ = new Regex("^\\s*(?-?[0-9]*[.]?[0-9]+)([\\s]+(?[a-zA-Z°²³$£%/*^@#`]*))?\\s*$", RegexOptions.Compiled);
+
+ ///
+ /// Parses the input string and outputs the value in decimal inches upon success
+ ///
+ public static bool TryParseFeetAndInchesToDecimalInches(string input, out double value)
+ {
+ value = 0;
+ if (string.IsNullOrWhiteSpace(input))
+ return false;
+
+ var m = FeetAndInchesRegex.Match(input);
+ if (!m.Success)
+ return false;
+
+ var sign = m.Groups["minus"].Success ? -1 : 1;
+ var feet = m.Groups["feet"].Success ? double.Parse(m.Groups["feet"].Value, CultureInfo.InvariantCulture) : 0;
+ var inch = m.Groups["inch"].Success ? Convert.ToInt32(m.Groups["inch"].Value) : 0;
+ var sixt = m.Groups["sixt"].Success ? Convert.ToInt32(m.Groups["sixt"].Value) : 0;
+ var numer = m.Groups["numer"].Success ? Convert.ToInt32(m.Groups["numer"].Value) : 0;
+ var denom = m.Groups["denom"].Success ? Convert.ToInt32(m.Groups["denom"].Value) : 1;
+ value = sign * (feet * 12 + inch + sixt / 16.0 + numer / Convert.ToDouble(denom));
+ return true;
+ }
+ }
+}
diff --git a/src/cs/vim/Vim.Format.CodeGen/ObjectModelGenerator.cs b/src/cs/vim/Vim.Format.CodeGen/ObjectModelGenerator.cs
index 2cc1a34c..86929669 100644
--- a/src/cs/vim/Vim.Format.CodeGen/ObjectModelGenerator.cs
+++ b/src/cs/vim/Vim.Format.CodeGen/ObjectModelGenerator.cs
@@ -156,7 +156,9 @@ private static CodeBuilder WriteEntityClass(Type t, CodeBuilder cb = null)
cb.AppendLine($"public partial class {t.Name}").AppendLine("{");
foreach (var fieldInfo in relationFields)
{
- cb.AppendLine($"public {fieldInfo.FieldType.RelationTypeParameter()} {fieldInfo.Name.Substring(1)} => {fieldInfo.Name}.Value;");
+ var relationFieldName = fieldInfo.Name.Substring(1);
+ cb.AppendLine($"public {fieldInfo.FieldType.RelationTypeParameter()} {relationFieldName} => {fieldInfo.Name}?.Value;");
+ cb.AppendLine($"public int {relationFieldName}Index => {fieldInfo.Name}?.Index ?? EntityRelation.None;");
}
cb.AppendLine($"public {t.Name}()");
@@ -294,28 +296,27 @@ private static void WriteEntityTableSet(CodeBuilder cb)
cb.AppendLine("public partial class EntityTableSet");
cb.AppendLine("{");
- cb.AppendLine(
- "public Dictionary RawTableMap { get; } = new Dictionary();");
+ cb.AppendLine("public string[] StringTable { get; }");
cb.AppendLine();
- cb.AppendLine("private SerializableEntityTable GetRawTableOrDefault(string tableName)");
- cb.AppendLine(" => RawTableMap.TryGetValue(tableName, out var result) ? result : null;");
+ cb.AppendLine("public Dictionary RawTableMap { get; } = new Dictionary();");
+ cb.AppendLine();
+ cb.AppendLine("public SerializableEntityTable GetSerializableTableOrEmpty(string tableName)");
+ cb.AppendLine(" => RawTableMap.TryGetValue(tableName, out var result) ? result : new SerializableEntityTable { Name = tableName };");
cb.AppendLine();
cb.AppendLine("public ElementIndexMaps ElementIndexMaps { get; }");
cb.AppendLine();
- cb.AppendLine("public EntityTableSet(SerializableEntityTable[] rawTables, string[] stringBuffer, bool inParallel = true)");
+ cb.AppendLine("public EntityTableSet(SerializableEntityTable[] rawTables, string[] stringTable, bool inParallel = true)");
cb.AppendLine("{");
+ cb.AppendLine("StringTable = stringTable;");
+ cb.AppendLine();
cb.AppendLine("foreach (var rawTable in rawTables)");
cb.AppendLine(" RawTableMap[rawTable.Name] = rawTable;");
cb.AppendLine();
cb.AppendLine("// Populate the entity tables.");
foreach (var t in entityTypes)
{
- var etName = t.GetEntityTableName();
- var tmp = $"{t.Name.ToLowerInvariant()}Table";
- cb.AppendLine($"if (GetRawTableOrDefault(\"{etName}\") is SerializableEntityTable {tmp})");
- cb.AppendLine($" {t.Name}Table = new {t.Name}Table({tmp}, stringBuffer);");
- cb.AppendLine();
+ cb.AppendLine($"{t.Name}Table = new {t.Name}Table(GetSerializableTableOrEmpty(TableNames.{t.Name}), stringTable, this);");
}
cb.AppendLine("// Initialize element index maps");
cb.AppendLine("ElementIndexMaps = new ElementIndexMaps(this, inParallel);");
@@ -329,6 +330,56 @@ private static void WriteEntityTableSet(CodeBuilder cb)
cb.AppendLine($"public {t.Name} Get{t.Name}(int index) => {t.Name}Table?.Get(index);");
}
+ var elementKindEntityTypes = entityTypes
+ .Select(t => (t, t.GetElementKind()))
+ .Where(tuple => tuple.Item2 != ElementKind.Unknown)
+ .ToArray();
+ cb.AppendLine();
+ cb.AppendLine("public static HashSet GetElementKindTableNames()");
+ cb.AppendLine(" => new HashSet()");
+ cb.AppendLine(" {");
+ foreach (var (t, _) in elementKindEntityTypes)
+ {
+ cb.AppendLine( $"TableNames.{t.Name},");
+ }
+ cb.AppendLine(" };");
+
+ cb.AppendLine();
+ cb.AppendLine("// Returns an array defining a 1:1 association of Element to its ElementKind");
+ cb.AppendLine("public ElementKind[] GetElementKinds()");
+ cb.AppendLine("{");
+ cb.AppendLine("var elementKinds = new ElementKind[ElementTable?.RowCount ?? 0];");
+ cb.AppendLine();
+ cb.AppendLine("if (elementKinds.Length == 0) return elementKinds;");
+ cb.AppendLine();
+ cb.AppendLine("// Initialize all element kinds to unknown");
+ cb.AppendLine("for (var i = 0; i < elementKinds.Length; ++i) { elementKinds[i] = ElementKind.Unknown; }");
+ cb.AppendLine();
+ cb.AppendLine("// Populate the element kinds from the relevant entity tables");
+ foreach (var (t, elementKind) in elementKindEntityTypes)
+ {
+ var etPropertyName = $"{t.Name}Table";
+ cb.AppendLine($"for (var i = 0; i < ({etPropertyName}?.RowCount ?? 0); ++i)");
+ cb.AppendLine("{");
+ cb.AppendLine($"var elementIndex = {etPropertyName}?.Column_ElementIndex[i] ?? EntityRelation.None;");
+ cb.AppendLine("if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;");
+ cb.AppendLine();
+ cb.AppendLine("var currentElementKind = elementKinds[elementIndex];");
+ cb.AppendLine($"var candidateElementKind = ElementKind.{elementKind:G};");
+ cb.AppendLine();
+ // NOTE: In some cases, a Group entity shares the same element as a FamilyInstance entity.
+ // Likewise, sometimes a System entity shares the same element as a FamilyInstance entity.
+ // In these cases, the ElementKind.FamilyInstance takes priority because of the comparison between the currentElementKind and the candidateElementKind.
+ cb.AppendLine("// Only update the element kind if it is unknown or if it is less than the current kind.");
+ cb.AppendLine("if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;");
+ cb.AppendLine();
+ cb.AppendLine("elementKinds[elementIndex] = candidateElementKind;");
+ cb.AppendLine("}");
+ cb.AppendLine();
+ }
+ cb.AppendLine("return elementKinds;");
+ cb.AppendLine("} // GetElementKinds()");
+
cb.AppendLine("} // class EntityTableSet");
cb.AppendLine();
@@ -343,11 +394,14 @@ private static void WriteEntityTable(CodeBuilder cb, Type t)
cb.AppendLine($"public partial class {t.Name}Table : EntityTable_v2, IEnumerable<{t.Name}>");
cb.AppendLine("{");
- cb.AppendLine("private readonly EntityTableSet _parentTableSet; // can be null");
cb.AppendLine();
- cb.AppendLine($"public {t.Name}Table(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)");
+ cb.AppendLine($"public const string TableName = TableNames.{t.Name};");
+ cb.AppendLine();
+ cb.AppendLine("public EntityTableSet ParentTableSet { get; } // can be null");
+ cb.AppendLine();
+ cb.AppendLine($"public {t.Name}Table(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)");
cb.AppendLine("{");
- cb.AppendLine("_parentTableSet = parentTableSet;");
+ cb.AppendLine("ParentTableSet = parentTableSet;");
foreach (var f in entityFields)
{
var fieldName = f.Name;
@@ -398,7 +452,7 @@ private static void WriteEntityTable(CodeBuilder cb, Type t)
cb.AppendLine($"public int[] Column_{localFieldName}Index {{ get; }}");
cb.AppendLine($"public int Get{localFieldName}Index(int index) => Column_{localFieldName}Index.ElementAtOrDefault(index, EntityRelation.None);");
cb.AppendLine($"public {relType.Name} Get{localFieldName}(int index) => _GetReferenced{localFieldName}(Get{localFieldName}Index(index));");
- cb.AppendLine($"private {relType.Name} _GetReferenced{localFieldName}(int referencedIndex) => _parentTableSet.Get{relType.Name}(referencedIndex);");
+ cb.AppendLine($"private {relType.Name} _GetReferenced{localFieldName}(int referencedIndex) => ParentTableSet.Get{relType.Name}(referencedIndex);");
}
cb.AppendLine("// Object Getter");
@@ -439,22 +493,17 @@ private static void WriteDocumentBuilder(CodeBuilder cb)
cb.AppendLine("public static class DocumentBuilderExtensions");
cb.AppendLine("{");
- cb.AppendLine("public static Func, EntityTableBuilder> GetTableBuilderFunc(this Type type)");
- cb.AppendLine("{");
- foreach (var et in entityTypes)
- cb.AppendLine($"if (type == typeof({et.Name})) return To{et.Name}TableBuilder;");
- cb.AppendLine("throw new ArgumentException(nameof(type));");
- cb.AppendLine("}");
-
foreach (var et in entityTypes)
{
var entityType = et.Name;
- cb.AppendLine($"public static EntityTableBuilder To{entityType}TableBuilder(this IEnumerable entities)");
+ cb.AppendLine($"public static EntityTableBuilder To{entityType}TableBuilder(this EntitySetBuilder<{entityType}> entitySet)");
cb.AppendLine("{");
- cb.AppendLine($"var typedEntities = entities?.Cast<{entityType}>() ?? Enumerable.Empty<{entityType}>();");
+ //cb.AppendLine($"var typedEntities = entities?.Cast<{entityType}>() ?? Enumerable.Empty<{entityType}>();");
var tableName = et.GetEntityTableName();
- cb.AppendLine($"var tb = new EntityTableBuilder(\"{tableName}\");");
+ cb.AppendLine($"var tb = new EntityTableBuilder(TableNames.{et.Name});");
+ cb.AppendLine("var entities = entitySet.Entities;");
+ cb.AppendLine("var entityCount = entities.Count;");
var entityFields = et.GetEntityFields().ToArray();
var relationFields = et.GetRelationFields().ToArray();
@@ -466,13 +515,21 @@ private static void WriteDocumentBuilder(CodeBuilder cb)
{
var (strategy, _) = fieldInfo.FieldType.GetValueSerializationStrategyAndTypePrefix();
var functionName = strategy.GetEntityTableBuilderAddFunctionName(fieldInfo.FieldType);
- cb.AppendLine($"tb.{functionName}(\"{fieldInfo.GetSerializedValueColumnName()}\", typedEntities.Select(x => x.{fieldInfo.Name}));");
+ cb.AppendLine("{");
+ cb.AppendLine($"var columnData = new {fieldInfo.FieldType.Name}[entityCount];");
+ cb.AppendLine($"for (var i = 0; i < columnData.Length; ++i) {{ columnData[i] = entities[i].{fieldInfo.Name}; }}");
+ cb.AppendLine($"tb.{functionName}(\"{fieldInfo.GetSerializedValueColumnName()}\", columnData);");
+ cb.AppendLine("}");
}
foreach (var fieldInfo in relationFields)
{
var (indexColumnName, localFieldName) = fieldInfo.GetIndexColumnInfo();
- cb.AppendLine($"tb.AddIndexColumn(\"{indexColumnName}\", typedEntities.Select(x => x._{localFieldName}?.Index ?? EntityRelation.None));");
+ cb.AppendLine("{");
+ cb.AppendLine("var columnData = new int[entityCount];");
+ cb.AppendLine($"for (var i = 0; i < columnData.Length; ++i) {{ columnData[i] = entities[i]._{localFieldName}?.Index ?? EntityRelation.None; }}");
+ cb.AppendLine($"tb.AddIndexColumn(\"{indexColumnName}\", columnData);");
+ cb.AppendLine("}");
}
cb.AppendLine("return tb;");
@@ -484,13 +541,33 @@ private static void WriteDocumentBuilder(CodeBuilder cb)
cb.AppendLine("public partial class ObjectModelBuilder");
cb.AppendLine("{");
- // NOTE: the following line must not be made static since the ObjectModelBuilder is instantiated upon each new export.
- // Making this static will cause the contained EntityTableBuilders to accumulate data from previous exports during the lifetime of the program.
- cb.AppendLine("public readonly Dictionary EntityTableBuilders = new Dictionary()");
+ // NOTE: the following lines must not be made static since the ObjectModelBuilder is instantiated upon each new export.
+ // Making this static will cause the contained EntitySetBuilders to accumulate data from previous exports during the lifetime of the program.
+
+ // Instantiates a named entity table builder for each type.
+ foreach (var et in entityTypes)
+ cb.AppendLine($"public readonly EntitySetBuilder<{et.Name}> {et.Name}Builder = new EntitySetBuilder<{et.Name}>(TableNames.{et.Name});");
+
+ cb.AppendLine();
+ cb.AppendLine("public DocumentBuilder AddEntityTableSets(DocumentBuilder db)");
cb.AppendLine("{");
foreach (var et in entityTypes)
- cb.AppendLine($"{{typeof({et.Name}), new EntityTableBuilder()}},");
- cb.AppendLine("};");
+ {
+ cb.AppendLine($"db.Tables.Add({et.Name}Builder.EntityTableName, {et.Name}Builder.To{et.Name}TableBuilder());");
+ }
+ cb.AppendLine();
+ cb.AppendLine("return db;");
+ cb.AppendLine("} // AddEntityTableSets");
+
+ cb.AppendLine();
+ cb.AppendLine("public void Clear()");
+ cb.AppendLine("{");
+ foreach (var et in entityTypes)
+ {
+ cb.AppendLine($"{et.Name}Builder.Clear();");
+ }
+ cb.AppendLine("} // Clear");
+
cb.AppendLine("} // ObjectModelBuilder");
}
diff --git a/src/cs/vim/Vim.Format.Core/EntityTable_v2.cs b/src/cs/vim/Vim.Format.Core/EntityTable_v2.cs
index 775e2190..d73d7faf 100644
--- a/src/cs/vim/Vim.Format.Core/EntityTable_v2.cs
+++ b/src/cs/vim/Vim.Format.Core/EntityTable_v2.cs
@@ -8,7 +8,7 @@ namespace Vim.Format
{
public class EntityTable_v2
{
- private readonly string[] _stringBuffer;
+ private readonly string[] _stringTable;
public Dictionary> IndexColumns { get; } = new Dictionary>();
public Dictionary> StringColumns { get; } = new Dictionary>();
@@ -34,7 +34,7 @@ public class EntityTable_v2
///
public EntityTable_v2(
SerializableEntityTable et,
- string[] stringBuffer)
+ string[] stringTable)
{
Name = et.Name;
Columns = et.ValidateColumnRowsAreAligned();
@@ -49,7 +49,7 @@ public EntityTable_v2(
foreach (var column in et.DataColumns)
DataColumns[column.Name] = column;
- _stringBuffer = stringBuffer;
+ _stringTable = stringTable;
}
private static T GetColumnOrDefault(Dictionary map, string key, T defaultValue = default)
@@ -73,9 +73,9 @@ public string[] GetStringColumnValues(string columnName)
for (var i = 0; i < strings.Length; i++)
{
- strings[i] = _stringBuffer == null || _stringBuffer.Length == 0
+ strings[i] = _stringTable == null || _stringTable.Length == 0
? "" // Guard against the case where the string buffer is null or empty.
- : _stringBuffer.ElementAtOrDefault(stringIndices[i], "");
+ : _stringTable.ElementAtOrDefault(stringIndices[i], "");
}
return strings;
diff --git a/src/cs/vim/Vim.Format.Core/Geometry/MeshOptimization.cs b/src/cs/vim/Vim.Format.Core/Geometry/MeshOptimization.cs
index 6efb92f3..ce94512d 100644
--- a/src/cs/vim/Vim.Format.Core/Geometry/MeshOptimization.cs
+++ b/src/cs/vim/Vim.Format.Core/Geometry/MeshOptimization.cs
@@ -87,58 +87,5 @@ public static Dictionary> GroupMeshesByHash(this IArray> GroupMeshesByHash(this IEnumerable meshes, float tolerance)
=> meshes.AsParallel().GroupBy(m => new MeshHash(m, tolerance)).ToDictionary(grp => grp.Key, grp => grp.ToList());
-
- ///
- /// Merges vertices that are within a certain distance and have similar normals and colors.
- ///
- public static IMesh WeldVertices(this IMesh g, float threshold = (float)Math3d.Constants.MmToFeet)
- {
- var positions = g.Vertices;
- var normals = g.GetOrComputeVertexNormals().ToArray();
- var colors = g.VertexColors ?? Vector4.Zero.Repeat(positions.Count);
-
- // Vertex indices by color, and then by normal
- var d = new Dictionary();
-
- // The mapping of old indices to new ones
- var indexRemap = new int[g.Vertices.Count];
-
- // This is a list of vertex indices that we are keeping
- var vertRemap = new List();
-
- // Local helper function
- Int3 ToInt3(Vector3 v)
- => new Int3((int)v.X, (int)v.Y, (int)v.Z);
-
- for (var i = 0; i < g.NumVertices; ++i)
- {
- var p = ToInt3(positions[i] * (1 / threshold));
- var c = ToInt3(colors[i].ToVector3() * 10000);
- var n = ToInt3(normals[i] * 10000);
-
- var pcn = new IntegerPositionColorNormal(p, c, n);
-
- if (d.TryGetValue(pcn, out var index))
- {
- indexRemap[i] = index;
- continue;
- }
-
- var newVertIndex = vertRemap.Count;
- indexRemap[i] = newVertIndex;
- vertRemap.Add(i);
-
- d.Add(pcn, newVertIndex);
- }
-
- Debug.Assert(vertRemap.Count <= g.NumVertices);
- for (var i = 1; i < vertRemap.Count; ++i)
- Debug.Assert(vertRemap[i - 1] < vertRemap[i]);
-
- return g.RemapVertices(
- vertRemap.ToIArray(),
- g.Indices.Select(i => indexRemap[i]))
- .ToIMesh();
- }
}
}
diff --git a/src/cs/vim/Vim.Format.Core/Serializer.cs b/src/cs/vim/Vim.Format.Core/Serializer.cs
index 06dce92e..28ef14f9 100644
--- a/src/cs/vim/Vim.Format.Core/Serializer.cs
+++ b/src/cs/vim/Vim.Format.Core/Serializer.cs
@@ -57,12 +57,15 @@ public static NamedBuffer ReadEntityTableColumn(
.ToNamedBuffer(name);
}
+ public delegate bool EntityTableColumnFilter(string entityTableName, string columnName);
+
///
/// Returns a SerializableEntityTable based on the given buffer reader.
///
public static SerializableEntityTable ReadEntityTable(
this BFastBufferReader entityTableBufferReader,
- bool schemaOnly)
+ bool schemaOnly,
+ EntityTableColumnFilter entityTableColumnFilter = null)
{
var et = new SerializableEntityTable { Name = entityTableBufferReader.Name };
@@ -71,6 +74,9 @@ public static SerializableEntityTable ReadEntityTable(
var name = colBr.Name;
var typePrefix = name.GetTypePrefix();
+ if (entityTableColumnFilter != null && !entityTableColumnFilter(et.Name, name))
+ continue;
+
switch (typePrefix)
{
case VimConstants.IndexColumnNameTypePrefix:
@@ -121,14 +127,15 @@ public static SerializableEntityTable ReadEntityTable(
public static IEnumerable EnumerateEntityTables(
this BFastBufferReader entitiesBufferReader,
bool schemaOnly,
- Func entityTableNameFilterFunc = null)
+ Func entityTableNameFilterFunc = null,
+ EntityTableColumnFilter entityTableColumnFilter = null)
{
var entityTableBufferReaders = entitiesBufferReader.Seek()
.GetBFastBufferReaders(br => entityTableNameFilterFunc?.Invoke(br.Name) ?? true);
foreach (var entityTableBufferReader in entityTableBufferReaders)
{
- yield return entityTableBufferReader.ReadEntityTable(schemaOnly);
+ yield return entityTableBufferReader.ReadEntityTable(schemaOnly, entityTableColumnFilter);
}
}
@@ -138,7 +145,8 @@ public static IEnumerable EnumerateEntityTables(
public static IEnumerable EnumerateEntityTables(
this FileInfo vimFileInfo,
bool schemaOnly,
- Func entityTableNameFilterFunc = null)
+ Func entityTableNameFilterFunc = null,
+ EntityTableColumnFilter entityTableColumnFilter = null)
{
using (var stream = vimFileInfo.OpenRead())
{
@@ -146,13 +154,49 @@ public static IEnumerable EnumerateEntityTables(
if (entitiesBufferReader == null)
yield break;
- foreach (var entityTable in entitiesBufferReader.EnumerateEntityTables(schemaOnly, entityTableNameFilterFunc))
+ foreach (var entityTable in entitiesBufferReader.EnumerateEntityTables(schemaOnly, entityTableNameFilterFunc, entityTableColumnFilter))
{
yield return entityTable;
}
}
}
+ ///
+ /// Returns the string table contained in the given VIM file.
+ ///
+ public static string[] GetStringTable(this FileInfo vimFileInfo)
+ {
+ using (var stream = vimFileInfo.OpenRead())
+ {
+ var stringTableReader = stream.GetBFastBufferReader(BufferNames.Strings);
+ if (stringTableReader == null)
+ return Array.Empty();
+
+ stringTableReader.Seek();
+
+ var (_, numBytes) = stringTableReader;
+
+ return ReadStrings(stream, numBytes);
+ }
+ }
+
+ ///
+ /// Returns the geometry contained in the given VIM file.
+ ///
+ public static G3D GetGeometry(this FileInfo vimFileInfo)
+ {
+ using (var stream = vimFileInfo.OpenRead())
+ {
+ var geometryReader = stream.GetBFastBufferReader(BufferNames.Geometry);
+ if (geometryReader == null)
+ return G3D.Empty;
+
+ geometryReader.Seek();
+
+ return G3D.Read(stream);
+ }
+ }
+
public static BFastBuilder ToBFastBuilder(this IEnumerable entityTables)
{
var bldr = new BFastBuilder();
diff --git a/src/cs/vim/Vim.Format.Tests/ElementParameterInfoServiceTests.cs b/src/cs/vim/Vim.Format.Tests/ElementParameterInfoServiceTests.cs
new file mode 100644
index 00000000..375de2cb
--- /dev/null
+++ b/src/cs/vim/Vim.Format.Tests/ElementParameterInfoServiceTests.cs
@@ -0,0 +1,60 @@
+using NUnit.Framework;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Vim.Format.ElementParameterInfo;
+using Vim.Format.ObjectModel;
+using Vim.Util.Logging;
+using Vim.Util.Tests;
+
+namespace Vim.Format.Tests;
+
+[TestFixture]
+public static class ElementParameterInfoServiceTests
+{
+ public static IEnumerable TestVimFilePaths => TestFiles.VimFilePaths;
+
+ [TestCaseSource(nameof(TestVimFilePaths))]
+ public static void TestElementParameterInfoService(string vimFilePath)
+ {
+ var fileName = Path.GetFileName(vimFilePath);
+ var ctx = new CallerTestContext(subDirComponents: fileName);
+ var dir = ctx.PrepareDirectory();
+ var logger = ctx.CreateLogger();
+
+ using var _ = logger.LogDuration($"{nameof(TestElementParameterInfoService)}: {vimFilePath}");
+
+ var vimFileInfo = new FileInfo(vimFilePath);
+
+ var stringTable = vimFileInfo.GetStringTable();
+
+ var infos = ElementParameterInfoService.GetElementParameterInfos(vimFileInfo, stringTable);
+ var levelInfos = infos.LevelInfos;
+ var elementLevelInfos = infos.ElementLevelInfos;
+ var elementMeasureInfos = infos.ElementMeasureInfos;
+ var parameterMeasureTypes = infos.ParameterMeasureTypes;
+
+ var validationTableSet = new EntityTableSet(
+ vimFileInfo,
+ stringTable,
+ n => n is TableNames.Level or TableNames.Element or TableNames.FamilyInstance or TableNames.Parameter);
+
+ Assert.AreEqual(validationTableSet.LevelTable.RowCount, levelInfos.Length);
+
+ var elementInstanceCount = validationTableSet.ElementTable.RowCount;
+ Assert.AreEqual(elementInstanceCount, elementLevelInfos.Length);
+ Assert.AreEqual(elementInstanceCount, elementMeasureInfos.Length);
+
+ var parameterCount = validationTableSet.ParameterTable.RowCount;
+ Assert.AreEqual(parameterCount, parameterMeasureTypes.Length);
+
+ var familyInstanceElementMap = validationTableSet.ElementIndexMaps.FamilyInstanceIndexFromElementIndex;
+
+ var knownFamilyInstanceCount = elementLevelInfos.Count(eli => familyInstanceElementMap.ContainsKey(eli.GetElementIndexOrNone()) && eli.PrimaryLevelKind != PrimaryLevelKind.Unknown);
+ var unknownFamilyInstanceCount = elementLevelInfos.Count(eli => familyInstanceElementMap.ContainsKey(eli.GetElementIndexOrNone()) && eli.PrimaryLevelKind == PrimaryLevelKind.Unknown);
+ Assert.GreaterOrEqual(knownFamilyInstanceCount, unknownFamilyInstanceCount);
+
+ if (familyInstanceElementMap.Count > 0)
+ Assert.Greater(knownFamilyInstanceCount, 0);
+ }
+}
diff --git a/src/cs/vim/Vim.Format.Tests/EntityTable_v2_Tests.cs b/src/cs/vim/Vim.Format.Tests/EntityTable_v2_Tests.cs
index 560e5887..307e6272 100644
--- a/src/cs/vim/Vim.Format.Tests/EntityTable_v2_Tests.cs
+++ b/src/cs/vim/Vim.Format.Tests/EntityTable_v2_Tests.cs
@@ -1,4 +1,5 @@
using NUnit.Framework;
+using System;
using System.IO;
using System.Linq;
using Vim.Format.ObjectModel;
@@ -13,7 +14,7 @@ public static class EntityTable_v2_Tests
[Test]
public static void TestEntityTable_v2_Parity()
{
- var vimFilePath = VimFormatRepoPaths.GetLatestWolfordResidenceVim();
+ var vimFilePath = VimFormatRepoPaths.GetDataFilePath("Dwelling*.vim", true);
// Classic deserialization (using VIM Scene)
var vim = VimScene.LoadVim(vimFilePath);
@@ -22,7 +23,7 @@ public static void TestEntityTable_v2_Parity()
// EntityTable_v2 manual construction.
var fileInfo = new FileInfo(vimFilePath);
- var entityTableSet = new EntityTableSet(fileInfo, false, stringBuffer);
+ var entityTableSet = new EntityTableSet(fileInfo, stringBuffer);
var baseElementCount = dm.NumElement;
var nextElementCount = entityTableSet.ElementTable.RowCount;
@@ -56,4 +57,34 @@ public static void TestEntityTable_v2_Parity()
Assert.AreEqual(@base._Room.Index, next._Room.Index);
}
}
+
+ [Test]
+ public static void TestElementTableKinds()
+ {
+ var fileInfo = new FileInfo(VimFormatRepoPaths.GetDataFilePath("Dwelling*.vim", true));
+
+ Console.WriteLine($"Loading {fileInfo.FullName}");
+
+ var elementKinds = EntityTableSet.GetElementKinds(fileInfo);
+
+ var ets = new EntityTableSet(fileInfo);
+
+ Assert.IsNotEmpty(elementKinds);
+ Assert.AreEqual(ets.ElementTable.RowCount, elementKinds.Length);
+
+ var familyInstanceCount = elementKinds.Count(e => e == ElementKind.FamilyInstance);
+ Assert.Greater(familyInstanceCount, 0);
+ Assert.AreEqual(ets.FamilyInstanceTable.Column_ElementIndex.Distinct().Count(ei => ei != EntityRelation.None), familyInstanceCount);
+ Assert.IsTrue(ets.FamilyInstanceTable.Column_ElementIndex.All(ei => ei == EntityRelation.None || elementKinds[ei] == ElementKind.FamilyInstance));
+
+ var familyTypeCount = elementKinds.Count(e => e == ElementKind.FamilyType);
+ Assert.Greater(familyTypeCount, 0);
+ Assert.AreEqual(ets.FamilyTypeTable.Column_ElementIndex.Distinct().Count(ei => ei != EntityRelation.None), familyTypeCount);
+ Assert.IsTrue(ets.FamilyTypeTable.Column_ElementIndex.All(ei => ei == EntityRelation.None || elementKinds[ei] == ElementKind.FamilyType));
+
+ var familyCount = elementKinds.Count(e => e == ElementKind.Family);
+ Assert.Greater(familyCount, 0);
+ Assert.AreEqual(ets.FamilyTable.Column_ElementIndex.Distinct().Count(ei => ei != EntityRelation.None), familyCount);
+ Assert.IsTrue(ets.FamilyTable.Column_ElementIndex.All(ei => ei == EntityRelation.None || elementKinds[ei] == ElementKind.Family));
+ }
}
diff --git a/src/cs/vim/Vim.Format.Tests/ReferenceAppTests.cs b/src/cs/vim/Vim.Format.Tests/ReferenceAppTests.cs
index 205cd978..87d0b017 100644
--- a/src/cs/vim/Vim.Format.Tests/ReferenceAppTests.cs
+++ b/src/cs/vim/Vim.Format.Tests/ReferenceAppTests.cs
@@ -13,7 +13,7 @@ public static class ReferenceAppTests
[Test]
public static void Validate()
{
- var vim = VimFormatRepoPaths.GetLatestWolfordResidenceVim();
+ var vim = VimFormatRepoPaths.GetDataFilePath("Wolford_Residence*.vim", true);
Console.WriteLine("Welcome to the VIM Reference application");
Console.WriteLine("This application demonstrates how to parse a VIM file");
diff --git a/src/cs/vim/Vim.Format.Tests/TestFiles.cs b/src/cs/vim/Vim.Format.Tests/TestFiles.cs
new file mode 100644
index 00000000..efc6f447
--- /dev/null
+++ b/src/cs/vim/Vim.Format.Tests/TestFiles.cs
@@ -0,0 +1,14 @@
+using System.IO;
+using Vim.Util.Tests;
+
+namespace Vim.Format.Tests;
+
+public static class TestFiles
+{
+ public static string[] VimFilePaths;
+
+ static TestFiles()
+ {
+ VimFilePaths = Directory.GetFiles(VimFormatRepoPaths.DataDir, "*.vim", SearchOption.AllDirectories);
+ }
+}
diff --git a/src/cs/vim/Vim.Format.Tests/TransformServiceTests.cs b/src/cs/vim/Vim.Format.Tests/TransformServiceTests.cs
index 9a8e4b29..0244708e 100644
--- a/src/cs/vim/Vim.Format.Tests/TransformServiceTests.cs
+++ b/src/cs/vim/Vim.Format.Tests/TransformServiceTests.cs
@@ -150,7 +150,7 @@ public static void TestMergeDedupAndFilter()
var ctx = new CallerTestContext();
var dir = ctx.PrepareDirectory();
- var vimFilePath = Path.Combine(VimFormatRepoPaths.DataDir, "Dwelling.r2019.om_v5.5.0.vim");
+ var vimFilePath = VimFormatRepoPaths.GetDataFilePath("Dwelling*.vim", true);
// Setup: Merge two identical VIM files as a grid.
var vim1 = VimScene.LoadVim(vimFilePath);
diff --git a/src/cs/vim/Vim.Format/ElementParameterInfo/ElementLevelInfo.cs b/src/cs/vim/Vim.Format/ElementParameterInfo/ElementLevelInfo.cs
new file mode 100644
index 00000000..c894503b
--- /dev/null
+++ b/src/cs/vim/Vim.Format/ElementParameterInfo/ElementLevelInfo.cs
@@ -0,0 +1,509 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Vim.Format.ObjectModel;
+using Vim.Math3d;
+using Vim.Util;
+
+// ReSharper disable InconsistentNaming
+
+// SOME BACKGROUND INFORMATION ABOUT REVIT LEVELS AND ELEMENTS
+//
+// by: Martin Ashton, July 29, 2025
+//
+// Elements in Revit are not always directly associated to a level via their Element.Level property.
+// In some cases, the element's level must be calculated or inferred. Here is the ordering of calculated level:
+//
+// 1. "Schedule Level"
+// - Corresponds to the schedule level parameter on an element which specifically defines its level.
+// - Not always present; the parameter must be explicitly assigned.
+//
+// 2. "Level"
+// - Corresponds to the Element.Level property.
+// - Not always present; if element (A) is hosted on another element (B),
+// then (A) will have an empty Element.Level property.
+//
+// 3. "Host Level":
+// - Corresponds to the host level parameter on an element. This parameter may point to either
+// a Level element or another element. In the later case, we infer that the host level is
+// the level of the host element.
+// - Not always present; the element must be hosted on either a level or another element.
+//
+// 4. "Reference Level"
+// - Corresponds to the reference level parameter on an element.
+// - Not always present; the element must be associated with a reference level.
+//
+// 5. "Base Level"
+// - Corresponds to the base level constraint parameter on an element.
+// - Not always present; the element must be constrained.
+//
+// We refer to the "Primary" level as the first non-null level association among the ones listed above.
+
+namespace Vim.Format.ElementParameterInfo
+{
+ public enum PrimaryLevelKind
+ {
+ Unknown = 0,
+ ScheduleLevel = 1,
+ Level = 2,
+ HostLevel = 3,
+ ReferenceLevel = 4,
+ BaseLevel = 5,
+ }
+
+ public enum BuildingStoryGeometryContainment
+ {
+ // Definitions:
+ // min & max: element geometry bounding box min.z and max.z
+ // lvlLow = LevelBuildingStoryCurrentOrBelow.z
+ // lvlHi = LevelBuildingStoryAbove.z
+ Unknown = 0, // lvlLow and lvlHi are unknown
+ CompletelyBelow = 1, // min < max < lvlLow < lvlHi
+ CrossingBelow = 2, // min < lvlLow < max < lvlHi
+ Contained = 3, // lvlLow < min < max < lvlHi
+ CrossingAbove = 4, // lvlLow < min < lvlHi < max
+ CompletelyAbove = 5, // lvlLow < lvlHi < min < max
+ SpanningBelowAndAbove = 6, // min < lvlLow < lvlHi < max
+ }
+
+ public class ElementLevelInfo : IElementIndex
+ {
+ ///
+ /// The element.
+ ///
+ public Element Element { get; }
+
+ ///
+ /// Returns the element index.
+ ///
+ public int GetElementIndexOrNone()
+ => Element.IndexOrDefault();
+
+ ///
+ /// The schedule level associated to the element parameters. Can be null.
+ ///
+ public LevelInfo ScheduleLevelInfo { get; }
+ //public const string TypeId_ScheduleLevel = "autodesk.revit.parameter:instanceScheduleOnlyLevelParam";
+ public const string BuiltInId_ScheduleLevel = "-1001365";
+ public static readonly HashSet ScheduleLevelBuiltInIds = new HashSet { BuiltInId_ScheduleLevel };
+
+ ///
+ /// The level associated with the element. Can be null.
+ ///
+ public LevelInfo LevelInfo { get; }
+
+ ///
+ /// The level of the host element (or the level element) if the element is hosted. Can be null.
+ ///
+ public LevelInfo HostLevelInfo { get; }
+
+ ///
+ /// The level of the reference of the element. Can be null.
+ ///
+ public LevelInfo ReferenceLevelInfo { get; }
+
+ // NOTE: the values are correlated to the parameters named "Reference Level" in the BuiltInParameter enumerations https://www.revitapidocs.com/2025/fb011c91-be7e-f737-28c7-3f1e1917a0e0.htm
+ public static readonly HashSet ReferenceLevelBuiltInIds = new HashSet
+ {
+ "-1001383", // InstanceReferenceLevel,
+ "-1001651", // RoofConstraintLevel,
+ "-1001715", // FaceRoofLevel,
+ "-1114000", // RbsStartLevel,
+ "-1114817", // SpaceReferenceLevel,
+ "-1133500", // GroupLevel,
+ "-1140709", // TrussLevel
+ "-1140916", // FabricationLevel,
+ "-1154630", // MultiStoryStairLevel
+ };
+
+ ///
+ /// The base level of the element if it is constrained. Can be null.
+ ///
+ public LevelInfo BaseLevelInfo { get; }
+
+ // NOTE: the values are correlated to the parameters named "Base Level" in the BuiltInParameter enumerations https://www.revitapidocs.com/2025/fb011c91-be7e-f737-28c7-3f1e1917a0e0.htm
+ public static readonly HashSet BaseLevelBuiltInIds = new HashSet
+ {
+ "-1001708", // RoofBaseLevel,
+ "-1002063", // ScheduleBaseLevel,
+ "-1007200", // StairsBaseLevelParam,
+ "-1151101", // StairsBaseLevel,
+ "-1008620", // StairsRailingBaseLevel,
+ "-1152335", // DpartBaseLevel,
+ "-1152336", // DpartBaseLevelByOriginal
+ };
+
+ ///
+ /// The primary level associated with the element. Can be null.
+ ///
+ public LevelInfo PrimaryLevelInfo
+ {
+ get
+ {
+ if (ScheduleLevelInfo != null)
+ return ScheduleLevelInfo;
+
+ if (LevelInfo != null)
+ return LevelInfo;
+
+ if (HostLevelInfo != null)
+ return HostLevelInfo;
+
+ if (ReferenceLevelInfo != null)
+ return ReferenceLevelInfo;
+
+ if (BaseLevelInfo != null)
+ return BaseLevelInfo;
+
+ return null;
+ }
+ }
+
+ ///
+ /// The primary level kind associated with the element.
+ ///
+ public PrimaryLevelKind PrimaryLevelKind
+ {
+ get
+ {
+ if (ScheduleLevelInfo != null)
+ return PrimaryLevelKind.ScheduleLevel;
+
+ if (LevelInfo != null)
+ return PrimaryLevelKind.Level;
+
+ if (HostLevelInfo != null)
+ return PrimaryLevelKind.HostLevel;
+
+ if (ReferenceLevelInfo != null)
+ return PrimaryLevelKind.ReferenceLevel;
+
+ if (BaseLevelInfo != null)
+ return PrimaryLevelKind.BaseLevel;
+
+ return PrimaryLevelKind.Unknown;
+ }
+ }
+
+ ///
+ /// The building story above the primary level.
+ /// Null if the primary level is null.
+ ///
+ public LevelInfo BuildingStoryAbovePrimaryLevelInfo { get; }
+
+ ///
+ /// The building story below the primary level if the primary level is not a building story, or the primary level if it is a building story.
+ /// Null if the primary level is null.
+ ///
+ public LevelInfo BuildingStoryCurrentOrBelowPrimaryLevelInfo { get; }
+
+ ///
+ /// The containment type of the element's geometry relative to the BuildingStoryAbove and the BuildingStoryCurrentOrBelow.
+ ///
+ public BuildingStoryGeometryContainment BuildingStoryGeometryContainment { get; }
+
+ ///
+ /// The building story immediately below the element's geometry minimum z coordinate. Can be null.
+ ///
+ public LevelInfo BuildingStoryGeometryMinLevelInfo { get; }
+
+ ///
+ /// The building story immediately below the element's geometry maximum z coordinate. Can be null.
+ ///
+ public LevelInfo BuildingStoryGeometryMaxLevelInfo { get; }
+
+ ///
+ /// Constructor
+ ///
+ public ElementLevelInfo(
+ Element element,
+ ElementTable elementTable,
+ FamilyInstanceTable familyInstanceTable,
+ LevelTable levelTable,
+ ParameterTable parameterTable,
+ ElementIndexMaps elementIndexMaps,
+ ElementGeometryMap elementGeometryMap,
+ IReadOnlyDictionary levelInfoMap,
+ IReadOnlyList orderedLevelInfosByProjectElevation,
+ IReadOnlyDictionary elementIdToLevelInfoMap)
+ {
+ Element = element;
+
+ var elementIndex = GetElementIndexOrNone();
+
+ // The level index of the element
+ if (elementIndex != EntityRelation.None)
+ {
+ var elementLevelIndex = elementTable.GetLevelIndex(elementIndex);
+ if (elementLevelIndex != EntityRelation.None &&
+ levelInfoMap.TryGetValue(elementLevelIndex, out var levelInfo))
+ {
+ LevelInfo = levelInfo;
+ }
+ }
+
+ if (TryGetHostLevel(element, elementTable, familyInstanceTable, levelTable, elementIndexMaps, elementIdToLevelInfoMap, out var hostLevelInfo))
+ HostLevelInfo = hostLevelInfo;
+
+ var elementParameterIndices = elementIndexMaps.GetParameterIndicesFromElementIndex(elementIndex);
+ foreach (var parameterIndex in elementParameterIndices)
+ {
+ var p = parameterTable.Get(parameterIndex);
+ var (nativeValue, _) = p.Values;
+ var d = p.ParameterDescriptor;
+
+ // NOTE: Guid is either the built-in ID (if the parameter is built-in), or a guid (if the parameter is shared).
+ var paramNameLowerInvariant = d.Name.ToLowerInvariant();
+ var builtInId = d.Guid;
+
+ if (ScheduleLevelInfo == null &&
+ TryGetLevelInfoFromParameter(nativeValue, builtInId, paramNameLowerInvariant, "schedule level", ScheduleLevelBuiltInIds, elementIdToLevelInfoMap, out var scheduleLevelInfo))
+ {
+ ScheduleLevelInfo = scheduleLevelInfo;
+ }
+ else if (
+ ReferenceLevelInfo == null &&
+ TryGetLevelInfoFromParameter(nativeValue, builtInId, paramNameLowerInvariant, "reference level", ReferenceLevelBuiltInIds, elementIdToLevelInfoMap, out var referenceLevelInfo))
+ {
+ ReferenceLevelInfo = referenceLevelInfo;
+ }
+ else if (
+ BaseLevelInfo == null &&
+ TryGetLevelInfoFromParameter(nativeValue, builtInId, paramNameLowerInvariant, "base level", BaseLevelBuiltInIds, elementIdToLevelInfoMap, out var baseLevelInfo))
+ {
+ BaseLevelInfo = baseLevelInfo;
+ }
+ }
+
+ BuildingStoryGeometryContainment = GetBuildingStoryGeometryContainment(
+ elementIndex,
+ PrimaryLevelInfo?.Level?.ProjectElevation,
+ orderedLevelInfosByProjectElevation,
+ elementGeometryMap,
+ out var maybeBuildingStoryAbove,
+ out var maybeBuildingStoryCurrentOrBelow,
+ out var maybeBuildingStoryGeometryMin,
+ out var maybeBuildingStoryGeometryMax);
+
+ BuildingStoryAbovePrimaryLevelInfo = maybeBuildingStoryAbove;
+ BuildingStoryCurrentOrBelowPrimaryLevelInfo = maybeBuildingStoryCurrentOrBelow;
+ BuildingStoryGeometryMinLevelInfo = maybeBuildingStoryGeometryMin;
+ BuildingStoryGeometryMaxLevelInfo = maybeBuildingStoryGeometryMax;
+ }
+
+ ///
+ /// Returns the host level of the element.
+ ///
+ private static bool TryGetHostLevel(
+ Element element,
+ ElementTable elementTable,
+ FamilyInstanceTable familyInstanceTable,
+ LevelTable levelTable,
+ ElementIndexMaps elementIndexMaps,
+ IReadOnlyDictionary elementIdToLevelInfoMap,
+ out LevelInfo hostLevelInfo)
+ {
+ hostLevelInfo = null;
+
+ if (!elementIndexMaps.FamilyInstanceIndexFromElementIndex.TryGetValue(element.Index, out var familyInstanceIndex))
+ return false;
+
+ var hostElementIndex = familyInstanceTable.GetHostIndex(familyInstanceIndex);
+ if (hostElementIndex == EntityRelation.None)
+ return false;
+
+ var hostElementId = elementTable.GetId(hostElementIndex);
+
+ // If the host element is a level, use it.
+ if (elementIdToLevelInfoMap.TryGetEntityFromElementId(hostElementId, out hostLevelInfo))
+ return true;
+
+ // If the host element is just a regular instance, then return the host element's level.
+ var hostElementLevelIndex = elementTable.GetLevelIndex(hostElementIndex);
+ if (hostElementLevelIndex == EntityRelation.None)
+ return false;
+
+ var hostElementLevelElementIndex = levelTable.GetElementIndex(hostElementLevelIndex);
+ if (hostElementLevelElementIndex == EntityRelation.None)
+ return false;
+
+ var hostElementLevelElementId = elementTable.GetId(hostElementLevelElementIndex);
+
+ return elementIdToLevelInfoMap.TryGetEntityFromElementId(hostElementLevelElementId, out hostLevelInfo);
+ }
+
+ ///
+ /// Returns a level info based on the given built-in parameter id set, if present.
+ ///
+ private static bool TryGetLevelInfoFromParameter(
+ string nativeValue,
+ string builtInId,
+ string paramNameLowerInvariant,
+ string expectedParamNameLowerInvariant,
+ HashSet builtInIds,
+ IReadOnlyDictionary elementIdToLevelInfoMap,
+ out LevelInfo levelInfo)
+ {
+ levelInfo = null;
+
+ if (paramNameLowerInvariant.Equals(expectedParamNameLowerInvariant) || builtInIds.Contains(builtInId))
+ {
+ return Parameter.TryParseNativeValueAsElementId(nativeValue, out var levelElementId) &&
+ elementIdToLevelInfoMap.TryGetEntityFromElementId(levelElementId, out levelInfo);
+ }
+
+ return false;
+ }
+
+ ///
+ /// Returns the building story info and calculates the geometry
+ ///
+ private static BuildingStoryGeometryContainment GetBuildingStoryGeometryContainment(
+ int elementIndex,
+ double? primaryProjectElevation,
+ IReadOnlyList orderedLevelInfosByProjectElevation,
+ ElementGeometryMap elementGeometryMap,
+ out LevelInfo maybeBuildingStoryAbove,
+ out LevelInfo maybeBuildingStoryCurrentOrBelow,
+ out LevelInfo maybeBuildingStoryGeometryMin,
+ out LevelInfo maybeBuildingStoryGeometryMax)
+ {
+ maybeBuildingStoryAbove = null;
+ maybeBuildingStoryCurrentOrBelow = null;
+ maybeBuildingStoryGeometryMin = null;
+ maybeBuildingStoryGeometryMax = null;
+
+ if (primaryProjectElevation == null)
+ return BuildingStoryGeometryContainment.Unknown;
+
+ // Note: Level.ProjectElevation is relative to the internal scene origin (0,0,0), and so is the vim scene's geometry.
+ var elementGeometryInfo = elementGeometryMap.ElementAtOrDefault(elementIndex);
+ var hasGeometry = elementGeometryInfo?.HasGeometry ?? false;
+ var bb = hasGeometry ? elementGeometryInfo.WorldSpaceBoundingBox : AABox.Empty;
+ var bbIsValid = hasGeometry && bb.IsValid;
+ var bbMin = bb.Min.Z;
+ var bbMax = bb.Max.Z;
+
+ // Iterate over all the levels to compare project elevations.
+ foreach (var levelInfo in orderedLevelInfosByProjectElevation)
+ {
+ var levelProjectElevation = levelInfo.Level.ProjectElevation;
+
+ if (!levelInfo.IsBuildingStory)
+ continue;
+
+ if (levelProjectElevation <= primaryProjectElevation)
+ {
+ // Find the building story below or at the primary level.
+ maybeBuildingStoryCurrentOrBelow = levelInfo;
+ }
+
+ if (maybeBuildingStoryAbove == null && levelProjectElevation > primaryProjectElevation)
+ {
+ // Find the first building story above the primary level.
+ maybeBuildingStoryAbove = levelInfo;
+ }
+
+ if (bbIsValid && bbMin >= levelProjectElevation)
+ {
+ // Find the building story below or at the geometric minimum.
+ maybeBuildingStoryGeometryMin = levelInfo;
+ }
+
+ if (bbIsValid && bbMax >= levelProjectElevation)
+ {
+ // Find the first building story below or at the geometric maximum.
+ maybeBuildingStoryGeometryMax = levelInfo;
+ }
+ }
+
+ var maybeLvlLow = maybeBuildingStoryCurrentOrBelow?.Level.ProjectElevation;
+ var maybeLvlHi = maybeBuildingStoryAbove?.Level.ProjectElevation;
+
+ // Case 1: both are null, so unknown containment.
+ if (maybeLvlLow == null && maybeLvlHi == null)
+ return BuildingStoryGeometryContainment.Unknown;
+
+ // Case 2:
+ //
+ // v CrossingAbove
+ //
+ // v CompletelyAbove
+ //
+ // _ _
+ // | | | |
+ // _ | | | |
+ // | | |_| | |
+ // --------------------------_----| |----------_----| |--- lvlHi
+ // | | |_| | | | |
+ // _ | | | | | |
+ // | | |_| | | | |
+ // _ | | | | | |
+ // | | |_| |_| | |
+ // --------_----| |---------------------------------| |--- lvlLow
+ // | | |_| | |
+ // | | | |
+ // |_| |_|
+ //
+ // ^____^_____Contained___^
+ //
+ // ^ CrossingBelow ^ SpanningBelowAndAbove
+ //
+ // ^ CompletelyBelow
+ //
+ // bbMin_LessThan_LvlLow
+ // bbMin_LessThanOrEqualTo_LvlLow
+ // bbMin_GreaterThanOrEqualTo_LvlLow
+ // bbMin_GreaterThan_LvlLow
+ // bbMin_LessThan_LvlHi
+ // bbMin_LessThanOrEqualTo_LvlHi
+ // bbMin_GreaterThanOrEqualTo_LvlHi
+ // bbMin_GreaterThan_LvlHi
+ //
+ // bbMax_LessThan_LvlLow
+ // bbMax_LessThanOrEqualTo_LvlLow
+ // bbMax_GreaterThanOrEqualTo_LvlLow
+ // bbMax_GreaterThan_LvlLow
+ // bbMax_LessThan_LvlHi
+ // bbMax_LessThanOrEqualTo_LvlHi
+ // bbMax_GreaterThanOrEqualTo_LvlHi
+ // bbMax_GreaterThan_LvlHi
+ //
+ // CompletelyBelow: bbMin_LessThan_LvlLow && bbMax_LessThan_LvlLow
+ // CrossingBelow: bbMin_LessThan_LvlLow && bbMax_GreaterThanOrEqualTo_lvlLow && bbMax_LessThanOrEqualTo_LvlHi
+ // Contained: bbMin_GreaterThanOrEqualTo_LvlLow && bbMax_LessThanOrEqualTo_LvlHi
+ // CrossingAbove: bbMin_GreaterThanOrEqualTo_LvlLow && bbMin_LessThanOrEqualTo_LvlHi && bbMax_GreaterThan_LvlHi
+ // CompletelyAbove: bbMin_GreaterThan_LvlHi && bbMax_GreaterThan_LvlHi
+ // SpanningBelowAndAbove: bbMin_LessThan_LvlLow && bbMax_GreaterThan_LvlHi
+
+ // Assume min/max values if one of the levels is null.
+ var lvlLow = maybeLvlLow ?? double.MinValue;
+ var lvlHi = maybeLvlHi ?? double.MaxValue;
+
+ if (bbMin < lvlLow && bbMax < lvlLow)
+ return BuildingStoryGeometryContainment.CompletelyBelow;
+
+ if (bbMin < lvlLow && bbMax >= lvlLow && bbMax <= lvlHi)
+ return BuildingStoryGeometryContainment.CrossingBelow;
+
+ if (bbMin >= lvlLow && bbMax <= lvlHi)
+ return BuildingStoryGeometryContainment.Contained;
+
+ if (bbMin >= lvlLow && bbMin <= lvlHi && bbMax > lvlHi)
+ return BuildingStoryGeometryContainment.CrossingAbove;
+
+ if (bbMin > lvlHi && bbMax > lvlHi)
+ return BuildingStoryGeometryContainment.CompletelyAbove;
+
+ if (bbMin < lvlLow && bbMax > lvlHi)
+ return BuildingStoryGeometryContainment.SpanningBelowAndAbove;
+
+ Debug.Fail($"Unexpected geometry containment case. bbMin: {bbMin}, bbMax: {bbMax}, lvlLow: {lvlLow}, lvlHi: {lvlHi}");
+
+ return BuildingStoryGeometryContainment.Unknown;
+ }
+
+ public string PropertiesToString()
+ => string.Join(Environment.NewLine, this.PropertiesToStrings());
+ }
+}
diff --git a/src/cs/vim/Vim.Format/ElementParameterInfo/ElementMeasureInfo.cs b/src/cs/vim/Vim.Format/ElementParameterInfo/ElementMeasureInfo.cs
new file mode 100644
index 00000000..851d64bc
--- /dev/null
+++ b/src/cs/vim/Vim.Format/ElementParameterInfo/ElementMeasureInfo.cs
@@ -0,0 +1,153 @@
+using Vim.Format.ObjectModel;
+using Vim.Util;
+
+namespace Vim.Format.ElementParameterInfo
+{
+ ///
+ /// Convenience class which extracts angle/slope/length/width/height/area/volume from the Element's parameters.
+ ///
+ public class ElementMeasureInfo : IElementIndex
+ {
+ ///
+ /// The element.
+ ///
+ public Element Element { get; }
+
+ ///
+ /// Returns the element index.
+ ///
+ public int GetElementIndexOrNone()
+ => Element.IndexOrDefault();
+
+ public double? Angle { get; }
+
+ public double? Slope { get; }
+
+ public double? Length { get; }
+
+ public double? Width { get; }
+
+ public double? Height { get; }
+
+ public double? Area { get; }
+
+ public double? Volume { get; }
+
+ ///
+ /// Constructor
+ ///
+ public ElementMeasureInfo(
+ Element element,
+ ParameterTable parameterTable,
+ MeasureType[] parameterMeasureInfos,
+ ElementIndexMaps elementIndexMaps)
+ {
+ Element = element;
+
+ var elementIndex = GetElementIndexOrNone();
+
+ var elementParameterIndices = elementIndexMaps.GetParameterIndicesFromElementIndex(elementIndex);
+
+ foreach (var parameterIndex in elementParameterIndices)
+ {
+ var mt = parameterMeasureInfos[parameterIndex];
+
+ var (nativeValue, _) = Parameter.SplitValues(parameterTable.Column_Value[parameterIndex]);
+ var parsed = Parameter.ParseNativeValueAsDouble(nativeValue);
+
+ switch (mt)
+ {
+ case MeasureType.Angle:
+ Angle = parsed;
+ break;
+ case MeasureType.Slope:
+ Slope = parsed;
+ break;
+ case MeasureType.Length:
+ Length = parsed;
+ break;
+ case MeasureType.Width:
+ Width = parsed;
+ break;
+ case MeasureType.Height:
+ Height = parsed;
+ break;
+ case MeasureType.Area:
+ Area = parsed;
+ break;
+ case MeasureType.Volume:
+ Volume = parsed;
+ break;
+ case MeasureType.Unknown:
+ default:
+ break; // not recognized
+ }
+ }
+ }
+ }
+
+ ///
+ /// A wrapper around an ElementMeasureInfo which interprets the values as though they were coming from Revit and provides the values in feet and meters.
+ ///
+ public class RevitElementMeasureInfo
+ {
+ public ElementMeasureInfo ElementMeasureInfo { get; }
+
+ ///
+ /// Constructor
+ ///
+ public RevitElementMeasureInfo(ElementMeasureInfo elementMeasureInfo)
+ {
+ ElementMeasureInfo = elementMeasureInfo;
+ }
+
+ // When reading from Revit, angle parameters are always stored in radians.
+ public double? AngleInRadians
+ => ElementMeasureInfo.Angle;
+
+ public double? AngleInDegrees
+ => Units.RadiansToDegrees(AngleInRadians);
+
+ // When reading from Revit, slope parameters are always stored in radians
+ public double? SlopeInRadians
+ => ElementMeasureInfo.Slope;
+
+ public double? SlopeInDegrees
+ => Units.RadiansToDegrees(SlopeInRadians);
+
+ // When reading from Revit, length parameters are always stored in feet.
+ public double? LengthInFeet
+ => ElementMeasureInfo.Length;
+
+ public double? LengthInMeters
+ => Units.FeetToMeters(LengthInFeet);
+
+ // When reading from Revit, width parameters are always stored in feet.
+ public double? WidthInFeet
+ => ElementMeasureInfo.Width;
+
+ public double? WidthInMeters
+ => Units.FeetToMeters(WidthInFeet);
+
+ // When reading from Revit, height parameters are always stored in feet.
+ public double? HeightInFeet
+ => ElementMeasureInfo.Height;
+
+ public double? HeightInMeters
+ => Units.FeetToMeters(HeightInFeet);
+
+ // When reading from Revit, area parameters are always stored in square feet.
+ public double? AreaInSquareFeet
+ => ElementMeasureInfo.Area;
+
+ public double? AreaInSquareMeters
+ => Units.SquareFeetToSquareMeters(AreaInSquareFeet);
+
+ // When reading from Revit, volume parameters are always stored in cubic feet.
+ public double? VolumeInCubicFeet
+ => ElementMeasureInfo.Volume;
+
+ public double? VolumeInCubicMeters
+ => Units.CubicFeetToCubicMeters(VolumeInCubicFeet);
+ }
+}
diff --git a/src/cs/vim/Vim.Format/ElementParameterInfo/ElementParameterInfoService.cs b/src/cs/vim/Vim.Format/ElementParameterInfo/ElementParameterInfoService.cs
new file mode 100644
index 00000000..cc01cd1e
--- /dev/null
+++ b/src/cs/vim/Vim.Format/ElementParameterInfo/ElementParameterInfoService.cs
@@ -0,0 +1,219 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Vim.Format.ObjectModel;
+using Vim.Util;
+
+namespace Vim.Format.ElementParameterInfo
+{
+ public static class ElementParameterInfoService
+ {
+ public struct ElementParameterInfo
+ {
+ public LevelInfo[] LevelInfos;
+ public ElementLevelInfo[] ElementLevelInfos;
+ public ElementMeasureInfo[] ElementMeasureInfos;
+ public MeasureType[] ParameterMeasureTypes;
+ }
+
+ ///
+ /// Returns:
+ /// - an array of LevelInfo objects representing harmonized information about the levels in the given VIM Scene (see comment in LevelInfo.cs)
+ /// - an array of ElementLevelInfo objects representing detailed information of element level associations.
+ /// - an array of ElementMeasureInfo objects representing information about element measures (angle/slope, length, width, height, area, volume)
+ /// - an array of ParameterQuantityInfo objects representing information about parameters and their MeasureType.
+ ///
+ public static ElementParameterInfo GetElementParameterInfos(
+ FileInfo vimFileInfo,
+ string[] stringTable = null,
+ ElementGeometryMap elementGeometryMap = null)
+ {
+ elementGeometryMap = elementGeometryMap ?? new ElementGeometryMap(vimFileInfo);
+
+ var tableSet = new EntityTableSet(
+ vimFileInfo,
+ stringTable,
+ n =>
+ n is TableNames.Element ||
+ n is TableNames.FamilyInstance ||
+ n is TableNames.FamilyType ||
+ n is TableNames.Parameter ||
+ n is TableNames.ParameterDescriptor ||
+ n is TableNames.DisplayUnit ||
+ n is TableNames.Level ||
+ n is TableNames.BasePoint);
+
+ var elementIndexMaps = tableSet.ElementIndexMaps;
+ var elementTable = tableSet.ElementTable;
+ var parameterTable = tableSet.ParameterTable;
+ var descriptorTable = tableSet.ParameterDescriptorTable;
+ var familyInstanceTable = tableSet.FamilyInstanceTable;
+ var familyTypeTable = tableSet.FamilyTypeTable;
+ var basePointTable = tableSet.BasePointTable;
+ var levelTable = tableSet.LevelTable;
+
+ var levels = levelTable.ToArray();
+ var levelsByBimDocumentIndexAndElementId = levels.GroupByBimDocumentIndexAndElementId(elementTable);
+ var basePointsByBimDocumentIndexAndElementId = basePointTable.GroupByBimDocumentIndexAndElementId(elementTable);
+
+ var levelInfos = CreateLevelInfos(
+ levels,
+ elementTable,
+ familyTypeTable,
+ parameterTable,
+ elementIndexMaps,
+ levelsByBimDocumentIndexAndElementId,
+ basePointsByBimDocumentIndexAndElementId);
+
+ var levelInfoByBimDocumentIndex = levelInfos.GroupByBimDocumentIndexAndElementId(elementTable);
+
+ var levelInfoMap = levelInfos.ToDictionaryIgnoreDuplicates(li => li.Level.Index, li => li);
+
+ PatchBuildingStoryAbove(levelInfoByBimDocumentIndex);
+
+ var elementLevelInfos = CreateElementLevelInfos(
+ elementTable,
+ familyInstanceTable,
+ parameterTable,
+ levelTable,
+ elementIndexMaps,
+ elementGeometryMap,
+ levelInfoMap,
+ levelInfoByBimDocumentIndex);
+
+ var parameterMeasureTypes = CreateParameterMeasureTypes(parameterTable, descriptorTable);
+
+ var elementMeasureInfos = CreateElementMeasureInfos(elementTable, parameterTable, parameterMeasureTypes, elementIndexMaps);
+
+ return new ElementParameterInfo
+ {
+ LevelInfos = levelInfos,
+ ElementLevelInfos = elementLevelInfos,
+ ElementMeasureInfos = elementMeasureInfos,
+ ParameterMeasureTypes = parameterMeasureTypes
+ };
+ }
+
+ ///
+ /// Instantiates the level infos in parallel based on the given list of levels.
+ ///
+ private static LevelInfo[] CreateLevelInfos(
+ IReadOnlyList levels,
+ ElementTable elementTable,
+ FamilyTypeTable familyTypeTable,
+ ParameterTable parameterTable,
+ ElementIndexMaps elementIndexMaps,
+ IReadOnlyDictionary> levelsByBimDocumentIndexAndElementId,
+ IReadOnlyDictionary> basePointsByBimDocumentIndexAndElementId)
+ => levels
+ .AsParallel()
+ .Select(level =>
+ {
+ var bimDocumentIndex = elementTable.GetBimDocumentIndex(level.GetElementIndexOrNone());
+
+ if (!levelsByBimDocumentIndexAndElementId.TryGetValue(bimDocumentIndex, out var elementIdToLevelMap))
+ elementIdToLevelMap = new Dictionary();
+
+ if (!basePointsByBimDocumentIndexAndElementId.TryGetValue(bimDocumentIndex, out var elementIdToBasePointMap))
+ elementIdToBasePointMap = new Dictionary();
+
+ return new LevelInfo(
+ level,
+ familyTypeTable,
+ parameterTable,
+ elementIndexMaps,
+ elementIdToLevelMap,
+ elementIdToBasePointMap);
+ })
+ .ToArray();
+
+ ///
+ /// Populates the LevelInfo.BuildingStoryAbove property if it is null.
+ ///
+ private static void PatchBuildingStoryAbove(IReadOnlyDictionary> levelInfoByBimDocumentIndex)
+ {
+ foreach (var (_, levelInfosInBimDocument) in levelInfoByBimDocumentIndex)
+ {
+ var levelInfosOrderedByProjectElevation = levelInfosInBimDocument.Values.OrderBy(l => l.Level.ProjectElevation).ToArray();
+
+ foreach (var levelInfo in levelInfosOrderedByProjectElevation)
+ {
+ if (levelInfo.HasBuildingStoryAbove)
+ continue;
+
+ levelInfo.BuildingStoryAbove = levelInfosOrderedByProjectElevation
+ .FirstOrDefault(other => other.IsBuildingStory && other.Level.ProjectElevation > levelInfo.Level.ProjectElevation)
+ ?.Level;
+ }
+ }
+ }
+
+ ///
+ /// Returns an array of element level infos based on the given list of elements.
+ ///
+ private static ElementLevelInfo[] CreateElementLevelInfos(
+ ElementTable elementTable,
+ FamilyInstanceTable familyInstanceTable,
+ ParameterTable parameterTable,
+ LevelTable levelTable,
+ ElementIndexMaps elementIndexMaps,
+ ElementGeometryMap elementGeometryMap,
+ IReadOnlyDictionary levelInfoMap,
+ IReadOnlyDictionary> levelInfoByBimDocumentIndex)
+ {
+ var levelInfoByBimDocumentIndexOrdered = levelInfoByBimDocumentIndex.ToDictionary(
+ kv => kv.Key,
+ kv => kv.Value.Values.OrderBy(li => li.Level.ProjectElevation).ToArray());
+
+ return elementTable
+ .AsParallel()
+ .Select(e =>
+ {
+ var bimDocumentIndex = elementTable.GetBimDocumentIndex(e.Index);
+
+ if (!levelInfoByBimDocumentIndexOrdered.TryGetValue(bimDocumentIndex, out var orderedLevelInfosByProjectElevation))
+ orderedLevelInfosByProjectElevation = Array.Empty();
+
+ if (!levelInfoByBimDocumentIndex.TryGetValue(bimDocumentIndex, out var elementIdToLevelInfoMap))
+ elementIdToLevelInfoMap = new Dictionary();
+
+ return new ElementLevelInfo(
+ e,
+ elementTable,
+ familyInstanceTable,
+ levelTable,
+ parameterTable,
+ elementIndexMaps,
+ elementGeometryMap,
+ levelInfoMap,
+ orderedLevelInfosByProjectElevation,
+ elementIdToLevelInfoMap);
+ })
+ .ToArray();
+ }
+
+ public static MeasureType[] CreateParameterMeasureTypes(
+ ParameterTable parameterTable,
+ ParameterDescriptorTable parameterDescriptorTable)
+ => parameterTable.Column_ParameterDescriptorIndex
+ .AsParallel()
+ .Select(pdi =>
+ {
+ var parameterDescriptorNameLowerInvariant = parameterDescriptorTable.GetName(pdi).ToLowerInvariant();
+ var parameterDescriptorGuid = parameterDescriptorTable.GetGuid(pdi);
+ return ParameterMeasureInfo.ParseMeasureType(parameterDescriptorNameLowerInvariant, parameterDescriptorGuid);
+ })
+ .ToArray();
+
+ public static ElementMeasureInfo[] CreateElementMeasureInfos(
+ ElementTable elementTable,
+ ParameterTable parameterTable,
+ MeasureType[] parameterMeasureTypes,
+ ElementIndexMaps elementIndexMaps)
+ => elementTable
+ .AsParallel()
+ .Select(e => new ElementMeasureInfo(e, parameterTable, parameterMeasureTypes, elementIndexMaps))
+ .ToArray();
+ }
+}
diff --git a/src/cs/vim/Vim.Format/ElementParameterInfo/LevelInfo.cs b/src/cs/vim/Vim.Format/ElementParameterInfo/LevelInfo.cs
new file mode 100644
index 00000000..e68a77aa
--- /dev/null
+++ b/src/cs/vim/Vim.Format/ElementParameterInfo/LevelInfo.cs
@@ -0,0 +1,296 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Vim.Format.ObjectModel;
+using Vim.Util;
+
+// ReSharper disable InconsistentNaming
+
+namespace Vim.Format.ElementParameterInfo
+{
+ public class LevelInfo : IElementIndex
+ {
+ // SOME BACKGROUND INFORMATION ABOUT REVIT LEVELS
+ //
+ // by: Martin Ashton, July 25 2025
+ //
+ // In Revit, a Level has two elevation values:
+ //
+ // - Level.ProjectElevation: this value is relative to the internal scene origin at (0,0,0)
+ //
+ // - Level.Elevation: this value is relative to either
+ //
+ // a) the "project base point" of the bim document
+ //
+ // b) the "survey point" of the bim document
+ //
+ // For more information on these values, check the Revit API documentation and see ObjectModel.cs > BasePoint.
+ //
+ // Additionally, a Level may be qualified as either a building story or not.
+ //
+ // - When the level is a building story, it typically corresponds to the actual floors of a building.
+ //
+ // - When the level is not a building story, it can be a working plane used by the designer to align things
+ // like mechanical items in the ceiling, stair systems, etc.
+ //
+ // ... other relevant notes in ElementLevelInfo.cs ...
+
+ ///
+ /// The Level.
+ ///
+ public Level Level { get; }
+
+ ///
+ /// The element index of the level.
+ ///
+ public int GetElementIndexOrNone()
+ => Level.GetElementIndexOrNone();
+
+ ///
+ /// The name of the Level.
+ ///
+ public string LevelName
+ => Level?.Element?.Name ?? "";
+
+ const string WholeFeetFormatString = "0000";
+ const string DecimalFormatString = "0000.0000";
+ const string PositivePrefix = "+";
+ private const int RoundingDigits = Units.GoodEnoughRoundingDigits;
+
+ ///
+ /// "{-|+}{elevationDecimalFeetWithLeadingZeroes}ft - {name}
+ ///
+ public string NameWithElevationFeetDecimal
+ => $"{Units.ToDecimalFeetString(Level.Elevation, DecimalFormatString, PositivePrefix)} - {LevelName}";
+
+ ///
+ /// "{-|+}{elevationFractionalFeetAndInchesWithLeadingZeroes} - {name}
+ ///
+ public string NameWithElevationFeetAndFractionalInches
+ => $"{Units.ToFeetAndFractionalInchesString(Level.Elevation, WholeFeetFormatString, PositivePrefix)} - {LevelName}";
+
+ ///
+ /// "{-|+}{elevationMetersWithLeadingZeroes}m - {name}
+ ///
+ public string NameWithElevationMeters
+ => $"{Units.ToMetersString(Units.FeetToMeters(Level.Elevation, RoundingDigits), DecimalFormatString, PositivePrefix)} - {LevelName}";
+
+ ///
+ /// The elevation in feet relative to the bim document's project base point (unrounded), or null if no project base point exists.
+ ///
+ public double? ElevationRelativeToProjectBasePointDecimalFeetUnrounded { get; }
+
+ ///
+ /// The elevation in decimal feet relative to the bim document's project base point (rounded to 4 digits), or null if no project base point exists.
+ ///
+ public double? ElevationRelativeToProjectBasePointDecimalFeet
+ => ElevationRelativeToProjectBasePointDecimalFeetUnrounded == null
+ ? (double?) null
+ : Math.Round(ElevationRelativeToProjectBasePointDecimalFeetUnrounded.Value, RoundingDigits);
+
+ ///
+ /// The elevation in feet and fractional inches relative to the bim document's project base point, or empty if no project base point exists.
+ ///
+ public string ElevationRelativeToProjectBasePointFeetAndFractionalInches
+ => Units.ToFeetAndFractionalInchesString(ElevationRelativeToProjectBasePointDecimalFeetUnrounded);
+
+ ///
+ /// The elevation in meters relative to the bim document's project base point, or null if no project base point exists.
+ ///
+ public double? ElevationRelativeToProjectBasePointMeters
+ => Units.FeetToMeters(ElevationRelativeToProjectBasePointDecimalFeetUnrounded, RoundingDigits);
+
+ ///
+ /// The elevation in feet relative to the bim document's survey point (unrounded), or null if no survey point exists.
+ ///
+ public double? ElevationRelativeToSurveyPointDecimalFeetUnrounded { get; }
+
+ ///
+ /// The elevation in feet relative to the bim document's survey point (rounded to 4 digits), or null if no survey point exists.
+ ///
+ public double? ElevationRelativeToSurveyPointDecimalFeet
+ => ElevationRelativeToSurveyPointDecimalFeetUnrounded == null
+ ? (double?)null
+ : Math.Round(ElevationRelativeToSurveyPointDecimalFeetUnrounded.Value, RoundingDigits);
+
+ ///
+ /// The elevation in feet and fractional inches relative to the bim document's survey point, or empty if no survey point exists.
+ ///
+ public string ElevationRelativeToSurveyPointFeetAndFractionalInches
+ => Units.ToFeetAndFractionalInchesString(ElevationRelativeToSurveyPointDecimalFeetUnrounded);
+
+ ///
+ /// The elevation in meters relative to the bim document's survey point, or null if no survey point exists.
+ ///
+ public double? ElevationRelativeToSurveyPointMeters
+ => Units.FeetToMeters(ElevationRelativeToSurveyPointDecimalFeetUnrounded, RoundingDigits);
+
+ ///
+ /// This is derived from the level's type.
+ /// - true: level is relative to bim document's project base point
+ /// - false: level is relative to bim document's survey point
+ /// - null: not specified
+ ///
+ public bool? IsRelativeToProjectBasePoint { get; private set; }
+ //public const string TypeId_ElevationBase = "autodesk.revit.parameter:levelRelativeBaseType";
+ public const string BuiltInId_ElevationBase = "-1007109";
+ public static bool DescriptorIsProjectBasePoint(ParameterDescriptor pd)
+ => pd.Guid == BuiltInId_ElevationBase;
+
+ ///
+ /// Determines whether the level is considered a structural level.
+ ///
+ public bool IsStructural { get; private set; }
+ //public const string TypeId_IsStructural = "autodesk.revit.parameter:levelIsStructural";
+ public const string BuiltInId_IsStructural = "-1007112";
+ public static bool DescriptorIsStructural(ParameterDescriptor pd)
+ => pd.Guid == BuiltInId_IsStructural;
+
+ ///
+ /// Determines whether the level is considered a building story.
+ ///
+ public bool IsBuildingStory { get; private set; }
+ //public const string TypeId_IsBuildingStory = "autodesk.revit.parameter:levelIsBuildingStory";
+ public const string BuiltInId_IsBuildingStory = "-1007111";
+ public static bool DescriptorIsBuildingStory(ParameterDescriptor pd)
+ => pd.Guid == BuiltInId_IsBuildingStory;
+
+ ///
+ /// The building story above this one. Can be null if this is set to "Default" in Revit or if the level is the topmost building story.
+ ///
+ public Level BuildingStoryAbove { get; set; }
+ //public const string TypeId_BuildingStoryAbove = "autodesk.revit.parameter:levelUpToLevel";
+ public const string BuiltInId_BuildingStoryAbove = "-1007110";
+ public static bool DescriptorIsBuildingStoryAbove(ParameterDescriptor pd)
+ => pd.Guid == BuiltInId_BuildingStoryAbove;
+
+ ///
+ /// The height of the building story above in decimal feet (unrounded).
+ ///
+ public double? BuildingStoryAboveHeightFeetDecimalUnrounded
+ => BuildingStoryAbove == null
+ ? (double?)null
+ : BuildingStoryAbove.ProjectElevation - Level.ProjectElevation;
+
+ ///
+ /// The height of the building story above in decimal feet.
+ /// Calculated based on the difference in BuildingStoryAbove.ProjectElevation and Level.ProjectElevation.
+ ///
+ public double? BuildingStoryAboveHeightFeetDecimal
+ => BuildingStoryAboveHeightFeetDecimalUnrounded == null
+ ? (double?) null
+ : Math.Round(BuildingStoryAboveHeightFeetDecimalUnrounded.Value, RoundingDigits);
+
+ ///
+ /// The height of the building story above in feet and fractional inches.
+ ///
+ public string BuildingStoryAboveFeetAndFractionalInches
+ => Units.ToFeetAndFractionalInchesString(BuildingStoryAboveHeightFeetDecimalUnrounded);
+
+ ///
+ /// The height of the building story above in meters.
+ /// Calculated based on the difference in BuildingStoryAbove.ProjectElevation and Level.ProjectElevation.
+ ///
+ public double? BuildingStoryAboveHeightMeters
+ => Units.FeetToMeters(BuildingStoryAboveHeightFeetDecimalUnrounded, RoundingDigits);
+
+ ///
+ /// Returns true if the level info has a BuildingStoryAbove.
+ ///
+ public bool HasBuildingStoryAbove
+ => BuildingStoryAbove != null;
+
+ ///
+ /// Constructor
+ ///
+ public LevelInfo(
+ Level level,
+ FamilyTypeTable familyTypeTable,
+ ParameterTable parameterTable,
+ ElementIndexMaps elementIndexMaps,
+ IReadOnlyDictionary elementIdToLevelMap,
+ IReadOnlyDictionary elementIdToBasePointMap)
+ {
+ Level = level;
+
+ var projectBasePoint = elementIdToBasePointMap.Values.FirstOrDefault(bp => bp.IsSurveyPoint == false);
+ ElevationRelativeToProjectBasePointDecimalFeetUnrounded = projectBasePoint == null
+ ? (double?) null
+ : Level.ProjectElevation - projectBasePoint.Position_Z;
+
+ var surveyPoint = elementIdToBasePointMap.Values.FirstOrDefault(bp => bp.IsSurveyPoint);
+ ElevationRelativeToSurveyPointDecimalFeetUnrounded = surveyPoint == null
+ ? (double?) null
+ : Level.ProjectElevation - surveyPoint.Position_Z;
+
+ ReadLevelParameters(parameterTable, elementIndexMaps, elementIdToLevelMap);
+
+ ReadLevelTypeParameters(familyTypeTable, parameterTable, elementIndexMaps);
+ }
+
+ private void ReadLevelParameters(
+ ParameterTable parameterTable,
+ ElementIndexMaps elementIndexMaps,
+ IReadOnlyDictionary elementIdToLevelMap)
+ {
+ var levelElementParameterIndices = elementIndexMaps.GetParameterIndicesFromElementIndex(GetElementIndexOrNone());
+
+ foreach (var paramIndex in levelElementParameterIndices)
+ {
+ var p = parameterTable.Get(paramIndex);
+ var desc = p.ParameterDescriptor;
+
+ if (DescriptorIsStructural(desc) &&
+ p.TryParseNativeValueAsBoolean(desc, out var isStructural))
+ {
+ IsStructural = isStructural;
+ }
+ else if (
+ DescriptorIsBuildingStory(desc) &&
+ p.TryParseNativeValueAsBoolean(desc, out var isBuildingStory))
+ {
+ IsBuildingStory = isBuildingStory;
+ }
+ else if (
+ DescriptorIsBuildingStoryAbove(desc) &&
+ p.TryParseNativeValueAsElementId(out var storyAboveElementId) &&
+ elementIdToLevelMap.TryGetEntityFromElementId(storyAboveElementId, out var buildingStoryAbove))
+ {
+ // If the building story above has an element ID of -1, then it could be set to "Default" in Revit,
+ // and so BuildingStoryAbove will remain null here. To resolve this, the BuildingStoryAbove must
+ // be calculated in a subsequent pass (see LevelService.PatchBuildingStoryAbove)
+ BuildingStoryAbove = buildingStoryAbove;
+ }
+ }
+ }
+
+ private void ReadLevelTypeParameters(
+ FamilyTypeTable familyTypeTable,
+ ParameterTable parameterTable,
+ ElementIndexMaps elementIndexMaps)
+ {
+ var levelTypeElementIndex = familyTypeTable.GetElementIndex(Level.FamilyTypeIndex);
+
+ if (!elementIndexMaps.ParameterIndicesFromElementIndex.TryGetValue(levelTypeElementIndex, out var levelTypeParameterIndices) ||
+ levelTypeParameterIndices.Count <= 0)
+ {
+ return;
+ }
+
+ var typeParameters = levelTypeParameterIndices.Select(parameterTable.Get);
+ foreach (var p in typeParameters)
+ {
+ var desc = p.ParameterDescriptor;
+
+ if (DescriptorIsProjectBasePoint(desc) &&
+ p.TryParseNativeValueAsLong(out var relativeToProjectBasePoint))
+ {
+ IsRelativeToProjectBasePoint = relativeToProjectBasePoint == 0L; // 0L == "Project Base Point", 1L == "Survey Point"
+ }
+ }
+ }
+
+ public string PropertiesToString()
+ => string.Join(Environment.NewLine, this.PropertiesToStrings());
+ }
+}
diff --git a/src/cs/vim/Vim.Format/ElementParameterInfo/ParameterMeasureInfo.cs b/src/cs/vim/Vim.Format/ElementParameterInfo/ParameterMeasureInfo.cs
new file mode 100644
index 00000000..cf816527
--- /dev/null
+++ b/src/cs/vim/Vim.Format/ElementParameterInfo/ParameterMeasureInfo.cs
@@ -0,0 +1,767 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Vim.Util;
+
+namespace Vim.Format.ElementParameterInfo
+{
+ ///
+ /// A collection of well-known scalar measure types
+ ///
+ public enum MeasureType
+ {
+ Unknown = 0,
+ Length = 1,
+ Width = 2,
+ Height = 3,
+ Area = 4,
+ Volume = 5,
+ Angle = 6,
+ Slope = 7,
+ Radius = 8,
+ Diameter = 9,
+ Thickness = 10,
+ Elevation = 11,
+ Offset = 12,
+ Depth = 13,
+ Size = 14,
+ Distance = 15,
+ // [MAINTAIN]
+ // - Add more measure types as needed.
+ // - Update documentation @ VIM SQL ObjectModelContextCustom.cs > PocoParameter > MeasureType
+ // - *DO NOT CHANGE THE ACTUAL ENUM VALUES*
+ }
+
+ public static class ParameterMeasureInfo
+ {
+ ///
+ /// Maps the lowercase parameter name to the MeasureType.
+ ///
+ public static readonly Dictionary NameLowerInvariantToMeasureTypeMap =
+ Enum.GetValues(typeof(MeasureType))
+ .OfType()
+ .ToDictionary(mt => mt.ToString("G").ToLowerInvariant(), mt => mt);
+
+ ///
+ /// Maps the lowercase parameter name to the regex which detects whether it ends with the parameter name followed by an optional space and digits (ex: "Pipe Length 1")
+ ///
+ public static readonly Regex[] MeasureTypeRegex =
+ Enum.GetValues(typeof(MeasureType))
+ .OfType()
+ .Select(mt =>
+ {
+ var lowerStringEscaped = Regex.Escape(mt.ToString("G").ToLowerInvariant());
+ return new Regex($@"^(?:{lowerStringEscaped}|.*{lowerStringEscaped}\s*\d*)$", RegexOptions.Compiled);
+ })
+ .ToArray();
+
+ public static MeasureType ParseMeasureType(string parameterDescriptorNameLowerInvariant, string parameterDescriptorGuid)
+ {
+ // NOTE: parameterDescriptorGuid is either the Revit built-in ID (if the parameter is built-in), or a guid (if the parameter is shared).
+ if (BuiltInIdToMeasureTypeMap.TryGetValue(parameterDescriptorGuid, out var measureType))
+ return measureType;
+
+ // Compare the input descriptor name to the known mapping
+ if (NameLowerInvariantToMeasureTypeMap.TryGetValue(parameterDescriptorNameLowerInvariant, out measureType))
+ return measureType;
+
+ // Fall back to a string comparison to catch any localized parameter descriptor names which either start or end with the key followed by a space and digits,
+ // for example: "Length of Beam" or "Pipe Length 1"
+ foreach (var kv in NameLowerInvariantToMeasureTypeMap)
+ {
+ var candidateMeasureType = kv.Value;
+
+ // Skip the unknown measure type.
+ if (candidateMeasureType == MeasureType.Unknown)
+ continue;
+
+ var regex = MeasureTypeRegex[(int) candidateMeasureType];
+ if (regex.IsMatch(parameterDescriptorNameLowerInvariant))
+ return candidateMeasureType;
+ }
+
+ return MeasureType.Unknown;
+ }
+
+ public static void GetQuantityOrDisplayValue(
+ double? maybeQuantity,
+ string displayValue,
+ MeasureType measureType,
+ out string outQuantityInFeetRvtOrDisplayValue,
+ out string outQuantityInMetersOrDisplayValue)
+ {
+ outQuantityInFeetRvtOrDisplayValue = "";
+ outQuantityInMetersOrDisplayValue = "";
+
+ if (maybeQuantity == null)
+ {
+ // Use the display value.
+ outQuantityInFeetRvtOrDisplayValue = outQuantityInMetersOrDisplayValue = displayValue;
+ return;
+ }
+
+ var q = maybeQuantity.Value;
+
+ // Use parsed quantity depending on the value
+ switch (measureType)
+ {
+ case MeasureType.Angle:
+ case MeasureType.Slope:
+ outQuantityInFeetRvtOrDisplayValue = outQuantityInMetersOrDisplayValue = (Units.RadiansToDegrees(q) ?? 0d).ToString(CultureInfo.InvariantCulture);
+ break;
+ case MeasureType.Length:
+ case MeasureType.Width:
+ case MeasureType.Height:
+ case MeasureType.Radius:
+ case MeasureType.Diameter:
+ case MeasureType.Thickness:
+ case MeasureType.Elevation:
+ case MeasureType.Offset:
+ case MeasureType.Depth:
+ case MeasureType.Size:
+ case MeasureType.Distance:
+ outQuantityInFeetRvtOrDisplayValue = q.ToString(CultureInfo.InvariantCulture);
+ outQuantityInMetersOrDisplayValue = (Units.FeetToMeters(q) ?? 0d).ToString(CultureInfo.InvariantCulture);
+ break;
+ case MeasureType.Area:
+ outQuantityInFeetRvtOrDisplayValue = q.ToString(CultureInfo.InvariantCulture);
+ outQuantityInMetersOrDisplayValue = (Units.SquareFeetToSquareMeters(q) ?? 0d).ToString(CultureInfo.InvariantCulture);
+ break;
+ case MeasureType.Volume:
+ outQuantityInFeetRvtOrDisplayValue = q.ToString(CultureInfo.InvariantCulture);
+ outQuantityInMetersOrDisplayValue = (Units.CubicFeetToCubicMeters(q) ?? 0d).ToString(CultureInfo.InvariantCulture);
+ break;
+ case MeasureType.Unknown:
+ default:
+ // Use the display value.
+ outQuantityInFeetRvtOrDisplayValue = outQuantityInMetersOrDisplayValue = displayValue;
+ break;
+ }
+ }
+
+ // The built-in id sets below are correlated to the parameters named "Angle/Slope/Length/Width/Height/..."
+ // in the BuiltInParameter enumerations https://www.revitapidocs.com/2025/fb011c91-be7e-f737-28c7-3f1e1917a0e0.htm
+
+ ///
+ /// Maps the built-in parameter Revit ID to the MeasureType
+ ///
+ public static readonly Dictionary BuiltInIdToMeasureTypeMap = new Dictionary()
+ {
+ { "-1001817", MeasureType.Angle }, // PROFILE_ANGLE, "Angle"
+ { "-1001826", MeasureType.Angle }, // PROFILE1_ANGLE, "Angle"
+ { "-1001831", MeasureType.Angle }, // PROFILE2_ANGLE, "Angle"
+ { "-1004006", MeasureType.Angle }, // CURVE_ELEM_LINE_ANGLE, "Angle"
+ { "-1007007", MeasureType.Angle }, // TAG_ANGLE_PARAM, "Angle"
+ { "-1007363", MeasureType.Angle }, // MULLION_ANGLE, "Angle"
+ { "-1013309", MeasureType.Angle }, // CURTAINGRID_ANGLE_VERT, "Angle"
+ { "-1013310", MeasureType.Angle }, // CURTAINGRID_ANGLE_HORIZ, "Angle"
+ { "-1013339", MeasureType.Angle }, // CURTAINGRID_ANGLE_1, "Angle"
+ { "-1013340", MeasureType.Angle }, // CURTAINGRID_ANGLE_2, "Angle"
+ { "-1133409", MeasureType.Angle }, // CONNECTOR_ANGLE, "Angle"
+ { "-1140724", MeasureType.Angle }, // TRUSS_FAMILY_VERT_WEB_ANGLE_PARAM, "Angle"
+ { "-1140734", MeasureType.Angle }, // TRUSS_FAMILY_DIAG_WEB_ANGLE_PARAM, "Angle"
+ { "-1140744", MeasureType.Angle }, // TRUSS_FAMILY_TOP_CHORD_ANGLE_PARAM, "Angle"
+ { "-1140764", MeasureType.Angle }, // TRUSS_FAMILY_BOTTOM_CHORD_ANGLE_PARAM, "Angle"
+ { "-1140911", MeasureType.Angle }, // FABRICATION_PART_ANGLE, "Angle"
+ { "-1150226", MeasureType.Angle }, // POINT_ELEMENT_ANGLE, "Angle"
+ { "-1155075", MeasureType.Angle }, // STEEL_ELEM_PLATE_SHORTEN_ANGLE, "Angle"
+
+ { "-1006016", MeasureType.Slope }, // ROOF_SLOPE, "Slope"
+ { "-1140254", MeasureType.Slope }, // RBS_CURVE_UTSLOPE, "Slope"
+ { "-1140255", MeasureType.Slope }, // RBS_DUCT_SLOPE, "Slope"
+ { "-1140256", MeasureType.Slope }, // RBS_PIPE_SLOPE, "Slope"
+ { "-1140923", MeasureType.Slope }, // FABRICATION_SLOPE_PARAM, "Slope"
+
+ { "-1001136", MeasureType.Length }, // DPART_LENGTH_COMPUTED, "Length"
+ { "-1001306", MeasureType.Length }, // FAMILY_LINE_LENGTH_PARAM, "Length"
+ { "-1001375", MeasureType.Length }, // INSTANCE_LENGTH_PARAM, "Length"
+ { "-1001567", MeasureType.Length }, // CONTINUOUS_FOOTING_LENGTH, "Length"
+ { "-1001569", MeasureType.Length }, // STRUCTURAL_FOUNDATION_LENGTH, "Length"
+ { "-1004005", MeasureType.Length }, // CURVE_ELEM_LENGTH, "Length"
+ { "-1007736", MeasureType.Length }, // IMPORT_ADT_ENTITY_LENGTH, "Length"
+ { "-1013434", MeasureType.Length }, // COVER_TYPE_LENGTH, "Length"
+ { "-1015043", MeasureType.Length }, // LOAD_LINEAR_LENGTH, "Length"
+ { "-1017608", MeasureType.Length }, // FABRIC_SHEET_LENGTH, "Length"
+ { "-1140039", MeasureType.Length }, // RBS_ELEC_CIRCUIT_LENGTH_PARAM, "Length"
+ { "-1140132", MeasureType.Length }, // RBS_CABLETRAYCONDUITRUN_LENGTH_PARAM, "Length"
+ { "-1140337", MeasureType.Length }, // CONNECTOR_LENGTH, "Length"
+ { "-1140944", MeasureType.Length }, // FABRICATION_PART_LENGTH, "Length"
+ { "-1150348", MeasureType.Length }, // CONTINUOUSRAIL_EXTENSION_LENGTH_PARAM, "Length"
+ { "-1150350", MeasureType.Length }, // CONTINUOUSRAIL_END_EXTENSION_LENGTH_PARAM, "Length"
+ { "-1150360", MeasureType.Length }, // CONTINUOUSRAIL_LENGTH_PARAM, "Length"
+ { "-1150461", MeasureType.Length }, // ANALYTICAL_MODEL_LENGTH, "Length"
+ { "-1153545", MeasureType.Length }, // RBS_ELEC_ANALYTICAL_FEEDER_LENGTH, "Length"
+ { "-1155017", MeasureType.Length }, // STEEL_ELEM_ANCHOR_LENGTH, "Length"
+ { "-1155019", MeasureType.Length }, // STEEL_ELEM_SHEARSTUD_LENGTH, "Length"
+ { "-1155020", MeasureType.Length }, // STEEL_ELEM_SHORTEN_REFLENGTH, "Length"
+ { "-1155033", MeasureType.Length }, // STEEL_ELEM_WELD_LENGTH, "Length"
+ { "-1155137", MeasureType.Length }, // STEEL_ELEM_PLATE_LENGTH, "Length"
+ { "-1155147", MeasureType.Length }, // STEEL_ELEM_PROFILE_LENGTH, "Length"
+ { "-1155247", MeasureType.Length }, // LINEAR_FRAMING_LENGTH, "Length"
+
+ { "-1001000", MeasureType.Width }, // WALL_ATTR_WIDTH_PARAM, "Width"
+ { "-1001301", MeasureType.Width }, // FAMILY_WIDTH_PARAM, "Width"
+ // duplicate: "-1001301", // CASEWORK_WIDTH, "Width"
+ // duplicate: "-1001301", // DOOR_WIDTH, "Width"
+ // duplicate: "-1001301", // FURNITURE_WIDTH, "Width"
+ // duplicate: "-1001301", // GENERIC_WIDTH, "Width"
+ // duplicate: "-1001301", // WINDOW_WIDTH, "Width"
+ { "-1001558", MeasureType.Width }, // CONTINUOUS_FOOTING_WIDTH, "Width"
+ { "-1001562", MeasureType.Width }, // CONTINUOUS_FOOTING_BEARING_WIDTH, "Width"
+ { "-1001568", MeasureType.Width }, // STRUCTURAL_FOUNDATION_WIDTH, "Width"
+ { "-1005502", MeasureType.Width }, // STRUCTURAL_SECTION_COMMON_WIDTH, "Width"
+ { "-1007204", MeasureType.Width }, // STAIRS_ATTR_TREAD_WIDTH, "Width"
+ { "-1007600", MeasureType.Width }, // ELEV_WIDTH, "Width"
+ { "-1007735", MeasureType.Width }, // IMPORT_ADT_ENTITY_WIDTH, "Width"
+ { "-1007750", MeasureType.Width }, // RASTER_SHEETWIDTH, "Width"
+ { "-1007765", MeasureType.Width }, // RASTER_SYMBOL_WIDTH, "Width"
+ { "-1010301", MeasureType.Width }, // CURTAIN_WALL_PANELS_WIDTH, "Width"
+ { "-1012814", MeasureType.Width }, // DECAL_WIDTH, "Width"
+ { "-1017615", MeasureType.Width }, // FABRIC_SHEET_WIDTH, "Width": Width
+ { "-1114101", MeasureType.Width }, // RBS_CURVE_WIDTH_PARAM, "Width"
+ { "-1133403", MeasureType.Width }, // CONNECTOR_WIDTH, "Width"
+ { "-1140122", MeasureType.Width }, // RBS_CABLETRAY_WIDTH_PARAM, "Width"
+ { "-1140134", MeasureType.Width }, // RBS_CABLETRAYRUN_WIDTH_PARAM, "Width"
+ { "-1150623", MeasureType.Width }, // DIVISION_PROFILE_WIDTH, "Width": Width
+ { "-1151807", MeasureType.Width }, // STAIRS_SUPPORTTYPE_WIDTH, "Width": Width
+ { "-1155138", MeasureType.Width }, // STEEL_ELEM_PLATE_WIDTH, "Width"
+ { "-1155317", MeasureType.Width }, // BENDING_DETAIL_TYPE_SCHEMATIC_WIDTH, "Width"
+
+
+ {"-1001001", MeasureType.Height }, // WALL_ATTR_HEIGHT_PARAM, "Height"
+ {"-1001135", MeasureType.Height }, // DPART_HEIGHT_COMPUTED, "Height"
+ {"-1001300", MeasureType.Height }, // FAMILY_HEIGHT_PARAM, "Height"
+ // duplicate: "-1001300", // CASEWORK_HEIGHT, "Height"
+ // duplicate: "-1001300", // DOOR_HEIGHT, "Height"
+ // duplicate: "-1001300", // FURNITURE_HEIGHT, "Height"
+ // duplicate: "-1001300", // GENERIC_HEIGHT, "Height"
+ // duplicate: "-1001300", // WINDOW_HEIGHT, "Height"
+ {"-1005193", MeasureType.Height }, // RENDER_PLANT_HEIGHT, "Height"
+ {"-1005503", MeasureType.Height }, // STRUCTURAL_SECTION_COMMON_HEIGHT, "Height"
+ {"-1007734", MeasureType.Height }, // IMPORT_ADT_ENTITY_HEIGHT, "Height"
+ {"-1007751", MeasureType.Height }, // RASTER_SHEETHEIGHT, "Height"
+ {"-1007766", MeasureType.Height }, // RASTER_SYMBOL_HEIGHT, "Height"
+ {"-1010300", MeasureType.Height }, // CURTAIN_WALL_PANELS_HEIGHT, "Height"
+ {"-1012114", MeasureType.Height }, // VOLUME_OF_INTEREST_HEIGHT, "Height"
+ {"-1012815", MeasureType.Height }, // DECAL_HEIGHT, "Height"
+ {"-1017043", MeasureType.Height }, // REBAR_SHAPE_SPIRAL_HEIGHT, "Height"
+ {"-1114102", MeasureType.Height }, // RBS_CURVE_HEIGHT_PARAM, "Height"
+ {"-1133404", MeasureType.Height }, // CONNECTOR_HEIGHT, "Height"
+ {"-1140121", MeasureType.Height }, // RBS_CABLETRAY_HEIGHT_PARAM, "Height"
+ {"-1140133", MeasureType.Height }, // RBS_CABLETRAYRUN_HEIGHT_PARAM, "Height"
+ {"-1150328", MeasureType.Height }, // RAILING_SYSTEM_TOP_RAIL_HEIGHT_PARAM, "Height"
+ {"-1150331", MeasureType.Height }, // RAILING_SYSTEM_HANDRAILS_HEIGHT_PARAM, "Height"
+ {"-1150335", MeasureType.Height }, // RAILING_SYSTEM_SECONDARY_HANDRAILS_HEIGHT_PARAM, "Height"
+ {"-1150340", MeasureType.Height }, // HANDRAIL_HEIGHT_PARAM, "Height"
+ {"-1152166", MeasureType.Height }, // SUPPORT_HEIGHT, "Height"
+ {"-1155318", MeasureType.Height }, // BENDING_DETAIL_TYPE_SCHEMATIC_HEIGHT, "Height"
+
+ { "-1001133", MeasureType.Area}, // DPART_AREA_COMPUTED, "Area"
+ { "-1006902", MeasureType.Area}, // ROOM_AREA, "Area"
+ { "-1012600", MeasureType.Area}, // PROPERTY_AREA, "Area"
+ { "-1012606", MeasureType.Area}, // PROPERTY_AREA_OPEN, "Area"
+ { "-1012805", MeasureType.Area}, // HOST_AREA_COMPUTED, "Area"
+ { "-1015069", MeasureType.Area}, // LOAD_AREA_AREA, "Area"
+ { "-1114120", MeasureType.Area}, // RBS_CURVE_SURFACE_AREA, "Area"
+ { "-1114247", MeasureType.Area}, // RBS_GBXML_SURFACE_AREA, "Area"
+ { "-1114820", MeasureType.Area}, // SPACE_AREA, "Area"
+ { "-1140360", MeasureType.Area}, // MATERIAL_AREA, "Area"
+ { "-1150462", MeasureType.Area}, // ANALYTICAL_MODEL_AREA, "Area": The Area of Analytical Model
+ { "-1153551", MeasureType.Area}, // RBS_ELEC_ANALYTICAL_AREA, "Area"
+ { "-1155139", MeasureType.Area}, // STEEL_ELEM_PLATE_AREA, "Area"
+ { "-1155234", MeasureType.Area}, // LAYER_ELEM_AREA_COMPUTED, "Area"
+
+ { "-1001129", MeasureType.Volume }, // DPART_VOLUME_COMPUTED, "Volume"
+ { "-1006921", MeasureType.Volume }, // ROOM_VOLUME, "Volume"
+ { "-1012007", MeasureType.Volume }, // MASS_GROSS_VOLUME, "Gross Volume"
+ { "-1012012", MeasureType.Volume }, // LEVEL_DATA_VOLUME, "Floor Volume"
+ { "-1012021", MeasureType.Volume }, // MASS_ZONE_VOLUME, "Mass Zone Volume"
+ { "-1012806", MeasureType.Volume }, // HOST_VOLUME_COMPUTED, "Volume"
+ { "-1018502", MeasureType.Volume }, // REIN_EST_BAR_VOLUME, "Estimated Reinforcement Volume"
+ { "-1018503", MeasureType.Volume }, // REINFORCEMENT_VOLUME, "Reinforcement Volume"
+ { "-1114303", MeasureType.Volume }, // ZONE_VOLUME, "Occupied Volume"
+ { "-1114331", MeasureType.Volume }, // ZONE_VOLUME_GROSS, "Gross Volume"
+ { "-1114821", MeasureType.Volume }, // SPACE_VOLUME, "Volume"
+ { "-1140253", MeasureType.Volume }, // RBS_PIPE_VOLUME_PARAM, "Volume"
+ { "-1140361", MeasureType.Volume }, // MATERIAL_VOLUME, "Volume"
+ { "-1150425", MeasureType.Volume }, // RBS_INSULATION_LINING_VOLUME, "Volume"
+ { "-1155140", MeasureType.Volume }, // STEEL_ELEM_PLATE_VOLUME, "Volume"
+ { "-1155148", MeasureType.Volume }, // STEEL_ELEM_PROFILE_VOLUME, "Volume"
+ { "-1155232", MeasureType.Volume }, // LAYER_ELEM_VOLUME_COMPUTED, "Volume"
+ { "-1180303", MeasureType.Volume }, // INDIVIDUAL_EXCAVATION_VOLUME, "Individual Excavation Volume"
+ { "-1180306", MeasureType.Volume }, // EXCAVATION_VOLUME, "Excavation Volume"
+ { "-1180307", MeasureType.Volume }, // TOTAL_EXCAVATION_VOLUME, "Total Excavation Volume"
+
+ { "-1004010", MeasureType.Radius }, // CURVE_ELEM_ARC_RADIUS, "Radius"
+ { "-1004014", MeasureType.Radius }, // RADIAL_ARRAY_ARC_RADIUS, "Radius"
+ { "-1007350", MeasureType.Radius }, // CIRC_MULLION_RADIUS, "Radius"
+ { "-1008201", MeasureType.Radius }, // CALLOUT_CORNER_SHEET_RADIUS, "Corner Radius"
+ { "-1010020", MeasureType.Radius }, // ELLIPSE_X_PARAM, "X-Radius Value for Ellipse (for Use with XAML Data Template example)"
+ { "-1010021", MeasureType.Radius }, // ELLIPSE_Y_PARAM, "Y-Radius Value for Ellipse (for Use with XAML Data Template example)"
+ { "-1012407", MeasureType.Radius }, // BOUNDARY_RADIUS, "Radius"
+ { "-1012618", MeasureType.Radius }, // PROPERTY_SEGMENT_RADIUS, "Radius"
+ { "-1017020", MeasureType.Radius }, // REBAR_BAR_MAXIMUM_BEND_RADIUS, "Maximum Bend Radius"
+ { "-1133401", MeasureType.Radius }, // CONNECTOR_RADIUS, "Radius"
+ { "-1140115", MeasureType.Radius }, // RBS_CABLETRAY_BENDRADIUS, "Bend Radius"
+ { "-1140116", MeasureType.Radius }, // RBS_CONDUIT_BENDRADIUS, "Bend Radius"
+ { "-1150338", MeasureType.Radius }, // CONTINUOUSRAIL_FILLET_RADIUS_PARAM, "Fillet Radius"
+ { "-1151906", MeasureType.Radius }, // STAIRS_WINDERPATTERN_RADIUS_INTERIOR, "Fillet Radius": The fillet corner radius on the interior boundary
+ { "-1155028", MeasureType.Radius }, // STEEL_ELEM_PARAM_RADIUS, "Radius"
+ { "-1155059", MeasureType.Radius }, // STEEL_ELEM_PATTERN_RADIUS, "Radius"
+
+ { "-1005504", MeasureType.Diameter }, // STRUCTURAL_SECTION_COMMON_DIAMETER, "Diameter"
+ { "-1005539", MeasureType.Diameter }, // STRUCTURAL_SECTION_ISHAPE_BOLT_DIAMETER, "Bolt Diameter"
+ { "-1005546", MeasureType.Diameter }, // STRUCTURAL_SECTION_LANGLE_BOLT_DIAMETER_LONGER_FLANGE, "Bolt Diameter Longer Flange"
+ { "-1005547", MeasureType.Diameter }, // STRUCTURAL_SECTION_LANGLE_BOLT_DIAMETER_SHORTER_FLANGE, "Bolt Diameter Shorter Flange"
+ { "-1017000", MeasureType.Diameter }, // REBAR_BAR_DIAMETER, "Bar Diameter"
+ { "-1017010", MeasureType.Diameter }, // REBAR_STANDARD_BEND_DIAMETER, "Standard Bend Diameter"
+ { "-1017019", MeasureType.Diameter }, // REBAR_BAR_STIRRUP_BEND_DIAMETER, "Stirrup/Tie Bend Diameter"
+ { "-1017037", MeasureType.Diameter }, // REBAR_INSTANCE_BAR_DIAMETER, "Bar Diameter"
+ { "-1017038", MeasureType.Diameter }, // REBAR_INSTANCE_BEND_DIAMETER, "Bend Diameter"
+ { "-1017041", MeasureType.Diameter }, // REBAR_STANDARD_HOOK_BEND_DIAMETER, "Standard Hook Bend Diameter"
+ { "-1017048", MeasureType.Diameter }, // REBAR_SHAPE_OUT_OF_PLANE_BEND_DIAMETER, "Out of Plane Bend Diameter"
+ { "-1017601", MeasureType.Diameter }, // FABRIC_WIRE_DIAMETER, "Nominal Diameter": Nominal Diameter of Fabric Wire.
+ { "-1017625", MeasureType.Diameter }, // FABRIC_BEND_DIAMETER, "Bend Diameter": Standard Bend Diameter of Fabric Wire.
+ { "-1114103", MeasureType.Diameter }, // RBS_CURVE_DIAMETER_PARAM, "Diameter"
+ { "-1114127", MeasureType.Diameter }, // RBS_EQ_DIAMETER_PARAM, "Equivalent Diameter"
+ { "-1114129", MeasureType.Diameter }, // RBS_HYDRAULIC_DIAMETER_PARAM, "Hydraulic Diameter"
+ { "-1133415", MeasureType.Diameter }, // CONNECTOR_DIAMETER, "Diameter"
+ { "-1133416", MeasureType.Diameter }, // CONNECTOR_INSIDE_DIAMETER, "Inside Diameter"
+ { "-1140123", MeasureType.Diameter }, // RBS_CONDUIT_DIAMETER_PARAM, "Diameter(Trade Size)"
+ { "-1140126", MeasureType.Diameter }, // RBS_CONDUIT_INNER_DIAM_PARAM, "Inside Diameter"
+ { "-1140127", MeasureType.Diameter }, // RBS_CONDUIT_OUTER_DIAM_PARAM, "Outside Diameter"
+ { "-1140135", MeasureType.Diameter }, // RBS_CONDUITRUN_DIAMETER_PARAM, "Diameter(Trade Size)"
+ { "-1140136", MeasureType.Diameter }, // RBS_CONDUITRUN_INNER_DIAM_PARAM, "Inside Diameter"
+ { "-1140137", MeasureType.Diameter }, // RBS_CONDUITRUN_OUTER_DIAM_PARAM, "Outside Diameter"
+ { "-1140212", MeasureType.Diameter }, // RBS_PIPE_INNER_DIAM_PARAM, "Inside Diameter"
+ { "-1140225", MeasureType.Diameter }, // RBS_PIPE_DIAMETER_PARAM, "Diameter"
+ { "-1140238", MeasureType.Diameter }, // RBS_PIPE_OUTER_DIAMETER, "Outside Diameter"
+ { "-1140912", MeasureType.Diameter }, // FABRICATION_PART_DIAMETER_IN, "Main Primary Diameter"
+ { "-1140933", MeasureType.Diameter }, // FABRICATION_PART_DIAMETER_OUT, "Main Secondary Diameter"
+ { "-1140952", MeasureType.Diameter }, // FABRICATION_PART_DIAMETER_IN_OPTION, "Main Primary Diameter Option"
+ { "-1140955", MeasureType.Diameter }, // FABRICATION_PART_DIAMETER_OUT_OPTION, "Main Secondary Diameter Option"
+ { "-1150129", MeasureType.Diameter }, // FBX_LIGHT_EMIT_CIRCLE_DIAMETER, "Emit from Circle Diameter"
+ { "-1150130", MeasureType.Diameter }, // FBX_LIGHT_SOURCE_DIAMETER, "Light Source Symbol Size"
+ { "-1154651", MeasureType.Diameter }, // COUPLER_WIDTH, "External Diameter"
+ { "-1155008", MeasureType.Diameter }, // STEEL_ELEM_BOLT_DIAMETER, "Diameter"
+ { "-1155013", MeasureType.Diameter }, // STEEL_ELEM_ANCHOR_DIAMETER, "Diameter"
+ { "-1155016", MeasureType.Diameter }, // STEEL_ELEM_SHEARSTUD_DIAMETER, "Diameter"
+ { "-1155061", MeasureType.Diameter }, // STEEL_ELEM_HOLE_DIAMETER, "Diameter"
+ { "-1155068", MeasureType.Diameter }, // STEEL_ELEM_HOLE_HEAD_DIAMETER, "Head diameter"
+ { "-1155223", MeasureType.Diameter }, // REBAR_MODEL_BAR_DIAMETER, "Model Bar Diameter"
+ { "-1155224", MeasureType.Diameter }, // REBAR_INSTANCE_BAR_MODEL_DIAMETER, "Model Bar Diameter"
+ { "-1155248", MeasureType.Diameter }, // CIRCULAR_FRAMING_DIAMETER, "Circular Diameter"
+ { "-1155299", MeasureType.Diameter }, // BENDING_DETAIL_TYPE_BEND_DIAMETER_DIMENSIONS_ENABLED, "Bend Diameter Dimensions"
+ { "-1155301", MeasureType.Diameter }, // BENDING_DETAIL_TYPE_DIAMETER_DIMENSION_TYPE_ID, "Diameter Dimension Style"
+
+ { "-1001134", MeasureType.Thickness }, // DPART_LAYER_WIDTH, "Thickness"
+ { "-1001302", MeasureType.Thickness }, // FAMILY_THICKNESS_PARAM, "Thickness"
+ // duplicate: "-1001302" // DOOR_THICKNESS, "Thickness"
+ // duplicate: "-1001302" // FURNITURE_THICKNESS, "Thickness"
+ // duplicate: "-1001302" // GENERIC_THICKNESS, "Thickness"
+ // duplicate: "-1001302" // WINDOW_THICKNESS, "Thickness"
+ { "-1001557", MeasureType.Thickness }, // STRUCTURAL_FOUNDATION_THICKNESS, "Foundation Thickness"
+ { "-1001600", MeasureType.Thickness }, // ROOF_ATTR_DEFAULT_THICKNESS_PARAM, "Default Thickness"
+ { "-1001601", MeasureType.Thickness }, // ROOF_ATTR_THICKNESS_PARAM, "Thickness"
+ { "-1001656", MeasureType.Thickness }, // STRUCTURAL_FLOOR_CORE_THICKNESS, "Core Thickness"
+ { "-1001900", MeasureType.Thickness }, // FLOOR_ATTR_THICKNESS_PARAM, "Thickness"
+ { "-1001902", MeasureType.Thickness }, // FLOOR_ATTR_DEFAULT_THICKNESS_PARAM, "Default Thickness"
+ { "-1002206", MeasureType.Thickness }, // CEILING_THICKNESS, "Thickness"
+ { "-1002301", MeasureType.Thickness }, // CEILING_THICKNESS_PARAM, "Thickness"
+ { "-1005505", MeasureType.Thickness }, // STRUCTURAL_SECTION_PIPESTANDARD_WALLNOMINALTHICKNESS, "Wall Nominal Thickness"
+ { "-1005506", MeasureType.Thickness }, // STRUCTURAL_SECTION_PIPESTANDARD_WALLDESIGNTHICKNESS, "Wall Design Thickness"
+ { "-1005524", MeasureType.Thickness }, // STRUCTURAL_SECTION_ISHAPE_FLANGETHICKNESS, "Flange Thickness"
+ { "-1005525", MeasureType.Thickness }, // STRUCTURAL_SECTION_ISHAPE_WEBTHICKNESS, "Web Thickness"
+ { "-1005531", MeasureType.Thickness }, // STRUCTURAL_SECTION_IWELDED_TOPFLANGETHICKNESS, "Top Flange Thickness"
+ { "-1005533", MeasureType.Thickness }, // STRUCTURAL_SECTION_IWELDED_BOTTOMFLANGETHICKNESS, "Bottom Flange Thickness"
+ { "-1005566", MeasureType.Thickness }, // STRUCTURAL_SECTION_ISHAPE_FLANGETHICKNESS_LOCATION, "Flange Thickness Location"
+ { "-1005567", MeasureType.Thickness }, // STRUCTURAL_SECTION_ISHAPE_WEBTHICKNESS_LOCATION, "Web Thickness Location"
+ { "-1007210", MeasureType.Thickness }, // STAIRS_ATTR_STRINGER_THICKNESS, "Stringer Thickness"
+ { "-1007211", MeasureType.Thickness }, // STAIRS_ATTR_TREAD_THICKNESS, "Tread Thickness"
+ { "-1007261", MeasureType.Thickness }, // STAIRS_ATTR_RISER_THICKNESS, "Riser Thickness"
+ { "-1007304", MeasureType.Thickness }, // RECT_MULLION_THICK, "Thickness"
+ { "-1007322", MeasureType.Thickness }, // CUST_MULLION_THICK, "Thickness"
+ { "-1007737", MeasureType.Thickness }, // IMPORT_ADT_ENTITY_THICKNESS, "Thickness"
+ { "-1008304", MeasureType.Thickness }, // RAMP_ATTR_THICKNESS, "Thickness"
+ { "-1008604", MeasureType.Thickness }, // STAIRS_RAILING_THICKNESS, "Railing Thickness"
+ { "-1010304", MeasureType.Thickness }, // CURTAIN_WALL_SYSPANEL_THICKNESS, "Thickness"
+ { "-1012501", MeasureType.Thickness }, // BUILDINGPAD_THICKNESS, "Thickness"
+ { "-1013455", MeasureType.Thickness }, // ANALYTICAL_PANEL_THICKNESS, "Thickness": Used for Analytical Panel
+ { "-1114117", MeasureType.Thickness }, // RBS_INSULATION_THICKNESS, "Insulation Thickness"
+ { "-1114118", MeasureType.Thickness }, // RBS_LINING_THICKNESS, "Lining Thickness"
+ { "-1114358", MeasureType.Thickness }, // RBS_INSULATION_THICKNESS_FOR_DUCT, "Insulation Thickness"
+ { "-1114359", MeasureType.Thickness }, // RBS_INSULATION_THICKNESS_FOR_PIPE, "Insulation Thickness"
+ { "-1114360", MeasureType.Thickness }, // RBS_LINING_THICKNESS_FOR_DUCT, "Lining Thickness"
+ { "-1114851", MeasureType.Thickness }, // THERMAL_MATERIAL_THICKNESS, "Thickness"
+ { "-1140111", MeasureType.Thickness }, // RBS_CABLETRAY_THICKNESS, "Thickness"
+ { "-1140241", MeasureType.Thickness }, // RBS_PIPE_INSULATION_THICKNESS, "Insulation Thickness"
+ { "-1140972", MeasureType.Thickness }, // FABRICATION_PART_DOUBLEWALL_MATERIAL_THICKNESS, "Double Wall Material Thickness"
+ { "-1140978", MeasureType.Thickness }, // FABRICATION_PART_MATERIAL_THICKNESS, "Part Material Thickness"
+ { "-1141040", MeasureType.Thickness }, // RBS_PIPE_WALL_THICKNESS, "Wall Thickness"
+ { "-1150431", MeasureType.Thickness }, // RBS_REFERENCE_INSULATION_THICKNESS, "Insulation Thickness": This parameter is obsolete. Use DUCT_INSULATION_THICKNESS and PIPE_INSULATION_THICKNESS.
+ { "-1150433", MeasureType.Thickness }, // RBS_REFERENCE_LINING_THICKNESS, "Lining Thickness"
+ { "-1150436", MeasureType.Thickness }, // DUCT_INSULATION_THICKNESS, "Insulation Thickness"
+ { "-1150437", MeasureType.Thickness }, // PIPE_INSULATION_THICKNESS, "Insulation Thickness"
+ { "-1151226", MeasureType.Thickness }, // STAIRSTYPE_NOTCH_THICKNESS, "Notch Thickness":
+ { "-1151507", MeasureType.Thickness }, // STAIRS_LANDING_THICKNESS, "Total Thickness": Thickness
+ { "-1151603", MeasureType.Thickness }, // STAIRS_LANDINGTYPE_THICKNESS, "Monolithic Thickness": Default thickness
+ { "-1152152", MeasureType.Thickness }, // STAIRS_TRISERTYPE_TREAD_THICKNESS, "Tread Thickness"
+ { "-1152160", MeasureType.Thickness }, // STAIRS_TRISERTYPE_RISER_THICKNESS, "Riser Thickness"
+ { "-1155003", MeasureType.Thickness }, // STEEL_ELEM_PLATE_THICKNESS, "Thickness"
+ { "-1155032", MeasureType.Thickness }, // STEEL_ELEM_WELD_MAIN_THICKNESS, "Main Thickness"
+ { "-1155044", MeasureType.Thickness }, // STEEL_ELEM_WELD_DOUBLE_THICKNESS, "Double Thickness"
+ { "-1155230", MeasureType.Thickness }, // LAYER_TYPE_THICKNESS, "Thickness": Thickness
+ { "-1155235", MeasureType.Thickness }, // LAYER_ELEM_THICKNESS, "Thickness": Thickness
+ { "-1155253", MeasureType.Thickness }, // TOPOSOLID_TYPE_DEFAULT_THICKNESS_PARAM, "Default Thickness"
+ { "-1155254", MeasureType.Thickness }, // TOPOSOLID_ATTR_THICKNESS_PARAM, "Thickness"
+
+ { "-1001320", MeasureType.Elevation }, // FAMILY_WPB_DEFAULT_ELEVATION, "Default Elevation"
+ { "-1001360", MeasureType.Elevation }, // INSTANCE_ELEVATION_PARAM, "Elevation from Level"
+ { "-1001397", MeasureType.Elevation }, // STRUCTURAL_ATTACHMENT_START_VALUE_ELEVATION, "Start Attachment Elevation"
+ { "-1001398", MeasureType.Elevation }, // STRUCTURAL_ATTACHMENT_END_VALUE_ELEVATION, "End Attachment Elevation"
+ { "-1001561", MeasureType.Elevation }, // STRUCTURAL_ELEVATION_AT_BOTTOM, "Elevation at Bottom"
+ { "-1001571", MeasureType.Elevation }, // STRUCTURAL_BEAM_END0_ELEVATION, "Start Level Offset"
+ { "-1001572", MeasureType.Elevation }, // STRUCTURAL_BEAM_END1_ELEVATION, "End Level Offset"
+ { "-1001598", MeasureType.Elevation }, // STRUCTURAL_ELEVATION_AT_TOP, "Elevation at Top"
+ { "-1001653", MeasureType.Elevation }, // STRUCTURAL_REFERENCE_LEVEL_ELEVATION, "Reference Level Elevation"
+ { "-1001654", MeasureType.Elevation }, // STRUCTURAL_ELEVATION_AT_TOP_CORE, "Elevation at Top Core"
+ { "-1001655", MeasureType.Elevation }, // STRUCTURAL_ELEVATION_AT_BOTTOM_CORE, "Elevation at Bottom Core"
+ { "-1001657", MeasureType.Elevation }, // STRUCTURAL_ELEVATION_AT_TOP_SURVEY, "Elevation at Top Survey"
+ { "-1001658", MeasureType.Elevation }, // STRUCTURAL_ELEVATION_AT_BOTTOM_SURVEY, "Elevation at Bottom Survey"
+ { "-1005000", MeasureType.Elevation }, // VIEWER_EYE_ELEVATION, "Eye Elevation"
+ { "-1005002", MeasureType.Elevation }, // VIEWER_TARGET_ELEVATION, "Target Elevation"
+ { "-1005331", MeasureType.Elevation }, // VIEW_GRAPH_SCHED_LEVEL_RELATIVE_BASE_TYPE, "Elevation Base for Levels"
+ { "-1006437", MeasureType.Elevation }, // SPOT_ELEV_BASE, "Elevation Base"
+ { "-1006452", MeasureType.Elevation }, // SPOT_ELEV_IND_ELEVATION, "Elevation Indicator"
+ { "-1006469", MeasureType.Elevation }, // SPOT_ELEV_DISPLAY_ELEVATIONS, "Display Elevations"
+ { "-1006486", MeasureType.Elevation }, // SPOT_COORDINATE_ELEVATION_PREFIX, "Elevation Prefix"
+ { "-1006487", MeasureType.Elevation }, // SPOT_COORDINATE_ELEVATION_SUFFIX, "Elevation Suffix"
+ { "-1006488", MeasureType.Elevation }, // SPOT_COORDINATE_INCLUDE_ELEVATION, "Include Elevation"
+ { "-1006489", MeasureType.Elevation }, // SPOT_ELEV_IND_TYPE_ELEVATION, "Elevation Indicator as Prefix/Suffix"
+ { "-1007010", MeasureType.Elevation }, // TAG_ELEVATION_BASE, "Elevation Base"
+ { "-1007102", MeasureType.Elevation }, // LEVEL_ELEV, "Elevation"
+ { "-1007109", MeasureType.Elevation }, // LEVEL_RELATIVE_BASE_TYPE, "Elevation Base"
+ { "-1007610", MeasureType.Elevation }, // ELEV_SYMBOL_ID, "Elevation Mark"
+ { "-1008207", MeasureType.Elevation }, // ELEVATN_TAG, "Elevation Tag"
+ { "-1012400", MeasureType.Elevation }, // POINT_ELEVATION, "Elevation"
+ { "-1012401", MeasureType.Elevation }, // CONTOUR_ELEVATION, "Elevation"
+ { "-1012402", MeasureType.Elevation }, // CONTOUR_ELEVATION_STEP, "Increment"
+ { "-1012621", MeasureType.Elevation }, // CONTOUR_LABELS_ELEV_BASE_TYPE, "Elevation Base"
+ { "-1012842", MeasureType.Elevation }, // FAMILY_IS_ELEVATION_MARK_BODY, "Elevation Mark Use"
+ { "-1114002", MeasureType.Elevation }, // RBS_START_OFFSET_PARAM, "Start Middle Elevation"
+ { "-1114003", MeasureType.Elevation }, // RBS_END_OFFSET_PARAM, "End Middle Elevation"
+ { "-1114132", MeasureType.Elevation }, // RBS_OFFSET_PARAM, "Middle Elevation"
+ { "-1140096", MeasureType.Elevation }, // RBS_ELEC_WIRE_ELEVATION, "Elevation"
+ { "-1140124", MeasureType.Elevation }, // RBS_CTC_TOP_ELEVATION, "Upper End Top Elevation"
+ { "-1140125", MeasureType.Elevation }, // RBS_CTC_BOTTOM_ELEVATION, "Lower End Bottom Elevation"
+ { "-1140237", MeasureType.Elevation }, // RBS_PIPE_INVERT_ELEVATION, "Invert Elevation": This parameter is obsolete. It exists only for compatibility.
+ { "-1140239", MeasureType.Elevation }, // RBS_DUCT_TOP_ELEVATION, "Upper End Top Elevation"
+ { "-1140240", MeasureType.Elevation }, // RBS_DUCT_BOTTOM_ELEVATION, "Lower End Bottom Elevation"
+ { "-1140707", MeasureType.Elevation }, // TRUSS_ELEMENT_END0_ELEVATION, "Start Level Offset"
+ { "-1140708", MeasureType.Elevation }, // TRUSS_ELEMENT_END1_ELEVATION, "End Level Offset"
+ { "-1140917", MeasureType.Elevation }, // FABRICATION_OFFSET_PARAM, "Middle Elevation"
+ { "-1140918", MeasureType.Elevation }, // FABRICATION_TOP_OF_PART, "Upper End Top of Insulation Elevation"
+ { "-1140919", MeasureType.Elevation }, // FABRICATION_BOTTOM_OF_PART, "Lower End Bottom of Insulation Elevation"
+ { "-1140924", MeasureType.Elevation }, // FABRICATION_START_OFFSET_PARAM, "Start Middle Elevation"
+ { "-1140925", MeasureType.Elevation }, // FABRICATION_END_OFFSET_PARAM, "End Middle Elevation"
+ { "-1140984", MeasureType.Elevation }, // MEP_SPOT_TOP_ELEVATION, "Spot Top Elevation": used for both design and fabrication components
+ // duplicate: "-1140984" // FABRICATION_SPOT_TOP_ELEVATION_OF_PART, "Spot Top Elevation": used for both design and fabrication components
+ { "-1140985", MeasureType.Elevation }, // MEP_SPOT_TOP_ELEVATION_INCLUDE_INSULATION, "Spot Top of Insulation Elevation"
+ // duplicate: "-1140985" // FABRICATION_SPOT_TOP_ELEVATION_INCLUDE_INSULATION_OF_PART, "Spot Top of Insulation Elevation"
+ { "-1140986", MeasureType.Elevation }, // MEP_SPOT_BOTTOM_ELEVATION, "Spot Bottom Elevation": used for both design and fabrication components
+ // duplicate: "-1140986" // FABRICATION_SPOT_BOTTOM_ELEVATION_OF_PART, "Spot Bottom Elevation": used for both design and fabrication components
+ { "-1140987", MeasureType.Elevation }, // MEP_SPOT_BOTTOM_ELEVATION_INCLUDE_INSULATION, "Spot Bottom of Insulation Elevation"
+ // duplicate: "-1140987" // FABRICATION_SPOT_BOTTOM_ELEVATION_INCLUDE_INSULATION_OF_PART, "Spot Bottom of Insulation Elevation"
+ { "-1140988", MeasureType.Elevation }, // MEP_SPOT_CENTERLINE_ELEVATION, "Spot Centerline Elevation": used for both design and fabrication components
+ // duplicate: "-1140988" // FABRICATION_CENTERLINE_ELEVATION_OF_PART, "Spot Centerline Elevation": used for both design and fabrication components
+ { "-1140989", MeasureType.Elevation }, // FABRICATION_TOP_ELEVATION_OF_PART, "Top Elevation"
+ { "-1140990", MeasureType.Elevation }, // FABRICATION_TOP_ELEVATION_INCLUDE_INSULATION_OF_PART, "Top Elevation with Insulation"
+ { "-1140991", MeasureType.Elevation }, // FABRICATION_BOTTOM_ELEVATION_OF_PART, "Bottom Elevation"
+ { "-1140992", MeasureType.Elevation }, // FABRICATION_BOTTOM_ELEVATION_INCLUDE_INSULATION_OF_PART, "Bottom Elevation with Insulation"
+ { "-1140993", MeasureType.Elevation }, // FABRICATION_PIPE_INVERT_ELEVATION, "Pipe Invert Elevation": This parameter is obsolete. It exists only for compatibility.
+ { "-1141020", MeasureType.Elevation }, // MEP_UPPER_CENTERLINE_ELEVATION, "Upper End Centerline Elevation"
+ { "-1141021", MeasureType.Elevation }, // MEP_LOWER_CENTERLINE_ELEVATION, "Lower End Centerline Elevation"
+ { "-1141022", MeasureType.Elevation }, // MEP_UPPER_TOP_ELEVATION, "Upper End Top Elevation"
+ { "-1141023", MeasureType.Elevation }, // MEP_UPPER_BOTTOM_ELEVATION, "Upper End Bottom Elevation"
+ { "-1141024", MeasureType.Elevation }, // MEP_LOWER_TOP_ELEVATION, "Lower End Top Elevation"
+ { "-1141025", MeasureType.Elevation }, // MEP_LOWER_BOTTOM_ELEVATION, "Lower End Bottom Elevation"
+ { "-1141026", MeasureType.Elevation }, // MEP_UPPER_TOP_ELEVATION_INCLUDE_INSULATION, "Upper End Top of Insulation Elevation"
+ { "-1141027", MeasureType.Elevation }, // MEP_UPPER_BOTTOM_ELEVATION_INCLUDE_INSULATION, "Upper End Bottom of Insulation Elevation"
+ { "-1141028", MeasureType.Elevation }, // MEP_LOWER_TOP_ELEVATION_INCLUDE_INSULATION, "Lower End Top of Insulation Elevation"
+ { "-1141029", MeasureType.Elevation }, // MEP_LOWER_BOTTOM_ELEVATION_INCLUDE_INSULATION, "Lower End Bottom of Insulation Elevation"
+ { "-1141030", MeasureType.Elevation }, // MEP_PIPE_UPPER_OBVERT_ELEVATION, "Upper End Obvert Elevation"
+ { "-1141031", MeasureType.Elevation }, // MEP_PIPE_LOWER_OBVERT_ELEVATION, "Lower End Obvert Elevation"
+ { "-1141032", MeasureType.Elevation }, // MEP_PIPE_UPPER_INVERT_ELEVATION, "Upper End Invert Elevation"
+ { "-1141033", MeasureType.Elevation }, // MEP_PIPE_LOWER_INVERT_ELEVATION, "Lower End Invert Elevation"
+ { "-1150193", MeasureType.Elevation }, // BASEPOINT_ELEVATION_PARAM, "Elev"
+ { "-1151301", MeasureType.Elevation }, // STAIRS_RUN_BOTTOM_ELEVATION, "Relative Base Height": Relative height to stairs bottom elevation
+ { "-1151302", MeasureType.Elevation }, // STAIRS_RUN_TOP_ELEVATION, "Relative Top Height": Top height of run
+ { "-1151501", MeasureType.Elevation }, // STAIRS_LANDING_BASE_ELEVATION, "Relative Height": Height
+ { "-1154647", MeasureType.Elevation }, // FAMILY_FREEINST_DEFAULT_ELEVATION, "Default Elevation"
+ { "-1155114", MeasureType.Elevation }, // RBS_PIPE_TOP_ELEVATION, "Upper End Top Elevation"
+ { "-1155115", MeasureType.Elevation }, // RBS_PIPE_BOTTOM_ELEVATION, "Lower End Bottom Elevation"
+ { "-1155260", MeasureType.Elevation }, // TOPOSOLID_ELEVATION_AT_BOTTOM, "Elevation at Bottom"
+ { "-1155261", MeasureType.Elevation }, // TOPOSOLID_ELEVATION_AT_TOP, "Elevation at Top"
+ { "-1155272", MeasureType.Elevation }, // SSE_POINT_ELEVATION, "Elevation"
+
+ { "-1001108", MeasureType.Offset }, // WALL_BASE_OFFSET, "Base Offset"
+ { "-1001109", MeasureType.Offset }, // WALL_TOP_OFFSET, "Top Offset"
+ { "-1001123", MeasureType.Offset }, // WALL_LOCATION_LINE_OFFSET_PARAM, "Location Line Offset"
+ { "-1001357", MeasureType.Offset }, // FAMILY_BASE_LEVEL_OFFSET_PARAM, "Base Offset"
+ { "-1001358", MeasureType.Offset }, // FAMILY_TOP_LEVEL_OFFSET_PARAM, "Top Offset"
+ { "-1001364", MeasureType.Offset }, // INSTANCE_FREE_HOST_OFFSET_PARAM, "Offset from Host"
+ // duplicate: "-1001571" // STRUCTURAL_BEAM_END0_ELEVATION, "Start Level Offset"
+ // duplicate: "-1001572" // STRUCTURAL_BEAM_END1_ELEVATION, "End Level Offset"
+ { "-1001574", MeasureType.Offset }, // BEAM_V_JUSTIFICATION_OTHER_VALUE, "z-Direction Offset Value"
+ { "-1001588", MeasureType.Offset }, // STRUCTURAL_ANALYTICAL_TESS_DEVIATION, "Maximum discretized offset"
+ { "-1001652", MeasureType.Offset }, // ROOF_CONSTRAINT_OFFSET_PARAM, "Level Offset"
+ { "-1001701", MeasureType.Offset }, // ROOF_LEVEL_OFFSET_PARAM, "Base Offset From Level"
+ { "-1001703", MeasureType.Offset }, // ROOF_UPTO_LEVEL_OFFSET_PARAM, "Cutoff Offset"
+ { "-1001706", MeasureType.Offset }, // CURVE_WALL_OFFSET, "Wall offset"
+ { "-1001707", MeasureType.Offset }, // CURVE_WALL_OFFSET_ROOFS, "Overhang"
+ { "-1001716", MeasureType.Offset }, // FACEROOF_OFFSET_PARAM, "Level Offset"
+ { "-1001813", MeasureType.Offset }, // PROFILE_OFFSET_X, "Horizontal Profile Offset"
+ { "-1001814", MeasureType.Offset }, // PROFILE_OFFSET_Y, "Vertical Profile Offset"
+ { "-1001822", MeasureType.Offset }, // PROFILE1_OFFSET_X, "Horizontal Profile Offset"
+ { "-1001823", MeasureType.Offset }, // PROFILE1_OFFSET_Y, "Vertical Profile Offset"
+ { "-1001827", MeasureType.Offset }, // PROFILE2_OFFSET_X, "Horizontal Profile Offset"
+ { "-1001828", MeasureType.Offset }, // PROFILE2_OFFSET_Y, "Vertical Profile Offset"
+ { "-1001951", MeasureType.Offset }, // FLOOR_HEIGHTABOVELEVEL_PARAM, "Height Offset From Level"
+ { "-1002065", MeasureType.Offset }, // SCHEDULE_BASE_LEVEL_OFFSET_PARAM, "Base Offset"
+ { "-1002066", MeasureType.Offset }, // SCHEDULE_TOP_LEVEL_OFFSET_PARAM, "Top Offset"
+ { "-1002300", MeasureType.Offset }, // CEILING_HEIGHTABOVELEVEL_PARAM, "Height Offset From Level"
+ { "-1002400", MeasureType.Offset }, // SLOPE_START_HEIGHT, "Height Offset at Tail"
+ { "-1002401", MeasureType.Offset }, // SLOPE_END_HEIGHT, "Height Offset at Head"
+ { "-1002557", MeasureType.Offset }, // COLUMN_TOP_ATTACHMENT_OFFSET_PARAM, "Offset From Attachment At Top"
+ { "-1002558", MeasureType.Offset }, // COLUMN_BASE_ATTACHMENT_OFFSET_PARAM, "Offset From Attachment At Base"
+ { "-1002565", MeasureType.Offset }, // ASSOCIATED_LEVEL_OFFSET, "Associated Level Offset": The offset from the associated level.
+ { "-1005100", MeasureType.Offset }, // VIEWER_BOUND_OFFSET_RIGHT, "Right Clip Offset"
+ { "-1005101", MeasureType.Offset }, // VIEWER_BOUND_OFFSET_LEFT, "Left Clip Offset"
+ { "-1005102", MeasureType.Offset }, // VIEWER_BOUND_OFFSET_TOP, "Top Clip Offset"
+ { "-1005103", MeasureType.Offset }, // VIEWER_BOUND_OFFSET_BOTTOM, "Bottom Clip Offset"
+ { "-1005104", MeasureType.Offset }, // VIEWER_BOUND_OFFSET_FAR, "Far Clip Offset"
+ { "-1005105", MeasureType.Offset }, // VIEWER_BOUND_OFFSET_NEAR, "Near Clip Offset"
+ { "-1006001", MeasureType.Offset }, // ROOF_CURVE_HEIGHT_OFFSET, "Offset From Roof Base"
+ { "-1006005", MeasureType.Offset }, // ROOF_CURVE_HEIGHT_AT_WALL, "Plate Offset From Base"
+ { "-1006008", MeasureType.Offset }, // CURVE_HEIGHT_OFFSET, "Offset From Base"
+ { "-1006477", MeasureType.Offset }, // BASELINE_DIM_OFFSET, "Baseline Offset"
+ { "-1006494", MeasureType.Offset }, // SPOT_SLOPE_OFFSET_FROM_REFERENCE, "Offset from Reference"
+ { "-1006501", MeasureType.Offset }, // LEADER_OFFSET_SHEET, "Leader/Border Offset"
+ { "-1006637", MeasureType.Offset }, // NUMBER_SYSTEM_JUSTIFY_OFFSET, "Justify Offset"
+ { "-1006638", MeasureType.Offset }, // NUMBER_SYSTEM_REFERENCE_OFFSET, "Offset from Reference"
+ { "-1006924", MeasureType.Offset }, // ROOM_UPPER_OFFSET, "Limit Offset"
+ { "-1006925", MeasureType.Offset }, // ROOM_LOWER_OFFSET, "Base Offset"
+ { "-1006927", MeasureType.Offset }, // ALWAYS_ZERO_LENGTH, "Base Offset"
+ { "-1007218", MeasureType.Offset }, // STAIRS_BASE_OFFSET, "Base Offset"
+ { "-1007219", MeasureType.Offset }, // STAIRS_TOP_OFFSET, "Top Offset"
+ { "-1007238", MeasureType.Offset }, // STAIRS_ATTR_STRINGER_OFFSET, "Open Stringer Offset"
+ { "-1007259", MeasureType.Offset }, // STAIRS_ATTR_STAIRS_CUT_OFFSET, "Extend Below Base"
+ { "-1007351", MeasureType.Offset }, // MULLION_OFFSET, "Offset"
+ { "-1007703", MeasureType.Offset }, // IMPORT_BASE_LEVEL_OFFSET, "Offset from Work Plane"
+ { "-1007725", MeasureType.Offset }, // RVT_LEVEL_OFFSET, "Map Levels..."
+ { "-1008203", MeasureType.Offset }, // CALLOUT_SYNCRONIZE_BOUND_OFFSET_FAR, "Far Clip Settings"
+ { "-1008617", MeasureType.Offset }, // STAIRS_RAILING_RAIL_OFFSET, "Rail Offset"
+ { "-1008619", MeasureType.Offset }, // STAIRS_RAILING_BALUSTER_OFFSET, "Baluster Offset"
+ { "-1008621", MeasureType.Offset }, // STAIRS_RAILING_HEIGHT_OFFSET, "Base Offset"
+ { "-1010302", MeasureType.Offset }, // CURTAIN_WALL_SYSPANEL_OFFSET, "Offset"
+ { "-1012058", MeasureType.Offset }, // ENERGY_ANALYSIS_MASSZONE_COREOFFSET, "Perimeter Zone Depth"
+ { "-1012502", MeasureType.Offset }, // BUILDINGPAD_HEIGHTABOVELEVEL_PARAM, "Height Offset From Level"
+ { "-1012802", MeasureType.Offset }, // WALL_SWEEP_OFFSET_PARAM, "Offset From Level"
+ { "-1012804", MeasureType.Offset }, // WALL_SWEEP_WALL_OFFSET_PARAM, "Offset From Wall"
+ { "-1012825", MeasureType.Offset }, // SWEEP_BASE_OFFSET, "Horizontal Profile Offset"
+ { "-1012827", MeasureType.Offset }, // SWEEP_BASE_VERT_OFFSET, "Vertical Profile Offset"
+ { "-1013312", MeasureType.Offset }, // CURTAINGRID_ORIGIN_VERT, "Offset"
+ { "-1013313", MeasureType.Offset }, // CURTAINGRID_ORIGIN_HORIZ, "Offset"
+ { "-1013342", MeasureType.Offset }, // CURTAINGRID_ORIGIN_1, "Offset"
+ { "-1013343", MeasureType.Offset }, // CURTAINGRID_ORIGIN_2, "Offset"
+ { "-1013382", MeasureType.Offset }, // CURTAINGRID_ORIGIN_U, "Offset"
+ { "-1013383", MeasureType.Offset }, // CURTAINGRID_ORIGIN_V, "Offset"
+ { "-1013412", MeasureType.Offset }, // CURVE_SUPPORT_OFFSET, "Wall offset"
+ { "-1013429", MeasureType.Offset }, // CURVE_EDGE_OFFSET, "Wall offset"
+ { "-1016006", MeasureType.Offset }, // CWP_LEVEL_OFFSET, "Offset Level"
+ { "-1017034", MeasureType.Offset }, // REBAR_SHAPE_START_HOOK_OFFSET, "Start Hook Offset Length"
+ { "-1017036", MeasureType.Offset }, // REBAR_SHAPE_END_HOOK_OFFSET, "End Hook Offset Length"
+ { "-1017708", MeasureType.Offset }, // FABRIC_PARAM_COVER_OFFSET, "Additional Cover Offset": Additional cover offset of the fabric distribution.
+ { "-1017739", MeasureType.Offset }, // FABRIC_WIRE_OFFSET, "Offset along wire direction": Offset along wire direction
+ { "-1018024", MeasureType.Offset }, // REBAR_SYSTEM_ADDL_TOP_OFFSET, "Additional Top Cover Offset"
+ { "-1018025", MeasureType.Offset }, // REBAR_SYSTEM_ADDL_BOTTOM_OFFSET, "Additional Bottom Cover Offset"
+ { "-1018026", MeasureType.Offset }, // REBAR_SYSTEM_ADDL_EXTERIOR_OFFSET, "Additional Exterior Cover Offset"
+ { "-1018027", MeasureType.Offset }, // REBAR_SYSTEM_ADDL_INTERIOR_OFFSET, "Additional Interior Cover Offset"
+ { "-1018321", MeasureType.Offset }, // PATH_REIN_ALT_OFFSET, "Alternating Bar - Offset"
+ { "-1018322", MeasureType.Offset }, // PATH_REIN_ADDL_OFFSET, "Additional Offset"
+ { "-1018360", MeasureType.Offset }, // PATH_REIN_SPANLENGTH_ALT_OFFSET, "Offset"
+ // duplicate: "-1114002" // RBS_START_OFFSET_PARAM, "Start Middle Elevation"
+ // duplicate: "-1114003" // RBS_END_OFFSET_PARAM, "End Middle Elevation"
+ { "-1114105", MeasureType.Offset }, // RBS_CURVE_HOR_OFFSET_PARAM, "Horizontal Justification"
+ { "-1114106", MeasureType.Offset }, // RBS_CURVE_VERT_OFFSET_PARAM, "Vertical Justification"
+ // duplicate: "-1114132" // RBS_OFFSET_PARAM, "Middle Elevation"
+ { "-1114211", MeasureType.Offset }, // RBS_FAMILY_CONTENT_OFFSET_WIDTH, "OffsetWidth"
+ { "-1114212", MeasureType.Offset }, // RBS_FAMILY_CONTENT_OFFSET_HEIGHT, "OffsetHeight"
+ { "-1114237", MeasureType.Offset }, // RBS_CONNECTOR_OFFSET_OBSOLETE, "Connector Offset"
+ { "-1114706", MeasureType.Offset }, // ZONE_LEVEL_OFFSET, "Level Offset"
+ { "-1114707", MeasureType.Offset }, // ZONE_LEVEL_OFFSET_TOP, "Top Offset"
+ { "-1133501", MeasureType.Offset }, // GROUP_OFFSET_FROM_LEVEL, "Origin Level Offset"
+ { "-1140175", MeasureType.Offset }, // RBS_ELEC_CIRCUIT_PATH_OFFSET_PARAM, "Offset"
+ { "-1140270", MeasureType.Offset }, // RBS_PARALLELCONDUITS_HORIZONTAL_OFFSET_VALUE, "Horizontal Offset value for parallel conduits"
+ { "-1140271", MeasureType.Offset }, // RBS_PARALLELCONDUITS_VERTICAL_OFFSET_VALUE, "Vertical Offset value for parallel conduits"
+ { "-1140274", MeasureType.Offset }, // RBS_PARALLELPIPES_HORIZONTAL_OFFSET_VALUE, "Horizontal Offset value for parallel pipes"
+ { "-1140275", MeasureType.Offset }, // RBS_PARALLELPIPES_VERTICAL_OFFSET_VALUE, "Vertical Offset value for parallel pipes"
+ // duplicate: "-1140707" // TRUSS_ELEMENT_END0_ELEVATION, "Start Level Offset"
+ // duplicate: "-1140708" // TRUSS_ELEMENT_END1_ELEVATION, "End Level Offset"
+ { "-1140717", MeasureType.Offset }, // TRUSS_NON_BEARING_OFFSET_PARAM, "Non Bearing Offset"
+ { "-1140751", MeasureType.Offset }, // MATCHLINE_TOP_OFFSET, "Top Offset"
+ { "-1140752", MeasureType.Offset }, // MATCHLINE_BOTTOM_OFFSET, "Bottom Offset"
+ // duplicate: "-1140917" // FABRICATION_OFFSET_PARAM, "Middle Elevation"
+ // duplicate: "-1140924" // FABRICATION_START_OFFSET_PARAM, "Start Middle Elevation"
+ // duplicate: "-1140925" // FABRICATION_END_OFFSET_PARAM, "End Middle Elevation"
+ { "-1150055", MeasureType.Offset }, // DIVIDED_SURFACE_OFFSET_FROM_SURFACE, "Offset from surface"
+ { "-1150144", MeasureType.Offset }, // POINT_ELEMENT_OFFSET, "Offset"
+ { "-1150162", MeasureType.Offset }, // LOCKED_TOP_OFFSET, "Positive Offset"
+ { "-1150163", MeasureType.Offset }, // LOCKED_BASE_OFFSET, "Negative Offset"
+ { "-1150164", MeasureType.Offset }, // LOCKED_START_OFFSET, "Negative Offset"
+ { "-1150165", MeasureType.Offset }, // LOCKED_END_OFFSET, "Positive Offset"
+ { "-1150170", MeasureType.Offset }, // VIEW_SLANTED_COLUMN_SYMBOL_OFFSET, "Column Symbolic Offset"
+ { "-1150332", MeasureType.Offset }, // RAILING_SYSTEM_HANDRAILS_LATTERAL_OFFSET, "Lateral Offset"
+ { "-1150336", MeasureType.Offset }, // RAILING_SYSTEM_SECONDARY_HANDRAILS_LATTERAL_OFFSET, "Lateral Offset"
+ { "-1150624", MeasureType.Offset }, // PART_MAKER_DIVISION_PROFILE_OFFSET, "Profile Offset"
+ { "-1151235", MeasureType.Offset }, // STAIRSTYPE_RIGHT_SUPPORT_LATERAL_OFFSET, "Right Lateral Offset":
+ { "-1151236", MeasureType.Offset }, // STAIRSTYPE_LEFT_SUPPORT_LATERAL_OFFSET, "Left Lateral Offset":
+ { "-1151701", MeasureType.Offset }, // STAIRS_SUPPORT_HORIZONTAL_OFFSET, "Lateral Offset": Distance from center or edge of boundary
+ { "-1151702", MeasureType.Offset }, // STAIRS_SUPPORT_VERTICAL_OFFSET, "Vertical Offset": Distance of top plane of edge stringer relative to the plane connecting tread nosing
+ { "-1151904", MeasureType.Offset }, // STAIRS_WINDERPATTERN_STAIR_PATH_OFFSET, "Inside Walk Line Offset": The offset from inside walk line to interior boundary
+ { "-1152300", MeasureType.Offset }, // STAIRS_RAILING_PLACEMENT_OFFSET, "Offset from Path"
+ { "-1152363", MeasureType.Offset }, // Y_OFFSET_VALUE, "y Offset Value"
+ { "-1152365", MeasureType.Offset }, // Z_OFFSET_VALUE, "z Offset Value"
+ { "-1152367", MeasureType.Offset }, // START_Y_OFFSET_VALUE, "Start y Offset Value"
+ { "-1152369", MeasureType.Offset }, // START_Z_OFFSET_VALUE, "Start z Offset Value"
+ { "-1152371", MeasureType.Offset }, // END_Y_OFFSET_VALUE, "End y Offset Value"
+ { "-1152373", MeasureType.Offset }, // END_Z_OFFSET_VALUE, "End z Offset Value"
+ { "-1155233", MeasureType.Offset }, // LAYER_ELEM_OFFSET_FROM_HOST, "Offset From Host"
+ { "-1155252", MeasureType.Offset }, // OFFSET_FROM_REFERENCE_BASE, "Offset from Reference Base"
+ { "-1155255", MeasureType.Offset }, // TOPOSOLID_HEIGHTABOVELEVEL_PARAM, "Height Offset From Level"
+ { "-1155271", MeasureType.Offset }, // SSE_POINT_OFFSET_FROM_SURFACE, "Offset from Surface"
+ { "-1155285", MeasureType.Offset }, // SSE_POINT_OFFSET_FROM_SNAPS, "Offset from Snaps"
+ { "-1155292", MeasureType.Offset }, // BENDING_DETAIL_TYPE_SEGMENT_LENGTH_DIMENSIONS_OFFSET, "Dimension Offset"
+ { "-1155298", MeasureType.Offset }, // BENDING_DETAIL_TYPE_ANGULAR_DIMENSION_OFFSET, "Angular Dimension Offset"
+ { "-1180409", MeasureType.Offset }, // REBAR_STAGGER_OFFSET_AT_START, "Offset At Start"
+ { "-1180410", MeasureType.Offset }, // REBAR_STAGGER_OFFSET_AT_END, "Offset At End"
+
+ { "-1001711", MeasureType.Depth }, // FASCIA_DEPTH_PARAM, "Fascia Depth"
+ { "-1001799", MeasureType.Depth }, // EXTRUSION_DEPTH_PARAM, "Depth"
+ { "-1001812", MeasureType.Depth }, // EXTRUSION_LENGTH, "Depth"
+ { "-1005154", MeasureType.Depth }, // VIEW_DEPTH, "View Depth"
+ { "-1005181", MeasureType.Depth }, // VIEW_BACK_CLIPPING, "Depth Clipping"
+ { "-1007203", MeasureType.Depth }, // STAIRS_ATTR_MINIMUM_TREAD_DEPTH, "Minimum Tread Depth"
+ { "-1007250", MeasureType.Depth }, // STAIRS_ACTUAL_TREAD_DEPTH, "Actual Tread Depth"
+ { "-1007356", MeasureType.Depth }, // MULLION_DEPTH, "Depth"
+ { "-1007357", MeasureType.Depth }, // MULLION_DEPTH1, "Depth 1"
+ { "-1007358", MeasureType.Depth }, // MULLION_DEPTH2, "Depth 2"
+ { "-1010003", MeasureType.Depth }, // GENERIC_DEPTH, "Depth"
+ // duplicate: "-1010003" // CASEWORK_DEPTH, "Depth"
+ { "-1012041", MeasureType.Depth }, // MASS_DATA_SHADE_DEPTH, "Shade Depth"
+ { "-1012044", MeasureType.Depth }, // MASS_DATA_SKYLIGHT_WIDTH, "Skylight Width & Depth"
+ { "-1012055", MeasureType.Depth }, // ENERGY_ANALYSIS_SKYLIGHT_WIDTH, "Skylight Width & Depth"
+ { "-1012057", MeasureType.Depth }, // ENERGY_ANALYSIS_SHADE_DEPTH, "Shade Depth"
+ // duplicate: "-1012058" // ENERGY_ANALYSIS_MASSZONE_COREOFFSET, "Perimeter Zone Depth"
+ { "-1140930", MeasureType.Depth }, // FABRICATION_PART_DEPTH_IN, "Main Primary Depth"
+ { "-1140935", MeasureType.Depth }, // FABRICATION_PART_DEPTH_OUT, "Main Secondary Depth"
+ { "-1140951", MeasureType.Depth }, // FABRICATION_PART_DEPTH_IN_OPTION, "Main Primary Depth Option"
+ { "-1140957", MeasureType.Depth }, // FABRICATION_PART_DEPTH_OUT_OPTION, "Main Secondary Depth Option"
+ { "-1141002", MeasureType.Depth }, // DISPLACEMENT_PATH_DEPTH, "Depth"
+ { "-1150361", MeasureType.Depth }, // CONTINUOUSRAIL_PLUS_TREAD_DEPTH_PARAM, "Plus Tread Depth"
+ { "-1151117", MeasureType.Depth }, // STAIRS_MIN_AUTOMATIC_LANDING_DEPTH, "Minimum Automatic Landing Depth": The minimum depth of automatic landing
+ { "-1151204", MeasureType.Depth }, // STAIRSTYPE_MINIMUM_TREAD_DEPTH, "Min. Tread Depth": Minimum Tread Depth
+ { "-1151205", MeasureType.Depth }, // STAIRSTYPE_MINIMUM_TREAD_WIDTH_INSIDE_BOUNDARY, "Min. Tread Depth on Winder Inner Boundary": Minimum Tread Width on Inside Boundary
+ { "-1151308", MeasureType.Depth }, // STAIRS_RUN_ACTUAL_TREAD_DEPTH, "Actual Tread Depth": Actual Tread Depth
+ { "-1151404", MeasureType.Depth }, // STAIRS_RUNTYPE_STRUCTURAL_DEPTH, "Structural Depth": Structural Depth
+ { "-1151405", MeasureType.Depth }, // STAIRS_RUNTYPE_TOTAL_DEPTH, "Total Depth": Total Depth
+ { "-1151805", MeasureType.Depth }, // STAIRS_SUPPORTTYPE_STRUCTURAL_DEPTH, "Structural Depth": Structural Depth
+ { "-1151806", MeasureType.Depth }, // STAIRS_SUPPORTTYPE_TOTAL_DEPTH, "Total Depth": Total Depth
+ { "-1151809", MeasureType.Depth }, // STAIRS_SUPPORTTYPE_STRUCTURAL_DEPTH_ON_RUN, "Structural Depth On Run": Structural Depth
+ { "-1151810", MeasureType.Depth }, // STAIRS_SUPPORTTYPE_STRUCTURAL_DEPTH_ON_LANDING, "Structural Depth On Landing": Structural Depth
+ { "-1154634", MeasureType.Depth }, // MULTISTORY_STAIRS_ACTUAL_TREAD_DEPTH, "Actual Tread Depth"
+ { "-1155042", MeasureType.Depth }, // STEEL_ELEM_WELD_MAIN_PREPDEPTH, "Main Preparation Depth"
+ { "-1155050", MeasureType.Depth }, // STEEL_ELEM_WELD_DOUBLE_PREPDEPTH, "Double Preparation Depth"
+ { "-1155065", MeasureType.Depth }, // STEEL_ELEM_HOLE_DEPTH, "Hole Depth"
+ { "-1155072", MeasureType.Depth }, // STEEL_ELEM_HOLE_DEPTH_OF_BOLT_HEAD, "Depth of bolt head"
+ { "-1155314", MeasureType.Depth }, // BLEND_DEPTH_PARAM, "Depth"
+
+ { "-1001530", MeasureType.Size }, // STRUCTURAL_CAMBER, "Camber Size"
+ { "-1006407", MeasureType.Size }, // CENTER_MARK_SIZE, "Center Mark Size"
+ { "-1013316", MeasureType.Size }, // CURTAINGRID_ADJUST_BORDER_VERT, "Adjust for Mullion Size"
+ { "-1013317", MeasureType.Size }, // CURTAINGRID_ADJUST_BORDER_HORIZ, "Adjust for Mullion Size"
+ { "-1013346", MeasureType.Size }, // CURTAINGRID_ADJUST_BORDER_1, "Adjust for Mullion Size"
+ { "-1013347", MeasureType.Size }, // CURTAINGRID_ADJUST_BORDER_2, "Adjust for Mullion Size"
+ { "-1013386", MeasureType.Size }, // CURTAINGRID_ADJUST_BORDER_U, "Adjust for Mullion Size"
+ { "-1013387", MeasureType.Size }, // CURTAINGRID_ADJUST_BORDER_V, "Adjust for Mullion Size"
+ { "-1114143", MeasureType.Size }, // RBS_DUCT_SIZE_FORMATTED_PARAM, "Size"
+ { "-1114144", MeasureType.Size }, // RBS_PIPE_SIZE_FORMATTED_PARAM, "Size"
+ { "-1114240", MeasureType.Size }, // RBS_CALCULATED_SIZE, "Size"
+ { "-1140022", MeasureType.Size }, // RBS_WIRE_NEUTRAL_MODE_PARAM, "Neutral Size"
+ { "-1140025", MeasureType.Size }, // RBS_WIRE_MAX_CONDUCTOR_SIZE_PARAM, "Max Size"
+ { "-1140037", MeasureType.Size }, // RBS_ELEC_CIRCUIT_WIRE_SIZE_PARAM, "Wire Size"
+ { "-1140266", MeasureType.Size }, // RBS_FP_SPRINKLER_ORIFICE_SIZE_PARAM, "Orifice Size"
+ { "-1140283", MeasureType.Size }, // RBS_PIPE_SIZE_MINIMUM, "Minimum Size"
+ { "-1140284", MeasureType.Size }, // RBS_PIPE_SIZE_MAXIMUM, "Maximum Size"
+ { "-1141010", MeasureType.Size }, // FABRICATION_PRIMARY_SIZE, "Size of Primary End"
+ // duplicate: "-1141010" // FABRICATION_PRI_SIZE, "Size of Primary End"
+ { "-1141011", MeasureType.Size }, // FABRICATION_SECONDARY_SIZE, "Size of Secondary End"
+ // duplicate: "-1141011" // FABRICATION_SEC_SIZE, "Size of Secondary End"
+ { "-1141012", MeasureType.Size }, // FABRICATION_BRANCH_SIZE, "Size of Primary Branch End"
+ { "-1141013", MeasureType.Size }, // FABRICATION_END_SIZE, "Size of Connector End"
+ { "-1150233", MeasureType.Size }, // RBS_ENERGY_ANALYSIS_BUILDING_ENVELOPE_ANALYTICAL_GRID_CELL_SIZE, "Analytical Grid Cell Size"
+ { "-1150426", MeasureType.Size }, // RBS_DUCT_CALCULATED_SIZE, "Duct Size"
+ { "-1150427", MeasureType.Size }, // RBS_PIPE_CALCULATED_SIZE, "Pipe Size"
+ { "-1150434", MeasureType.Size }, // RBS_REFERENCE_OVERALLSIZE, "Overall Size"
+ { "-1150435", MeasureType.Size }, // RBS_REFERENCE_FREESIZE, "Free Size"
+ { "-1154639", MeasureType.Size }, // COUPLER_MAIN_BAR_SIZE, "Bar Size 1"
+ { "-1154640", MeasureType.Size }, // COUPLER_COUPLED_BAR_SIZE, "Bar Size 2"
+
+ { "-1001387", MeasureType.Distance}, // STRUCTURAL_ATTACHMENT_START_VALUE_DISTANCE, "Start Attachment Distance"
+ { "-1001388", MeasureType.Distance}, // STRUCTURAL_ATTACHMENT_END_VALUE_DISTANCE, "End Attachment Distance"
+ { "-1001559", MeasureType.Distance}, // STRUCTURAL_COPING_DISTANCE, "Coping Distance"
+ { "-1006446", MeasureType.Distance}, // DIM_STYLE_DIM_LINE_SNAP_DIST, "Dimension Line Snap Distance"
+ { "-1006595", MeasureType.Distance}, // ALIGNMENT_STATION_LABEL_DISTANCE, "Distance": Currently not in use
+ { "-1006617", MeasureType.Distance}, // CUT_LINE_DISTANCE, "Cut Line Distance"
+ { "-1006625", MeasureType.Distance}, // DISTANCE_TO_CUT_MARK, "Distance to Cut Mark"
+ { "-1012403", MeasureType.Distance}, // BOUNDARY_DISTANCE, "Distance"
+ { "-1012614", MeasureType.Distance}, // PROPERTY_SEGMENT_DISTANCE, "Distance"
+ { "-1012828", MeasureType.Distance}, // WALL_TOP_EXTENSION_DIST_PARAM, "Top Extension Distance"
+ { "-1012829", MeasureType.Distance}, // WALL_BOTTOM_EXTENSION_DIST_PARAM, "Base Extension Distance"
+ { "-1013318", MeasureType.Distance}, // CURTAINGRID_USE_CURVE_DIST_VERT, "Use Curve Distance"
+ { "-1013319", MeasureType.Distance}, // CURTAINGRID_USE_CURVE_DIST_HORIZ, "Use Curve Distance"
+ { "-1013348", MeasureType.Distance}, // CURTAINGRID_USE_CURVE_DIST_1, "Use Curve Distance"
+ { "-1013349", MeasureType.Distance}, // CURTAINGRID_USE_CURVE_DIST_2, "Use Curve Distance"
+ { "-1013354", MeasureType.Distance}, // CURTAINGRID_USE_CURVE_DIST, "Use Curve Distance"
+ { "-1013372", MeasureType.Distance}, // SPACING_LENGTH_U, "Distance"
+ { "-1013373", MeasureType.Distance}, // SPACING_LENGTH_V, "Distance"
+ { "-1017738", MeasureType.Distance}, // FABRIC_WIRE_DISTANCE, "Wire distance": The distance between wires
+ { "-1050427", MeasureType.Distance}, // DIVIDEDPATH_DISTANCE, "Distance"
+ { "-1050430", MeasureType.Distance}, // DIVIDEDPATH_MIN_DISTANCE, "Minimum Distance"
+ { "-1050431", MeasureType.Distance}, // DIVIDEDPATH_MAX_DISTANCE, "Maximum Distance"
+ { "-1114397", MeasureType.Distance}, // GRID_BANK_ROW_HEIGHT, "Row Distance"
+ { "-1114398", MeasureType.Distance}, // GRID_BANK_COL_WIDTH, "Column Distance"
+ { "-1150177", MeasureType.Distance}, // STRUCTURAL_ATTACHMENT_BASE_DISTANCE, "Base Attachment Distance"
+ { "-1150181", MeasureType.Distance}, // STRUCTURAL_ATTACHMENT_TOP_DISTANCE, "Top Attachment Distance"
+ { "-1150216", MeasureType.Distance}, // STRUCTURAL_BEAM_START_ATTACHMENT_DISTANCE, "Start Attachment Distance"
+ { "-1150217", MeasureType.Distance}, // STRUCTURAL_BEAM_END_ATTACHMENT_DISTANCE, "End Attachment Distance"
+ { "-1151228", MeasureType.Distance}, // STAIRSTYPE_NOTCH_HORIZONTAL_GAP, "Horizontal Gap Distance":
+ { "-1151229", MeasureType.Distance}, // STAIRSTYPE_NOTCH_VERTICAL_GAP, "Vertical Gap Distance":
+ // duplicate: "-1151701" // STAIRS_SUPPORT_HORIZONTAL_OFFSET, "Lateral Offset": Distance from center or edge of boundary
+ // duplicate: "-1151702" // STAIRS_SUPPORT_VERTICAL_OFFSET, "Vertical Offset": Distance of top plane of edge stringer relative to the plane connecting tread nosing
+ { "-1155026", MeasureType.Distance}, // STEEL_ELEM_CONTOUR_SIDE1DIST, "Boundary distance 1"
+ { "-1155027", MeasureType.Distance}, // STEEL_ELEM_CONTOUR_SIDE2DIST, "Boundary distance 2"
+ { "-1155055", MeasureType.Distance}, // STEEL_ELEM_PATTERN_INTERMEDIATE_DISTANCE_X, "Intermediate distance on side 1"
+ { "-1155056", MeasureType.Distance}, // STEEL_ELEM_PATTERN_INTERMEDIATE_DISTANCE_Y, "Intermediate distance on side 2"
+ { "-1155057", MeasureType.Distance}, // STEEL_ELEM_PATTERN_EDGE_DISTANCE_X, "Edge distance on side 1"
+ { "-1155058", MeasureType.Distance}, // STEEL_ELEM_PATTERN_EDGE_DISTANCE_Y, "Edge distance on side 2"
+ { "-1155079", MeasureType.Distance}, // STEEL_ELEM_X_DISTANCE, "Side 1"
+ { "-1155080", MeasureType.Distance}, // STEEL_ELEM_Y_DISTANCE, "Side 2"
+ { "-1155082", MeasureType.Distance}, // STEEL_ELEM_COPE_DISTANCE_AXIS, "Distance from axis"
+ { "-1155238", MeasureType.Distance}, // LAYER_ELEM_TOP_EXTENSION_DIS, "Top Extension Distance"
+ { "-1155239", MeasureType.Distance}, // LAYER_ELEM_BASE_EXTENSION_DIS, "Base Extension Distance"
+ };
+ }
+}
diff --git a/src/cs/vim/Vim.Format/ObjectModel/ElementGeometryMap.cs b/src/cs/vim/Vim.Format/ObjectModel/ElementGeometryMap.cs
new file mode 100644
index 00000000..8977baf8
--- /dev/null
+++ b/src/cs/vim/Vim.Format/ObjectModel/ElementGeometryMap.cs
@@ -0,0 +1,201 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Vim.G3d;
+using Vim.LinqArray;
+using Vim.Math3d;
+
+namespace Vim.Format.ObjectModel
+{
+ ///
+ /// Represents the geometric information of an element.
+ ///
+ public class ElementGeometryInfo
+ {
+ public int ElementIndex { get; }
+
+ public int VertexCount { get; set; }
+
+ public int FaceCount { get; set; }
+
+ public AABox WorldSpaceBoundingBox { get; set; } = AABox.Empty;
+
+ public List<(int NodeIndex, int GeometryIndex)> NodeAndGeometryIndices { get; } = new List<(int NodeIndex, int GeometryIndex)>();
+
+ public int NodeCount
+ => NodeAndGeometryIndices.Count;
+
+ public bool HasGeometry
+ => FaceCount > 0;
+
+ ///
+ /// Constructor
+ ///
+ public ElementGeometryInfo(int elementIndex)
+ {
+ ElementIndex = elementIndex;
+ }
+ }
+
+ ///
+ /// A 1:1 list mapping ElementIndex -> ElementGeometryInfo
+ ///
+ public class ElementGeometryMap : IReadOnlyList
+ {
+ private readonly ElementGeometryInfo[] _items;
+
+ public IEnumerator GetEnumerator()
+ {
+ foreach (var item in _items)
+ yield return item;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator();
+
+ public int Count
+ => _items.Length;
+
+ public ElementGeometryInfo this[int index]
+ => _items[index];
+
+ public ElementGeometryInfo ElementAtOrDefault(int index)
+ => _items.ElementAtOrDefault(index);
+
+ ///
+ /// Constructor.
+ ///
+ public ElementGeometryMap(FileInfo vimFileInfo, G3D g3d = null)
+ {
+ g3d = g3d ?? vimFileInfo.GetGeometry();
+
+ var tableSet = new EntityTableSet(
+ vimFileInfo,
+ Array.Empty(),
+ n => n is TableNames.Node || n is TableNames.Element);
+
+ var elementCount = tableSet.ElementTable?.RowCount ?? 0;
+
+ _items = new ElementGeometryInfo[elementCount];
+
+ for (var elementIndex = 0; elementIndex < _items.Length; ++elementIndex)
+ _items[elementIndex] = new ElementGeometryInfo(elementIndex);
+
+ if (!(tableSet.NodeTable is NodeTable nodeTable))
+ return;
+
+ // Calculate the element associations to nodes and geometry.
+ // NOTE: one element may have more than one node and associated geometry
+
+ var elementIndexGroups = nodeTable
+ .Column_ElementIndex
+ .AsParallel()
+ .Select((elementIndex, nodeIndex) => (ElementIndex: elementIndex, NodeIndex: nodeIndex))
+ .GroupBy(t => t.ElementIndex)
+ .Where(g => g.Key >= 0);
+
+ foreach (var group in elementIndexGroups)
+ {
+ foreach (var (elementIndex, nodeIndex) in group)
+ {
+ if (elementIndex < 0 || elementIndex >= _items.Length)
+ continue;
+
+ // INVARIANT: there is a 1:1 relationship between Node entities and instances in the g3d buffer.
+ var instanceIndex = nodeIndex;
+
+ if (!TryGetGeometryIndex(g3d, instanceIndex, out var geometryIndex))
+ continue; // Skip nodes with no geometry.
+
+ _items[elementIndex].NodeAndGeometryIndices.Add((nodeIndex, geometryIndex));
+ }
+ }
+
+ // Calculate the element geometry in parallel.
+
+ Parallel.For(0, _items.Length, elementIndex =>
+ {
+ var item = _items[elementIndex];
+ var list = item.NodeAndGeometryIndices;
+ var vertexCount = 0;
+ var faceCount = 0;
+ var bb = new AABox(Vector3.MaxValue, Vector3.MinValue); // world space element bounding box
+
+ // Aggregate the geometry info
+ foreach (var (nodeIndex, geometryIndex) in list)
+ {
+ // INVARIANT: there is a 1:1 relationship between Node entities and instances in the g3d buffer.
+ var instanceIndex = nodeIndex;
+
+ if (!TryGetTransformedGeometryInfo(
+ g3d,
+ instanceIndex,
+ geometryIndex,
+ out var geometryVertexCount,
+ out var geometryFaceCount,
+ out var nodeBb))
+ {
+ continue;
+ }
+
+ // Aggregate the ElementGeometry data
+ vertexCount += geometryVertexCount;
+ faceCount += geometryFaceCount;
+ bb = bb.Merge(nodeBb);
+ }
+
+ item.VertexCount = vertexCount;
+ item.FaceCount = faceCount;
+ item.WorldSpaceBoundingBox = bb;
+ });
+ }
+
+ ///
+ /// Test constructor
+ ///
+ public ElementGeometryMap(IEnumerable items)
+ {
+ _items = items.ToArray();
+ }
+
+ private static bool TryGetGeometryIndex(G3D g3d, int instanceIndex, out int geometryIndex)
+ {
+ geometryIndex = -1;
+ geometryIndex = g3d.InstanceMeshes.ElementAtOrDefault(instanceIndex, -1);
+ return geometryIndex >= 0;
+ }
+
+ private static bool TryGetTransformedGeometryInfo(
+ G3D g3d,
+ int instanceIndex,
+ int geometryIndex,
+ out int vertexCount,
+ out int faceCount,
+ out AABox worldSpaceBb)
+ {
+ vertexCount = 0;
+ faceCount = 0;
+ worldSpaceBb = AABox.Empty;
+
+ if (geometryIndex < 0)
+ return false;
+
+ var g3dMesh = g3d.Meshes.ElementAtOrDefault(geometryIndex);
+ if (g3dMesh == null)
+ return false;
+
+ vertexCount = g3dMesh.NumVertices;
+ faceCount = g3dMesh.NumFaces;
+
+ var transform = g3d.InstanceTransforms.ElementAtOrDefault(instanceIndex, Matrix4x4.Identity);
+
+ // Calculate the world-space bounding box of the mesh.
+ worldSpaceBb = AABox.Create(g3dMesh.Vertices.ToArray().Select(v => v.Transform(transform)));
+
+ return true;
+ }
+ }
+}
diff --git a/src/cs/vim/Vim.Format/ObjectModel/ElementIndexMaps.cs b/src/cs/vim/Vim.Format/ObjectModel/ElementIndexMaps.cs
index 4684f302..1293cae5 100644
--- a/src/cs/vim/Vim.Format/ObjectModel/ElementIndexMaps.cs
+++ b/src/cs/vim/Vim.Format/ObjectModel/ElementIndexMaps.cs
@@ -90,20 +90,31 @@ public ElementIndexMaps(EntityTableSet entityTables, bool inParallel = true)
public static DictionaryOfLists GetElementIndicesMap(EntityTable et)
{
var indicesMap = new DictionaryOfLists();
- var elementIndices = et?.IndexColumns[ElementIndexColumnName]?.GetTypedData();
+
+ if (et?.IndexColumns?.Contains(ElementIndexColumnName) != true)
+ return indicesMap;
+
+ var elementIndices = et.IndexColumns[ElementIndexColumnName]?.GetTypedData();
if (elementIndices == null)
return indicesMap;
+
for (var i = 0; i < elementIndices.Length; ++i)
indicesMap.Add(elementIndices[i], i);
+
return indicesMap;
}
public static DictionaryOfLists GetElementIndicesMap(EntityTable_v2 et)
{
var indicesMap = new DictionaryOfLists();
- var elementIndices = et?.IndexColumns[ElementIndexColumnName]?.GetTypedData();
+
+ if (et?.IndexColumns?.TryGetValue(ElementIndexColumnName, out var buffer) != true || buffer == null)
+ return indicesMap;
+
+ var elementIndices = buffer.GetTypedData();
if (elementIndices == null)
return indicesMap;
+
for (var i = 0; i < elementIndices.Length; ++i)
indicesMap.Add(elementIndices[i], i);
return indicesMap;
@@ -112,18 +123,25 @@ public static DictionaryOfLists GetElementIndicesMap(EntityTable_v2 et
public static IndexMap GetElementIndexMap(EntityTable et)
{
var indexMap = new IndexMap();
- var elementIndices = et?.IndexColumns[ElementIndexColumnName]?.GetTypedData();
+
+ if (et?.IndexColumns?.Contains(ElementIndexColumnName) != true)
+ return indexMap;
+
+ var elementIndices = et.IndexColumns[ElementIndexColumnName]?.GetTypedData();
if (elementIndices == null)
return indexMap;
+
for (var i = 0; i < elementIndices.Length; ++i)
indexMap.TryAdd(elementIndices[i], i);
+
return indexMap;
}
public static IndexMap GetElementIndexMap(EntityTable_v2 et)
{
var indexMap = new IndexMap();
- if (et?.IndexColumns.TryGetValue(ElementIndexColumnName, out var buffer) != true || buffer == null)
+
+ if (et?.IndexColumns?.TryGetValue(ElementIndexColumnName, out var buffer) != true || buffer == null)
return indexMap;
var elementIndices = buffer.GetTypedData();
diff --git a/src/cs/vim/Vim.Format/ObjectModel/EntitySetBuilder.cs b/src/cs/vim/Vim.Format/ObjectModel/EntitySetBuilder.cs
new file mode 100644
index 00000000..8f062169
--- /dev/null
+++ b/src/cs/vim/Vim.Format/ObjectModel/EntitySetBuilder.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Vim.Util;
+
+namespace Vim.Format.ObjectModel
+{
+ public class EntitySetBuilder where TEntity : Entity
+ {
+ public readonly string EntityTableName;
+ public readonly List Entities = new List();
+ public readonly IndexedSet
[TableName(TableNames.Family)]
+ [ElementKind(ElementKind.Family)]
public partial class Family : EntityWithElement
{
public string StructuralMaterialType;
@@ -766,6 +916,7 @@ public partial class Family : EntityWithElement
/// In the Revit API, the FamilyType closely correlates to the FamilySymbol class.
///
[TableName(TableNames.FamilyType)]
+ [ElementKind(ElementKind.FamilyType)]
public partial class FamilyType : EntityWithElement
{
public bool IsSystemFamilyType;
@@ -780,6 +931,7 @@ public partial class FamilyType : EntityWithElement
///
[TableName(TableNames.FamilyInstance)]
[CascadeElementRemap]
+ [ElementKind(ElementKind.FamilyInstance)]
public partial class FamilyInstance : EntityWithElement
{
public bool FacingFlipped;
@@ -855,6 +1007,7 @@ public Vector3 HandOrientation
/// Represents a 3D or a 2D view.
///
[TableName(TableNames.View)]
+ [ElementKind(ElementKind.View)]
public partial class View : EntityWithElement
{
public string Title;
@@ -1072,6 +1225,7 @@ public partial class Camera : Entity
[G3dAttributeReference("g3d:material:color:0:float32:4", G3dAttributeReferenceMultiplicity.OneToOne)]
[G3dAttributeReference("g3d:material:glossiness:0:float32:1", G3dAttributeReferenceMultiplicity.OneToOne)]
[G3dAttributeReference("g3d:material:smoothness:0:float32:1", G3dAttributeReferenceMultiplicity.OneToOne)]
+ [ElementKind(ElementKind.Material)]
public partial class Material : EntityWithElement
{
///
@@ -1334,6 +1488,7 @@ public enum SystemType
/// Represents a collection of Elements which compose a System. These may be mechanical systems, piping systems, electrical systems, curtain walls, stairs, etc.
///
[TableName(TableNames.System)]
+ [ElementKind(ElementKind.System)]
public partial class System : EntityWithElement
{
///
@@ -1440,6 +1595,7 @@ public object GetStorageKey()
/// BasePoints are only exported in Revit 2021+
///
[TableName(TableNames.BasePoint)]
+ [ElementKind(ElementKind.BasePoint)]
public partial class BasePoint : EntityWithElement
{
///
@@ -1500,6 +1656,7 @@ public enum PhaseStatusPresentation
/// Represents a row in the Phase Filters view in Revit.
///
[TableName(TableNames.PhaseFilter)]
+ [ElementKind(ElementKind.PhaseFilter)]
public partial class PhaseFilter : EntityWithElement
{
///
@@ -1539,6 +1696,7 @@ public PhaseStatusPresentation GetTemporaryPhaseStatusPresentation()
/// Represents a vertical plane (or a vertical cylindrical segment when curved).
///
[TableName(TableNames.Grid)]
+ [ElementKind(ElementKind.Grid)]
public partial class Grid : EntityWithElement
{
///
@@ -1600,6 +1758,7 @@ public DAABox Extents
/// Represents a planar region which can be used to represent places like parking spots.
///
[TableName(TableNames.Area)]
+ [ElementKind(ElementKind.Area)]
public partial class Area : EntityWithElement
{
///
@@ -1632,6 +1791,7 @@ public partial class Area : EntityWithElement
/// Represents an area categorization, for example to differentiate between parking areas and waste/dump areas.
///
[TableName(TableNames.AreaScheme)]
+ [ElementKind(ElementKind.AreaScheme)]
public partial class AreaScheme : EntityWithElement
{
///
@@ -1644,6 +1804,8 @@ public partial class AreaScheme : EntityWithElement
/// Represents tabular data composed of named columns and cells containing string values.
///
[TableName(TableNames.Schedule)]
+ [ElementKind(ElementKind.Schedule)]
+
public partial class Schedule : EntityWithElement
{ }
@@ -1695,13 +1857,16 @@ public partial class ScheduleCell : Entity
/// Represents a view sheet set, which is a collection of views and view sheets.
///
[TableName(TableNames.ViewSheetSet)]
+ [ElementKind(ElementKind.ViewSheetSet)]
public partial class ViewSheetSet : EntityWithElement
- { }
+ {
+ }
///
/// Represents a view sheet, which can contain multiple views.
///
[TableName(TableNames.ViewSheet)]
+ [ElementKind(ElementKind.ViewSheet)]
public partial class ViewSheet : EntityWithElement
{
///
@@ -1750,6 +1915,7 @@ public object GetStorageKey()
}
[TableName(TableNames.Site)]
+ [ElementKind(ElementKind.Site)]
public partial class Site : EntityWithElement
{
public double Latitude;
@@ -1760,6 +1926,7 @@ public partial class Site : EntityWithElement
}
[TableName(TableNames.Building)]
+ [ElementKind(ElementKind.Building)]
public partial class Building : EntityWithElement
{
///
@@ -1800,6 +1967,18 @@ public static EntityColumnLoadingInfo[] GetEntityColumnLoadingInfo(this FieldInf
public static bool IsEntityAndHasTableNameAttribute(this Type t)
=> typeof(Entity).IsAssignableFrom(t) && t.GetCustomAttribute(typeof(TableNameAttribute)) != null;
+ public static ElementKind GetElementKind(this Type t)
+ {
+ if (t.GetCustomAttribute(typeof(ElementKindAttribute)) is ElementKindAttribute attr)
+ {
+ return attr.ElementKind;
+ }
+ else
+ {
+ return ElementKind.Unknown;
+ }
+ }
+
public static IEnumerable GetEntityTypes() where T : Entity
=> typeof(T).Assembly.GetAllSubclassesOf(typeof(T));
diff --git a/src/cs/vim/Vim.Format/ObjectModel/ObjectModelBuilder.cs b/src/cs/vim/Vim.Format/ObjectModel/ObjectModelBuilder.cs
index 71280797..ad2952d4 100644
--- a/src/cs/vim/Vim.Format/ObjectModel/ObjectModelBuilder.cs
+++ b/src/cs/vim/Vim.Format/ObjectModel/ObjectModelBuilder.cs
@@ -1,29 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using Vim.Util;
-
-namespace Vim.Format.ObjectModel
+namespace Vim.Format.ObjectModel
{
- public readonly struct GetOrAddResult where TEntity : Entity
- {
- public readonly TEntity Entity;
- public readonly bool Added;
-
- public GetOrAddResult(TEntity entity, bool added)
- => (Entity, Added) = (entity, added);
-
- public static GetOrAddResult Empty
- => new GetOrAddResult(null, false);
-
- public bool IsEmpty
- => Entity == null;
-
- public void Deconstruct(out TEntity entity, out bool added)
- => (entity, added) = (Entity, Added);
- }
-
///
/// This class makes it easy to fill out the entity tables of a VIM, by allowing the user to specify a mapping
/// between objects in the source domain (e.g. Revit.Element) and entities. This allows a programmer to not
@@ -32,139 +8,7 @@ public void Deconstruct(out TEntity entity, out bool added)
///
public partial class ObjectModelBuilder
{
- public class EntityTableBuilder
- {
- public readonly List Entities = new List();
- public readonly IndexedSet KeyToEntityIndex = new IndexedSet();
-
- ///
- /// Adds the entity but does not update the KeyToEntityIndex member.
- /// NOTE: Revit Parameters take up a *LOT* of memory and have previously caused System.OutOfMemoryExceptions
- /// when KeyToEntityIndex was trying to resize itself. To work around this issue, AddUntracked should be used
- /// when objects can be blindly added into the entity table.
- ///
- public TEntity AddUntracked(TEntity entity) where TEntity : Entity
- {
- // Update the entity's index.
- var index = Entities.Count;
- entity.Index = index;
-
- Entities.Add(entity);
-
- return entity;
- }
-
- ///
- /// Adds the provided entity and assigns it to the given key. Tracks the entity in the
- /// NOTE: this method mutates the entity's Index.
- ///
- public GetOrAddResult Add(object key, TEntity entity) where TEntity : Entity
- {
- Debug.Assert(KeyToEntityIndex.Count == Entities.Count);
-
- var addedEntity = AddUntracked(entity); // mutates entity.Index; addedEntity == entity.
-
- KeyToEntityIndex.Add(key, addedEntity.Index);
-
- return new GetOrAddResult(addedEntity, true);
- }
-
- ///
- /// Adds the provided entity.
- /// NOTE: this method mutates the entity's Index.
- ///
- public GetOrAddResult Add(TEntity entity) where TEntity : Entity
- => Add(new object(), entity);
-
- ///
- /// Gets or adds the provided entity based on the given key.
- /// NOTE: this method mutates the entity's Index.
- ///
- public GetOrAddResult GetOrAdd(object key, Func getEntity) where TEntity : Entity
- {
- if (KeyToEntityIndex.TryGetValue(key, out var storedEntityIndex))
- return new GetOrAddResult(Entities[storedEntityIndex] as TEntity, false);
-
- Debug.Assert(KeyToEntityIndex.Count == Entities.Count);
-
- // Obtain the entity
- var entity = getEntity(key);
- if (entity == null)
- return new GetOrAddResult(null, false);
-
- // Add the entity and sets its index.
- return Add(key, entity);
- }
- }
-
- public DocumentBuilder AddEntityTablesToDocumentBuilder(DocumentBuilder db)
- {
- foreach (var kv in EntityTableBuilders)
- {
- var tableName = kv.Key.GetEntityTableName();
- var tb = kv.Key.GetTableBuilderFunc()(kv.Value.Entities);
- db.Tables.Add(tableName, tb);
- }
- return db;
- }
-
- public EntityTableBuilder GetOrAddEntityTableBuilder() where TEntity : Entity
- => EntityTableBuilders.GetOrCompute(typeof(TEntity), _ => new EntityTableBuilder());
-
- public GetOrAddResult GetOrAdd(object key, Func getEntity) where TEntity : Entity
- => GetOrAddEntityTableBuilder().GetOrAdd(key, getEntity);
-
- public TEntity Add(TEntity e) where TEntity : Entity
- => GetOrAddEntityTableBuilder().Add(e).Entity;
-
- public TEntity AddUntracked(TEntity e) where TEntity : Entity
- => GetOrAddEntityTableBuilder().AddUntracked(e);
-
- public bool TryGet(object key, out TEntity value) where TEntity : Entity
- {
- value = default;
-
- if (!EntityTableBuilders.TryGetValue(typeof(TEntity), out var entityTableBuilder))
- return false;
-
- if (!entityTableBuilder.KeyToEntityIndex.TryGetValue(key, out var index))
- return false;
-
- value = entityTableBuilder.Entities[index] as TEntity;
- return value != null;
- }
-
- public TEntity GetOrDefault(object key) where TEntity : Entity
- => TryGet(key, out var e) ? e : default;
-
public DocumentBuilder ToDocumentBuilder(string generator, string versionString)
- => AddEntityTablesToDocumentBuilder(new DocumentBuilder(generator, SchemaVersion.Current, versionString));
-
- public bool HasBuilder(Type t)
- => EntityTableBuilders.ContainsKey(t);
-
- public bool HasKey(Type t, object key)
- => HasBuilder(t) && EntityTableBuilders[t].KeyToEntityIndex.ContainsKey(key);
-
- public IndexedSet GetLookup()
- => GetLookup(typeof(TEntity));
-
- public IndexedSet GetLookup(Type t)
- => EntityTableBuilders[t].KeyToEntityIndex;
-
- public int IndexOf(object key)
- => GetLookup().GetOrDefault(key, -1);
-
- public EntityTableBuilder GetEntityTableBuilder()
- => GetEntityTableBuilder(typeof(TEntity));
-
- public EntityTableBuilder GetEntityTableBuilder(Type t)
- => EntityTableBuilders.GetOrDefault(t);
-
- public IEnumerable GetEntities() where TEntity : Entity
- => GetEntityTableBuilder()?.Entities?.Cast();
-
- public TEntity GetEntityByIndex(int index) where TEntity : Entity
- => GetEntityTableBuilder()?.Entities[index] as TEntity;
+ => AddEntityTableSets(new DocumentBuilder(generator, SchemaVersion.Current, versionString));
}
}
diff --git a/src/cs/vim/Vim.Format/ObjectModel/ObjectModelExtensions.cs b/src/cs/vim/Vim.Format/ObjectModel/ObjectModelExtensions.cs
index ceab0b2c..75ed6734 100644
--- a/src/cs/vim/Vim.Format/ObjectModel/ObjectModelExtensions.cs
+++ b/src/cs/vim/Vim.Format/ObjectModel/ObjectModelExtensions.cs
@@ -3,8 +3,11 @@
using System.Data;
using System.IO;
using System.Linq;
+using Vim.Format.Geometry;
+using Vim.G3d;
using Vim.Util;
using Vim.LinqArray;
+using Vim.Math3d;
namespace Vim.Format.ObjectModel
{
@@ -174,5 +177,84 @@ public static DataTable GetScheduleAsDataTable(this DocumentModel dm, int schedu
return dataTable;
}
+
+ ///
+ /// Returns the list of parameter indices associated with the given element index.
+ ///
+ public static List GetParameterIndicesFromElementIndex(this ElementIndexMaps elementIndexMaps, int elementIndex)
+ {
+ return elementIndexMaps.ParameterIndicesFromElementIndex.TryGetValue(elementIndex, out var parameterIndices)
+ ? parameterIndices
+ : new List();
+ }
+
+ ///
+ /// Returns a grouping of entities representing elements by bim document index.
+ ///
+ public static IEnumerable> GroupByBimDocumentIndex(
+ this IEnumerable entityWithElementCollection,
+ ElementTable elementTable)
+ where T : IElementIndex
+ {
+ entityWithElementCollection = entityWithElementCollection ?? Array.Empty();
+
+ var elementBimDocumentIndices = elementTable.Column_BimDocumentIndex;
+
+ return entityWithElementCollection.GroupBy(e =>
+ elementBimDocumentIndices.ElementAtOrDefault(e.GetElementIndexOrNone(), EntityRelation.None));
+ }
+
+ ///
+ /// Returns a dictionary mapping a bim document index to a dictionary of entities whose keys are those entities' element IDs.
+ /// This is useful when you want to scope elements in a BIM document and when you are referring to elements by their IDs.
+ /// Note 1: Element IDs are only unique within their respective BIM documents.
+ /// Note 2: Entities which do not have an element association will not appear in the returned value.
+ ///
+ public static Dictionary> GroupByBimDocumentIndexAndElementId(
+ this IEnumerable entityWithElementCollection,
+ ElementTable elementTable)
+ where T : IElementIndex
+ {
+ entityWithElementCollection = entityWithElementCollection ?? Array.Empty();
+
+ var elementIds = elementTable.Column_Id;
+
+ var result = entityWithElementCollection
+ .GroupByBimDocumentIndex(elementTable)
+ // For each bim document group, create a mapping from elementID to each entity.
+ .ToDictionary(
+ groupByBimDocumentIndex => groupByBimDocumentIndex.Key,
+ groupByBimDocumentIndex =>
+ {
+ var elementIdToEntityWithElementMap = new Dictionary();
+
+ foreach (var entityWithElement in groupByBimDocumentIndex)
+ {
+ var elementIndex = entityWithElement.GetElementIndexOrNone();
+ if (elementIndex == EntityRelation.None)
+ continue; // Skip entities which do not have an element index.
+
+ var elementId = elementIds.ElementAtOrDefault(elementIndex);
+ elementIdToEntityWithElementMap[elementId] = entityWithElement;
+ }
+ return elementIdToEntityWithElementMap;
+ });
+
+ return result;
+ }
+
+ ///
+ /// Returns the entity corresponding to the given element ID.
+ /// IMPORTANT: if the given element ID is -1 or is not present in the given map, returns false and the item will be null.
+ ///
+ public static bool TryGetEntityFromElementId(
+ this IReadOnlyDictionary elementIdMap,
+ long elementId,
+ out T item)
+ where T: class
+ {
+ item = null;
+ return elementId != -1L && elementIdMap.TryGetValue(elementId, out item);
+ }
}
}
diff --git a/src/cs/vim/Vim.Format/ObjectModel/ObjectModelGenerated.cs b/src/cs/vim/Vim.Format/ObjectModel/ObjectModelGenerated.cs
index d77aaee9..bbd5a3b2 100644
--- a/src/cs/vim/Vim.Format/ObjectModel/ObjectModelGenerated.cs
+++ b/src/cs/vim/Vim.Format/ObjectModel/ObjectModelGenerated.cs
@@ -67,7 +67,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ParameterDescriptor
{
- public Vim.Format.ObjectModel.DisplayUnit DisplayUnit => _DisplayUnit.Value;
+ public Vim.Format.ObjectModel.DisplayUnit DisplayUnit => _DisplayUnit?.Value;
+ public int DisplayUnitIndex => _DisplayUnit?.Index ?? EntityRelation.None;
public ParameterDescriptor()
{
_DisplayUnit = new Relation();
@@ -104,8 +105,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Parameter
{
- public Vim.Format.ObjectModel.ParameterDescriptor ParameterDescriptor => _ParameterDescriptor.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.ParameterDescriptor ParameterDescriptor => _ParameterDescriptor?.Value;
+ public int ParameterDescriptorIndex => _ParameterDescriptor?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Parameter()
{
_ParameterDescriptor = new Relation();
@@ -136,17 +139,28 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Element
{
- public Vim.Format.ObjectModel.Level Level => _Level.Value;
- public Vim.Format.ObjectModel.Phase PhaseCreated => _PhaseCreated.Value;
- public Vim.Format.ObjectModel.Phase PhaseDemolished => _PhaseDemolished.Value;
- public Vim.Format.ObjectModel.Category Category => _Category.Value;
- public Vim.Format.ObjectModel.Workset Workset => _Workset.Value;
- public Vim.Format.ObjectModel.DesignOption DesignOption => _DesignOption.Value;
- public Vim.Format.ObjectModel.View OwnerView => _OwnerView.Value;
- public Vim.Format.ObjectModel.Group Group => _Group.Value;
- public Vim.Format.ObjectModel.AssemblyInstance AssemblyInstance => _AssemblyInstance.Value;
- public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument.Value;
- public Vim.Format.ObjectModel.Room Room => _Room.Value;
+ public Vim.Format.ObjectModel.Level Level => _Level?.Value;
+ public int LevelIndex => _Level?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Phase PhaseCreated => _PhaseCreated?.Value;
+ public int PhaseCreatedIndex => _PhaseCreated?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Phase PhaseDemolished => _PhaseDemolished?.Value;
+ public int PhaseDemolishedIndex => _PhaseDemolished?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Category Category => _Category?.Value;
+ public int CategoryIndex => _Category?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Workset Workset => _Workset?.Value;
+ public int WorksetIndex => _Workset?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.DesignOption DesignOption => _DesignOption?.Value;
+ public int DesignOptionIndex => _DesignOption?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.View OwnerView => _OwnerView?.Value;
+ public int OwnerViewIndex => _OwnerView?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Group Group => _Group?.Value;
+ public int GroupIndex => _Group?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.AssemblyInstance AssemblyInstance => _AssemblyInstance?.Value;
+ public int AssemblyInstanceIndex => _AssemblyInstance?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument?.Value;
+ public int BimDocumentIndex => _BimDocument?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Room Room => _Room?.Value;
+ public int RoomIndex => _Room?.Index ?? EntityRelation.None;
public Element()
{
_Level = new Relation();
@@ -203,7 +217,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Workset
{
- public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument.Value;
+ public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument?.Value;
+ public int BimDocumentIndex => _BimDocument?.Index ?? EntityRelation.None;
public Workset()
{
_BimDocument = new Relation();
@@ -238,7 +253,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class AssemblyInstance
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public AssemblyInstance()
{
_Element = new Relation();
@@ -270,7 +286,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Group
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Group()
{
_Element = new Relation();
@@ -302,7 +319,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class DesignOption
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public DesignOption()
{
_Element = new Relation();
@@ -331,9 +349,12 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Level
{
- public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType.Value;
- public Vim.Format.ObjectModel.Building Building => _Building.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType?.Value;
+ public int FamilyTypeIndex => _FamilyType?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Building Building => _Building?.Value;
+ public int BuildingIndex => _Building?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Level()
{
_FamilyType = new Relation();
@@ -367,7 +388,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Phase
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Phase()
{
_Element = new Relation();
@@ -395,8 +417,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Room
{
- public Vim.Format.ObjectModel.Level UpperLimit => _UpperLimit.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Level UpperLimit => _UpperLimit?.Value;
+ public int UpperLimitIndex => _UpperLimit?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Room()
{
_UpperLimit = new Relation();
@@ -433,10 +457,14 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class BimDocument
{
- public Vim.Format.ObjectModel.View ActiveView => _ActiveView.Value;
- public Vim.Format.ObjectModel.Family OwnerFamily => _OwnerFamily.Value;
- public Vim.Format.ObjectModel.BimDocument Parent => _Parent.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.View ActiveView => _ActiveView?.Value;
+ public int ActiveViewIndex => _ActiveView?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Family OwnerFamily => _OwnerFamily?.Value;
+ public int OwnerFamilyIndex => _OwnerFamily?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.BimDocument Parent => _Parent?.Value;
+ public int ParentIndex => _Parent?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public BimDocument()
{
_ActiveView = new Relation();
@@ -498,8 +526,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class DisplayUnitInBimDocument
{
- public Vim.Format.ObjectModel.DisplayUnit DisplayUnit => _DisplayUnit.Value;
- public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument.Value;
+ public Vim.Format.ObjectModel.DisplayUnit DisplayUnit => _DisplayUnit?.Value;
+ public int DisplayUnitIndex => _DisplayUnit?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument?.Value;
+ public int BimDocumentIndex => _BimDocument?.Index ?? EntityRelation.None;
public DisplayUnitInBimDocument()
{
_DisplayUnit = new Relation();
@@ -529,8 +559,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class PhaseOrderInBimDocument
{
- public Vim.Format.ObjectModel.Phase Phase => _Phase.Value;
- public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument.Value;
+ public Vim.Format.ObjectModel.Phase Phase => _Phase?.Value;
+ public int PhaseIndex => _Phase?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument?.Value;
+ public int BimDocumentIndex => _BimDocument?.Index ?? EntityRelation.None;
public PhaseOrderInBimDocument()
{
_Phase = new Relation();
@@ -561,8 +593,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Category
{
- public Vim.Format.ObjectModel.Category Parent => _Parent.Value;
- public Vim.Format.ObjectModel.Material Material => _Material.Value;
+ public Vim.Format.ObjectModel.Category Parent => _Parent?.Value;
+ public int ParentIndex => _Parent?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Material Material => _Material?.Value;
+ public int MaterialIndex => _Material?.Index ?? EntityRelation.None;
public Category()
{
_Parent = new Relation();
@@ -599,8 +633,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Family
{
- public Vim.Format.ObjectModel.Category FamilyCategory => _FamilyCategory.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Category FamilyCategory => _FamilyCategory?.Value;
+ public int FamilyCategoryIndex => _FamilyCategory?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Family()
{
_FamilyCategory = new Relation();
@@ -634,9 +670,12 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class FamilyType
{
- public Vim.Format.ObjectModel.Family Family => _Family.Value;
- public Vim.Format.ObjectModel.CompoundStructure CompoundStructure => _CompoundStructure.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Family Family => _Family?.Value;
+ public int FamilyIndex => _Family?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.CompoundStructure CompoundStructure => _CompoundStructure?.Value;
+ public int CompoundStructureIndex => _CompoundStructure?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public FamilyType()
{
_Family = new Relation();
@@ -669,12 +708,18 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class FamilyInstance
{
- public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType.Value;
- public Vim.Format.ObjectModel.Element Host => _Host.Value;
- public Vim.Format.ObjectModel.Room FromRoom => _FromRoom.Value;
- public Vim.Format.ObjectModel.Room ToRoom => _ToRoom.Value;
- public Vim.Format.ObjectModel.Element SuperComponent => _SuperComponent.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType?.Value;
+ public int FamilyTypeIndex => _FamilyType?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Host => _Host?.Value;
+ public int HostIndex => _Host?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Room FromRoom => _FromRoom?.Value;
+ public int FromRoomIndex => _FromRoom?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Room ToRoom => _ToRoom?.Value;
+ public int ToRoomIndex => _ToRoom?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element SuperComponent => _SuperComponent?.Value;
+ public int SuperComponentIndex => _SuperComponent?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public FamilyInstance()
{
_FamilyType = new Relation();
@@ -735,9 +780,12 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class View
{
- public Vim.Format.ObjectModel.Camera Camera => _Camera.Value;
- public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Camera Camera => _Camera?.Value;
+ public int CameraIndex => _Camera?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType?.Value;
+ public int FamilyTypeIndex => _FamilyType?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public View()
{
_Camera = new Relation();
@@ -792,8 +840,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ElementInView
{
- public Vim.Format.ObjectModel.View View => _View.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.View View => _View?.Value;
+ public int ViewIndex => _View?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public ElementInView()
{
_View = new Relation();
@@ -823,8 +873,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ShapeInView
{
- public Vim.Format.ObjectModel.Shape Shape => _Shape.Value;
- public Vim.Format.ObjectModel.View View => _View.Value;
+ public Vim.Format.ObjectModel.Shape Shape => _Shape?.Value;
+ public int ShapeIndex => _Shape?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.View View => _View?.Value;
+ public int ViewIndex => _View?.Index ?? EntityRelation.None;
public ShapeInView()
{
_Shape = new Relation();
@@ -854,8 +906,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class AssetInView
{
- public Vim.Format.ObjectModel.Asset Asset => _Asset.Value;
- public Vim.Format.ObjectModel.View View => _View.Value;
+ public Vim.Format.ObjectModel.Asset Asset => _Asset?.Value;
+ public int AssetIndex => _Asset?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.View View => _View?.Value;
+ public int ViewIndex => _View?.Index ?? EntityRelation.None;
public AssetInView()
{
_Asset = new Relation();
@@ -885,8 +939,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class AssetInViewSheet
{
- public Vim.Format.ObjectModel.Asset Asset => _Asset.Value;
- public Vim.Format.ObjectModel.ViewSheet ViewSheet => _ViewSheet.Value;
+ public Vim.Format.ObjectModel.Asset Asset => _Asset?.Value;
+ public int AssetIndex => _Asset?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.ViewSheet ViewSheet => _ViewSheet?.Value;
+ public int ViewSheetIndex => _ViewSheet?.Index ?? EntityRelation.None;
public AssetInViewSheet()
{
_Asset = new Relation();
@@ -916,8 +972,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class LevelInView
{
- public Vim.Format.ObjectModel.Level Level => _Level.Value;
- public Vim.Format.ObjectModel.View View => _View.Value;
+ public Vim.Format.ObjectModel.Level Level => _Level?.Value;
+ public int LevelIndex => _Level?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.View View => _View?.Value;
+ public int ViewIndex => _View?.Index ?? EntityRelation.None;
public LevelInView()
{
_Level = new Relation();
@@ -987,9 +1045,12 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Material
{
- public Vim.Format.ObjectModel.Asset ColorTextureFile => _ColorTextureFile.Value;
- public Vim.Format.ObjectModel.Asset NormalTextureFile => _NormalTextureFile.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Asset ColorTextureFile => _ColorTextureFile?.Value;
+ public int ColorTextureFileIndex => _ColorTextureFile?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Asset NormalTextureFile => _NormalTextureFile?.Value;
+ public int NormalTextureFileIndex => _NormalTextureFile?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Material()
{
_ColorTextureFile = new Relation();
@@ -1038,8 +1099,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class MaterialInElement
{
- public Vim.Format.ObjectModel.Material Material => _Material.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Material Material => _Material?.Value;
+ public int MaterialIndex => _Material?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public MaterialInElement()
{
_Material = new Relation();
@@ -1072,8 +1135,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class CompoundStructureLayer
{
- public Vim.Format.ObjectModel.Material Material => _Material.Value;
- public Vim.Format.ObjectModel.CompoundStructure CompoundStructure => _CompoundStructure.Value;
+ public Vim.Format.ObjectModel.Material Material => _Material?.Value;
+ public int MaterialIndex => _Material?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.CompoundStructure CompoundStructure => _CompoundStructure?.Value;
+ public int CompoundStructureIndex => _CompoundStructure?.Index ?? EntityRelation.None;
public CompoundStructureLayer()
{
_Material = new Relation();
@@ -1106,7 +1171,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class CompoundStructure
{
- public Vim.Format.ObjectModel.CompoundStructureLayer StructuralLayer => _StructuralLayer.Value;
+ public Vim.Format.ObjectModel.CompoundStructureLayer StructuralLayer => _StructuralLayer?.Value;
+ public int StructuralLayerIndex => _StructuralLayer?.Index ?? EntityRelation.None;
public CompoundStructure()
{
_StructuralLayer = new Relation();
@@ -1135,7 +1201,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Node
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Node()
{
_Element = new Relation();
@@ -1196,7 +1263,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Shape
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Shape()
{
_Element = new Relation();
@@ -1224,7 +1292,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ShapeCollection
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public ShapeCollection()
{
_Element = new Relation();
@@ -1252,8 +1321,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ShapeInShapeCollection
{
- public Vim.Format.ObjectModel.Shape Shape => _Shape.Value;
- public Vim.Format.ObjectModel.ShapeCollection ShapeCollection => _ShapeCollection.Value;
+ public Vim.Format.ObjectModel.Shape Shape => _Shape?.Value;
+ public int ShapeIndex => _Shape?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.ShapeCollection ShapeCollection => _ShapeCollection?.Value;
+ public int ShapeCollectionIndex => _ShapeCollection?.Index ?? EntityRelation.None;
public ShapeInShapeCollection()
{
_Shape = new Relation();
@@ -1283,8 +1354,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class System
{
- public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType?.Value;
+ public int FamilyTypeIndex => _FamilyType?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public System()
{
_FamilyType = new Relation();
@@ -1315,8 +1388,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ElementInSystem
{
- public Vim.Format.ObjectModel.System System => _System.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.System System => _System?.Value;
+ public int SystemIndex => _System?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public ElementInSystem()
{
_System = new Relation();
@@ -1347,7 +1422,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Warning
{
- public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument.Value;
+ public Vim.Format.ObjectModel.BimDocument BimDocument => _BimDocument?.Value;
+ public int BimDocumentIndex => _BimDocument?.Index ?? EntityRelation.None;
public Warning()
{
_BimDocument = new Relation();
@@ -1378,8 +1454,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ElementInWarning
{
- public Vim.Format.ObjectModel.Warning Warning => _Warning.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Warning Warning => _Warning?.Value;
+ public int WarningIndex => _Warning?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public ElementInWarning()
{
_Warning = new Relation();
@@ -1409,7 +1487,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class BasePoint
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public BasePoint()
{
_Element = new Relation();
@@ -1444,7 +1523,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class PhaseFilter
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public PhaseFilter()
{
_Element = new Relation();
@@ -1476,8 +1556,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Grid
{
- public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType?.Value;
+ public int FamilyTypeIndex => _FamilyType?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Grid()
{
_FamilyType = new Relation();
@@ -1520,8 +1602,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Area
{
- public Vim.Format.ObjectModel.AreaScheme AreaScheme => _AreaScheme.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.AreaScheme AreaScheme => _AreaScheme?.Value;
+ public int AreaSchemeIndex => _AreaScheme?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Area()
{
_AreaScheme = new Relation();
@@ -1555,7 +1639,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class AreaScheme
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public AreaScheme()
{
_Element = new Relation();
@@ -1584,7 +1669,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Schedule
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Schedule()
{
_Element = new Relation();
@@ -1612,7 +1698,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ScheduleColumn
{
- public Vim.Format.ObjectModel.Schedule Schedule => _Schedule.Value;
+ public Vim.Format.ObjectModel.Schedule Schedule => _Schedule?.Value;
+ public int ScheduleIndex => _Schedule?.Index ?? EntityRelation.None;
public ScheduleColumn()
{
_Schedule = new Relation();
@@ -1642,7 +1729,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ScheduleCell
{
- public Vim.Format.ObjectModel.ScheduleColumn ScheduleColumn => _ScheduleColumn.Value;
+ public Vim.Format.ObjectModel.ScheduleColumn ScheduleColumn => _ScheduleColumn?.Value;
+ public int ScheduleColumnIndex => _ScheduleColumn?.Index ?? EntityRelation.None;
public ScheduleCell()
{
_ScheduleColumn = new Relation();
@@ -1672,7 +1760,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ViewSheetSet
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public ViewSheetSet()
{
_Element = new Relation();
@@ -1700,8 +1789,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ViewSheet
{
- public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.FamilyType FamilyType => _FamilyType?.Value;
+ public int FamilyTypeIndex => _FamilyType?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public ViewSheet()
{
_FamilyType = new Relation();
@@ -1731,8 +1822,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ViewSheetInViewSheetSet
{
- public Vim.Format.ObjectModel.ViewSheet ViewSheet => _ViewSheet.Value;
- public Vim.Format.ObjectModel.ViewSheetSet ViewSheetSet => _ViewSheetSet.Value;
+ public Vim.Format.ObjectModel.ViewSheet ViewSheet => _ViewSheet?.Value;
+ public int ViewSheetIndex => _ViewSheet?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.ViewSheetSet ViewSheetSet => _ViewSheetSet?.Value;
+ public int ViewSheetSetIndex => _ViewSheetSet?.Index ?? EntityRelation.None;
public ViewSheetInViewSheetSet()
{
_ViewSheet = new Relation();
@@ -1762,8 +1855,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ViewInViewSheetSet
{
- public Vim.Format.ObjectModel.View View => _View.Value;
- public Vim.Format.ObjectModel.ViewSheetSet ViewSheetSet => _ViewSheetSet.Value;
+ public Vim.Format.ObjectModel.View View => _View?.Value;
+ public int ViewIndex => _View?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.ViewSheetSet ViewSheetSet => _ViewSheetSet?.Value;
+ public int ViewSheetSetIndex => _ViewSheetSet?.Index ?? EntityRelation.None;
public ViewInViewSheetSet()
{
_View = new Relation();
@@ -1793,8 +1888,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class ViewInViewSheet
{
- public Vim.Format.ObjectModel.View View => _View.Value;
- public Vim.Format.ObjectModel.ViewSheet ViewSheet => _ViewSheet.Value;
+ public Vim.Format.ObjectModel.View View => _View?.Value;
+ public int ViewIndex => _View?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.ViewSheet ViewSheet => _ViewSheet?.Value;
+ public int ViewSheetIndex => _ViewSheet?.Index ?? EntityRelation.None;
public ViewInViewSheet()
{
_View = new Relation();
@@ -1824,7 +1921,8 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Site
{
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Site()
{
_Element = new Relation();
@@ -1857,8 +1955,10 @@ public override bool FieldsAreEqual(object obj)
// AUTO-GENERATED
public partial class Building
{
- public Vim.Format.ObjectModel.Site Site => _Site.Value;
- public Vim.Format.ObjectModel.Element Element => _Element.Value;
+ public Vim.Format.ObjectModel.Site Site => _Site?.Value;
+ public int SiteIndex => _Site?.Index ?? EntityRelation.None;
+ public Vim.Format.ObjectModel.Element Element => _Element?.Value;
+ public int ElementIndex => _Element?.Index ?? EntityRelation.None;
public Building()
{
_Site = new Relation();
@@ -4313,181 +4413,77 @@ public DocumentModel(Document d, bool inParallel = true)
public partial class EntityTableSet
{
+ public string[] StringTable { get; }
+
public Dictionary RawTableMap { get; } = new Dictionary();
- private SerializableEntityTable GetRawTableOrDefault(string tableName)
- => RawTableMap.TryGetValue(tableName, out var result) ? result : null;
+ public SerializableEntityTable GetSerializableTableOrEmpty(string tableName)
+ => RawTableMap.TryGetValue(tableName, out var result) ? result : new SerializableEntityTable { Name = tableName };
public ElementIndexMaps ElementIndexMaps { get; }
- public EntityTableSet(SerializableEntityTable[] rawTables, string[] stringBuffer, bool inParallel = true)
+ public EntityTableSet(SerializableEntityTable[] rawTables, string[] stringTable, bool inParallel = true)
{
+ StringTable = stringTable;
+
foreach (var rawTable in rawTables)
RawTableMap[rawTable.Name] = rawTable;
// Populate the entity tables.
- if (GetRawTableOrDefault("Vim.Asset") is SerializableEntityTable assetTable)
- AssetTable = new AssetTable(assetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.DisplayUnit") is SerializableEntityTable displayunitTable)
- DisplayUnitTable = new DisplayUnitTable(displayunitTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ParameterDescriptor") is SerializableEntityTable parameterdescriptorTable)
- ParameterDescriptorTable = new ParameterDescriptorTable(parameterdescriptorTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Parameter") is SerializableEntityTable parameterTable)
- ParameterTable = new ParameterTable(parameterTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Element") is SerializableEntityTable elementTable)
- ElementTable = new ElementTable(elementTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Workset") is SerializableEntityTable worksetTable)
- WorksetTable = new WorksetTable(worksetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.AssemblyInstance") is SerializableEntityTable assemblyinstanceTable)
- AssemblyInstanceTable = new AssemblyInstanceTable(assemblyinstanceTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Group") is SerializableEntityTable groupTable)
- GroupTable = new GroupTable(groupTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.DesignOption") is SerializableEntityTable designoptionTable)
- DesignOptionTable = new DesignOptionTable(designoptionTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Level") is SerializableEntityTable levelTable)
- LevelTable = new LevelTable(levelTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Phase") is SerializableEntityTable phaseTable)
- PhaseTable = new PhaseTable(phaseTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Room") is SerializableEntityTable roomTable)
- RoomTable = new RoomTable(roomTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.BimDocument") is SerializableEntityTable bimdocumentTable)
- BimDocumentTable = new BimDocumentTable(bimdocumentTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.DisplayUnitInBimDocument") is SerializableEntityTable displayunitinbimdocumentTable)
- DisplayUnitInBimDocumentTable = new DisplayUnitInBimDocumentTable(displayunitinbimdocumentTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.PhaseOrderInBimDocument") is SerializableEntityTable phaseorderinbimdocumentTable)
- PhaseOrderInBimDocumentTable = new PhaseOrderInBimDocumentTable(phaseorderinbimdocumentTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Category") is SerializableEntityTable categoryTable)
- CategoryTable = new CategoryTable(categoryTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Family") is SerializableEntityTable familyTable)
- FamilyTable = new FamilyTable(familyTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.FamilyType") is SerializableEntityTable familytypeTable)
- FamilyTypeTable = new FamilyTypeTable(familytypeTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.FamilyInstance") is SerializableEntityTable familyinstanceTable)
- FamilyInstanceTable = new FamilyInstanceTable(familyinstanceTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.View") is SerializableEntityTable viewTable)
- ViewTable = new ViewTable(viewTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ElementInView") is SerializableEntityTable elementinviewTable)
- ElementInViewTable = new ElementInViewTable(elementinviewTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ShapeInView") is SerializableEntityTable shapeinviewTable)
- ShapeInViewTable = new ShapeInViewTable(shapeinviewTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.AssetInView") is SerializableEntityTable assetinviewTable)
- AssetInViewTable = new AssetInViewTable(assetinviewTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.AssetInViewSheet") is SerializableEntityTable assetinviewsheetTable)
- AssetInViewSheetTable = new AssetInViewSheetTable(assetinviewsheetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.LevelInView") is SerializableEntityTable levelinviewTable)
- LevelInViewTable = new LevelInViewTable(levelinviewTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Camera") is SerializableEntityTable cameraTable)
- CameraTable = new CameraTable(cameraTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Material") is SerializableEntityTable materialTable)
- MaterialTable = new MaterialTable(materialTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.MaterialInElement") is SerializableEntityTable materialinelementTable)
- MaterialInElementTable = new MaterialInElementTable(materialinelementTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.CompoundStructureLayer") is SerializableEntityTable compoundstructurelayerTable)
- CompoundStructureLayerTable = new CompoundStructureLayerTable(compoundstructurelayerTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.CompoundStructure") is SerializableEntityTable compoundstructureTable)
- CompoundStructureTable = new CompoundStructureTable(compoundstructureTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Node") is SerializableEntityTable nodeTable)
- NodeTable = new NodeTable(nodeTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Geometry") is SerializableEntityTable geometryTable)
- GeometryTable = new GeometryTable(geometryTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Shape") is SerializableEntityTable shapeTable)
- ShapeTable = new ShapeTable(shapeTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ShapeCollection") is SerializableEntityTable shapecollectionTable)
- ShapeCollectionTable = new ShapeCollectionTable(shapecollectionTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ShapeInShapeCollection") is SerializableEntityTable shapeinshapecollectionTable)
- ShapeInShapeCollectionTable = new ShapeInShapeCollectionTable(shapeinshapecollectionTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.System") is SerializableEntityTable systemTable)
- SystemTable = new SystemTable(systemTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ElementInSystem") is SerializableEntityTable elementinsystemTable)
- ElementInSystemTable = new ElementInSystemTable(elementinsystemTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Warning") is SerializableEntityTable warningTable)
- WarningTable = new WarningTable(warningTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ElementInWarning") is SerializableEntityTable elementinwarningTable)
- ElementInWarningTable = new ElementInWarningTable(elementinwarningTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.BasePoint") is SerializableEntityTable basepointTable)
- BasePointTable = new BasePointTable(basepointTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.PhaseFilter") is SerializableEntityTable phasefilterTable)
- PhaseFilterTable = new PhaseFilterTable(phasefilterTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Grid") is SerializableEntityTable gridTable)
- GridTable = new GridTable(gridTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Area") is SerializableEntityTable areaTable)
- AreaTable = new AreaTable(areaTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.AreaScheme") is SerializableEntityTable areaschemeTable)
- AreaSchemeTable = new AreaSchemeTable(areaschemeTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Schedule") is SerializableEntityTable scheduleTable)
- ScheduleTable = new ScheduleTable(scheduleTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ScheduleColumn") is SerializableEntityTable schedulecolumnTable)
- ScheduleColumnTable = new ScheduleColumnTable(schedulecolumnTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ScheduleCell") is SerializableEntityTable schedulecellTable)
- ScheduleCellTable = new ScheduleCellTable(schedulecellTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ViewSheetSet") is SerializableEntityTable viewsheetsetTable)
- ViewSheetSetTable = new ViewSheetSetTable(viewsheetsetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ViewSheet") is SerializableEntityTable viewsheetTable)
- ViewSheetTable = new ViewSheetTable(viewsheetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ViewSheetInViewSheetSet") is SerializableEntityTable viewsheetinviewsheetsetTable)
- ViewSheetInViewSheetSetTable = new ViewSheetInViewSheetSetTable(viewsheetinviewsheetsetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ViewInViewSheetSet") is SerializableEntityTable viewinviewsheetsetTable)
- ViewInViewSheetSetTable = new ViewInViewSheetSetTable(viewinviewsheetsetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.ViewInViewSheet") is SerializableEntityTable viewinviewsheetTable)
- ViewInViewSheetTable = new ViewInViewSheetTable(viewinviewsheetTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Site") is SerializableEntityTable siteTable)
- SiteTable = new SiteTable(siteTable, stringBuffer);
-
- if (GetRawTableOrDefault("Vim.Building") is SerializableEntityTable buildingTable)
- BuildingTable = new BuildingTable(buildingTable, stringBuffer);
-
+ AssetTable = new AssetTable(GetSerializableTableOrEmpty(TableNames.Asset), stringTable, this);
+ DisplayUnitTable = new DisplayUnitTable(GetSerializableTableOrEmpty(TableNames.DisplayUnit), stringTable, this);
+ ParameterDescriptorTable = new ParameterDescriptorTable(GetSerializableTableOrEmpty(TableNames.ParameterDescriptor), stringTable, this);
+ ParameterTable = new ParameterTable(GetSerializableTableOrEmpty(TableNames.Parameter), stringTable, this);
+ ElementTable = new ElementTable(GetSerializableTableOrEmpty(TableNames.Element), stringTable, this);
+ WorksetTable = new WorksetTable(GetSerializableTableOrEmpty(TableNames.Workset), stringTable, this);
+ AssemblyInstanceTable = new AssemblyInstanceTable(GetSerializableTableOrEmpty(TableNames.AssemblyInstance), stringTable, this);
+ GroupTable = new GroupTable(GetSerializableTableOrEmpty(TableNames.Group), stringTable, this);
+ DesignOptionTable = new DesignOptionTable(GetSerializableTableOrEmpty(TableNames.DesignOption), stringTable, this);
+ LevelTable = new LevelTable(GetSerializableTableOrEmpty(TableNames.Level), stringTable, this);
+ PhaseTable = new PhaseTable(GetSerializableTableOrEmpty(TableNames.Phase), stringTable, this);
+ RoomTable = new RoomTable(GetSerializableTableOrEmpty(TableNames.Room), stringTable, this);
+ BimDocumentTable = new BimDocumentTable(GetSerializableTableOrEmpty(TableNames.BimDocument), stringTable, this);
+ DisplayUnitInBimDocumentTable = new DisplayUnitInBimDocumentTable(GetSerializableTableOrEmpty(TableNames.DisplayUnitInBimDocument), stringTable, this);
+ PhaseOrderInBimDocumentTable = new PhaseOrderInBimDocumentTable(GetSerializableTableOrEmpty(TableNames.PhaseOrderInBimDocument), stringTable, this);
+ CategoryTable = new CategoryTable(GetSerializableTableOrEmpty(TableNames.Category), stringTable, this);
+ FamilyTable = new FamilyTable(GetSerializableTableOrEmpty(TableNames.Family), stringTable, this);
+ FamilyTypeTable = new FamilyTypeTable(GetSerializableTableOrEmpty(TableNames.FamilyType), stringTable, this);
+ FamilyInstanceTable = new FamilyInstanceTable(GetSerializableTableOrEmpty(TableNames.FamilyInstance), stringTable, this);
+ ViewTable = new ViewTable(GetSerializableTableOrEmpty(TableNames.View), stringTable, this);
+ ElementInViewTable = new ElementInViewTable(GetSerializableTableOrEmpty(TableNames.ElementInView), stringTable, this);
+ ShapeInViewTable = new ShapeInViewTable(GetSerializableTableOrEmpty(TableNames.ShapeInView), stringTable, this);
+ AssetInViewTable = new AssetInViewTable(GetSerializableTableOrEmpty(TableNames.AssetInView), stringTable, this);
+ AssetInViewSheetTable = new AssetInViewSheetTable(GetSerializableTableOrEmpty(TableNames.AssetInViewSheet), stringTable, this);
+ LevelInViewTable = new LevelInViewTable(GetSerializableTableOrEmpty(TableNames.LevelInView), stringTable, this);
+ CameraTable = new CameraTable(GetSerializableTableOrEmpty(TableNames.Camera), stringTable, this);
+ MaterialTable = new MaterialTable(GetSerializableTableOrEmpty(TableNames.Material), stringTable, this);
+ MaterialInElementTable = new MaterialInElementTable(GetSerializableTableOrEmpty(TableNames.MaterialInElement), stringTable, this);
+ CompoundStructureLayerTable = new CompoundStructureLayerTable(GetSerializableTableOrEmpty(TableNames.CompoundStructureLayer), stringTable, this);
+ CompoundStructureTable = new CompoundStructureTable(GetSerializableTableOrEmpty(TableNames.CompoundStructure), stringTable, this);
+ NodeTable = new NodeTable(GetSerializableTableOrEmpty(TableNames.Node), stringTable, this);
+ GeometryTable = new GeometryTable(GetSerializableTableOrEmpty(TableNames.Geometry), stringTable, this);
+ ShapeTable = new ShapeTable(GetSerializableTableOrEmpty(TableNames.Shape), stringTable, this);
+ ShapeCollectionTable = new ShapeCollectionTable(GetSerializableTableOrEmpty(TableNames.ShapeCollection), stringTable, this);
+ ShapeInShapeCollectionTable = new ShapeInShapeCollectionTable(GetSerializableTableOrEmpty(TableNames.ShapeInShapeCollection), stringTable, this);
+ SystemTable = new SystemTable(GetSerializableTableOrEmpty(TableNames.System), stringTable, this);
+ ElementInSystemTable = new ElementInSystemTable(GetSerializableTableOrEmpty(TableNames.ElementInSystem), stringTable, this);
+ WarningTable = new WarningTable(GetSerializableTableOrEmpty(TableNames.Warning), stringTable, this);
+ ElementInWarningTable = new ElementInWarningTable(GetSerializableTableOrEmpty(TableNames.ElementInWarning), stringTable, this);
+ BasePointTable = new BasePointTable(GetSerializableTableOrEmpty(TableNames.BasePoint), stringTable, this);
+ PhaseFilterTable = new PhaseFilterTable(GetSerializableTableOrEmpty(TableNames.PhaseFilter), stringTable, this);
+ GridTable = new GridTable(GetSerializableTableOrEmpty(TableNames.Grid), stringTable, this);
+ AreaTable = new AreaTable(GetSerializableTableOrEmpty(TableNames.Area), stringTable, this);
+ AreaSchemeTable = new AreaSchemeTable(GetSerializableTableOrEmpty(TableNames.AreaScheme), stringTable, this);
+ ScheduleTable = new ScheduleTable(GetSerializableTableOrEmpty(TableNames.Schedule), stringTable, this);
+ ScheduleColumnTable = new ScheduleColumnTable(GetSerializableTableOrEmpty(TableNames.ScheduleColumn), stringTable, this);
+ ScheduleCellTable = new ScheduleCellTable(GetSerializableTableOrEmpty(TableNames.ScheduleCell), stringTable, this);
+ ViewSheetSetTable = new ViewSheetSetTable(GetSerializableTableOrEmpty(TableNames.ViewSheetSet), stringTable, this);
+ ViewSheetTable = new ViewSheetTable(GetSerializableTableOrEmpty(TableNames.ViewSheet), stringTable, this);
+ ViewSheetInViewSheetSetTable = new ViewSheetInViewSheetSetTable(GetSerializableTableOrEmpty(TableNames.ViewSheetInViewSheetSet), stringTable, this);
+ ViewInViewSheetSetTable = new ViewInViewSheetSetTable(GetSerializableTableOrEmpty(TableNames.ViewInViewSheetSet), stringTable, this);
+ ViewInViewSheetTable = new ViewInViewSheetTable(GetSerializableTableOrEmpty(TableNames.ViewInViewSheet), stringTable, this);
+ SiteTable = new SiteTable(GetSerializableTableOrEmpty(TableNames.Site), stringTable, this);
+ BuildingTable = new BuildingTable(GetSerializableTableOrEmpty(TableNames.Building), stringTable, this);
// Initialize element index maps
ElementIndexMaps = new ElementIndexMaps(this, inParallel);
@@ -4601,15 +4597,382 @@ public EntityTableSet(SerializableEntityTable[] rawTables, string[] stringBuffer
public Site GetSite(int index) => SiteTable?.Get(index);
public BuildingTable BuildingTable { get; } // can be null
public Building GetBuilding(int index) => BuildingTable?.Get(index);
+
+ public static HashSet GetElementKindTableNames()
+ => new HashSet()
+ {
+ TableNames.AssemblyInstance,
+ TableNames.Group,
+ TableNames.DesignOption,
+ TableNames.Level,
+ TableNames.Phase,
+ TableNames.Room,
+ TableNames.BimDocument,
+ TableNames.Family,
+ TableNames.FamilyType,
+ TableNames.FamilyInstance,
+ TableNames.View,
+ TableNames.Material,
+ TableNames.System,
+ TableNames.BasePoint,
+ TableNames.PhaseFilter,
+ TableNames.Grid,
+ TableNames.Area,
+ TableNames.AreaScheme,
+ TableNames.Schedule,
+ TableNames.ViewSheetSet,
+ TableNames.ViewSheet,
+ TableNames.Site,
+ TableNames.Building,
+ };
+
+ // Returns an array defining a 1:1 association of Element to its ElementKind
+ public ElementKind[] GetElementKinds()
+ {
+ var elementKinds = new ElementKind[ElementTable?.RowCount ?? 0];
+
+ if (elementKinds.Length == 0) return elementKinds;
+
+ // Initialize all element kinds to unknown
+ for (var i = 0; i < elementKinds.Length; ++i) { elementKinds[i] = ElementKind.Unknown; }
+
+ // Populate the element kinds from the relevant entity tables
+ for (var i = 0; i < (AssemblyInstanceTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = AssemblyInstanceTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.AssemblyInstance;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (GroupTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = GroupTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Group;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (DesignOptionTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = DesignOptionTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.DesignOption;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (LevelTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = LevelTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Level;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (PhaseTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = PhaseTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Phase;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (RoomTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = RoomTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Room;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (BimDocumentTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = BimDocumentTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.BimDocument;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (FamilyTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = FamilyTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Family;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (FamilyTypeTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = FamilyTypeTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.FamilyType;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (FamilyInstanceTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = FamilyInstanceTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.FamilyInstance;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (ViewTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = ViewTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.View;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (MaterialTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = MaterialTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Material;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (SystemTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = SystemTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.System;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (BasePointTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = BasePointTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.BasePoint;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (PhaseFilterTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = PhaseFilterTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.PhaseFilter;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (GridTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = GridTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Grid;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (AreaTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = AreaTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Area;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (AreaSchemeTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = AreaSchemeTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.AreaScheme;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (ScheduleTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = ScheduleTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Schedule;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (ViewSheetSetTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = ViewSheetSetTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.ViewSheetSet;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (ViewSheetTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = ViewSheetTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.ViewSheet;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (SiteTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = SiteTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Site;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ for (var i = 0; i < (BuildingTable?.RowCount ?? 0); ++i)
+ {
+ var elementIndex = BuildingTable?.Column_ElementIndex[i] ?? EntityRelation.None;
+ if (elementIndex < 0 || elementIndex >= elementKinds.Length) continue;
+
+ var currentElementKind = elementKinds[elementIndex];
+ var candidateElementKind = ElementKind.Building;
+
+ // Only update the element kind if it is unknown or if it is less than the current kind.
+ if (currentElementKind != ElementKind.Unknown && currentElementKind <= candidateElementKind) continue;
+
+ elementKinds[elementIndex] = candidateElementKind;
+ }
+
+ return elementKinds;
+ } // GetElementKinds()
} // class EntityTableSet
public partial class AssetTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public AssetTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Asset;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public AssetTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_BufferName = GetStringColumnValues("string:BufferName") ?? Array.Empty();
}
@@ -4635,11 +4998,14 @@ public IEnumerator GetEnumerator()
public partial class DisplayUnitTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public DisplayUnitTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.DisplayUnit;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public DisplayUnitTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Spec = GetStringColumnValues("string:Spec") ?? Array.Empty();
Column_Type = GetStringColumnValues("string:Type") ?? Array.Empty();
Column_Label = GetStringColumnValues("string:Label") ?? Array.Empty();
@@ -4673,11 +5039,14 @@ public IEnumerator GetEnumerator()
public partial class ParameterDescriptorTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public ParameterDescriptorTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.ParameterDescriptor;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public ParameterDescriptorTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Name = GetStringColumnValues("string:Name") ?? Array.Empty();
Column_Group = GetStringColumnValues("string:Group") ?? Array.Empty();
Column_ParameterType = GetStringColumnValues("string:ParameterType") ?? Array.Empty();
@@ -4711,7 +5080,7 @@ public ParameterDescriptorTable(SerializableEntityTable rawTable, string[] strin
public int[] Column_DisplayUnitIndex { get; }
public int GetDisplayUnitIndex(int index) => Column_DisplayUnitIndex.ElementAtOrDefault(index, EntityRelation.None);
public DisplayUnit GetDisplayUnit(int index) => _GetReferencedDisplayUnit(GetDisplayUnitIndex(index));
- private DisplayUnit _GetReferencedDisplayUnit(int referencedIndex) => _parentTableSet.GetDisplayUnit(referencedIndex);
+ private DisplayUnit _GetReferencedDisplayUnit(int referencedIndex) => ParentTableSet.GetDisplayUnit(referencedIndex);
// Object Getter
public ParameterDescriptor Get(int index)
{
@@ -4741,11 +5110,14 @@ public IEnumerator GetEnumerator()
public partial class ParameterTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public ParameterTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Parameter;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public ParameterTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Value = GetStringColumnValues("string:Value") ?? Array.Empty();
Column_ParameterDescriptorIndex = GetIndexColumnValues("index:Vim.ParameterDescriptor:ParameterDescriptor") ?? Array.Empty();
Column_ElementIndex = GetIndexColumnValues("index:Vim.Element:Element") ?? Array.Empty();
@@ -4756,11 +5128,11 @@ public ParameterTable(SerializableEntityTable rawTable, string[] stringBuffer, E
public int[] Column_ParameterDescriptorIndex { get; }
public int GetParameterDescriptorIndex(int index) => Column_ParameterDescriptorIndex.ElementAtOrDefault(index, EntityRelation.None);
public ParameterDescriptor GetParameterDescriptor(int index) => _GetReferencedParameterDescriptor(GetParameterDescriptorIndex(index));
- private ParameterDescriptor _GetReferencedParameterDescriptor(int referencedIndex) => _parentTableSet.GetParameterDescriptor(referencedIndex);
+ private ParameterDescriptor _GetReferencedParameterDescriptor(int referencedIndex) => ParentTableSet.GetParameterDescriptor(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public Parameter Get(int index)
{
@@ -4783,11 +5155,14 @@ public IEnumerator GetEnumerator()
public partial class ElementTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public ElementTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Element;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public ElementTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Id = (GetDataColumnValues("long:Id") ?? GetDataColumnValues("int:Id")?.Select(v => (Int64) v).ToArray()) ?? Array.Empty();
Column_Type = GetStringColumnValues("string:Type") ?? Array.Empty();
Column_Name = GetStringColumnValues("string:Name") ?? Array.Empty();
@@ -4831,47 +5206,47 @@ public ElementTable(SerializableEntityTable rawTable, string[] stringBuffer, Ent
public int[] Column_LevelIndex { get; }
public int GetLevelIndex(int index) => Column_LevelIndex.ElementAtOrDefault(index, EntityRelation.None);
public Level GetLevel(int index) => _GetReferencedLevel(GetLevelIndex(index));
- private Level _GetReferencedLevel(int referencedIndex) => _parentTableSet.GetLevel(referencedIndex);
+ private Level _GetReferencedLevel(int referencedIndex) => ParentTableSet.GetLevel(referencedIndex);
public int[] Column_PhaseCreatedIndex { get; }
public int GetPhaseCreatedIndex(int index) => Column_PhaseCreatedIndex.ElementAtOrDefault(index, EntityRelation.None);
public Phase GetPhaseCreated(int index) => _GetReferencedPhaseCreated(GetPhaseCreatedIndex(index));
- private Phase _GetReferencedPhaseCreated(int referencedIndex) => _parentTableSet.GetPhase(referencedIndex);
+ private Phase _GetReferencedPhaseCreated(int referencedIndex) => ParentTableSet.GetPhase(referencedIndex);
public int[] Column_PhaseDemolishedIndex { get; }
public int GetPhaseDemolishedIndex(int index) => Column_PhaseDemolishedIndex.ElementAtOrDefault(index, EntityRelation.None);
public Phase GetPhaseDemolished(int index) => _GetReferencedPhaseDemolished(GetPhaseDemolishedIndex(index));
- private Phase _GetReferencedPhaseDemolished(int referencedIndex) => _parentTableSet.GetPhase(referencedIndex);
+ private Phase _GetReferencedPhaseDemolished(int referencedIndex) => ParentTableSet.GetPhase(referencedIndex);
public int[] Column_CategoryIndex { get; }
public int GetCategoryIndex(int index) => Column_CategoryIndex.ElementAtOrDefault(index, EntityRelation.None);
public Category GetCategory(int index) => _GetReferencedCategory(GetCategoryIndex(index));
- private Category _GetReferencedCategory(int referencedIndex) => _parentTableSet.GetCategory(referencedIndex);
+ private Category _GetReferencedCategory(int referencedIndex) => ParentTableSet.GetCategory(referencedIndex);
public int[] Column_WorksetIndex { get; }
public int GetWorksetIndex(int index) => Column_WorksetIndex.ElementAtOrDefault(index, EntityRelation.None);
public Workset GetWorkset(int index) => _GetReferencedWorkset(GetWorksetIndex(index));
- private Workset _GetReferencedWorkset(int referencedIndex) => _parentTableSet.GetWorkset(referencedIndex);
+ private Workset _GetReferencedWorkset(int referencedIndex) => ParentTableSet.GetWorkset(referencedIndex);
public int[] Column_DesignOptionIndex { get; }
public int GetDesignOptionIndex(int index) => Column_DesignOptionIndex.ElementAtOrDefault(index, EntityRelation.None);
public DesignOption GetDesignOption(int index) => _GetReferencedDesignOption(GetDesignOptionIndex(index));
- private DesignOption _GetReferencedDesignOption(int referencedIndex) => _parentTableSet.GetDesignOption(referencedIndex);
+ private DesignOption _GetReferencedDesignOption(int referencedIndex) => ParentTableSet.GetDesignOption(referencedIndex);
public int[] Column_OwnerViewIndex { get; }
public int GetOwnerViewIndex(int index) => Column_OwnerViewIndex.ElementAtOrDefault(index, EntityRelation.None);
public View GetOwnerView(int index) => _GetReferencedOwnerView(GetOwnerViewIndex(index));
- private View _GetReferencedOwnerView(int referencedIndex) => _parentTableSet.GetView(referencedIndex);
+ private View _GetReferencedOwnerView(int referencedIndex) => ParentTableSet.GetView(referencedIndex);
public int[] Column_GroupIndex { get; }
public int GetGroupIndex(int index) => Column_GroupIndex.ElementAtOrDefault(index, EntityRelation.None);
public Group GetGroup(int index) => _GetReferencedGroup(GetGroupIndex(index));
- private Group _GetReferencedGroup(int referencedIndex) => _parentTableSet.GetGroup(referencedIndex);
+ private Group _GetReferencedGroup(int referencedIndex) => ParentTableSet.GetGroup(referencedIndex);
public int[] Column_AssemblyInstanceIndex { get; }
public int GetAssemblyInstanceIndex(int index) => Column_AssemblyInstanceIndex.ElementAtOrDefault(index, EntityRelation.None);
public AssemblyInstance GetAssemblyInstance(int index) => _GetReferencedAssemblyInstance(GetAssemblyInstanceIndex(index));
- private AssemblyInstance _GetReferencedAssemblyInstance(int referencedIndex) => _parentTableSet.GetAssemblyInstance(referencedIndex);
+ private AssemblyInstance _GetReferencedAssemblyInstance(int referencedIndex) => ParentTableSet.GetAssemblyInstance(referencedIndex);
public int[] Column_BimDocumentIndex { get; }
public int GetBimDocumentIndex(int index) => Column_BimDocumentIndex.ElementAtOrDefault(index, EntityRelation.None);
public BimDocument GetBimDocument(int index) => _GetReferencedBimDocument(GetBimDocumentIndex(index));
- private BimDocument _GetReferencedBimDocument(int referencedIndex) => _parentTableSet.GetBimDocument(referencedIndex);
+ private BimDocument _GetReferencedBimDocument(int referencedIndex) => ParentTableSet.GetBimDocument(referencedIndex);
public int[] Column_RoomIndex { get; }
public int GetRoomIndex(int index) => Column_RoomIndex.ElementAtOrDefault(index, EntityRelation.None);
public Room GetRoom(int index) => _GetReferencedRoom(GetRoomIndex(index));
- private Room _GetReferencedRoom(int referencedIndex) => _parentTableSet.GetRoom(referencedIndex);
+ private Room _GetReferencedRoom(int referencedIndex) => ParentTableSet.GetRoom(referencedIndex);
// Object Getter
public Element Get(int index)
{
@@ -4911,11 +5286,14 @@ public IEnumerator GetEnumerator()
public partial class WorksetTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public WorksetTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Workset;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public WorksetTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Id = GetDataColumnValues("int:Id") ?? Array.Empty();
Column_Name = GetStringColumnValues("string:Name") ?? Array.Empty();
Column_Kind = GetStringColumnValues("string:Kind") ?? Array.Empty();
@@ -4943,7 +5321,7 @@ public WorksetTable(SerializableEntityTable rawTable, string[] stringBuffer, Ent
public int[] Column_BimDocumentIndex { get; }
public int GetBimDocumentIndex(int index) => Column_BimDocumentIndex.ElementAtOrDefault(index, EntityRelation.None);
public BimDocument GetBimDocument(int index) => _GetReferencedBimDocument(GetBimDocumentIndex(index));
- private BimDocument _GetReferencedBimDocument(int referencedIndex) => _parentTableSet.GetBimDocument(referencedIndex);
+ private BimDocument _GetReferencedBimDocument(int referencedIndex) => ParentTableSet.GetBimDocument(referencedIndex);
// Object Getter
public Workset Get(int index)
{
@@ -4971,11 +5349,14 @@ public IEnumerator GetEnumerator()
public partial class AssemblyInstanceTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public AssemblyInstanceTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.AssemblyInstance;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public AssemblyInstanceTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_AssemblyTypeName = GetStringColumnValues("string:AssemblyTypeName") ?? Array.Empty();
Column_Position_X = GetDataColumnValues("float:Position.X") ?? Array.Empty();
Column_Position_Y = GetDataColumnValues("float:Position.Y") ?? Array.Empty();
@@ -4994,7 +5375,7 @@ public AssemblyInstanceTable(SerializableEntityTable rawTable, string[] stringBu
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public AssemblyInstance Get(int index)
{
@@ -5019,11 +5400,14 @@ public IEnumerator GetEnumerator()
public partial class GroupTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public GroupTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Group;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public GroupTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_GroupType = GetStringColumnValues("string:GroupType") ?? Array.Empty();
Column_Position_X = GetDataColumnValues("float:Position.X") ?? Array.Empty();
Column_Position_Y = GetDataColumnValues("float:Position.Y") ?? Array.Empty();
@@ -5042,7 +5426,7 @@ public GroupTable(SerializableEntityTable rawTable, string[] stringBuffer, Entit
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public Group Get(int index)
{
@@ -5067,11 +5451,14 @@ public IEnumerator GetEnumerator()
public partial class DesignOptionTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public DesignOptionTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.DesignOption;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public DesignOptionTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_IsPrimary = GetDataColumnValues("byte:IsPrimary") ?? Array.Empty();
Column_ElementIndex = GetIndexColumnValues("index:Vim.Element:Element") ?? Array.Empty();
}
@@ -5081,7 +5468,7 @@ public DesignOptionTable(SerializableEntityTable rawTable, string[] stringBuffer
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public DesignOption Get(int index)
{
@@ -5103,11 +5490,14 @@ public IEnumerator GetEnumerator()
public partial class LevelTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public LevelTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Level;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public LevelTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Elevation = GetDataColumnValues("double:Elevation") ?? Array.Empty();
Column_ProjectElevation = GetDataColumnValues("double:ProjectElevation") ?? Array.Empty();
Column_FamilyTypeIndex = GetIndexColumnValues("index:Vim.FamilyType:FamilyType") ?? Array.Empty();
@@ -5122,15 +5512,15 @@ public LevelTable(SerializableEntityTable rawTable, string[] stringBuffer, Entit
public int[] Column_FamilyTypeIndex { get; }
public int GetFamilyTypeIndex(int index) => Column_FamilyTypeIndex.ElementAtOrDefault(index, EntityRelation.None);
public FamilyType GetFamilyType(int index) => _GetReferencedFamilyType(GetFamilyTypeIndex(index));
- private FamilyType _GetReferencedFamilyType(int referencedIndex) => _parentTableSet.GetFamilyType(referencedIndex);
+ private FamilyType _GetReferencedFamilyType(int referencedIndex) => ParentTableSet.GetFamilyType(referencedIndex);
public int[] Column_BuildingIndex { get; }
public int GetBuildingIndex(int index) => Column_BuildingIndex.ElementAtOrDefault(index, EntityRelation.None);
public Building GetBuilding(int index) => _GetReferencedBuilding(GetBuildingIndex(index));
- private Building _GetReferencedBuilding(int referencedIndex) => _parentTableSet.GetBuilding(referencedIndex);
+ private Building _GetReferencedBuilding(int referencedIndex) => ParentTableSet.GetBuilding(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public Level Get(int index)
{
@@ -5155,18 +5545,21 @@ public IEnumerator GetEnumerator()
public partial class PhaseTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public PhaseTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Phase;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public PhaseTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_ElementIndex = GetIndexColumnValues("index:Vim.Element:Element") ?? Array.Empty();
}
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public Phase Get(int index)
{
@@ -5187,11 +5580,14 @@ public IEnumerator GetEnumerator()
public partial class RoomTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public RoomTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Room;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public RoomTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_BaseOffset = GetDataColumnValues("double:BaseOffset") ?? Array.Empty();
Column_LimitOffset = GetDataColumnValues("double:LimitOffset") ?? Array.Empty();
Column_UnboundedHeight = GetDataColumnValues("double:UnboundedHeight") ?? Array.Empty();
@@ -5220,11 +5616,11 @@ public RoomTable(SerializableEntityTable rawTable, string[] stringBuffer, Entity
public int[] Column_UpperLimitIndex { get; }
public int GetUpperLimitIndex(int index) => Column_UpperLimitIndex.ElementAtOrDefault(index, EntityRelation.None);
public Level GetUpperLimit(int index) => _GetReferencedUpperLimit(GetUpperLimitIndex(index));
- private Level _GetReferencedUpperLimit(int referencedIndex) => _parentTableSet.GetLevel(referencedIndex);
+ private Level _GetReferencedUpperLimit(int referencedIndex) => ParentTableSet.GetLevel(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public Room Get(int index)
{
@@ -5253,11 +5649,14 @@ public IEnumerator GetEnumerator()
public partial class BimDocumentTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public BimDocumentTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.BimDocument;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public BimDocumentTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Title = GetStringColumnValues("string:Title") ?? Array.Empty();
Column_IsMetric = GetDataColumnValues("byte:IsMetric") ?? Array.Empty();
Column_Guid = GetStringColumnValues("string:Guid") ?? Array.Empty();
@@ -5354,19 +5753,19 @@ public BimDocumentTable(SerializableEntityTable rawTable, string[] stringBuffer,
public int[] Column_ActiveViewIndex { get; }
public int GetActiveViewIndex(int index) => Column_ActiveViewIndex.ElementAtOrDefault(index, EntityRelation.None);
public View GetActiveView(int index) => _GetReferencedActiveView(GetActiveViewIndex(index));
- private View _GetReferencedActiveView(int referencedIndex) => _parentTableSet.GetView(referencedIndex);
+ private View _GetReferencedActiveView(int referencedIndex) => ParentTableSet.GetView(referencedIndex);
public int[] Column_OwnerFamilyIndex { get; }
public int GetOwnerFamilyIndex(int index) => Column_OwnerFamilyIndex.ElementAtOrDefault(index, EntityRelation.None);
public Family GetOwnerFamily(int index) => _GetReferencedOwnerFamily(GetOwnerFamilyIndex(index));
- private Family _GetReferencedOwnerFamily(int referencedIndex) => _parentTableSet.GetFamily(referencedIndex);
+ private Family _GetReferencedOwnerFamily(int referencedIndex) => ParentTableSet.GetFamily(referencedIndex);
public int[] Column_ParentIndex { get; }
public int GetParentIndex(int index) => Column_ParentIndex.ElementAtOrDefault(index, EntityRelation.None);
public BimDocument GetParent(int index) => _GetReferencedParent(GetParentIndex(index));
- private BimDocument _GetReferencedParent(int referencedIndex) => _parentTableSet.GetBimDocument(referencedIndex);
+ private BimDocument _GetReferencedParent(int referencedIndex) => ParentTableSet.GetBimDocument(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public BimDocument Get(int index)
{
@@ -5419,11 +5818,14 @@ public IEnumerator GetEnumerator()
public partial class DisplayUnitInBimDocumentTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public DisplayUnitInBimDocumentTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.DisplayUnitInBimDocument;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public DisplayUnitInBimDocumentTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_DisplayUnitIndex = GetIndexColumnValues("index:Vim.DisplayUnit:DisplayUnit") ?? Array.Empty();
Column_BimDocumentIndex = GetIndexColumnValues("index:Vim.BimDocument:BimDocument") ?? Array.Empty();
}
@@ -5431,11 +5833,11 @@ public DisplayUnitInBimDocumentTable(SerializableEntityTable rawTable, string[]
public int[] Column_DisplayUnitIndex { get; }
public int GetDisplayUnitIndex(int index) => Column_DisplayUnitIndex.ElementAtOrDefault(index, EntityRelation.None);
public DisplayUnit GetDisplayUnit(int index) => _GetReferencedDisplayUnit(GetDisplayUnitIndex(index));
- private DisplayUnit _GetReferencedDisplayUnit(int referencedIndex) => _parentTableSet.GetDisplayUnit(referencedIndex);
+ private DisplayUnit _GetReferencedDisplayUnit(int referencedIndex) => ParentTableSet.GetDisplayUnit(referencedIndex);
public int[] Column_BimDocumentIndex { get; }
public int GetBimDocumentIndex(int index) => Column_BimDocumentIndex.ElementAtOrDefault(index, EntityRelation.None);
public BimDocument GetBimDocument(int index) => _GetReferencedBimDocument(GetBimDocumentIndex(index));
- private BimDocument _GetReferencedBimDocument(int referencedIndex) => _parentTableSet.GetBimDocument(referencedIndex);
+ private BimDocument _GetReferencedBimDocument(int referencedIndex) => ParentTableSet.GetBimDocument(referencedIndex);
// Object Getter
public DisplayUnitInBimDocument Get(int index)
{
@@ -5457,11 +5859,14 @@ public IEnumerator GetEnumerator()
public partial class PhaseOrderInBimDocumentTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public PhaseOrderInBimDocumentTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.PhaseOrderInBimDocument;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public PhaseOrderInBimDocumentTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_OrderIndex = GetDataColumnValues("int:OrderIndex") ?? Array.Empty();
Column_PhaseIndex = GetIndexColumnValues("index:Vim.Phase:Phase") ?? Array.Empty();
Column_BimDocumentIndex = GetIndexColumnValues("index:Vim.BimDocument:BimDocument") ?? Array.Empty();
@@ -5472,11 +5877,11 @@ public PhaseOrderInBimDocumentTable(SerializableEntityTable rawTable, string[] s
public int[] Column_PhaseIndex { get; }
public int GetPhaseIndex(int index) => Column_PhaseIndex.ElementAtOrDefault(index, EntityRelation.None);
public Phase GetPhase(int index) => _GetReferencedPhase(GetPhaseIndex(index));
- private Phase _GetReferencedPhase(int referencedIndex) => _parentTableSet.GetPhase(referencedIndex);
+ private Phase _GetReferencedPhase(int referencedIndex) => ParentTableSet.GetPhase(referencedIndex);
public int[] Column_BimDocumentIndex { get; }
public int GetBimDocumentIndex(int index) => Column_BimDocumentIndex.ElementAtOrDefault(index, EntityRelation.None);
public BimDocument GetBimDocument(int index) => _GetReferencedBimDocument(GetBimDocumentIndex(index));
- private BimDocument _GetReferencedBimDocument(int referencedIndex) => _parentTableSet.GetBimDocument(referencedIndex);
+ private BimDocument _GetReferencedBimDocument(int referencedIndex) => ParentTableSet.GetBimDocument(referencedIndex);
// Object Getter
public PhaseOrderInBimDocument Get(int index)
{
@@ -5499,11 +5904,14 @@ public IEnumerator GetEnumerator()
public partial class CategoryTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public CategoryTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Category;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public CategoryTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Name = GetStringColumnValues("string:Name") ?? Array.Empty();
Column_Id = (GetDataColumnValues("long:Id") ?? GetDataColumnValues("int:Id")?.Select(v => (Int64) v).ToArray()) ?? Array.Empty();
Column_CategoryType = GetStringColumnValues("string:CategoryType") ?? Array.Empty();
@@ -5532,11 +5940,11 @@ public CategoryTable(SerializableEntityTable rawTable, string[] stringBuffer, En
public int[] Column_ParentIndex { get; }
public int GetParentIndex(int index) => Column_ParentIndex.ElementAtOrDefault(index, EntityRelation.None);
public Category GetParent(int index) => _GetReferencedParent(GetParentIndex(index));
- private Category _GetReferencedParent(int referencedIndex) => _parentTableSet.GetCategory(referencedIndex);
+ private Category _GetReferencedParent(int referencedIndex) => ParentTableSet.GetCategory(referencedIndex);
public int[] Column_MaterialIndex { get; }
public int GetMaterialIndex(int index) => Column_MaterialIndex.ElementAtOrDefault(index, EntityRelation.None);
public Material GetMaterial(int index) => _GetReferencedMaterial(GetMaterialIndex(index));
- private Material _GetReferencedMaterial(int referencedIndex) => _parentTableSet.GetMaterial(referencedIndex);
+ private Material _GetReferencedMaterial(int referencedIndex) => ParentTableSet.GetMaterial(referencedIndex);
// Object Getter
public Category Get(int index)
{
@@ -5565,11 +5973,14 @@ public IEnumerator GetEnumerator()
public partial class FamilyTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public FamilyTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.Family;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public FamilyTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_StructuralMaterialType = GetStringColumnValues("string:StructuralMaterialType") ?? Array.Empty();
Column_StructuralSectionShape = GetStringColumnValues("string:StructuralSectionShape") ?? Array.Empty();
Column_IsSystemFamily = GetDataColumnValues("byte:IsSystemFamily") ?? Array.Empty();
@@ -5589,11 +6000,11 @@ public FamilyTable(SerializableEntityTable rawTable, string[] stringBuffer, Enti
public int[] Column_FamilyCategoryIndex { get; }
public int GetFamilyCategoryIndex(int index) => Column_FamilyCategoryIndex.ElementAtOrDefault(index, EntityRelation.None);
public Category GetFamilyCategory(int index) => _GetReferencedFamilyCategory(GetFamilyCategoryIndex(index));
- private Category _GetReferencedFamilyCategory(int referencedIndex) => _parentTableSet.GetCategory(referencedIndex);
+ private Category _GetReferencedFamilyCategory(int referencedIndex) => ParentTableSet.GetCategory(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public Family Get(int index)
{
@@ -5619,11 +6030,14 @@ public IEnumerator GetEnumerator()
public partial class FamilyTypeTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public FamilyTypeTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.FamilyType;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public FamilyTypeTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_IsSystemFamilyType = GetDataColumnValues("byte:IsSystemFamilyType") ?? Array.Empty();
Column_FamilyIndex = GetIndexColumnValues("index:Vim.Family:Family") ?? Array.Empty();
Column_CompoundStructureIndex = GetIndexColumnValues("index:Vim.CompoundStructure:CompoundStructure") ?? Array.Empty();
@@ -5635,15 +6049,15 @@ public FamilyTypeTable(SerializableEntityTable rawTable, string[] stringBuffer,
public int[] Column_FamilyIndex { get; }
public int GetFamilyIndex(int index) => Column_FamilyIndex.ElementAtOrDefault(index, EntityRelation.None);
public Family GetFamily(int index) => _GetReferencedFamily(GetFamilyIndex(index));
- private Family _GetReferencedFamily(int referencedIndex) => _parentTableSet.GetFamily(referencedIndex);
+ private Family _GetReferencedFamily(int referencedIndex) => ParentTableSet.GetFamily(referencedIndex);
public int[] Column_CompoundStructureIndex { get; }
public int GetCompoundStructureIndex(int index) => Column_CompoundStructureIndex.ElementAtOrDefault(index, EntityRelation.None);
public CompoundStructure GetCompoundStructure(int index) => _GetReferencedCompoundStructure(GetCompoundStructureIndex(index));
- private CompoundStructure _GetReferencedCompoundStructure(int referencedIndex) => _parentTableSet.GetCompoundStructure(referencedIndex);
+ private CompoundStructure _GetReferencedCompoundStructure(int referencedIndex) => ParentTableSet.GetCompoundStructure(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public FamilyType Get(int index)
{
@@ -5667,11 +6081,14 @@ public IEnumerator GetEnumerator()
public partial class FamilyInstanceTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public FamilyInstanceTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.FamilyInstance;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public FamilyInstanceTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_FacingFlipped = GetDataColumnValues("byte:FacingFlipped") ?? Array.Empty();
Column_FacingOrientation_X = GetDataColumnValues("float:FacingOrientation.X") ?? Array.Empty();
Column_FacingOrientation_Y = GetDataColumnValues("float:FacingOrientation.Y") ?? Array.Empty();
@@ -5752,27 +6169,27 @@ public FamilyInstanceTable(SerializableEntityTable rawTable, string[] stringBuff
public int[] Column_FamilyTypeIndex { get; }
public int GetFamilyTypeIndex(int index) => Column_FamilyTypeIndex.ElementAtOrDefault(index, EntityRelation.None);
public FamilyType GetFamilyType(int index) => _GetReferencedFamilyType(GetFamilyTypeIndex(index));
- private FamilyType _GetReferencedFamilyType(int referencedIndex) => _parentTableSet.GetFamilyType(referencedIndex);
+ private FamilyType _GetReferencedFamilyType(int referencedIndex) => ParentTableSet.GetFamilyType(referencedIndex);
public int[] Column_HostIndex { get; }
public int GetHostIndex(int index) => Column_HostIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetHost(int index) => _GetReferencedHost(GetHostIndex(index));
- private Element _GetReferencedHost(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedHost(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
public int[] Column_FromRoomIndex { get; }
public int GetFromRoomIndex(int index) => Column_FromRoomIndex.ElementAtOrDefault(index, EntityRelation.None);
public Room GetFromRoom(int index) => _GetReferencedFromRoom(GetFromRoomIndex(index));
- private Room _GetReferencedFromRoom(int referencedIndex) => _parentTableSet.GetRoom(referencedIndex);
+ private Room _GetReferencedFromRoom(int referencedIndex) => ParentTableSet.GetRoom(referencedIndex);
public int[] Column_ToRoomIndex { get; }
public int GetToRoomIndex(int index) => Column_ToRoomIndex.ElementAtOrDefault(index, EntityRelation.None);
public Room GetToRoom(int index) => _GetReferencedToRoom(GetToRoomIndex(index));
- private Room _GetReferencedToRoom(int referencedIndex) => _parentTableSet.GetRoom(referencedIndex);
+ private Room _GetReferencedToRoom(int referencedIndex) => ParentTableSet.GetRoom(referencedIndex);
public int[] Column_SuperComponentIndex { get; }
public int GetSuperComponentIndex(int index) => Column_SuperComponentIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetSuperComponent(int index) => _GetReferencedSuperComponent(GetSuperComponentIndex(index));
- private Element _GetReferencedSuperComponent(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedSuperComponent(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public FamilyInstance Get(int index)
{
@@ -5821,11 +6238,14 @@ public IEnumerator GetEnumerator()
public partial class ViewTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public ViewTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.View;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public ViewTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Title = GetStringColumnValues("string:Title") ?? Array.Empty();
Column_ViewType = GetStringColumnValues("string:ViewType") ?? Array.Empty();
Column_Up_X = GetDataColumnValues("double:Up.X") ?? Array.Empty();
@@ -5903,15 +6323,15 @@ public ViewTable(SerializableEntityTable rawTable, string[] stringBuffer, Entity
public int[] Column_CameraIndex { get; }
public int GetCameraIndex(int index) => Column_CameraIndex.ElementAtOrDefault(index, EntityRelation.None);
public Camera GetCamera(int index) => _GetReferencedCamera(GetCameraIndex(index));
- private Camera _GetReferencedCamera(int referencedIndex) => _parentTableSet.GetCamera(referencedIndex);
+ private Camera _GetReferencedCamera(int referencedIndex) => ParentTableSet.GetCamera(referencedIndex);
public int[] Column_FamilyTypeIndex { get; }
public int GetFamilyTypeIndex(int index) => Column_FamilyTypeIndex.ElementAtOrDefault(index, EntityRelation.None);
public FamilyType GetFamilyType(int index) => _GetReferencedFamilyType(GetFamilyTypeIndex(index));
- private FamilyType _GetReferencedFamilyType(int referencedIndex) => _parentTableSet.GetFamilyType(referencedIndex);
+ private FamilyType _GetReferencedFamilyType(int referencedIndex) => ParentTableSet.GetFamilyType(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public View Get(int index)
{
@@ -5957,11 +6377,14 @@ public IEnumerator GetEnumerator()
public partial class ElementInViewTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public ElementInViewTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.ElementInView;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public ElementInViewTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_ViewIndex = GetIndexColumnValues("index:Vim.View:View") ?? Array.Empty();
Column_ElementIndex = GetIndexColumnValues("index:Vim.Element:Element") ?? Array.Empty();
}
@@ -5969,11 +6392,11 @@ public ElementInViewTable(SerializableEntityTable rawTable, string[] stringBuffe
public int[] Column_ViewIndex { get; }
public int GetViewIndex(int index) => Column_ViewIndex.ElementAtOrDefault(index, EntityRelation.None);
public View GetView(int index) => _GetReferencedView(GetViewIndex(index));
- private View _GetReferencedView(int referencedIndex) => _parentTableSet.GetView(referencedIndex);
+ private View _GetReferencedView(int referencedIndex) => ParentTableSet.GetView(referencedIndex);
public int[] Column_ElementIndex { get; }
public int GetElementIndex(int index) => Column_ElementIndex.ElementAtOrDefault(index, EntityRelation.None);
public Element GetElement(int index) => _GetReferencedElement(GetElementIndex(index));
- private Element _GetReferencedElement(int referencedIndex) => _parentTableSet.GetElement(referencedIndex);
+ private Element _GetReferencedElement(int referencedIndex) => ParentTableSet.GetElement(referencedIndex);
// Object Getter
public ElementInView Get(int index)
{
@@ -5995,11 +6418,14 @@ public IEnumerator GetEnumerator()
public partial class ShapeInViewTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public ShapeInViewTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.ShapeInView;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public ShapeInViewTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_ShapeIndex = GetIndexColumnValues("index:Vim.Shape:Shape") ?? Array.Empty();
Column_ViewIndex = GetIndexColumnValues("index:Vim.View:View") ?? Array.Empty();
}
@@ -6007,11 +6433,11 @@ public ShapeInViewTable(SerializableEntityTable rawTable, string[] stringBuffer,
public int[] Column_ShapeIndex { get; }
public int GetShapeIndex(int index) => Column_ShapeIndex.ElementAtOrDefault(index, EntityRelation.None);
public Shape GetShape(int index) => _GetReferencedShape(GetShapeIndex(index));
- private Shape _GetReferencedShape(int referencedIndex) => _parentTableSet.GetShape(referencedIndex);
+ private Shape _GetReferencedShape(int referencedIndex) => ParentTableSet.GetShape(referencedIndex);
public int[] Column_ViewIndex { get; }
public int GetViewIndex(int index) => Column_ViewIndex.ElementAtOrDefault(index, EntityRelation.None);
public View GetView(int index) => _GetReferencedView(GetViewIndex(index));
- private View _GetReferencedView(int referencedIndex) => _parentTableSet.GetView(referencedIndex);
+ private View _GetReferencedView(int referencedIndex) => ParentTableSet.GetView(referencedIndex);
// Object Getter
public ShapeInView Get(int index)
{
@@ -6033,11 +6459,14 @@ public IEnumerator GetEnumerator()
public partial class AssetInViewTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public AssetInViewTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.AssetInView;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public AssetInViewTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_AssetIndex = GetIndexColumnValues("index:Vim.Asset:Asset") ?? Array.Empty();
Column_ViewIndex = GetIndexColumnValues("index:Vim.View:View") ?? Array.Empty();
}
@@ -6045,11 +6474,11 @@ public AssetInViewTable(SerializableEntityTable rawTable, string[] stringBuffer,
public int[] Column_AssetIndex { get; }
public int GetAssetIndex(int index) => Column_AssetIndex.ElementAtOrDefault(index, EntityRelation.None);
public Asset GetAsset(int index) => _GetReferencedAsset(GetAssetIndex(index));
- private Asset _GetReferencedAsset(int referencedIndex) => _parentTableSet.GetAsset(referencedIndex);
+ private Asset _GetReferencedAsset(int referencedIndex) => ParentTableSet.GetAsset(referencedIndex);
public int[] Column_ViewIndex { get; }
public int GetViewIndex(int index) => Column_ViewIndex.ElementAtOrDefault(index, EntityRelation.None);
public View GetView(int index) => _GetReferencedView(GetViewIndex(index));
- private View _GetReferencedView(int referencedIndex) => _parentTableSet.GetView(referencedIndex);
+ private View _GetReferencedView(int referencedIndex) => ParentTableSet.GetView(referencedIndex);
// Object Getter
public AssetInView Get(int index)
{
@@ -6071,11 +6500,14 @@ public IEnumerator GetEnumerator()
public partial class AssetInViewSheetTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public AssetInViewSheetTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.AssetInViewSheet;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public AssetInViewSheetTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_AssetIndex = GetIndexColumnValues("index:Vim.Asset:Asset") ?? Array.Empty();
Column_ViewSheetIndex = GetIndexColumnValues("index:Vim.ViewSheet:ViewSheet") ?? Array.Empty();
}
@@ -6083,11 +6515,11 @@ public AssetInViewSheetTable(SerializableEntityTable rawTable, string[] stringBu
public int[] Column_AssetIndex { get; }
public int GetAssetIndex(int index) => Column_AssetIndex.ElementAtOrDefault(index, EntityRelation.None);
public Asset GetAsset(int index) => _GetReferencedAsset(GetAssetIndex(index));
- private Asset _GetReferencedAsset(int referencedIndex) => _parentTableSet.GetAsset(referencedIndex);
+ private Asset _GetReferencedAsset(int referencedIndex) => ParentTableSet.GetAsset(referencedIndex);
public int[] Column_ViewSheetIndex { get; }
public int GetViewSheetIndex(int index) => Column_ViewSheetIndex.ElementAtOrDefault(index, EntityRelation.None);
public ViewSheet GetViewSheet(int index) => _GetReferencedViewSheet(GetViewSheetIndex(index));
- private ViewSheet _GetReferencedViewSheet(int referencedIndex) => _parentTableSet.GetViewSheet(referencedIndex);
+ private ViewSheet _GetReferencedViewSheet(int referencedIndex) => ParentTableSet.GetViewSheet(referencedIndex);
// Object Getter
public AssetInViewSheet Get(int index)
{
@@ -6109,11 +6541,14 @@ public IEnumerator GetEnumerator()
public partial class LevelInViewTable : EntityTable_v2, IEnumerable
{
- private readonly EntityTableSet _parentTableSet; // can be null
- public LevelInViewTable(SerializableEntityTable rawTable, string[] stringBuffer, EntityTableSet parentTableSet = null) : base(rawTable, stringBuffer)
+ public const string TableName = TableNames.LevelInView;
+
+ public EntityTableSet ParentTableSet { get; } // can be null
+
+ public LevelInViewTable(SerializableEntityTable rawTable, string[] stringTable, EntityTableSet parentTableSet = null) : base(rawTable, stringTable)
{
- _parentTableSet = parentTableSet;
+ ParentTableSet = parentTableSet;
Column_Extents_Min_X = GetDataColumnValues("double:Extents.Min.X") ?? Array.Empty();
Column_Extents_Min_Y = GetDataColumnValues("double:Extents.Min.Y") ?? Array.Empty();
Column_Extents_Min_Z = GetDataColumnValues("double:Extents.Min.Z") ?? Array.Empty();
@@ -6139,11 +6574,11 @@ public LevelInViewTable(SerializableEntityTable rawTable, string[] stringBuffer,
public int[] Column_LevelIndex { get; }
public int GetLevelIndex(int index) => Column_LevelIndex.ElementAtOrDefault(index, EntityRelation.None);
public Level GetLevel(int index) => _GetReferencedLevel(GetLevelIndex(index));
- private Level _GetReferencedLevel(int referencedIndex) => _parentTableSet.GetLevel(referencedIndex);
+ private Level _GetReferencedLevel(int referencedIndex) => ParentTableSet.GetLevel(referencedIndex);
public int[] Column_ViewIndex { get; }
public int GetViewIndex(int index) => Column_ViewIndex.ElementAtOrDefault(index, EntityRelation.None);
public View GetView(int index) => _GetReferencedView(GetViewIndex(index));
- private View _GetReferencedView(int referencedIndex) => _parentTableSet.GetView(referencedIndex);
+ private View _GetReferencedView(int referencedIndex) => ParentTableSet.GetView(referencedIndex);
// Object Getter
public LevelInView Get(int index)
{
@@ -6171,11 +6606,14 @@ public IEnumerator GetEnumerator()
public partial class CameraTable : EntityTable_v2, IEnumerable