Skip to content

Commit f020bc1

Browse files
After RFEM6 update RFEM6_Toolkit stopped working. (#99)
2 parents 7fc3761 + 591f7e4 commit f020bc1

File tree

5 files changed

+260
-158
lines changed

5 files changed

+260
-158
lines changed

.ci/unit-tests/RFEM_Toolkit_Test/BHoMDataStructure/Comparer/Section.cs

Lines changed: 116 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -43,94 +43,145 @@
4343

4444
namespace RFEM_Toolkit_Test.Comparer_Tests
4545
{
46-
internal class Section
46+
internal class Section
4747

48-
{
48+
{
4949

50-
RFEM6Adapter adapter;
51-
ISectionProperty steelSection1;
52-
ISectionProperty steelSection2;
53-
ISectionProperty concreteSection0;
54-
ISectionProperty concreteSection1;
55-
ISectionProperty genericSectionGLTimber;
56-
ISectionProperty genericSectionSawnTimber;
57-
IProfile rectProfileGLTimber;
58-
IProfile circleProfileSawnTimber;
59-
IProfile concreteProfile0;
60-
IProfile concreteProfile1;
50+
RFEM6Adapter adapter;
51+
ISectionProperty steelSection1;
52+
ISectionProperty steelSection2;
53+
ISectionProperty steelSection3;
54+
ISectionProperty steelSection4;
55+
ISectionProperty concreteSection0;
56+
ISectionProperty concreteSection1;
57+
ISectionProperty concreteSection2;
58+
ISectionProperty concreteSection3;
59+
ISectionProperty genericSectionGLTimber;
60+
ISectionProperty genericSectionSawnTimber;
61+
IProfile rectProfileGLTimber;
62+
IProfile circleProfileSawnTimber;
63+
IProfile concreteProfile0;
64+
IProfile concreteProfile1;
6165

62-
IMaterialFragment glulam;
63-
IMaterialFragment timberC;
64-
Concrete concrete0;
65-
Concrete concrete1;
66+
IMaterialFragment glulam;
67+
IMaterialFragment timberC;
68+
Concrete concrete0;
69+
Concrete concrete1;
70+
Concrete concrete01;
71+
Concrete concrete11;
6672

67-
RFEMSectionComparer comparer;
73+
RFEMSectionComparer comparer;
6874

69-
//[SetUp]
70-
//public void Setup()
71-
//{
72-
73-
//}
75+
//[SetUp]
76+
//public void Setup()
77+
//{
7478

75-
[OneTimeSetUp]
76-
public void InitializeRFEM6Adapter()
77-
{
79+
//}
7880

79-
adapter = new RFEM6Adapter(true);
80-
comparer = new RFEMSectionComparer();
81+
[OneTimeSetUp]
82+
public void InitializeRFEM6Adapter()
83+
{
8184

82-
}
85+
adapter = new RFEM6Adapter(true);
86+
comparer = new RFEMSectionComparer();
8387

84-
[Test]
85-
public void StandardConcreteSections()
86-
{
87-
/***************************************************/
88-
/**** Test Preparation ****/
89-
/***************************************************/
90-
concrete0 = BH.Engine.Library.Query.Match("Concrete", "C25/30", true, true).DeepClone() as Concrete;
91-
concrete1 = BH.Engine.Library.Query.Match("Concrete", "C45/55", true, true).DeepClone() as Concrete;
88+
}
9289

90+
[Test]
91+
public void StandardConcreteSections()
92+
{
93+
/***************************************************/
94+
/**** Arrange ****/
95+
/***************************************************/
96+
concrete0 = BH.Engine.Library.Query.Match("Concrete", "C25/30", true, true).DeepClone() as Concrete;
97+
concrete01 = BH.Engine.Library.Query.Match("Concrete", "C25/30", true, true).DeepClone() as Concrete;
9398

94-
concreteProfile0 = BH.Engine.Spatial.Create.CircleProfile(0.2);
95-
concreteSection0 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile0, concrete0, "ConcreteSection1");
99+
concrete1 = BH.Engine.Library.Query.Match("Concrete", "C45/55", true, true).DeepClone() as Concrete;
100+
concrete11 = BH.Engine.Library.Query.Match("Concrete", "C45/55", true, true).DeepClone() as Concrete;
96101

97-
concreteProfile1 = BH.Engine.Spatial.Create.CircleProfile(0.5);
98-
concreteSection1 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile1, concrete1, "ConcreteSection2");
99102

100-
adapter.Push(new List<ISectionProperty>() { concreteSection0});
103+
concreteProfile0 = BH.Engine.Spatial.Create.CircleProfile(0.2);
104+
concreteSection0 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile0, concrete0, "ConcreteSection1");
101105

102-
FilterRequest sectionFilter = new FilterRequest() { Type = typeof(ISectionProperty) };
103-
var sectionsPulled = adapter.Pull(sectionFilter).Select(s => (ConcreteSection)s).ToList().First();
106+
concreteProfile1 = BH.Engine.Spatial.Create.CircleProfile(0.5);
107+
concreteSection1 = BH.Engine.Structure.Create.GenericSectionFromProfile(concreteProfile1, concrete1, "ConcreteSection2");
104108

105-
/***************************************************/
106-
/**** Assertions ****/
107-
/***************************************************/
109+
adapter.Push(new List<ISectionProperty>() { concreteSection0 });
108110

109-
//Assert.IsTrue(comparer.Equals(sectionsPulled,ConcreteSection0));
111+
FilterRequest sectionFilter = new FilterRequest() { Type = typeof(ISectionProperty) };
112+
var sectionsPulled = adapter.Pull(sectionFilter).Select(s => (ConcreteSection)s).ToList().First();
110113

114+
/***************************************************/
115+
/**** Asserti ****/
116+
/***************************************************/
111117

118+
//Assert.IsTrue(comparer.Equals(sectionsPulled,ConcreteSection0));
112119

113-
}
114120

115-
[Test]
116-
public void StandardSteelSections()
117-
{
118-
//TODO: Implement
119-
}
120121

121-
[Test]
122-
public void GenericTimberSections()
123-
{
124-
//TODO: Implement
125-
}
122+
}
126123

127-
[Test]
128-
public void GenericConcreteSections()
129-
{
130-
//TODO: Implement
131-
}
124+
[Test]
125+
public void StandardSteelSections()
126+
{
132127

133128

134-
}
129+
/***************************************************/
130+
/**** Arrange ****/
131+
/***************************************************/
132+
133+
steelSection1 = BH.Engine.Library.Query.Match("EU_SteelSections", "IPE 300", true, true).DeepClone() as ISectionProperty;
134+
steelSection2 = BH.Engine.Library.Query.Match("EU_SteelSections", "IPE 300", true, true).DeepClone() as ISectionProperty;
135+
136+
adapter.Push(new List<ISectionProperty>(){steelSection1});
137+
FilterRequest sectionFilter = new FilterRequest() { Type = typeof(ISectionProperty) };
138+
var tst = adapter.Pull(sectionFilter);
139+
steelSection3 = adapter.Pull(sectionFilter).Select(s => (ISectionProperty)s).ToList().First();
140+
141+
steelSection4 = BH.Engine.Library.Query.Match("EU_SteelSections", "IPE 550", true, true).DeepClone() as ISectionProperty;
142+
143+
/***************************************************/
144+
/**** Act ****/
145+
/***************************************************/
146+
147+
bool OrgSec1_Vs_OrgSec1 = comparer.Equals(steelSection1, steelSection1);
148+
bool OrgSec1_Vs_OrgSec2 = comparer.Equals(steelSection1, steelSection2);
149+
bool OrgSec1_Vs_PullSec3 = comparer.Equals(steelSection1, steelSection3);
150+
bool OrgSec1_Vs_OrgSec4 = comparer.Equals(steelSection1, steelSection4);
151+
152+
153+
/***************************************************/
154+
/**** Assert ****/
155+
/***************************************************/
156+
157+
//Checking Steel Section Agains it self
158+
Assert.IsTrue(OrgSec1_Vs_OrgSec1);
159+
160+
// Checking Steel Section agains its Copy
161+
Assert.IsTrue(OrgSec1_Vs_OrgSec2);
162+
163+
// Checking Steel Section agains its Push/Pulled version
164+
Assert.IsTrue(OrgSec1_Vs_PullSec3);
165+
166+
// Checking Steel Sectin agains a differnt Steel Section
167+
Assert.IsTrue(!OrgSec1_Vs_OrgSec4);
168+
169+
170+
}
171+
172+
[Test]
173+
public void GenericTimberSections()
174+
{
175+
//TODO: Implement
176+
}
177+
178+
[Test]
179+
public void GenericConcreteSections()
180+
{
181+
//TODO: Implement
182+
}
183+
184+
185+
}
135186
}
136187

