Skip to content

Commit 3c81ed1

Browse files
author
Fraser Greenroyd
authored
Structure_Engine: Rename StartNode/EndNode to Start/End (#3236)
2 parents 1af507d + fd0bf0f commit 3c81ed1

22 files changed

+64
-64
lines changed

Analytical_Engine/Convert/Graph/ToRelation.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ public static IRelation ToRelation<TNode>(this ILink<TNode> link)
172172
{
173173
Relation relation = new Relation()
174174
{
175-
Source = link.StartNode.BHoM_Guid,
176-
Target = link.EndNode.BHoM_Guid,
175+
Source = link.Start.BHoM_Guid,
176+
Target = link.End.BHoM_Guid,
177177
Curve = (ICurve)link.IGeometry(),
178178
};
179179

180180
Graph subgraph = new Graph();
181-
subgraph.Entities.Add(link.StartNode.BHoM_Guid, link.StartNode);
182-
subgraph.Entities.Add(link.EndNode.BHoM_Guid, link.EndNode);
181+
subgraph.Entities.Add(link.Start.BHoM_Guid, link.Start);
182+
subgraph.Entities.Add(link.End.BHoM_Guid, link.End);
183183
subgraph.Entities.Add(link.BHoM_Guid, link);
184-
subgraph.Relations.Add(new Relation() { Source = link.StartNode.BHoM_Guid, Target = link.BHoM_Guid });
185-
subgraph.Relations.Add(new Relation() { Source = link.BHoM_Guid, Target = link.StartNode.BHoM_Guid });
184+
subgraph.Relations.Add(new Relation() { Source = link.Start.BHoM_Guid, Target = link.BHoM_Guid });
185+
subgraph.Relations.Add(new Relation() { Source = link.BHoM_Guid, Target = link.Start.BHoM_Guid });
186186
relation.Subgraph = subgraph;
187187

188188
return relation;

Analytical_Engine/Modify/SetElements0D.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ public static ILink<TNode> SetElements0D<TNode>(this ILink<TNode> link, List<IEl
5858
if (newElements0D[0] is Point)
5959
{
6060
//clone.StartNode = new TNode() { Position = newElements0D[0] as Point };
61-
clone.StartNode = Activator.CreateInstance<TNode>();
62-
clone.StartNode.Position = newElements0D[0] as Point;
61+
clone.Start = Activator.CreateInstance<TNode>();
62+
clone.Start.Position = newElements0D[0] as Point;
6363
}
6464
else
65-
clone.StartNode = (TNode)newElements0D[0];
65+
clone.Start = (TNode)newElements0D[0];
6666

6767
// Default the ILink end if the input is an Point
6868
if (newElements0D[1] is Point)
6969
{
7070
//clone.EndNode = new TNode() { Position = newElements0D[1] as Point };
71-
clone.EndNode = Activator.CreateInstance<TNode>();
72-
clone.EndNode.Position = newElements0D[1] as Point;
71+
clone.End = Activator.CreateInstance<TNode>();
72+
clone.End.Position = newElements0D[1] as Point;
7373
}
7474
else
75-
clone.EndNode = (TNode)newElements0D[1];
75+
clone.End = (TNode)newElements0D[1];
7676

7777
return clone;
7878
}

Analytical_Engine/Modify/SetGeometry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public static ILink<TNode> SetGeometry<TNode>(this ILink<TNode> link, ICurve cur
7373
}
7474

7575
ILink<TNode> clone = link.ShallowClone();
76-
clone.StartNode = (TNode)clone.StartNode.SetGeometry(curve.IStartPoint());
77-
clone.EndNode = (TNode)clone.EndNode.SetGeometry(curve.IEndPoint());
76+
clone.Start = (TNode)clone.Start.SetGeometry(curve.IStartPoint());
77+
clone.End = (TNode)clone.End.SetGeometry(curve.IEndPoint());
7878
return clone;
7979
}
8080

Analytical_Engine/Query/Elements0D.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static partial class Query
4343
public static List<IElement0D> Elements0D<TNode>(this ILink<TNode> link)
4444
where TNode : INode
4545
{
46-
return new List<IElement0D> { link.StartNode, link.EndNode };
46+
return new List<IElement0D> { link.Start, link.End };
4747
}
4848

4949
/******************************************/

Analytical_Engine/Query/Geometry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static Point Geometry(this INode node)
6060
public static Line Geometry<TNode>(this ILink<TNode> link)
6161
where TNode : INode
6262
{
63-
return new Line { Start = link?.StartNode?.Position, End = link?.EndNode?.Position };
63+
return new Line { Start = link?.Start?.Position, End = link?.End?.Position };
6464
}
6565

6666
/***************************************************/

Structure_Engine/Compute/MapTaperedProfile.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public static partial class Compute
4242
/***************************************************/
4343
[Description("Maps a TaperedProfile to a series of sequential Bars by interpolating the profiles at the startNode and endNode of each bar using a polynomial defined by the interpolationOrder. " +
4444
"For nonlinear profiles a concave profile is achieved by setting the larger profile at the smallest position. To achieve a convex profile, the larger profile must be at the largest position.")]
45-
[Input("section", "The section containing the TaperedProfile to be mapped to the series of Bars.")]
4645
[Input("bars", "The Bars in sequential order for the TaperedProfile to be mapped to.")]
46+
[Input("section", "The section containing the TaperedProfile to be mapped to the series of Bars.")]
4747
[Output("bars", "The Bars with interpolated SectionProperties based on the TaperedProfile provided.")]
4848
public static List<Bar> MapTaperedProfile(List<Bar> bars, IGeometricalSection section)
4949
{
@@ -119,8 +119,8 @@ private static List<TaperedProfile> MapTaperedProfile(List<Bar> bars, TaperedPro
119119
//For each bar interpolate the profiles as necessary and create a TaperedProfile
120120
foreach (Bar bar in bars)
121121
{
122-
double startPosition = centreline.ParameterAtPoint(bar.StartNode.Position);
123-
double endPosition = centreline.ParameterAtPoint(bar.EndNode.Position);
122+
double startPosition = centreline.ParameterAtPoint(bar.Start.Position);
123+
double endPosition = centreline.ParameterAtPoint(bar.End.Position);
124124
double newLength = endPosition - startPosition;
125125

126126
List<double> positions = new List<double>(originalPositions);

Structure_Engine/Create/Elements/Bar.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public static Bar Bar(Line line, ISectionProperty sectionProperty = null, double
5656
return line.IsNull() ? null : new Bar
5757
{
5858
Name = name,
59-
StartNode = (Node)line.Start,
60-
EndNode = (Node)line.End,
59+
Start = (Node)line.Start,
60+
End = (Node)line.End,
6161
SectionProperty = sectionProperty,
6262
Release = release == null ? BarReleaseFixFix() : release,
6363
FEAType = feaType,

Structure_Engine/Create/Loads/BarVaryingDistributedLoad/BarVaryingDistributedLoadDistanceBothEnds.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ public static partial class Create
5252
"Method will group Bars by their length, according to the tolerance, and return one load for each group.")]
5353
[InputFromProperty("loadcase")]
5454
[InputFromProperty("group", "Objects")]
55-
[Input("startToStartDistance", "Distance along each Bar from the StartNode to the start of the load.")]
56-
[Input("endToEndDistance", "Distance along each Bar from the EndNode to the end of the load.")]
5755
[InputFromProperty("relativePositions")]
56+
[Input("startToStartDistance", "Distance along each Bar from the StartNode to the start of the load.")]
5857
[InputFromProperty("forceAtStart")]
58+
[InputFromProperty("momentAtStart")]
59+
[Input("endToEndDistance", "Distance along each Bar from the EndNode to the end of the load.")]
5960
[InputFromProperty("forceAtEnd")]
60-
[InputFromProperty("momentAtStart")]
6161
[InputFromProperty("momentAtEnd")]
6262
[InputFromProperty("axis")]
6363
[InputFromProperty("projected")]
@@ -105,12 +105,12 @@ public static List<BarVaryingDistributedLoad> BarVaryingDistributedLoadDistanceB
105105
"Method will group Bars by their length, according to the tolerance, and return one load for each group.")]
106106
[InputFromProperty("loadcase")]
107107
[Input("objects", "The collection of Bars the load should be applied to.")]
108-
[Input("startToStartDistance", "Distance along each Bar from the StartNode to the start of the load.")]
109-
[Input("endToEndDistance", "Distance along each Bar from the EndNode to the end of the load.")]
110108
[InputFromProperty("relativePositions")]
109+
[Input("startToStartDistance", "Distance along each Bar from the StartNode to the start of the load.")]
111110
[InputFromProperty("forceAtStart")]
112-
[InputFromProperty("forceAtEnd")]
113111
[InputFromProperty("momentAtStart")]
112+
[Input("endToEndDistance", "Distance along each Bar from the EndNode to the end of the load.")]
113+
[InputFromProperty("forceAtEnd")]
114114
[InputFromProperty("momentAtEnd")]
115115
[InputFromProperty("axis")]
116116
[InputFromProperty("projected")]
@@ -139,7 +139,7 @@ public static List<BarVaryingDistributedLoad> BarVaryingDistributedLoadDistanceB
139139
private static Dictionary<double, List<Bar>> GroupBarsByLength(this IEnumerable<Bar> bars, double tolerance)
140140
{
141141
//Check that bars have valid geometry
142-
bars = bars.Where(x => x != null && x.StartNode != null && x.EndNode != null && x.StartNode.Position != null && x.EndNode.Position != null);
142+
bars = bars.Where(x => x != null && x.Start != null && x.End != null && x.Start.Position != null && x.End.Position != null);
143143

144144
Dictionary<double, List<Bar>> dict = new Dictionary<double, List<Bar>>();
145145
foreach (var group in bars.GroupBy(x => (int)Math.Round(x.Length() / tolerance)))

Structure_Engine/Modify/Flip.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public static Bar Flip(this Bar bar)
4747

4848
Bar flipped = bar.ShallowClone();
4949

50-
Node tempNode = flipped.StartNode;
51-
flipped.StartNode = flipped.EndNode;
52-
flipped.EndNode = tempNode;
50+
Node tempNode = flipped.Start;
51+
flipped.Start = flipped.End;
52+
flipped.End = tempNode;
5353

5454
return flipped;
5555
}

Structure_Engine/Modify/SetElements0D.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ public static Bar SetElements0D(this Bar bar, List<IElement0D> newElements0D)
5656
// Default the Bars end if the input is an Point
5757
if (newElements0D[0] is Point)
5858
{
59-
clone.StartNode = new Node { Position = newElements0D[0] as Point };
59+
clone.Start = new Node { Position = newElements0D[0] as Point };
6060
if (clone.Release != null)
6161
clone.Release.StartRelease = Create.FixConstraint6DOF();
6262
}
6363
else
64-
clone.StartNode = newElements0D[0] as Node;
64+
clone.Start = newElements0D[0] as Node;
6565

6666
// Default the Bars end if the input is an Point
6767
if (newElements0D[1] is Point)
6868
{
69-
clone.EndNode = new Node { Position = newElements0D[1] as Point };
69+
clone.End = new Node { Position = newElements0D[1] as Point };
7070
if (clone.Release != null)
7171
clone.Release.EndRelease = Create.FixConstraint6DOF();
7272
}
7373
else
74-
clone.EndNode = newElements0D[1] as Node;
74+
clone.End = newElements0D[1] as Node;
7575

7676
return clone;
7777
}

Structure_Engine/Modify/Transform.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static Bar Transform(this Bar bar, TransformMatrix transform, double tole
7878
return null;
7979
}
8080

81-
if (bar.StartNode?.Position == null || bar.EndNode?.Position == null)
81+
if (bar.Start?.Position == null || bar.End?.Position == null)
8282
{
8383
BH.Engine.Base.Compute.RecordWarning("The bar could not be transformed because at least one of its nodes (or their location) is null.");
8484
return bar;
@@ -91,12 +91,12 @@ public static Bar Transform(this Bar bar, TransformMatrix transform, double tole
9191
}
9292

9393
Bar result = bar.ShallowClone();
94-
result.StartNode = result.StartNode.Transform(transform, tolerance);
95-
result.EndNode = result.EndNode.Transform(transform, tolerance);
94+
result.Start = result.Start.Transform(transform, tolerance);
95+
result.End = result.End.Transform(transform, tolerance);
9696

97-
Vector normalBefore = new Line { Start = bar.StartNode.Position, End = bar.EndNode.Position }.ElementNormal(bar.OrientationAngle);
97+
Vector normalBefore = new Line { Start = bar.Start.Position, End = bar.End.Position }.ElementNormal(bar.OrientationAngle);
9898
Vector normalAfter = normalBefore.Transform(transform);
99-
result.OrientationAngle = normalAfter.OrientationAngleLinear(new Line { Start = result.StartNode.Position, End = result.EndNode.Position });
99+
result.OrientationAngle = normalAfter.OrientationAngleLinear(new Line { Start = result.Start.Position, End = result.End.Position });
100100

101101
return result;
102102
}

Structure_Engine/Objects/EqualityComparers/BarEndNodesDistanceComparer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ public bool Equals(Bar bar1, Bar bar2)
5858
if (Object.ReferenceEquals(bar1, null) || Object.ReferenceEquals(bar2, null))
5959
return false;
6060

61-
if (m_nodeComparer.Equals(bar1.StartNode, bar2.StartNode))
61+
if (m_nodeComparer.Equals(bar1.Start, bar2.Start))
6262
{
63-
return m_nodeComparer.Equals(bar1.EndNode, bar2.EndNode);
63+
return m_nodeComparer.Equals(bar1.End, bar2.End);
6464
}
65-
else if (m_nodeComparer.Equals(bar1.StartNode, bar2.EndNode))
65+
else if (m_nodeComparer.Equals(bar1.Start, bar2.End))
6666
{
67-
return m_nodeComparer.Equals(bar1.EndNode, bar2.StartNode);
67+
return m_nodeComparer.Equals(bar1.End, bar2.Start);
6868
}
6969

7070
return false;
@@ -77,7 +77,7 @@ public int GetHashCode(Bar bar)
7777
//Check whether the object is null
7878
if (Object.ReferenceEquals(bar, null)) return 0;
7979

80-
return m_nodeComparer.GetHashCode(bar.StartNode) ^ m_nodeComparer.GetHashCode(bar.EndNode);
80+
return m_nodeComparer.GetHashCode(bar.Start) ^ m_nodeComparer.GetHashCode(bar.End);
8181
}
8282

