-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLoadCase.cs
More file actions
37 lines (30 loc) · 1.22 KB
/
Copy pathLoadCase.cs
File metadata and controls
37 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SectionCutter
{
public class LoadCase
{
public int NumberNames { get; set; }
public string MyName { get; set; }
public int Status { get; set; }
public Dictionary<string, bool> SeismicInfo { get; set; }
public List<string> SeismicLoadDirection { get; set; }
// Method to return ordered list of seismic directions
public List<string> GetOrderedSeismicDirections()
{
// Define the desired order
string[] order = { "EQx", "EQy", "EQx + E", "EQy + E", "EQx - E", "EQy - E" };
// Sort keys based on values and then order
var orderedKeys = SeismicInfo.OrderBy(kv => kv.Value)
.ThenBy(kv => Array.IndexOf(order, kv.Key))
.Select(kv => kv.Key)
.ToList();
// Filter out keys with false values
var filteredKeys = orderedKeys.Where(key => SeismicInfo[key]).ToList();
return filteredKeys;
}
}
}