.ci/unit-tests/RFEM_Toolkit_Test/BHoMDataStructure/Result/NodalResult.cs

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,63 +27,88 @@
2727
using BH.oM.Structure.SectionProperties;
2828
using BH.oM.Geometry;
2929
using BH.oM.Structure.Elements;
30+
using BH.oM.Analytical.Elements;
31+
using BH.oM.Base;
32+
using BH.oM.Structure.Requests;
3033

3134
namespace RFEM_Toolkit_Test.Elements
3235
{
3336

3437

35-
public class NodalResultTestClass
38+
public class NodalResultTestClass
3639

37-
{
40+
{
3841

39-
RFEM6Adapter adapter;
42+
RFEM6Adapter adapter;
4043

41-
Line line0;
42-
Line line1;
43-
Line line2;
44-
Line line3;
44+
Line line0;
45+
Line line1;
46+
Line line2;
47+
Line line3;
4548

4649

4750

48-
IMaterialFragment glulam;
49-
IMaterialFragment timberC;
50-
//IMaterialFragment timberT;
51-
//IMaterialFragment timberD;
51+
IMaterialFragment glulam;
52+
IMaterialFragment timberC;
53+
//IMaterialFragment timberT;
54+
//IMaterialFragment timberD;
5255

53-
Concrete concrete;
54-
//IMaterialFragment steel;
56+
Concrete concrete;
57+
//IMaterialFragment steel;
5558

56-
ISectionProperty steelSection;
57-
ISectionProperty concreteSection;
58-
ISectionProperty genericSectionGLTimber;
59-
ISectionProperty genericSectionSawnTimber;
59+
ISectionProperty steelSection;
60+
ISectionProperty concreteSection;
61+
ISectionProperty genericSectionGLTimber;
62+
ISectionProperty genericSectionSawnTimber;
6063

61-
Bar barSteelSection;
62-
Bar barConcreteSection;
63-
Bar barGLTimber;
64-
Bar barSawTimber;
64+
Bar barSteelSection;
65+
Bar barConcreteSection;
66+
Bar barGLTimber;
67+
Bar barSawTimber;
6568

66-
BarEndNodesDistanceComparer comparer = new BarEndNodesDistanceComparer(3);
69+
BarEndNodesDistanceComparer comparer = new BarEndNodesDistanceComparer(3);
6770

68-
[TearDown]
69-
public void TearDown()
70-
{
71-
adapter.Wipeout();
72-
}
71+
[TearDown]
72+
public void TearDown()
73+
{
74+
adapter.Wipeout();
75+
}
7376

74-
[OneTimeSetUp]
75-
public void InitializeRFEM6Adapter()
76-
{
77-
adapter = new RFEM6Adapter(true);
77+
[OneTimeSetUp]
78+
public void InitializeRFEM6Adapter()
79+
{
80+
adapter = new RFEM6Adapter(true);
7881

79-
80-
8182

82-
}
8383

8484

85-
85+
}
8686

87+
[Test]
88+
public void ReadResult()
89+
{
8790

88-
}
91+
NodeResultRequest request = new NodeResultRequest();
92+
request.Cases = new List<Object> { 1 };
93+
request.ObjectIds = new List<object> { 1, 2, 3, 4, 5 ,6};
94+
request.ResultType = NodeResultType.NodeReaction;
95+
96+
//Push it once
97+
var obj = adapter.Pull(request);
98+
99+
obj.First();
100+
101+
////Pull it
102+
//FilterRequest edgeFilter = new FilterRequest() { Type = typeof(Edge) };
103+
//var edgePulled = adapter.Pull(edgeFilter).ToList();
104+
//Edge ep = (Edge)edgePulled[0];
105+
106+
////Check
107+
//Assert.IsNotNull(ep);
108+
//Assert.True(comparer.Equals(edge1, ep));
109+
}
110+
111+
112+
113+
}
89114
}

0 commit comments

Comments
 (0)