8383

Structure_Engine/Query/BarSectionTranformation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static TransformMatrix BarSectionTranformation(this Bar bar)
4545
if (bar.IsNull())
4646
return null;
4747

48-
Vector trans = bar.StartNode.Position - Point.Origin;
48+
Vector trans = bar.Start.Position - Point.Origin;
4949

5050
Vector gX = Vector.XAxis;
5151
Vector gY = Vector.YAxis;

Structure_Engine/Query/Centreline.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static partial class Query
3838
[Output("centreLine", "The centreline of the Bar.")]
3939
public static Line Centreline(this Bar bar)
4040
{
41-
return bar.IsNull() ? null : new Line { Start = bar.StartNode.Position, End = bar.EndNode.Position };
41+
return bar.IsNull() ? null : new Line { Start = bar.Start.Position, End = bar.End.Position };
4242
}
4343

4444
/***************************************************/

Structure_Engine/Query/CoordinateSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static Cartesian CoordinateSystem(this Bar bar)
5656
{
5757
Vector tan = bar?.Tangent(true);
5858
Vector ax = bar?.Normal()?.CrossProduct(tan);
59-
return tan != null && ax != null ? Engine.Geometry.Create.CartesianCoordinateSystem(bar.StartNode.Position, tan, ax) : null;
59+
return tan != null && ax != null ? Engine.Geometry.Create.CartesianCoordinateSystem(bar.Start.Position, tan, ax) : null;
6060
}
6161

