From dd35cd155f3c94ef6b85925b119d50d35a96fc51 Mon Sep 17 00:00:00 2001
From: Viktor Molostov <86685532+ConcreteEcho@users.noreply.github.com>
Date: Sat, 16 Dec 2023 18:10:04 +0300
Subject: [PATCH] add tests (#7)
---
.../BeamTests.cs | 144 +++++++
.../Fluent.Structures.Model.UnitTests.csproj | 26 ++
.../GlobalUsings.cs | 8 +
.../PolygonTests.cs | 45 ++
.../RebarGroupTests.cs | 386 ++++++++++++++++++
FluentStructures.sln | 6 +
.../{ => Beam}/Beam.cs | 133 +++++-
.../Beam/IBeamWithProfile.cs | 14 +
.../Beam/IBeamWithStartAndEndPoints.cs | 14 +
.../Beam/IBeamWithStartPoint.cs | 14 +
.../ICompletedBeam.cs} | 111 +++--
.../Beam/IEmptyBeam.cs | 22 +
.../Fluent.Structures.Model.csproj | 7 +-
...Fluent.Structures.Model.csproj.DotSettings | 5 +
src/Fluent.Structures.Model/GlobalUsings.cs | 1 +
src/Fluent.Structures.Model/Model.cs | 11 -
.../ModelObjectExtensions.cs | 25 --
src/Fluent.Structures.Model/Plate.cs | 162 --------
.../PlateBuilderInterfaces.cs | 27 --
.../Polygon/ICompletedPolygon.cs | 13 +
.../IEmptyPolygon.cs} | 12 -
.../{ => Polygon}/Polygon.cs | 0
.../RebarGroup/ICompletedRebarGroup.cs | 137 +++++++
.../RebarGroup/IEmptyRebarGroup.cs | 14 +
.../RebarGroup/IRebarGroupWithClass.cs | 28 ++
.../RebarGroup/IRebarGroupWithFather.cs | 42 ++
.../RebarGroup/IRebarGroupWithGrade.cs | 14 +
.../RebarGroup/IRebarGroupWithPolygons.cs | 22 +
.../RebarGroup/IRebarGroupWithRadiusValues.cs | 14 +
.../RebarGroup/IRebarGroupWithSize.cs | 28 ++
.../RebarGroup/IRebarGroupWithSpacings.cs | 44 ++
.../IRebarGroupWithStartAndEndPoints.cs | 14 +
.../RebarGroup/IRebarGroupWithStartHook.cs | 23 ++
.../RebarGroup/IRebarGroupWithStartPoint.cs | 14 +
.../{ => RebarGroup}/RebarGroup.cs | 184 +++++++--
.../RebarGroupBuilderInterfaces.cs | 296 --------------
.../TeklaAssemblyExtensions.cs | 17 -
37 files changed, 1431 insertions(+), 646 deletions(-)
create mode 100644 Fluent.Structures.Model.UnitTests/BeamTests.cs
create mode 100644 Fluent.Structures.Model.UnitTests/Fluent.Structures.Model.UnitTests.csproj
create mode 100644 Fluent.Structures.Model.UnitTests/GlobalUsings.cs
create mode 100644 Fluent.Structures.Model.UnitTests/PolygonTests.cs
create mode 100644 Fluent.Structures.Model.UnitTests/RebarGroupTests.cs
rename src/Fluent.Structures.Model/{ => Beam}/Beam.cs (78%)
create mode 100644 src/Fluent.Structures.Model/Beam/IBeamWithProfile.cs
create mode 100644 src/Fluent.Structures.Model/Beam/IBeamWithStartAndEndPoints.cs
create mode 100644 src/Fluent.Structures.Model/Beam/IBeamWithStartPoint.cs
rename src/Fluent.Structures.Model/{BeamBuilderInterfaces.cs => Beam/ICompletedBeam.cs} (61%)
create mode 100644 src/Fluent.Structures.Model/Beam/IEmptyBeam.cs
create mode 100644 src/Fluent.Structures.Model/Fluent.Structures.Model.csproj.DotSettings
delete mode 100644 src/Fluent.Structures.Model/Model.cs
delete mode 100644 src/Fluent.Structures.Model/ModelObjectExtensions.cs
delete mode 100644 src/Fluent.Structures.Model/Plate.cs
delete mode 100644 src/Fluent.Structures.Model/PlateBuilderInterfaces.cs
create mode 100644 src/Fluent.Structures.Model/Polygon/ICompletedPolygon.cs
rename src/Fluent.Structures.Model/{PolygonBuilderInterfaces.cs => Polygon/IEmptyPolygon.cs} (70%)
rename src/Fluent.Structures.Model/{ => Polygon}/Polygon.cs (100%)
create mode 100644 src/Fluent.Structures.Model/RebarGroup/ICompletedRebarGroup.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IEmptyRebarGroup.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithClass.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithFather.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithGrade.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithPolygons.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithRadiusValues.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSize.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSpacings.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartAndEndPoints.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartHook.cs
create mode 100644 src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartPoint.cs
rename src/Fluent.Structures.Model/{ => RebarGroup}/RebarGroup.cs (70%)
delete mode 100644 src/Fluent.Structures.Model/RebarGroupBuilderInterfaces.cs
delete mode 100644 src/Fluent.Structures.Model/TeklaAssemblyExtensions.cs
diff --git a/Fluent.Structures.Model.UnitTests/BeamTests.cs b/Fluent.Structures.Model.UnitTests/BeamTests.cs
new file mode 100644
index 0000000..32a621e
--- /dev/null
+++ b/Fluent.Structures.Model.UnitTests/BeamTests.cs
@@ -0,0 +1,144 @@
+namespace Fluent.Structures.Model.UnitTests;
+
+public class BeamTests
+{
+ private TSM.Beam _tekla = null!;
+
+ private readonly TSG.Point _startPoint = new(1, 2, 3);
+ private readonly TSG.Point _endPoint = new(4, 5, 6);
+ private readonly TSM.Profile _profile = new() { ProfileString = "D567", };
+ private readonly TSM.Material _material = new() { MaterialString = "C355", };
+ private const string Class = "654321";
+ private const string Name = "Beam name";
+ private readonly TSM.NumberingSeries _partNumber = new("part", 101);
+ private readonly TSM.NumberingSeries _assemblyNumber = new("assembly", 909);
+ private const TSM.Part.CastUnitTypeEnum CastUnitType = TSM.Part.CastUnitTypeEnum.CAST_IN_PLACE;
+ private const string Finish = "Painting";
+ private readonly TS.Identifier _identifier = new(1234567);
+ private const int PourPhase = 4567;
+
+ private readonly TSM.Offset _startPointOffset = new()
+ {
+ Dx = 67,
+ Dy = 73,
+ Dz = 81,
+ };
+
+ private readonly TSM.Offset _endPointOffset = new()
+ {
+ Dx = 93,
+ Dy = 97,
+ Dz = 103,
+ };
+
+ private readonly TSM.DeformingData _deformingData = new()
+ {
+ Shortening = 14d,
+ Cambering = 3.5d,
+ Angle = 45d,
+ Angle2 = 90d,
+ };
+
+ private readonly TSM.Position _position = new()
+ {
+ Depth = TSM.Position.DepthEnum.MIDDLE,
+ DepthOffset = 12,
+ Rotation = TSM.Position.RotationEnum.TOP,
+ RotationOffset = 23,
+ Plane = TSM.Position.PlaneEnum.RIGHT,
+ PlaneOffset = 34,
+ };
+
+ [SetUp]
+ public void SetupTeklaBeam()
+ => _tekla = new TSM.Beam()
+ {
+ StartPoint = _startPoint,
+ EndPoint = _endPoint,
+ Profile = _profile,
+ Material = _material,
+ Class = Class,
+ Name = Name,
+ PartNumber = _partNumber,
+ AssemblyNumber = _assemblyNumber,
+ Position = _position,
+ CastUnitType = CastUnitType,
+ Finish = Finish,
+ Identifier = _identifier,
+ DeformingData = _deformingData,
+ PourPhase = PourPhase,
+ StartPointOffset = _startPointOffset,
+ EndPointOffset = _endPointOffset,
+ };
+
+ [Test]
+ public void Required_fluent_properties_equals_to_tekla_properties()
+ {
+ var fluent = GetDefaultFluentBeam().Build();
+
+ fluent.StartPoint.Should().BeEquivalentTo(_tekla.StartPoint);
+ fluent.EndPoint.Should().BeEquivalentTo(_tekla.EndPoint);
+ fluent.Profile.Should().BeEquivalentTo(_tekla.Profile.ProfileString);
+ fluent.Material.Should().BeEquivalentTo(_tekla.Material.MaterialString);
+ }
+
+ [Test]
+ public void All_fluent_properties_equals_to_tekla_properties()
+ {
+ var fluent = GetDefaultFluentBeam()
+ .Class(Class)
+ .Name(Name)
+ .PartNumbering(_partNumber.Prefix, _partNumber.StartNumber)
+ .AssemblyNumbering(_assemblyNumber.Prefix, _assemblyNumber.StartNumber)
+ .DepthPosition(_position.Depth, _position.DepthOffset)
+ .PlanePosition(_position.Plane, _position.PlaneOffset)
+ .RotationPosition(_position.Rotation, _position.RotationOffset)
+ .CastUnitType(CastUnitType)
+ .Finish(Finish)
+ .Identifier(_identifier)
+ .DeformingData(_deformingData)
+ .PourPhase(PourPhase)
+ .StartPointOffset(_startPointOffset)
+ .EndPointOffset(_endPointOffset)
+ .Build();
+
+ fluent.Class.Should().BeEquivalentTo(_tekla.Class);
+ fluent.Name.Should().BeEquivalentTo(_tekla.Name);
+ fluent.PartPrefix.Should().BeEquivalentTo(_tekla.PartNumber.Prefix);
+ fluent.PartStartNumber.Should().Be(_tekla.PartNumber.StartNumber);
+ fluent.AssemblyPrefix.Should().BeEquivalentTo(_tekla.AssemblyNumber.Prefix);
+ fluent.AssemblyStartNumber.Should().Be(_tekla.AssemblyNumber.StartNumber);
+ fluent.DepthPosition.Should().Be(_tekla.Position.Depth);
+ fluent.DepthOffset.Should().Be(_tekla.Position.DepthOffset);
+ fluent.PlanePosition.Should().Be(_tekla.Position.Plane);
+ fluent.PlaneOffset.Should().Be(_tekla.Position.PlaneOffset);
+ fluent.RotationPosition.Should().Be(_tekla.Position.Rotation);
+ fluent.RotationOffset.Should().Be(_tekla.Position.RotationOffset);
+ fluent.CastUnitType.Should().Be(_tekla.CastUnitType);
+ fluent.Finish.Should().BeEquivalentTo(_tekla.Finish);
+ fluent.Identifier.Should().BeEquivalentTo(_tekla.Identifier);
+ fluent.DeformingData.Should().BeEquivalentTo(_tekla.DeformingData);
+ fluent.PourPhase.Should().Be(_tekla.PourPhase);
+ fluent.StartPointOffset.Should().BeEquivalentTo(_tekla.StartPointOffset);
+ fluent.EndPointOffset.Should().BeEquivalentTo(_tekla.EndPointOffset);
+ }
+
+ [Test]
+ public void Fluent_default_beam_properties_is_set()
+ {
+ var fluent = Beam.BuildBeam.Default().Build();
+
+ fluent.StartPoint.Should().NotBeNull();
+ fluent.EndPoint.Should().NotBeNull();
+ fluent.Profile.Should().NotBeNullOrEmpty();
+ fluent.Material.Should().NotBeNullOrEmpty();
+ fluent.Class.Should().NotBeNullOrEmpty();
+ }
+
+ private ICompletedBeam GetDefaultFluentBeam()
+ => Beam.BuildBeam.With()
+ .StartPoint(_startPoint)
+ .EndPoint(_endPoint)
+ .Profile(_profile.ProfileString)
+ .Material(_material.MaterialString);
+}
\ No newline at end of file
diff --git a/Fluent.Structures.Model.UnitTests/Fluent.Structures.Model.UnitTests.csproj b/Fluent.Structures.Model.UnitTests/Fluent.Structures.Model.UnitTests.csproj
new file mode 100644
index 0000000..a0a97a1
--- /dev/null
+++ b/Fluent.Structures.Model.UnitTests/Fluent.Structures.Model.UnitTests.csproj
@@ -0,0 +1,26 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+ false
+
+ default
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Fluent.Structures.Model.UnitTests/GlobalUsings.cs b/Fluent.Structures.Model.UnitTests/GlobalUsings.cs
new file mode 100644
index 0000000..ad09105
--- /dev/null
+++ b/Fluent.Structures.Model.UnitTests/GlobalUsings.cs
@@ -0,0 +1,8 @@
+// Global using directives
+
+global using System.Collections;
+global using FluentAssertions;
+global using NUnit.Framework;
+global using TS = Tekla.Structures;
+global using TSG = Tekla.Structures.Geometry3d;
+global using TSM = Tekla.Structures.Model;
\ No newline at end of file
diff --git a/Fluent.Structures.Model.UnitTests/PolygonTests.cs b/Fluent.Structures.Model.UnitTests/PolygonTests.cs
new file mode 100644
index 0000000..135f857
--- /dev/null
+++ b/Fluent.Structures.Model.UnitTests/PolygonTests.cs
@@ -0,0 +1,45 @@
+namespace Fluent.Structures.Model.UnitTests;
+
+public class PolygonTests
+{
+ private ArrayList _points = new()
+ {
+ new TSG.Point(1, 2, 3), new TSG.Point(4, 5, 6), new TSG.Point(7, 8, 9),
+ new TSG.Point(10, 11, 12), new TSG.Point(13, 14, 15),
+ };
+
+ private TSM.Polygon _tekla = null!;
+
+ [SetUp]
+ public void SetupTeklaPolygon()
+ => _tekla = new TSM.Polygon
+ { Points = _points, };
+
+ [Test]
+ public void Fluent_polygon_from_arraylist_equals_tekla_polygon()
+ {
+ var fluent = Polygon.BuildPolygon.With().Points(_points).Build();
+
+ fluent.Points.Should().BeEquivalentTo(_tekla.Points.Cast());
+ }
+
+ [Test]
+ public void Fluent_polygon_from_array_equals_tekla_polygon()
+ {
+ var fluent = Polygon.BuildPolygon.With()
+ .Points(_points.Cast().ToArray())
+ .Build();
+
+ fluent.Points.Should().BeEquivalentTo(_tekla.Points.Cast());
+ }
+
+ [Test]
+ public void Fluent_polygon_from_list_equals_tekla_polygon()
+ {
+ var fluent = Polygon.BuildPolygon.With()
+ .Points(_points.Cast().ToList())
+ .Build();
+
+ fluent.Points.Should().BeEquivalentTo(_tekla.Points.Cast());
+ }
+}
\ No newline at end of file
diff --git a/Fluent.Structures.Model.UnitTests/RebarGroupTests.cs b/Fluent.Structures.Model.UnitTests/RebarGroupTests.cs
new file mode 100644
index 0000000..539d94e
--- /dev/null
+++ b/Fluent.Structures.Model.UnitTests/RebarGroupTests.cs
@@ -0,0 +1,386 @@
+namespace Fluent.Structures.Model.UnitTests;
+
+public class RebarGroupTests
+{
+ private readonly TSM.ModelObject _father = new TSM.Beam(TSM.Beam.BeamTypeEnum.BEAM);
+
+ private readonly ArrayList _polygons = new()
+ {
+ new TSM.Polygon
+ {
+ Points = new ArrayList
+ {
+ new TSG.Point(-100, 0), new TSG.Point(100, 0), new TSG.Point(100, 200),
+ new TSG.Point(-100, 200),
+ },
+ },
+ };
+
+ private readonly TSG.Point _startPoint = new(1, 2, 3);
+
+ private readonly TSG.Point _endPoint = new(123, 456, 789);
+
+ private const string Grade = "A500C";
+ private const string Size = "25";
+
+ private readonly ArrayList _radiusValues = new() { 80d, };
+
+ private const int Class = 123456;
+
+ private readonly ArrayList _spacings = new() { 100d, 150d, 200d, 250d, 300d, };
+
+ private readonly TSM.RebarHookData _startHook = new()
+ {
+ Shape = TSM.RebarHookData.RebarHookShapeEnum.CUSTOM_HOOK, Angle = 35d, Length = 123d,
+ Radius = 80d,
+ };
+
+ private readonly TSM.RebarHookData _endHook = new()
+ {
+ Shape = TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK,
+ };
+
+ private readonly TSM.NumberingSeries _numberingSeries = new("prefix", 666);
+
+ private const TSM.BaseRebarGroup.RebarGroupSpacingTypeEnum SpacingType =
+ TSM.BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_SPACINGS;
+
+ private const double StartPointOffsetValue = 11;
+ private const double EndPointOffsetValue = 22;
+ private const double StartFromPlaneOffset = 33;
+ private const double EndFromPlaneOffset = 44;
+
+ private const string Name = "rebar group name";
+
+ private const TSM.Reinforcement.RebarOffsetTypeEnum StartPointOffsetType =
+ TSM.Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_LEG_LENGTH;
+
+ private const TSM.Reinforcement.RebarOffsetTypeEnum EndPointOffsetType =
+ TSM.Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
+
+ private readonly ArrayList _onPlaneOffsets = new() { 15d, 16d, 17d, 18d, };
+
+ private const TSM.BaseRebarGroup.ExcludeTypeEnum ExcludeType =
+ TSM.BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_BOTH;
+
+ private const TSM.RebarGroup.RebarGroupStirrupTypeEnum StirrupType =
+ TSM.RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL;
+
+ private const Tekla.Structures.Forming.DeformingType InputPointDeformingType =
+ Tekla.Structures.Forming.DeformingType.UNDEFORMED;
+
+ private readonly TS.Identifier _identifier = new() { ID = 98765432, };
+
+ private TSM.RebarGroup _tekla = null!;
+
+ [SetUp]
+ public void SetupTeklaRebarGroup()
+ => _tekla = new TSM.RebarGroup()
+ {
+ Father = _father,
+ Polygons = _polygons,
+ StartPoint = _startPoint,
+ EndPoint = _endPoint,
+ Grade = Grade,
+ Size = Size,
+ RadiusValues = _radiusValues,
+ Class = Class,
+ Spacings = _spacings,
+ StartHook = _startHook,
+ EndHook = _endHook,
+ NumberingSeries = _numberingSeries,
+ SpacingType = SpacingType,
+ StartPointOffsetValue = StartPointOffsetValue,
+ EndPointOffsetValue = EndPointOffsetValue,
+ StartFromPlaneOffset = StartFromPlaneOffset,
+ EndFromPlaneOffset = EndFromPlaneOffset,
+ Name = Name,
+ StartPointOffsetType = StartPointOffsetType,
+ EndPointOffsetType = EndPointOffsetType,
+ OnPlaneOffsets = _onPlaneOffsets,
+ ExcludeType = ExcludeType,
+ StirrupType = StirrupType,
+ Identifier = _identifier,
+ InputPointDeformingState = InputPointDeformingType,
+ };
+
+ [Test]
+ public void Required_fluent_properties_equals_to_tekla_properties()
+ {
+ var fluent = GetDefaultFluentRebarGroup().Build();
+
+ fluent.Father.Should().BeEquivalentTo(_tekla.Father);
+ fluent.Polygons.Should().BeEquivalentTo(_tekla.Polygons.Cast());
+ fluent.StartPoint.Should().BeEquivalentTo(_tekla.StartPoint);
+ fluent.EndPoint.Should().BeEquivalentTo(_tekla.EndPoint);
+ fluent.Grade.Should().BeEquivalentTo(_tekla.Grade);
+ fluent.Size.Should().BeEquivalentTo(_tekla.Size);
+ fluent.RadiusValues.Should().BeEquivalentTo(_tekla.RadiusValues.Cast());
+ fluent.Class.Should().Be(_tekla.Class);
+ fluent.Spacings.Should().BeEquivalentTo(_tekla.Spacings.Cast());
+ fluent.StartHook.Should().BeEquivalentTo(_tekla.StartHook);
+ fluent.EndHook.Should().BeEquivalentTo(_tekla.EndHook);
+ }
+
+ [Test]
+ public void Fluent_numbering_equals_to_tekla_numbering()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.NumberingSeries(_numberingSeries.Prefix, _numberingSeries.StartNumber);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.NumberingSeries.Should().BeEquivalentTo(_tekla.NumberingSeries);
+ }
+
+ [Test]
+ public void Fluent_Spacing_type_equals_to_tekla_spacing_type()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.SpacingType(SpacingType);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.SpacingType.Should().Be(_tekla.SpacingType);
+ }
+
+ [Test]
+ public void Fluent_start_point_offset_value_equals_to_tekla_value()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.StartPointOffsetValue(StartPointOffsetValue);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.StartPointOffsetValue.Should().Be(_tekla.StartPointOffsetValue);
+ }
+
+ [Test]
+ public void Fluent_end_point_offset_value_equals_to_tekla_value()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.EndPointOffsetValue(EndPointOffsetValue);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.EndPointOffsetValue.Should().Be(_tekla.EndPointOffsetValue);
+ }
+
+ [Test]
+ public void Fluent_start_from_plane_offset_equals_to_tekla_offset()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.StartFromPlaneOffset(StartFromPlaneOffset);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.StartFromPlaneOffset.Should().Be(_tekla.StartFromPlaneOffset);
+ }
+
+ [Test]
+ public void Fluent_end_from_plane_offset_equals_to_tekla_offset()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.EndFromPlaneOffset(EndFromPlaneOffset);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.EndFromPlaneOffset.Should().Be(_tekla.EndFromPlaneOffset);
+ }
+
+ [Test]
+ public void Fluent_name_equals_to_tekla_name()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.Name(Name);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.Name.Should().BeEquivalentTo(_tekla.Name);
+ }
+
+ [Test]
+ public void Fluent_start_point_offset_type_equals_tekla_type()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.StartPointOffsetType(StartPointOffsetType);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.StartPointOffsetType.Should().Be(_tekla.StartPointOffsetType);
+ }
+
+ [Test]
+ public void Fluent_end_point_offset_type_equals_tekla_type()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.EndPointOffsetType(EndPointOffsetType);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.EndPointOffsetType.Should().Be(_tekla.EndPointOffsetType);
+ }
+
+ [Test]
+ public void Fluent_on_plane_offsets_equals_tekla_offsets()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.OnPlaneOffsets(_onPlaneOffsets);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.OnPlaneOffsets.Should().BeEquivalentTo(_tekla.OnPlaneOffsets.Cast());
+ }
+
+ [Test]
+ public void Fluent_exclude_type_equals_tekla_type()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.ExcludeType(ExcludeType);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.ExcludeType.Should().Be(_tekla.ExcludeType);
+ }
+
+ [Test]
+ public void Fluent_stirrup_type_equals_tekla_type()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.StirrupType(StirrupType);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.StirrupType.Should().Be(_tekla.StirrupType);
+ }
+
+ [Test]
+ public void Fluent_identifier_equals_tekla_identifier()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.Identifier(_identifier);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.Identifier.Should().BeEquivalentTo(_tekla.Identifier);
+ }
+
+ [Test]
+ public void Fluent_input_point_deforming_type_equals_tekla_type()
+ {
+ var incompleteRebarGroup = GetDefaultFluentRebarGroup();
+ incompleteRebarGroup.InputPointDeformingState(InputPointDeformingType);
+ var fluent = incompleteRebarGroup.Build();
+
+ fluent.InputPointDeformingState.Should().Be(_tekla.InputPointDeformingState);
+ }
+
+ [Test]
+ public void Fluent_radius_values_equals_tekla_values()
+ {
+ var incompleteRebarGroup = RebarGroup.BuildRebarGroup.With()
+ .Father(_father)
+ .Polygons(_polygons)
+ .StartPoint(_startPoint)
+ .EndPoint(_endPoint)
+ .Grade(Grade)
+ .Size(Size);
+
+ var arrayRadiuses = incompleteRebarGroup.RadiusValues(
+ (double)(_radiusValues[0] ?? throw new InvalidOperationException())
+ );
+ var listRadiuses =
+ incompleteRebarGroup.RadiusValues(new List(_radiusValues.Cast()));
+
+ var arrayRebarGroup = arrayRadiuses.Class(Class)
+ .Spacings(_spacings)
+ .StartHook(_startHook)
+ .EndHook(_endHook)
+ .Build();
+
+ var listRebarGroup = listRadiuses.Class(Class)
+ .Spacings(_spacings)
+ .StartHook(_startHook)
+ .EndHook(_endHook)
+ .Build();
+
+ arrayRebarGroup.RadiusValues.Should().BeEquivalentTo(_tekla.RadiusValues.Cast());
+ listRebarGroup.RadiusValues.Should().BeEquivalentTo(_tekla.RadiusValues.Cast());
+ }
+
+ [Test]
+ public void Fluent_polygons_from_point_array_equals_tekla_polygons()
+ {
+ var incompleteRebarGroup = RebarGroup.BuildRebarGroup.With()
+ .Father(_father);
+
+ var pointsArrayPolygon = incompleteRebarGroup.Polygons(
+ (_polygons[0] as TSM.Polygon)?.Points?.Cast().ToArray()
+ ?? throw new ArgumentNullException()
+ );
+
+ var pointsArrayRebarGroup = pointsArrayPolygon.StartPoint(_startPoint)
+ .EndPoint(_endPoint)
+ .Grade(Grade)
+ .Size(Size)
+ .RadiusValues(_radiusValues)
+ .Class(Class)
+ .Spacings(_spacings)
+ .StartHook(_startHook)
+ .EndHook(_endHook)
+ .Build();
+
+ pointsArrayRebarGroup.Polygons.Should().BeEquivalentTo(_tekla.Polygons.Cast());
+ }
+
+ [Test]
+ public void Fluent_polygons_from_polygon_array_equals_tekla_polygons()
+ {
+ var incompleteRebarGroup = RebarGroup.BuildRebarGroup.With()
+ .Father(_father);
+
+ var polygonsArrayPolygon = incompleteRebarGroup.Polygons(
+ _polygons[0] as TSM.Polygon ?? throw new ArgumentNullException()
+ );
+
+ var polygonsArrayRebarGroup = polygonsArrayPolygon.StartPoint(_startPoint)
+ .EndPoint(_endPoint)
+ .Grade(Grade)
+ .Size(Size)
+ .RadiusValues(_radiusValues)
+ .Class(Class)
+ .Spacings(_spacings)
+ .StartHook(_startHook)
+ .EndHook(_endHook)
+ .Build();
+
+ polygonsArrayRebarGroup.Polygons.Should()
+ .BeEquivalentTo(_tekla.Polygons.Cast());
+ }
+
+ [Test]
+ public void Fluent_polygons_from_point_list_equals_tekla_polygons()
+ {
+ var incompleteRebarGroup = RebarGroup.BuildRebarGroup.With()
+ .Father(_father);
+
+ var pointsListPolygon = incompleteRebarGroup.Polygons(
+ (_polygons[0] as TSM.Polygon)?.Points?.Cast().ToList()
+ ?? throw new ArgumentNullException()
+ );
+
+ var pointsListRebarGroup = pointsListPolygon.StartPoint(_startPoint)
+ .EndPoint(_endPoint)
+ .Grade(Grade)
+ .Size(Size)
+ .RadiusValues(_radiusValues)
+ .Class(Class)
+ .Spacings(_spacings)
+ .StartHook(_startHook)
+ .EndHook(_endHook)
+ .Build();
+
+ pointsListRebarGroup.Polygons.Should().BeEquivalentTo(_tekla.Polygons.Cast());
+ }
+
+ private ICompletedRebarGroup GetDefaultFluentRebarGroup()
+ => RebarGroup.BuildRebarGroup.With()
+ .Father(_father)
+ .Polygons(_polygons)
+ .StartPoint(_startPoint)
+ .EndPoint(_endPoint)
+ .Grade(Grade)
+ .Size(Size)
+ .RadiusValues(_radiusValues)
+ .Class(Class)
+ .Spacings(_spacings)
+ .StartHook(_startHook)
+ .EndHook(_endHook);
+}
\ No newline at end of file
diff --git a/FluentStructures.sln b/FluentStructures.sln
index afa5ec5..e5f2f55 100644
--- a/FluentStructures.sln
+++ b/FluentStructures.sln
@@ -2,6 +2,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fluent.Structures.Model", "src\Fluent.Structures.Model\Fluent.Structures.Model.csproj", "{6E01CE07-0E03-438F-BE78-67C9550357E9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fluent.Structures.Model.UnitTests", "Fluent.Structures.Model.UnitTests\Fluent.Structures.Model.UnitTests.csproj", "{8C60237B-53C6-471A-8041-4B615587F8B8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -12,6 +14,10 @@ Global
{6E01CE07-0E03-438F-BE78-67C9550357E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E01CE07-0E03-438F-BE78-67C9550357E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6E01CE07-0E03-438F-BE78-67C9550357E9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8C60237B-53C6-471A-8041-4B615587F8B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8C60237B-53C6-471A-8041-4B615587F8B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8C60237B-53C6-471A-8041-4B615587F8B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8C60237B-53C6-471A-8041-4B615587F8B8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
diff --git a/src/Fluent.Structures.Model/Beam.cs b/src/Fluent.Structures.Model/Beam/Beam.cs
similarity index 78%
rename from src/Fluent.Structures.Model/Beam.cs
rename to src/Fluent.Structures.Model/Beam/Beam.cs
index 2812816..9528b12 100644
--- a/src/Fluent.Structures.Model/Beam.cs
+++ b/src/Fluent.Structures.Model/Beam/Beam.cs
@@ -15,6 +15,7 @@ private Beam(TSM.Beam.BeamTypeEnum beamTypeEnum = TSM.Beam.BeamTypeEnum.BEAM)
///
/// The underlying Tekla Structures Model beam object.
///
+ // ReSharper disable once MemberCanBePrivate.Global
public TSM.Beam TeklaBeam { get; }
///
@@ -138,7 +139,12 @@ public ICompletedBeam PartNumbering(string partPrefix, int partStartNumber)
return this;
}
- ///
+ public ICompletedBeam Position(TSM.Position position)
+ {
+ _beam.Position = position;
+ return this;
+ }
+
public ICompletedBeam PlanePosition(TSM.Position.PlaneEnum planeEnum, double planeOffset)
{
_beam.PlanePosition = planeEnum;
@@ -166,11 +172,46 @@ public ICompletedBeam RotationPosition(TSM.Position.RotationEnum rotationEnum,
///
public ICompletedBeam CastUnitType(TSM.Part.CastUnitTypeEnum castUnitTypeEnum)
{
- _beam.CastUnitTypeEnum = castUnitTypeEnum;
+ _beam.CastUnitType = castUnitTypeEnum;
+ return this;
+ }
+
+ public ICompletedBeam Finish(string finish)
+ {
+ _beam.Finish = finish;
+ return this;
+ }
+
+ public ICompletedBeam Identifier(TS.Identifier identifier)
+ {
+ _beam.Identifier = identifier;
+ return this;
+ }
+
+ public ICompletedBeam DeformingData(TSM.DeformingData deformingData)
+ {
+ _beam.DeformingData = deformingData;
+ return this;
+ }
+
+ public ICompletedBeam PourPhase(int pourPhase)
+ {
+ _beam.PourPhase = pourPhase;
+ return this;
+ }
+
+ public ICompletedBeam StartPointOffset(TSM.Offset startPointOffset)
+ {
+ _beam.StartPointOffset = startPointOffset;
+ return this;
+ }
+
+ public ICompletedBeam EndPointOffset(TSM.Offset endPointOffset)
+ {
+ _beam.EndPointOffset = endPointOffset;
return this;
}
- ///
public Beam Build()
=> _beam;
@@ -331,6 +372,18 @@ public int PartStartNumber
private set => TeklaBeam.PartNumber!.StartNumber = value;
}
+ ///
+ /// Gets or sets the position information for the Tekla Structures Beam.
+ ///
+ ///
+ /// The position of the beam in the model.
+ ///
+ public TSM.Position Position
+ {
+ get => TeklaBeam.Position;
+ private set => TeklaBeam.Position = value;
+ }
+
///
/// Gets or sets the depth position of the Tekla Structures Beam.
///
@@ -409,11 +462,83 @@ public double RotationOffset
///
/// The cast unit type is an enum representing the type of casting unit for the beam.
///
- public TSM.Part.CastUnitTypeEnum CastUnitTypeEnum
+ public TSM.Part.CastUnitTypeEnum CastUnitType
{
get => TeklaBeam.CastUnitType;
private set => TeklaBeam.CastUnitType = value;
}
+ ///
+ /// Gets or sets the finish property for the Tekla Structures Beam.
+ ///
+ ///
+ /// The finish property represents the surface quality or treatment applied to the beam.
+ ///
+ public string Finish
+ {
+ get => TeklaBeam.Finish;
+ private set => TeklaBeam.Finish = value;
+ }
+
+ ///
+ /// Gets or sets the identifier for the Tekla Structures Beam.
+ ///
+ ///
+ /// The identifier uniquely identifies the beam within the model.
+ ///
+ public TS.Identifier Identifier
+ {
+ get => TeklaBeam.Identifier;
+ private set => TeklaBeam.Identifier = value;
+ }
+
+ ///
+ /// Gets or sets the deforming data for the Tekla Structures Beam.
+ ///
+ ///
+ /// Deforming data includes information about how the beam may deform under certain conditions.
+ ///
+ public TSM.DeformingData DeformingData
+ {
+ get => TeklaBeam.DeformingData;
+ private set => TeklaBeam.DeformingData = value;
+ }
+
+ ///
+ /// Gets or sets the pour phase for the Tekla Structures Beam.
+ ///
+ ///
+ /// The pour phase indicates the construction phase during which the beam is poured or installed.
+ ///
+ public int PourPhase
+ {
+ get => TeklaBeam.PourPhase;
+ private set => TeklaBeam.PourPhase = value;
+ }
+
+ ///
+ /// Gets or sets the start point offset for the Tekla Structures Beam.
+ ///
+ ///
+ /// The offset from the beam's start point in the model.
+ ///
+ public TSM.Offset StartPointOffset
+ {
+ get => TeklaBeam.StartPointOffset;
+ private set => TeklaBeam.StartPointOffset = value;
+ }
+
+ ///
+ /// Gets or sets the end point offset for the Tekla Structures Beam.
+ ///
+ ///
+ /// The offset from the beam's end point in the model.
+ ///
+ public TSM.Offset EndPointOffset
+ {
+ get => TeklaBeam.EndPointOffset;
+ private set => TeklaBeam.EndPointOffset = value;
+ }
+
#endregion
}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Beam/IBeamWithProfile.cs b/src/Fluent.Structures.Model/Beam/IBeamWithProfile.cs
new file mode 100644
index 0000000..24ceb90
--- /dev/null
+++ b/src/Fluent.Structures.Model/Beam/IBeamWithProfile.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents an interface for completing the configuration of a Tekla Structures Beam with the builder pattern.
+///
+public interface IBeamWithProfile
+{
+ ///
+ /// Specifies the material of the beam.
+ ///
+ /// The material of the beam.
+ /// An interface for further configuration.
+ public ICompletedBeam Material(string material);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Beam/IBeamWithStartAndEndPoints.cs b/src/Fluent.Structures.Model/Beam/IBeamWithStartAndEndPoints.cs
new file mode 100644
index 0000000..5a7fb5e
--- /dev/null
+++ b/src/Fluent.Structures.Model/Beam/IBeamWithStartAndEndPoints.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents an interface for specifying the profile of a Tekla Structures Beam with the builder pattern.
+///
+public interface IBeamWithStartAndEndPoints
+{
+ ///
+ /// Specifies the profile of the beam.
+ ///
+ /// The profile of the beam.
+ /// An interface for further configuration.
+ public IBeamWithProfile Profile(string profile);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Beam/IBeamWithStartPoint.cs b/src/Fluent.Structures.Model/Beam/IBeamWithStartPoint.cs
new file mode 100644
index 0000000..8a6ef59
--- /dev/null
+++ b/src/Fluent.Structures.Model/Beam/IBeamWithStartPoint.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents an interface for specifying the end point of a Tekla Structures Beam with the builder pattern.
+///
+public interface IBeamWithStartPoint
+{
+ ///
+ /// Specifies the ending point of the beam.
+ ///
+ /// The ending point of the beam.
+ /// An interface for further configuration.
+ public IBeamWithStartAndEndPoints EndPoint(TSG.Point endPoint);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/BeamBuilderInterfaces.cs b/src/Fluent.Structures.Model/Beam/ICompletedBeam.cs
similarity index 61%
rename from src/Fluent.Structures.Model/BeamBuilderInterfaces.cs
rename to src/Fluent.Structures.Model/Beam/ICompletedBeam.cs
index ab118f0..882fa20 100644
--- a/src/Fluent.Structures.Model/BeamBuilderInterfaces.cs
+++ b/src/Fluent.Structures.Model/Beam/ICompletedBeam.cs
@@ -1,65 +1,5 @@
namespace Fluent.Structures.Model;
-///
-/// Represents an interface for starting the construction of a Beam with the builder pattern.
-///
-public interface IEmptyBeam
-{
- ///
- /// Specifies the start and end points of the beam.
- ///
- /// The starting point of the beam.
- /// The ending point of the beam.
- /// An interface for further configuration.
- public IBeamWithStartAndEndPoints StartAndEndPoint(TSG.Point startPoint, TSG.Point endPoint);
-
- ///
- /// Specifies the starting point of the beam.
- ///
- /// The starting point of the beam.
- /// An interface for further configuration.
- public IBeamWithStartPoint StartPoint(TSG.Point startPoint);
-}
-
-///
-/// Represents an interface for specifying the end point of a Tekla Structures Beam with the builder pattern.
-///
-public interface IBeamWithStartPoint
-{
- ///
- /// Specifies the ending point of the beam.
- ///
- /// The ending point of the beam.
- /// An interface for further configuration.
- public IBeamWithStartAndEndPoints EndPoint(TSG.Point endPoint);
-}
-
-///
-/// Represents an interface for specifying the profile of a Tekla Structures Beam with the builder pattern.
-///
-public interface IBeamWithStartAndEndPoints
-{
- ///
- /// Specifies the profile of the beam.
- ///
- /// The profile of the beam.
- /// An interface for further configuration.
- public IBeamWithProfile Profile(string profile);
-}
-
-///
-/// Represents an interface for completing the configuration of a Tekla Structures Beam with the builder pattern.
-///
-public interface IBeamWithProfile
-{
- ///
- /// Specifies the material of the beam.
- ///
- /// The material of the beam.
- /// An interface for further configuration.
- public ICompletedBeam Material(string material);
-}
-
///
/// Represents an interface for finalizing the construction of a Beam with the builder pattern.
///
@@ -95,6 +35,13 @@ public interface ICompletedBeam
/// An interface for further configuration or finalizing the construction.
public ICompletedBeam PartNumbering(string partPrefix, int partStartNumber);
+ ///
+ /// Specifies the position information for the beam.
+ ///
+ /// The position object containing information about the beam's location.
+ /// An interface for further configuration or finalizing the construction.
+ public ICompletedBeam Position(TSM.Position position);
+
///
/// Specifies the position of the beam in the plane.
///
@@ -124,9 +71,51 @@ public ICompletedBeam RotationPosition(TSM.Position.RotationEnum rotationEnum,
/// Specifies the cast unit type of the beam.
///
/// The cast unit type enum.
- /// The finalized Tekla Structures Beam object.
+ /// An interface for further configuration or finalizing the construction.
public ICompletedBeam CastUnitType(TSM.Part.CastUnitTypeEnum castUnitTypeEnum);
+ ///
+ /// Specifies the finish of the beam.
+ ///
+ /// The finish of the beam.
+ /// An interface for further configuration or finalizing the construction.
+ public ICompletedBeam Finish(string finish);
+
+ ///
+ /// Specifies the identifier for the beam.
+ ///
+ /// The identifier for the beam.
+ /// An interface for further configuration or finalizing the construction.
+ public ICompletedBeam Identifier(TS.Identifier identifier);
+
+ ///
+ /// Specifies the deforming data for the beam.
+ ///
+ /// The deforming data for the beam.
+ /// An interface for further configuration or finalizing the construction.
+ public ICompletedBeam DeformingData(TSM.DeformingData deformingData);
+
+ ///
+ /// Specifies the pour phase for the beam.
+ ///
+ /// The pour phase for the beam.
+ /// An interface for further configuration or finalizing the construction.
+ public ICompletedBeam PourPhase(int pourPhase);
+
+ ///
+ /// Specifies the start point offset for the beam.
+ ///
+ /// The offset for the start point of the beam.
+ /// An interface for further configuration or finalizing the construction.
+ public ICompletedBeam StartPointOffset(TSM.Offset startPointOffset);
+
+ ///
+ /// Specifies the end point offset for the beam.
+ ///
+ /// The offset for the end point of the beam.
+ /// An interface for further configuration or finalizing the construction.
+ public ICompletedBeam EndPointOffset(TSM.Offset endPointOffset);
+
///
/// Finalizes the construction and returns the Beam object.
///
diff --git a/src/Fluent.Structures.Model/Beam/IEmptyBeam.cs b/src/Fluent.Structures.Model/Beam/IEmptyBeam.cs
new file mode 100644
index 0000000..5942b4b
--- /dev/null
+++ b/src/Fluent.Structures.Model/Beam/IEmptyBeam.cs
@@ -0,0 +1,22 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents an interface for starting the construction of a Beam with the builder pattern.
+///
+public interface IEmptyBeam
+{
+ ///
+ /// Specifies the start and end points of the beam.
+ ///
+ /// The starting point of the beam.
+ /// The ending point of the beam.
+ /// An interface for further configuration.
+ public IBeamWithStartAndEndPoints StartAndEndPoint(TSG.Point startPoint, TSG.Point endPoint);
+
+ ///
+ /// Specifies the starting point of the beam.
+ ///
+ /// The starting point of the beam.
+ /// An interface for further configuration.
+ public IBeamWithStartPoint StartPoint(TSG.Point startPoint);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Fluent.Structures.Model.csproj b/src/Fluent.Structures.Model/Fluent.Structures.Model.csproj
index b5bf764..e160f30 100644
--- a/src/Fluent.Structures.Model/Fluent.Structures.Model.csproj
+++ b/src/Fluent.Structures.Model/Fluent.Structures.Model.csproj
@@ -6,17 +6,20 @@
enable
latestmajor
Fluent.Structures.Model
- 0.2.2
- ConcreteEcho
+ 0.2.3
+ Victor Molostov
Fluent.Structures.Model
Fluent.Structures.Model
Tekla
Interact effortlessly with the Tekla API using the Fluent Interface.
true
true
+ 0.2.3
+ Victor Molostov
README.md
https://github.com/ConcreteEcho/FluentStructures
LICENSE
+ embedded
diff --git a/src/Fluent.Structures.Model/Fluent.Structures.Model.csproj.DotSettings b/src/Fluent.Structures.Model/Fluent.Structures.Model.csproj.DotSettings
new file mode 100644
index 0000000..7538425
--- /dev/null
+++ b/src/Fluent.Structures.Model/Fluent.Structures.Model.csproj.DotSettings
@@ -0,0 +1,5 @@
+
+ True
+ True
+ True
+ True
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/GlobalUsings.cs b/src/Fluent.Structures.Model/GlobalUsings.cs
index 83ec5d3..a4061ae 100644
--- a/src/Fluent.Structures.Model/GlobalUsings.cs
+++ b/src/Fluent.Structures.Model/GlobalUsings.cs
@@ -2,5 +2,6 @@
global using System.Collections;
global using System.Collections.Generic;
+global using TS = Tekla.Structures;
global using TSM = Tekla.Structures.Model;
global using TSG = Tekla.Structures.Geometry3d;
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Model.cs b/src/Fluent.Structures.Model/Model.cs
deleted file mode 100644
index 43fbb00..0000000
--- a/src/Fluent.Structures.Model/Model.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Fluent.Structures.Model;
-
-public class Model
-{
- public TSM.Model TeklaModel;
-
- public Model()
- => TeklaModel = new TSM.Model();
-
- public bool IsConnected => TeklaModel.GetConnectionStatus();
-}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/ModelObjectExtensions.cs b/src/Fluent.Structures.Model/ModelObjectExtensions.cs
deleted file mode 100644
index 4e118a9..0000000
--- a/src/Fluent.Structures.Model/ModelObjectExtensions.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-namespace Fluent.Structures.Model;
-
-public static class ModelObjectEnumeratorExtensions
-{
- public static IEnumerable GetEnumerable(this TSM.ModelObjectEnumerator? enumerator)
- {
- while (enumerator is not null && enumerator.MoveNext())
- if (enumerator.Current != null)
- yield return enumerator.Current;
- }
-
- public static string? GetAssemblyPos(this TSM.ModelObject? modelObject)
- {
- var s = string.Empty;
- modelObject?.GetReportProperty("ASSEMBLY_POS", ref s);
- return s;
- }
-
- public static string? GetPartPos(this TSM.ModelObject? modelObject)
- {
- var s = string.Empty;
- modelObject?.GetReportProperty("PART_POS", ref s);
- return s;
- }
-}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Plate.cs b/src/Fluent.Structures.Model/Plate.cs
deleted file mode 100644
index c2b92cb..0000000
--- a/src/Fluent.Structures.Model/Plate.cs
+++ /dev/null
@@ -1,162 +0,0 @@
-namespace Fluent.Structures.Model;
-
-public sealed class Plate
-{
- private readonly TSM.ContourPlate _tsmPlate;
-
- private Plate()
- => _tsmPlate = new TSM.ContourPlate();
-
- public void Insert()
- => _tsmPlate.Insert();
-
- public TSM.Assembly GetAssembly()
- => _tsmPlate.GetAssembly();
-
- #region Builder
- public class BuildPlate : IEmptyPlate, IPlateWithPoints, IPlateWithProfile, ICompletedPlate
- {
- private readonly Plate _plate = new();
-
- public static IEmptyPlate With()
- => new BuildPlate();
-
- public IPlateWithPoints Points(params TSM.ContourPoint[] points)
- {
- var arrList = new ArrayList();
- foreach (var point in points)
- arrList.Add(point);
- _plate.Points = arrList;
- return this;
- }
-
- public IPlateWithPoints Contour(TSM.Contour contour)
- {
- _plate.Contour = contour;
- return this;
- }
-
- public IPlateWithProfile Profile(string profile)
- {
- _plate.Profile = profile;
- return this;
- }
-
- public ICompletedPlate Material(string material)
- {
- _plate.Material = material;
- return this;
- }
-
- public ICompletedPlate WithName(string name)
- {
- _plate.Name = name;
- return this;
- }
-
- public ICompletedPlate WithClass(string @class)
- {
- _plate.Class = @class;
- return this;
- }
-
- public ICompletedPlate WithAssemblyNumbering(string assemblyPrefix, int assemblyStartNumber)
- {
- _plate.AssemblyPrefix = assemblyPrefix;
- _plate.AssemblyStartNumber = assemblyStartNumber;
- return this;
- }
-
- public ICompletedPlate WithPartNumbering(string partPrefix, int partStartNumber)
- {
- _plate.PartPrefix = partPrefix;
- _plate.PartStartNumber = partStartNumber;
- return this;
- }
-
- public ICompletedPlate WithDepthPosition(TSM.Position.DepthEnum depthEnum, double depthOffset)
- {
- _plate.DepthPosition = depthEnum;
- _plate.DepthOffest = depthOffset;
- return this;
- }
-
- public Plate Build()
- => _plate;
- }
- #endregion
-
- #region Properties
- public TSM.Contour Contour
- {
- get => _tsmPlate.Contour!;
- private set => _tsmPlate.Contour = value;
- }
-
- public ArrayList Points
- {
- get => _tsmPlate.Contour!.ContourPoints!;
- private set => _tsmPlate.Contour!.ContourPoints = value;
- }
-
- public string? Profile
- {
- get => _tsmPlate.Profile.ProfileString;
- private set => _tsmPlate.Profile.ProfileString = value;
- }
-
- public string? Material
- {
- get => _tsmPlate.Material?.MaterialString;
- private set => _tsmPlate.Material.MaterialString = value;
- }
-
- public string? Name
- {
- get => _tsmPlate.Name;
- private set => _tsmPlate.Name = value;
- }
-
- public string? Class
- {
- get => _tsmPlate.Class;
- private set => _tsmPlate.Class = value;
- }
-
- public string? AssemblyPrefix
- {
- get => _tsmPlate.AssemblyNumber.Prefix;
- private set => _tsmPlate.AssemblyNumber.Prefix = value;
- }
-
- public int AssemblyStartNumber
- {
- get => _tsmPlate.AssemblyNumber!.StartNumber;
- private set => _tsmPlate.AssemblyNumber!.StartNumber = value;
- }
-
- public string? PartPrefix
- {
- get => _tsmPlate.PartNumber.Prefix;
- private set => _tsmPlate.PartNumber.Prefix = value;
- }
-
- public int PartStartNumber
- {
- get => _tsmPlate.PartNumber!.StartNumber;
- private set => _tsmPlate.PartNumber!.StartNumber = value;
- }
-
- public TSM.Position.DepthEnum DepthPosition
- {
- get => _tsmPlate.Position.Depth;
- private set => _tsmPlate.Position.Depth = value;
- }
-
- public double DepthOffest
- {
- get => _tsmPlate.Position!.DepthOffset;
- private set => _tsmPlate.Position!.DepthOffset = value;
- }
- #endregion
-}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/PlateBuilderInterfaces.cs b/src/Fluent.Structures.Model/PlateBuilderInterfaces.cs
deleted file mode 100644
index b1b6a9d..0000000
--- a/src/Fluent.Structures.Model/PlateBuilderInterfaces.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace Fluent.Structures.Model;
-
-public interface IEmptyPlate
-{
- IPlateWithPoints Points(params TSM.ContourPoint[] points);
- IPlateWithPoints Contour(TSM.Contour contour);
-}
-
-public interface IPlateWithPoints
-{
- IPlateWithProfile Profile(string profile);
-}
-
-public interface IPlateWithProfile
-{
- ICompletedPlate Material(string material);
-}
-
-public interface ICompletedPlate
-{
- public ICompletedPlate WithName(string name);
- public ICompletedPlate WithClass(string @class);
- public ICompletedPlate WithAssemblyNumbering(string assemblyPrefix, int assemblyStartNumber);
- public ICompletedPlate WithPartNumbering(string partPrefix, int partStartNumber);
- public ICompletedPlate WithDepthPosition(TSM.Position.DepthEnum depthEnum, double depthOffset);
- public Plate Build();
-}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Polygon/ICompletedPolygon.cs b/src/Fluent.Structures.Model/Polygon/ICompletedPolygon.cs
new file mode 100644
index 0000000..f0ecffc
--- /dev/null
+++ b/src/Fluent.Structures.Model/Polygon/ICompletedPolygon.cs
@@ -0,0 +1,13 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents an interface for finalizing the construction of a Polygon with the builder pattern.
+///
+public interface ICompletedPolygon
+{
+ ///
+ /// Finalizes the construction and returns the Polygon object.
+ ///
+ /// The finalized Polygon object.
+ public Polygon Build();
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/PolygonBuilderInterfaces.cs b/src/Fluent.Structures.Model/Polygon/IEmptyPolygon.cs
similarity index 70%
rename from src/Fluent.Structures.Model/PolygonBuilderInterfaces.cs
rename to src/Fluent.Structures.Model/Polygon/IEmptyPolygon.cs
index edd50dc..14fc715 100644
--- a/src/Fluent.Structures.Model/PolygonBuilderInterfaces.cs
+++ b/src/Fluent.Structures.Model/Polygon/IEmptyPolygon.cs
@@ -22,16 +22,4 @@ public interface IEmptyPolygon
///
/// Array of points to set.
public ICompletedPolygon Points(params TSG.Point[] points);
-}
-
-///
-/// Represents an interface for finalizing the construction of a Polygon with the builder pattern.
-///
-public interface ICompletedPolygon
-{
- ///
- /// Finalizes the construction and returns the Polygon object.
- ///
- /// The finalized Polygon object.
- public Polygon Build();
}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/Polygon.cs b/src/Fluent.Structures.Model/Polygon/Polygon.cs
similarity index 100%
rename from src/Fluent.Structures.Model/Polygon.cs
rename to src/Fluent.Structures.Model/Polygon/Polygon.cs
diff --git a/src/Fluent.Structures.Model/RebarGroup/ICompletedRebarGroup.cs b/src/Fluent.Structures.Model/RebarGroup/ICompletedRebarGroup.cs
new file mode 100644
index 0000000..fa47af2
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/ICompletedRebarGroup.cs
@@ -0,0 +1,137 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a completed state for constructing a Tekla Structures Rebar Group.
+///
+public interface ICompletedRebarGroup
+{
+ ///
+ /// Sets the name for the Rebar Group.
+ ///
+ /// The name of the Rebar Group.
+ /// An interface for further construction.
+ public ICompletedRebarGroup Name(string name);
+
+ ///
+ /// Sets the spacing type for the Rebar Group.
+ ///
+ /// Spacing type for the Rebar Group.
+ /// An interface for further construction.
+ public ICompletedRebarGroup SpacingType(
+ TSM.BaseRebarGroup.RebarGroupSpacingTypeEnum spacingType);
+
+ ///
+ /// Sets the start offset from the reference plane for the Rebar Group.
+ ///
+ /// Start offset from the reference plane.
+ /// An interface for further construction.
+ public ICompletedRebarGroup StartFromPlaneOffset(double startFromPlaneOffset);
+
+ ///
+ /// Sets the end offset from the reference plane for the Rebar Group.
+ ///
+ /// End offset from the reference plane.
+ /// An interface for further construction.
+ public ICompletedRebarGroup EndFromPlaneOffset(double endFromPlaneOffset);
+
+ ///
+ /// Sets the numbering series for the Rebar Group.
+ ///
+ /// Prefix for the numbering series.
+ /// Starting number for the numbering series.
+ /// An interface for further construction.
+ public ICompletedRebarGroup NumberingSeries(string prefix, int startNumber);
+
+ ///
+ /// Sets the numbering series for the Rebar Group.
+ ///
+ /// Numbering series.
+ /// An interface for further construction.
+ public ICompletedRebarGroup NumberingSeries(TSM.NumberingSeries numberingSeries);
+
+ ///
+ /// Sets the start point offset value for the Rebar Group.
+ ///
+ /// Start point offset value.
+ /// An interface for further construction.
+ public ICompletedRebarGroup StartPointOffsetValue(double startPointOffsetValue);
+
+ ///
+ /// Sets the end point offset value for the Rebar Group.
+ ///
+ /// End point offset value.
+ /// An interface for further construction.
+ public ICompletedRebarGroup EndPointOffsetValue(double endPointOffsetValue);
+
+ ///
+ /// Sets the start point offset type for the Rebar Group.
+ ///
+ /// Start point offset type.
+ /// An interface for further construction.
+ public ICompletedRebarGroup StartPointOffsetType(
+ TSM.Reinforcement.RebarOffsetTypeEnum startPointOffsetType);
+
+ ///
+ /// Sets the end point offset type for the Rebar Group.
+ ///
+ /// End point offset type.
+ /// An interface for further construction.
+ public ICompletedRebarGroup EndPointOffsetType(
+ TSM.Reinforcement.RebarOffsetTypeEnum endPointOffsetType);
+
+ ///
+ /// Sets on-plane offsets for the Rebar Group.
+ ///
+ /// ArrayList of on-plane offsets.
+ /// An interface for further construction.
+ public ICompletedRebarGroup OnPlaneOffsets(ArrayList onPlaneOffsets);
+
+ ///
+ /// Sets on-plane offsets for the Rebar Group.
+ ///
+ /// List of on-plane offsets.
+ /// An interface for further construction.
+ public ICompletedRebarGroup OnPlaneOffsets(List onPlaneOffsets);
+
+ ///
+ /// Sets on-plane offsets for the Rebar Group.
+ ///
+ /// Array of on-plane offsets.
+ /// An interface for further construction.
+ public ICompletedRebarGroup OnPlaneOffsets(params double[] onPlaneOffsets);
+
+ ///
+ /// Sets the exclude type for the Rebar Group.
+ ///
+ /// Exclude type.
+ /// An interface for further construction.
+ public ICompletedRebarGroup ExcludeType(TSM.BaseRebarGroup.ExcludeTypeEnum excludeType);
+
+ ///
+ /// Sets the stirrup type for the Rebar Group.
+ ///
+ /// Stirrup type.
+ /// An interface for further construction.
+ public ICompletedRebarGroup StirrupType(TSM.RebarGroup.RebarGroupStirrupTypeEnum stirrupType);
+
+ ///
+ /// Sets the identifier for the Rebar Group.
+ ///
+ /// Identifier for the Rebar Group.
+ /// An interface for further construction.
+ public ICompletedRebarGroup Identifier(TS.Identifier identifier);
+
+ ///
+ /// Sets the input deforming state for the Rebar Group.
+ ///
+ /// Deforming type for the Rebar Group.
+ /// An interface for further construction.
+ public ICompletedRebarGroup InputPointDeformingState(
+ Tekla.Structures.Forming.DeformingType deformingType);
+
+ ///
+ /// Builds and returns the finalized Rebar Group.
+ ///
+ /// The constructed Rebar Group.
+ public RebarGroup Build();
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IEmptyRebarGroup.cs b/src/Fluent.Structures.Model/RebarGroup/IEmptyRebarGroup.cs
new file mode 100644
index 0000000..5d235a0
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IEmptyRebarGroup.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents an interface for starting the construction of a Rebar Group with the builder pattern.
+///
+public interface IEmptyRebarGroup
+{
+ ///
+ /// Sets the father object for the Rebar Group.
+ ///
+ /// The parent .
+ /// An interface for further construction.
+ public IRebarGroupWithFather Father(TSM.ModelObject father);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithClass.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithClass.cs
new file mode 100644
index 0000000..3e6e7fe
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithClass.cs
@@ -0,0 +1,28 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with a specified class.
+///
+public interface IRebarGroupWithClass
+{
+ ///
+ /// Sets the spacings for the Rebar Group.
+ ///
+ /// ArrayList of spacings.
+ /// An interface for further construction.
+ public IRebarGroupWithSpacings Spacings(ArrayList spacings);
+
+ ///
+ /// Sets the spacings for the Rebar Group using an array.
+ ///
+ /// Array of spacings.
+ /// An interface for further construction.
+ public IRebarGroupWithSpacings Spacings(params double[] spacings);
+
+ ///
+ /// Sets the spacings for the Rebar Group using a list.
+ ///
+ /// List of spacings.
+ /// An interface for further construction.
+ public IRebarGroupWithSpacings Spacings(List spacings);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithFather.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithFather.cs
new file mode 100644
index 0000000..c3b8a59
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithFather.cs
@@ -0,0 +1,42 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with a specified father object.
+///
+public interface IRebarGroupWithFather
+{
+ ///
+ /// Sets the polygons for the Rebar Group.
+ ///
+ /// ArrayList of polygons for the Rebar Group.
+ /// An interface for further construction.
+ public IRebarGroupWithPolygons Polygons(ArrayList polygons);
+
+ ///
+ /// Sets the polygons for the Rebar Group.
+ ///
+ /// Array of Polygons.
+ /// An interface for further construction.
+ public IRebarGroupWithPolygons Polygons(params Polygon[] polygons);
+
+ ///
+ /// Sets the polygons for the Rebar Group.
+ ///
+ /// List of Polygons.
+ /// An interface for further construction.
+ public IRebarGroupWithPolygons Polygons(List polygons);
+
+ ///
+ /// Sets a single polygon for the Rebar Group using an array of Tekla Points.
+ ///
+ /// Array of Tekla Points representing the polygon.
+ /// An interface for further construction.
+ public IRebarGroupWithPolygons Polygons(params TSG.Point[] points);
+
+ ///
+ /// Sets a single polygon for the Rebar Group using an List of Tekla Points.
+ ///
+ /// List of Tekla Points representing the polygon.
+ /// An interface for further construction.
+ public IRebarGroupWithPolygons Polygons(List points);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithGrade.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithGrade.cs
new file mode 100644
index 0000000..189dce5
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithGrade.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with a specified grade.
+///
+public interface IRebarGroupWithGrade
+{
+ ///
+ /// Sets the size for the Rebar Group.
+ ///
+ /// The size of the rebar.
+ /// An interface for further construction.
+ public IRebarGroupWithSize Size(string size);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithPolygons.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithPolygons.cs
new file mode 100644
index 0000000..4d7babe
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithPolygons.cs
@@ -0,0 +1,22 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with specified polygons.
+///
+public interface IRebarGroupWithPolygons
+{
+ ///
+ /// Sets the starting point for the Rebar Group.
+ ///
+ /// The starting point.
+ /// An interface for further construction.
+ public IRebarGroupWithStartPoint StartPoint(TSG.Point start);
+
+ ///
+ /// Sets the starting and ending points for the Rebar Group.
+ ///
+ /// The starting point.
+ /// The ending point.
+ /// An interface for further construction.
+ public IRebarGroupWithStartAndEndPoints StartAndEndPoints(TSG.Point start, TSG.Point end);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithRadiusValues.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithRadiusValues.cs
new file mode 100644
index 0000000..c93746a
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithRadiusValues.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with specified radius values.
+///
+public interface IRebarGroupWithRadiusValues
+{
+ ///
+ /// Sets the class for the Rebar Group.
+ ///
+ /// The class of the rebar.
+ /// An interface for further construction.
+ public IRebarGroupWithClass Class(int @class);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSize.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSize.cs
new file mode 100644
index 0000000..2039caf
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSize.cs
@@ -0,0 +1,28 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with a specified size.
+///
+public interface IRebarGroupWithSize
+{
+ ///
+ /// Sets the radius values for the Rebar Group.
+ ///
+ /// ArrayList of radius values.
+ /// An interface for further construction.
+ public IRebarGroupWithRadiusValues RadiusValues(ArrayList radiusValues);
+
+ ///
+ /// Sets the radius values for the Rebar Group using an array.
+ ///
+ /// Array of radius values.
+ /// An interface for further construction.
+ public IRebarGroupWithRadiusValues RadiusValues(params double[] radiusValues);
+
+ ///
+ /// Sets the radius values for the Rebar Group using a list.
+ ///
+ /// List of radius values.
+ /// An interface for further construction.
+ public IRebarGroupWithRadiusValues RadiusValues(List radiusValues);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSpacings.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSpacings.cs
new file mode 100644
index 0000000..4b63d7b
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithSpacings.cs
@@ -0,0 +1,44 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with specified spacings.
+///
+public interface IRebarGroupWithSpacings
+{
+ ///
+ /// Sets the start hook for the Rebar Group.
+ ///
+ /// Rebar hook data for the start.
+ /// An interface for further construction.
+ public IRebarGroupWithStartHook StartHook(TSM.RebarHookData startHook);
+
+ ///
+ /// Sets the start hook for the Rebar Group using a predefined shape.
+ ///
+ /// Predefined shape for the start hook.
+ /// An interface for further construction.
+ public IRebarGroupWithStartHook StartHook(
+ TSM.RebarHookData.RebarHookShapeEnum shapeEnum =
+ TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK);
+
+ ///
+ /// Sets both start and end hooks for the Rebar Group.
+ ///
+ /// Rebar hook data for the start.
+ /// Rebar hook data for the end.
+ /// An interface for completing the construction.
+ public ICompletedRebarGroup StartAndEndHooks(TSM.RebarHookData startHook,
+ TSM.RebarHookData endHook);
+
+ ///
+ /// Sets both start and end hooks for the Rebar Group using predefined shapes.
+ ///
+ /// Predefined shape for the start hook.
+ /// Predefined shape for the end hook.
+ /// An interface for completing the construction.
+ public ICompletedRebarGroup StartAndEndHooks(
+ TSM.RebarHookData.RebarHookShapeEnum startShapeEnum =
+ TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK,
+ TSM.RebarHookData.RebarHookShapeEnum endShapeEnum =
+ TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartAndEndPoints.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartAndEndPoints.cs
new file mode 100644
index 0000000..1f0ea13
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartAndEndPoints.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with specified starting and ending points.
+///
+public interface IRebarGroupWithStartAndEndPoints
+{
+ ///
+ /// Sets the grade for the Rebar Group.
+ ///
+ /// The grade of the rebar.
+ /// An interface for further construction.
+ public IRebarGroupWithGrade Grade(string grade);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartHook.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartHook.cs
new file mode 100644
index 0000000..faa36e0
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartHook.cs
@@ -0,0 +1,23 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with a specified start hook.
+///
+public interface IRebarGroupWithStartHook
+{
+ ///
+ /// Sets the end hook for the Rebar Group.
+ ///
+ /// Rebar hook data for the end.
+ /// An interface for completing the construction.
+ public ICompletedRebarGroup EndHook(TSM.RebarHookData endHook);
+
+ ///
+ /// Sets the end hook for the Rebar Group using a predefined shape.
+ ///
+ /// Predefined shape for the end hook.
+ /// An interface for completing the construction.
+ public ICompletedRebarGroup EndHook(
+ TSM.RebarHookData.RebarHookShapeEnum endShapeEnum =
+ TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartPoint.cs b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartPoint.cs
new file mode 100644
index 0000000..1fa2cd5
--- /dev/null
+++ b/src/Fluent.Structures.Model/RebarGroup/IRebarGroupWithStartPoint.cs
@@ -0,0 +1,14 @@
+namespace Fluent.Structures.Model;
+
+///
+/// Represents a Rebar Group construction state with a specified starting point.
+///
+public interface IRebarGroupWithStartPoint
+{
+ ///
+ /// Sets the ending point for the Rebar Group.
+ ///
+ /// The ending point.
+ /// An interface for further construction.
+ public IRebarGroupWithStartAndEndPoints EndPoint(TSG.Point end);
+}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroup.cs b/src/Fluent.Structures.Model/RebarGroup/RebarGroup.cs
similarity index 70%
rename from src/Fluent.Structures.Model/RebarGroup.cs
rename to src/Fluent.Structures.Model/RebarGroup/RebarGroup.cs
index 5114d87..aab1491 100644
--- a/src/Fluent.Structures.Model/RebarGroup.cs
+++ b/src/Fluent.Structures.Model/RebarGroup/RebarGroup.cs
@@ -1,4 +1,6 @@
+using System;
using System.Linq;
+using Tekla.Structures.Forming;
namespace Fluent.Structures.Model;
@@ -16,6 +18,7 @@ private RebarGroup()
///
/// Gets or sets the Tekla Structures Rebar Group instance.
///
+ // ReSharper disable once MemberCanBePrivate.Global
public TSM.RebarGroup TeklaRebarGroup { get; }
///
@@ -53,12 +56,6 @@ public class BuildRebarGroup : IEmptyRebarGroup, IRebarGroupWithFather, IRebarGr
///
private BuildRebarGroup() {}
- ///
- /// Initializes a new instance of the class with an existing RebarGroup instance.
- ///
- /// The existing RebarGroup instance.
- private BuildRebarGroup(RebarGroup rebarGroup) {}
-
///
/// Entry point to start configuring the Rebar Group class
///
@@ -76,22 +73,37 @@ public IRebarGroupWithFather Father(TSM.ModelObject father)
///
public IRebarGroupWithPolygons Polygons(ArrayList polygons)
{
- _rebarGroup.Polygons = polygons;
- return this;
+ var list = new List();
+
+ foreach (var polygon in polygons)
+ if (polygon is TSM.Polygon p)
+ list.Add(p);
+ else
+ throw new ArgumentException(
+ $"Array list contains {polygon.GetType()
+ } which is not Tekla Structures Polygon"
+ );
+
+ return Polygons(list);
}
- ///
- public IRebarGroupWithPolygons Polygons(params TSM.Polygon[] polygons)
+ public IRebarGroupWithPolygons Polygons(params Polygon[] polygons)
+ => Polygons(polygons.ToList());
+
+ public IRebarGroupWithPolygons Polygons(List polygons)
{
- _rebarGroup.Polygons = new ArrayList(polygons);
+ _rebarGroup.Polygons = polygons;
return this;
}
///
public IRebarGroupWithPolygons Polygons(params TSG.Point[] points)
+ => Polygons(points.ToList());
+
+ public IRebarGroupWithPolygons Polygons(List points)
{
var polygon = Polygon.BuildPolygon.With().Points(points).Build();
- _rebarGroup.Polygons = new ArrayList { polygon.TeklaPolygon };
+ _rebarGroup.Polygons = new List { polygon, };
return this;
}
@@ -161,20 +173,17 @@ public IRebarGroupWithClass Class(int @class)
///
public IRebarGroupWithSpacings Spacings(ArrayList spacings)
- {
- _rebarGroup.Spacings = spacings;
- return this;
- }
+ => Spacings(spacings.Cast().ToList());
- ///
public IRebarGroupWithSpacings Spacings(params double[] spacings)
- => Spacings(new ArrayList(spacings));
+ => Spacings(spacings.ToList());
- ///
public IRebarGroupWithSpacings Spacings(List spacings)
- => Spacings(new ArrayList(spacings));
+ {
+ _rebarGroup.Spacings = spacings;
+ return this;
+ }
- ///
public IRebarGroupWithStartHook StartHook(TSM.RebarHookData startHook)
{
_rebarGroup.StartHook = startHook;
@@ -183,7 +192,7 @@ public IRebarGroupWithStartHook StartHook(TSM.RebarHookData startHook)
///
public IRebarGroupWithStartHook StartHook(TSM.RebarHookData.RebarHookShapeEnum shapeEnum)
- => StartHook(new TSM.RebarHookData { Shape = shapeEnum });
+ => StartHook(new TSM.RebarHookData { Shape = shapeEnum, });
///
public ICompletedRebarGroup StartAndEndHooks(TSM.RebarHookData startHook,
@@ -248,8 +257,11 @@ public ICompletedRebarGroup EndFromPlaneOffset(double endFromPlaneOffset)
///
public ICompletedRebarGroup NumberingSeries(string prefix, int startNumber)
+ => NumberingSeries(new TSM.NumberingSeries(prefix, startNumber));
+
+ public ICompletedRebarGroup NumberingSeries(TSM.NumberingSeries numberingSeries)
{
- _rebarGroup.NumberingSeries = new TSM.NumberingSeries(prefix, startNumber);
+ _rebarGroup.NumberingSeries = numberingSeries;
return this;
}
@@ -267,6 +279,57 @@ public ICompletedRebarGroup EndPointOffsetValue(double endPointOffsetValue)
return this;
}
+ public ICompletedRebarGroup StartPointOffsetType(
+ TSM.Reinforcement.RebarOffsetTypeEnum startPointOffsetType)
+ {
+ _rebarGroup.StartPointOffsetType = startPointOffsetType;
+ return this;
+ }
+
+ public ICompletedRebarGroup EndPointOffsetType(
+ TSM.Reinforcement.RebarOffsetTypeEnum endPointOffsetType)
+ {
+ _rebarGroup.EndPointOffsetType = endPointOffsetType;
+ return this;
+ }
+
+ public ICompletedRebarGroup OnPlaneOffsets(ArrayList onPlaneOffsets)
+ => OnPlaneOffsets(onPlaneOffsets.Cast().ToList());
+
+ public ICompletedRebarGroup OnPlaneOffsets(List onPlaneOffsets)
+ {
+ _rebarGroup.OnPlaneOffsets = onPlaneOffsets;
+ return this;
+ }
+
+ public ICompletedRebarGroup OnPlaneOffsets(params double[] onPlaneOffsets)
+ => OnPlaneOffsets(onPlaneOffsets.ToList());
+
+ public ICompletedRebarGroup ExcludeType(TSM.BaseRebarGroup.ExcludeTypeEnum excludeType)
+ {
+ _rebarGroup.ExcludeType = excludeType;
+ return this;
+ }
+
+ public ICompletedRebarGroup StirrupType(
+ TSM.RebarGroup.RebarGroupStirrupTypeEnum stirrupType)
+ {
+ _rebarGroup.StirrupType = stirrupType;
+ return this;
+ }
+
+ public ICompletedRebarGroup Identifier(TS.Identifier identifier)
+ {
+ _rebarGroup.Identifier = identifier;
+ return this;
+ }
+
+ public ICompletedRebarGroup InputPointDeformingState(DeformingType deformingType)
+ {
+ _rebarGroup.InputPointDeformingState = deformingType;
+ return this;
+ }
+
///
public RebarGroup Build()
=> _rebarGroup;
@@ -358,10 +421,10 @@ public TSM.RebarHookData StartHook
///
/// Gets or sets the spacings of the Rebar Group.
///
- public ArrayList Spacings
+ public List Spacings
{
- get => TeklaRebarGroup.Spacings;
- private set => TeklaRebarGroup.Spacings = value;
+ get => new(TeklaRebarGroup.Spacings.Cast());
+ private set => TeklaRebarGroup.Spacings = new ArrayList(value);
}
///
@@ -421,10 +484,10 @@ public TSG.Point StartPoint
///
/// Gets or sets the polygons of the Rebar Group.
///
- public ArrayList Polygons
+ public List Polygons
{
- get => TeklaRebarGroup.Polygons;
- private set => TeklaRebarGroup.Polygons = value;
+ get => new(TeklaRebarGroup.Polygons.Cast());
+ private set => TeklaRebarGroup.Polygons = new ArrayList(value);
}
///
@@ -436,5 +499,68 @@ public TSM.ModelObject Father
private set => TeklaRebarGroup.Father = value;
}
+ ///
+ /// Gets or sets the offset type at the start point of the Rebar Group.
+ ///
+ public TSM.Reinforcement.RebarOffsetTypeEnum StartPointOffsetType
+ {
+ get => TeklaRebarGroup.StartPointOffsetType;
+ private set => TeklaRebarGroup.StartPointOffsetType = value;
+ }
+
+ ///
+ /// Gets or sets the offset type at the end point of the Rebar Group.
+ ///
+ public TSM.Reinforcement.RebarOffsetTypeEnum EndPointOffsetType
+ {
+ get => TeklaRebarGroup.EndPointOffsetType;
+ private set => TeklaRebarGroup.EndPointOffsetType = value;
+ }
+
+ ///
+ /// Gets or sets on-plane offsets for the Rebar Group.
+ ///
+ public List OnPlaneOffsets
+ {
+ get => new(TeklaRebarGroup.OnPlaneOffsets.Cast());
+ private set => TeklaRebarGroup.OnPlaneOffsets = new ArrayList(value);
+ }
+
+ ///
+ /// Gets or sets the exclude type for the Rebar Group.
+ ///
+ public TSM.BaseRebarGroup.ExcludeTypeEnum ExcludeType
+ {
+ get => TeklaRebarGroup.ExcludeType;
+ private set => TeklaRebarGroup.ExcludeType = value;
+ }
+
+ ///
+ /// Gets or sets the stirrup type for the Rebar Group.
+ ///
+ public TSM.RebarGroup.RebarGroupStirrupTypeEnum StirrupType
+ {
+ get => TeklaRebarGroup.StirrupType;
+ private set => TeklaRebarGroup.StirrupType = value;
+ }
+
+ ///
+ /// Gets or sets the identifier for the Rebar Group.
+ ///
+ public TS.Identifier Identifier
+ {
+ get => TeklaRebarGroup.Identifier;
+ private set => TeklaRebarGroup.Identifier = value;
+ }
+
+ ///
+ /// Gets or sets the input deforming state for the Rebar Group.
+ ///
+ public DeformingType InputPointDeformingState
+ {
+ get => TeklaRebarGroup.InputPointDeformingState;
+ private set => TeklaRebarGroup.InputPointDeformingState = value;
+ }
+
#endregion
}
\ No newline at end of file
diff --git a/src/Fluent.Structures.Model/RebarGroupBuilderInterfaces.cs b/src/Fluent.Structures.Model/RebarGroupBuilderInterfaces.cs
deleted file mode 100644
index d757d22..0000000
--- a/src/Fluent.Structures.Model/RebarGroupBuilderInterfaces.cs
+++ /dev/null
@@ -1,296 +0,0 @@
-namespace Fluent.Structures.Model;
-
-///
-/// Represents an interface for starting the construction of a Rebar Group with the builder pattern.
-///
-public interface IEmptyRebarGroup
-{
- ///
- /// Sets the father object for the Rebar Group.
- ///
- /// The parent .
- /// An interface for further construction.
- public IRebarGroupWithFather Father(TSM.ModelObject father);
-}
-
-///
-/// Represents a Rebar Group construction state with a specified father object.
-///
-public interface IRebarGroupWithFather
-{
- ///
- /// Sets the polygons for the Rebar Group.
- ///
- /// ArrayList of polygons for the Rebar Group.
- /// An interface for further construction.
- public IRebarGroupWithPolygons Polygons(ArrayList polygons);
-
- ///
- /// Sets the polygons for the Rebar Group.
- ///
- /// Array of Tekla Polygons.
- /// An interface for further construction.
- public IRebarGroupWithPolygons Polygons(params TSM.Polygon[] polygons);
-
- ///
- /// Sets a single polygon for the Rebar Group using an array of Tekla Points.
- ///
- /// Array of Tekla Points representing the polygon.
- /// An interface for further construction.
- public IRebarGroupWithPolygons Polygons(params TSG.Point[] points);
-}
-
-///
-/// Represents a Rebar Group construction state with specified polygons.
-///
-public interface IRebarGroupWithPolygons
-{
- ///
- /// Sets the starting point for the Rebar Group.
- ///
- /// The starting point.
- /// An interface for further construction.
- public IRebarGroupWithStartPoint StartPoint(TSG.Point start);
-
- ///
- /// Sets the starting and ending points for the Rebar Group.
- ///
- /// The starting point.
- /// The ending point.
- /// An interface for further construction.
- public IRebarGroupWithStartAndEndPoints StartAndEndPoints(TSG.Point start, TSG.Point end);
-}
-
-///
-/// Represents a Rebar Group construction state with a specified starting point.
-///
-public interface IRebarGroupWithStartPoint
-{
- ///
- /// Sets the ending point for the Rebar Group.
- ///
- /// The ending point.
- /// An interface for further construction.
- public IRebarGroupWithStartAndEndPoints EndPoint(TSG.Point end);
-}
-
-///
-/// Represents a Rebar Group construction state with specified starting and ending points.
-///
-public interface IRebarGroupWithStartAndEndPoints
-{
- ///
- /// Sets the grade for the Rebar Group.
- ///
- /// The grade of the rebar.
- /// An interface for further construction.
- public IRebarGroupWithGrade Grade(string grade);
-}
-
-///
-/// Represents a Rebar Group construction state with a specified grade.
-///
-public interface IRebarGroupWithGrade
-{
- ///
- /// Sets the size for the Rebar Group.
- ///
- /// The size of the rebar.
- /// An interface for further construction.
- public IRebarGroupWithSize Size(string size);
-}
-
-///
-/// Represents a Rebar Group construction state with a specified size.
-///
-public interface IRebarGroupWithSize
-{
- ///
- /// Sets the radius values for the Rebar Group.
- ///
- /// ArrayList of radius values.
- /// An interface for further construction.
- public IRebarGroupWithRadiusValues RadiusValues(ArrayList radiusValues);
-
- ///
- /// Sets the radius values for the Rebar Group using an array.
- ///
- /// Array of radius values.
- /// An interface for further construction.
- public IRebarGroupWithRadiusValues RadiusValues(params double[] radiusValues);
-
- ///
- /// Sets the radius values for the Rebar Group using a list.
- ///
- /// List of radius values.
- /// An interface for further construction.
- public IRebarGroupWithRadiusValues RadiusValues(List radiusValues);
-}
-
-///
-/// Represents a Rebar Group construction state with specified radius values.
-///
-public interface IRebarGroupWithRadiusValues
-{
- ///
- /// Sets the class for the Rebar Group.
- ///
- /// The class of the rebar.
- /// An interface for further construction.
- public IRebarGroupWithClass Class(int @class);
-}
-
-///
-/// Represents a Rebar Group construction state with a specified class.
-///
-public interface IRebarGroupWithClass
-{
- ///
- /// Sets the spacings for the Rebar Group.
- ///
- /// ArrayList of spacings.
- /// An interface for further construction.
- public IRebarGroupWithSpacings Spacings(ArrayList spacings);
-
- ///
- /// Sets the spacings for the Rebar Group using an array.
- ///
- /// Array of spacings.
- /// An interface for further construction.
- public IRebarGroupWithSpacings Spacings(params double[] spacings);
-
- ///
- /// Sets the spacings for the Rebar Group using a list.
- ///
- /// List of spacings.
- /// An interface for further construction.
- public IRebarGroupWithSpacings Spacings(List spacings);
-}
-
-///
-/// Represents a Rebar Group construction state with specified spacings.
-///
-public interface IRebarGroupWithSpacings
-{
- ///
- /// Sets the start hook for the Rebar Group.
- ///
- /// Rebar hook data for the start.
- /// An interface for further construction.
- public IRebarGroupWithStartHook StartHook(TSM.RebarHookData startHook);
-
- ///
- /// Sets the start hook for the Rebar Group using a predefined shape.
- ///
- /// Predefined shape for the start hook.
- /// An interface for further construction.
- public IRebarGroupWithStartHook StartHook(
- TSM.RebarHookData.RebarHookShapeEnum shapeEnum =
- TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK);
-
- ///
- /// Sets both start and end hooks for the Rebar Group.
- ///
- /// Rebar hook data for the start.
- /// Rebar hook data for the end.
- /// An interface for completing the construction.
- public ICompletedRebarGroup StartAndEndHooks(TSM.RebarHookData startHook,
- TSM.RebarHookData endHook);
-
- ///
- /// Sets both start and end hooks for the Rebar Group using predefined shapes.
- ///
- /// Predefined shape for the start hook.
- /// Predefined shape for the end hook.
- /// An interface for completing the construction.
- public ICompletedRebarGroup StartAndEndHooks(
- TSM.RebarHookData.RebarHookShapeEnum startShapeEnum =
- TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK,
- TSM.RebarHookData.RebarHookShapeEnum endShapeEnum =
- TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK);
-}
-
-///
-/// Represents a Rebar Group construction state with a specified start hook.
-///
-public interface IRebarGroupWithStartHook
-{
- ///
- /// Sets the end hook for the Rebar Group.
- ///
- /// Rebar hook data for the end.
- /// An interface for completing the construction.
- public ICompletedRebarGroup EndHook(TSM.RebarHookData endHook);
-
- ///
- /// Sets the end hook for the Rebar Group using a predefined shape.
- ///
- /// Predefined shape for the end hook.
- /// An interface for completing the construction.
- public ICompletedRebarGroup EndHook(
- TSM.RebarHookData.RebarHookShapeEnum endShapeEnum =
- TSM.RebarHookData.RebarHookShapeEnum.NO_HOOK);
-}
-
-///
-/// Represents a completed state for constructing a Tekla Structures Rebar Group.
-///
-public interface ICompletedRebarGroup
-{
- ///
- /// Sets the name for the Rebar Group.
- ///
- /// The name of the Rebar Group.
- /// An interface for further construction.
- public ICompletedRebarGroup Name(string name);
-
- ///
- /// Sets the spacing type for the Rebar Group.
- ///
- /// Spacing type for the Rebar Group.
- /// An interface for further construction.
- public ICompletedRebarGroup SpacingType(
- TSM.BaseRebarGroup.RebarGroupSpacingTypeEnum spacingType);
-
- ///
- /// Sets the start offset from the reference plane for the Rebar Group.
- ///
- /// Start offset from the reference plane.
- /// An interface for further construction.
- public ICompletedRebarGroup StartFromPlaneOffset(double startFromPlaneOffset);
-
- ///
- /// Sets the end offset from the reference plane for the Rebar Group.
- ///
- /// End offset from the reference plane.
- /// An interface for further construction.
- public ICompletedRebarGroup EndFromPlaneOffset(double endFromPlaneOffset);
-
- ///
- /// Sets the numbering series for the Rebar Group.
- ///
- /// Prefix for the numbering series.
- /// Starting number for the numbering series.
- /// An interface for further construction.
- public ICompletedRebarGroup NumberingSeries(string prefix, int startNumber);
-
- ///
- /// Sets the start point offset value for the Rebar Group.
- ///
- /// Start point offset value.
- /// An interface for further construction.
- public ICompletedRebarGroup StartPointOffsetValue(double startPointOffsetValue);
-
- ///
- /// Sets the end point offset value for the Rebar Group.
- ///
- /// End point offset value.
- /// An interface for further construction.
- public ICompletedRebarGroup EndPointOffsetValue(double endPointOffsetValue);
-
- ///
- /// Builds and returns the finalized Rebar Group.
- ///
- /// The constructed Rebar Group.
- public RebarGroup Build();
-}
diff --git a/src/Fluent.Structures.Model/TeklaAssemblyExtensions.cs b/src/Fluent.Structures.Model/TeklaAssemblyExtensions.cs
deleted file mode 100644
index 61c92fd..0000000
--- a/src/Fluent.Structures.Model/TeklaAssemblyExtensions.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace Fluent.Structures.Model;
-
-public static class TeklaAssemblyExtensions
-{
- public static IEnumerable GetAllParts(this TSM.Assembly? assembly)
- {
- var mainPart = assembly?.GetMainPart();
- var secondaries = assembly?.GetSecondaries();
-
- if (mainPart is TSM.Part part)
- yield return part;
-
- foreach (var secondary in secondaries)
- if (secondary is TSM.Part p)
- yield return p;
- }
-}
\ No newline at end of file