Material diagram Window was changed
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportForceResultToCSVLogic : IExportResultLogic
|
||||
{
|
||||
const string separator = ";";
|
||||
StringBuilder output;
|
||||
IForcesResults results;
|
||||
public string FileName { get; set; }
|
||||
|
||||
public void Export()
|
||||
{
|
||||
ExportHeadings();
|
||||
ExportBoby();
|
||||
try
|
||||
{
|
||||
File.AppendAllText(FileName, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public ExportForceResultToCSVLogic(IForcesResults forcesResults)
|
||||
{
|
||||
this.results = forcesResults;
|
||||
output = new StringBuilder();
|
||||
}
|
||||
|
||||
private void ExportHeadings()
|
||||
{
|
||||
string[] headings =
|
||||
{
|
||||
"Limit State",
|
||||
"Calc duration",
|
||||
"Mx",
|
||||
"My",
|
||||
"Nz",
|
||||
"kx",
|
||||
"ky",
|
||||
"epsz"
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
}
|
||||
private void ExportBoby()
|
||||
{
|
||||
foreach (var item in results.ForcesResultList)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
var tuple = item.DesignForceTuple.ForceTuple;
|
||||
var strainMatrix = item.LoaderResults.StrainMatrix;
|
||||
string[] newLine =
|
||||
{
|
||||
item.DesignForceTuple.LimitState.ToString(),
|
||||
item.DesignForceTuple.CalcTerm.ToString(),
|
||||
tuple.Mx.ToString(),
|
||||
tuple.My.ToString(),
|
||||
tuple.Nz.ToString(),
|
||||
strainMatrix.Kx.ToString(),
|
||||
strainMatrix.Ky.ToString(),
|
||||
strainMatrix.EpsZ.ToString()
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportGeometryResultToCSVLogic : IExportResultLogic
|
||||
{
|
||||
const string separator = ";";
|
||||
StringBuilder output;
|
||||
IGeometryResult result;
|
||||
public string FileName { get; set; }
|
||||
public ExportGeometryResultToCSVLogic(IGeometryResult geometryResult)
|
||||
{
|
||||
this.result = geometryResult;
|
||||
output = new StringBuilder();
|
||||
}
|
||||
public void Export()
|
||||
{
|
||||
ExportHeadings();
|
||||
ExportBoby();
|
||||
try
|
||||
{
|
||||
File.AppendAllText(FileName, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void ExportHeadings()
|
||||
{
|
||||
string[] headings =
|
||||
{
|
||||
"Name",
|
||||
"Short",
|
||||
"Measerement Unit",
|
||||
"Value",
|
||||
"Description",
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
}
|
||||
private void ExportBoby()
|
||||
{
|
||||
foreach (var item in result.TextParameters)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
string[] newLine =
|
||||
{
|
||||
item.Name,
|
||||
item.ShortName,
|
||||
item.MeasurementUnit,
|
||||
item.Value.ToString(),
|
||||
item.Description
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportToCSVLogic : IExportResultLogic
|
||||
{
|
||||
string filename;
|
||||
|
||||
public void Export(INdmResult ndmResult)
|
||||
{
|
||||
string separator = ";";
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
if (ndmResult is ForcesResults)
|
||||
{
|
||||
var forceResults = ndmResult as ForcesResults;
|
||||
string[] headings =
|
||||
{
|
||||
"Limit State",
|
||||
"Calc duration",
|
||||
"Mx",
|
||||
"My",
|
||||
"Nz",
|
||||
"kx",
|
||||
"ky",
|
||||
"epsz"
|
||||
};
|
||||
output.AppendLine(string.Join(separator, headings));
|
||||
foreach (var item in forceResults.ForcesResultList)
|
||||
{
|
||||
if (item.IsValid == true)
|
||||
{
|
||||
var tuple = item.DesignForceTuple.ForceTuple;
|
||||
var strainMatrix = item.LoaderResults.StrainMatrix;
|
||||
string[] newLine =
|
||||
{
|
||||
item.DesignForceTuple.LimitState.ToString(),
|
||||
item.DesignForceTuple.CalcTerm.ToString(),
|
||||
tuple.Mx.ToString(),
|
||||
tuple.My.ToString(),
|
||||
tuple.Nz.ToString(),
|
||||
strainMatrix.Kx.ToString(),
|
||||
strainMatrix.Ky.ToString(),
|
||||
strainMatrix.EpsZ.ToString()
|
||||
};
|
||||
output.AppendLine(string.Join(separator, newLine));
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
File.AppendAllText(filename, output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Data could not be written to the CSV file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown +": "+ nameof(ndmResult));
|
||||
}
|
||||
|
||||
public ExportToCSVLogic(string filename)
|
||||
{
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public class GeometryCalculator : IGeometryCalculator
|
||||
{
|
||||
TextParametersLogic parametersLogic;
|
||||
IGeometryResult geometryResult;
|
||||
public string Name { get; set; }
|
||||
|
||||
public INdmResult Result => geometryResult;
|
||||
|
||||
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||
{
|
||||
parametersLogic = new TextParametersLogic(ndms, strainMatrix);
|
||||
}
|
||||
|
||||
public GeometryCalculator(TextParametersLogic parametersLogic)
|
||||
{
|
||||
this.parametersLogic = parametersLogic;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
geometryResult = new GeometryResult() { IsValid = true };
|
||||
geometryResult.TextParameters = parametersLogic.GetTextParameters();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public class GeometryResult : IGeometryResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public List<ITextParameter> TextParameters { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryCalculator : INdmCalculator
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryResult : INdmResult
|
||||
{
|
||||
List<ITextParameter> TextParameters { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public interface IExportResultLogic
|
||||
{
|
||||
void Export(INdmResult ndmResult);
|
||||
string FileName { get; set; }
|
||||
void Export();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user