6262
/***************************************************/

Structure_Engine/Query/DeformedShape.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static partial class Query
5555
[Input("scaleFactor", "Controls by how much the results should be scaled.")]
5656
[Input("drawSections", "Toggles if output should be just centrelines or include section geometry. Note that currently section geometry only supports displacements, no rotations!")]
5757
[Output("deformed","The shape of the Bars from the displacements.")]
58-
public static List<IGeometry> DeformedShape(List<Bar> bars, List<BarDisplacement> barDisplacements, Type adapterIdType, object loadcase, double scaleFactor = 1.0, bool drawSections = false)
58+
public static List<IGeometry> DeformedShape(this List<Bar> bars, List<BarDisplacement> barDisplacements, Type adapterIdType, object loadcase, double scaleFactor = 1.0, bool drawSections = false)
5959
{
6060
if (adapterIdType == null)
6161
{
@@ -116,7 +116,7 @@ public static List<IGeometry> DeformedShape(List<Bar> bars, List<BarDisplacement
116116
[Input("loadcase", "Loadcase to display results for. Should generally be either an identifier matching the one used in the analysis package that the results were pulled from or a Loadcase/LoadCombination.")]
117117
[Input("scaleFactor", "Controls by how much the results should be scaled.")]
118118
[Output("deformed", "The shape of the FEMeshes from the displacements.")]
119-
public static List<Mesh> DeformedShape(List<FEMesh> meshes, List<MeshResult> meshDisplacements, Type adapterIdType, object loadcase, double scaleFactor = 1.0)
119+
public static List<Mesh> DeformedShape(this List<FEMesh> meshes, List<MeshResult> meshDisplacements, Type adapterIdType, object loadcase, double scaleFactor = 1.0)
120120
{
121121
if (adapterIdType == null)
122122
{
@@ -168,13 +168,13 @@ public static List<Mesh> DeformedShape(List<FEMesh> meshes, List<MeshResult> mes
168168

169169
private static Polyline DeformedShapeCentreLine(Bar bar, List<BarDisplacement> deformations, double scaleFactor = 1.0)
170170
{
171-
Vector tan = (bar.EndNode.Position - bar.StartNode.Position);
171+
Vector tan = (bar.End.Position - bar.Start.Position);
172172
List<Point> pts = new List<Point>();
173173

174174
foreach (BarDisplacement defo in deformations)
175175
{
176176
Vector disp = new Vector { X = defo.UX * scaleFactor, Y = defo.UY * scaleFactor, Z = defo.UZ * scaleFactor };
177-
Point pt = bar.StartNode.Position + tan * defo.Position + disp;
177+
Point pt = bar.Start.Position + tan * defo.Position + disp;
178178
pts.Add(pt);
179179
}
180180

Structure_Engine/Query/DistributedPoints.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ public static List<Point> DistributedPoints(this Bar bar, int divisions, double
5959
Vector tan;
6060
if (startLength == 0 && endLength == 0)
6161
{
62-
startPos = bar.StartNode.Position;
62+
startPos = bar.Start.Position;
6363
tan = bar.Tangent() / (double)divisions;
6464
}
6565
else
6666
{
6767
double length = bar.Length();
6868
tan = bar.Tangent() / length;
69-
startPos = bar.StartNode.Position + tan * startLength;
69+
startPos = bar.Start.Position + tan * startLength;
7070

7171
tan *= (length - endLength - startLength) / (double)divisions;
7272
}

Structure_Engine/Query/IsNull.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static bool IsNull(this Bar bar, string msg = "", [CallerMemberName] stri
8383
ErrorMessage(methodName, "Bar", msg);
8484
return true;
8585
}
86-
else if (bar.StartNode.IsNull("The Node (StartNode) is owned by a Bar.", methodName) || bar.EndNode.IsNull("The Node (EndNode) is owned by a Bar.", methodName))
86+
else if (bar.Start.IsNull("The Node (Start) is owned by a Bar.", methodName) || bar.End.IsNull("The Node (End) is owned by a Bar.", methodName))
8787
return true;
8888

8989
return false;

Structure_Engine/Query/OppositeNode.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public static Node OppositeNode(this Bar bar, Node node)
4242
if (bar.IsNull() || node.IsNull())
4343
return null;
4444

45-
if (bar.EndNode.BHoM_Guid == node.BHoM_Guid)
46-
return bar.StartNode;
47-
else if (bar.StartNode.BHoM_Guid == node.BHoM_Guid)
48-
return bar.EndNode;
45+
if (bar.End.BHoM_Guid == node.BHoM_Guid)
46+
return bar.Start;
47+
else if (bar.Start.BHoM_Guid == node.BHoM_Guid)
48+
return bar.End;
4949
else
5050
{
5151
Base.Compute.RecordError("The Bar does not contain the provided Node.");

0 commit comments

Comments
 (0)