Skip to content

Commit

Permalink
feat(structure): add Structure, Element, and Connection classes to de…
Browse files Browse the repository at this point in the history
…scribe structures
  • Loading branch information
tsvilans committed Oct 28, 2020
1 parent 2f67485 commit 9866aa9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions GluLamb/Structure/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public Connection(Element eleA, Element eleB, double positionA, double positionB
Name = name;
}

public static void Disconnect(Connection conn)
{
conn.ElementA.Connections.Remove(conn);
conn.ElementB.Connections.Remove(conn);
}

public Line Discretize()
{
return new Line(
Expand Down
3 changes: 2 additions & 1 deletion GluLamb/Structure/Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ public class Element
public string Name;
public List<Connection> Connections;
protected Plane m_plane;
public GeometryBase Geometry;

public Element(string name = "")
{
Connections = new List<Connection>();
Name = name;
m_plane = Plane.WorldXY;
Geometry = null;
}

public Element(Plane handle, string name = "")
Expand Down Expand Up @@ -66,7 +68,6 @@ public Element GetConnected(int index)
if (conn.ElementA == this)
return conn.ElementB;
return conn.ElementA;

}
}

Expand Down
12 changes: 9 additions & 3 deletions GluLamb/Structure/ElementGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@

namespace GluLamb
{
public class ElementGroup
public class ElementGroup: List<Element>
{
public string Name;
private List<Element> m_elements;
//private List<Element> m_elements;

public ElementGroup(string name = "ElementGroup")
{
Name = name;
m_elements = new List<Element>();
//m_elements = new List<Element>();
}
/*
public int Count
{
get { return m_elements.Count; }
}
public Element this[int key]
Expand All @@ -38,5 +43,6 @@ public void Clear()
{
m_elements.Clear();
}
*/
}
}
2 changes: 2 additions & 0 deletions GluLamb/Structure/Structure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ public class Structure
{
public List<Connection> Connections;
public List<Element> Elements;
public Dictionary<string, List<Element>> Groups;

public Structure()
{
Connections = new List<Connection>();
Elements = new List<Element>();
Groups = new Dictionary<string, List<Element>>();
}

public static Structure FromBeamElements(List<BeamElement> elements, double searchDistance, double overlapDistance)
Expand Down

0 comments on commit 9866aa9

Please sign in to comment.