public SimplexPlanning(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport finalReport, Routes rout, ArgumentsCMD cmd, FilesForVolume filesForVolume) { this.model = model; this.material = material; this.add = add; this.file = file; this.finalReport = finalReport; this.rout = rout; this.cmd = cmd; this.filesForVolume = filesForVolume; }
public MainFunction(GeometryOptions model, MaterialsOptions material, AdditionallyOptions add, FileName file, CommonReport finalReport, GeneralReport genReport, Routes rout, ArgumentsCMD cmd, FilesForVolume filesForVolume) { this.model = model; this.material = material; this.add = add; this.file = file; this.finalReport = finalReport; this.genReport = genReport; this.rout = rout; this.cmd = cmd; this.filesForVolume = filesForVolume; }
public void GetStampNodesDisplacement(FilesForVolume filesForVolume) { StampNodesDisplacement = File.ReadLines(filesForVolume.stampNodeDisplacementRoute) .Select(line => line.Split(';')) .ToDictionary(data => Convert.ToDouble(data[0]), data => Convert.ToDouble(data[1])); StampNodesDisplacement = StampNodesDisplacement .Where(f => f.Value != 0) .ToDictionary(x => x.Key, x => x.Value); NodeDisplacement = StampNodesDisplacement.Values.Last(); File.WriteAllText("StampNodeDisplacement.txt", Convert.ToString(NodeDisplacement)); }
public void Processing(GeometryOptions model, FileName file, FilesForVolume filesForVolume, GeneralReport genReport) { try { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); var extract = new RunExtract(rout); extract.ExtractName(cmd.extractName, file); extract.ChangeName(file); extract.ExtractFiles(cmd.extractFiles); extract.ExtractNodes(cmd.extractNodes, file); var extrRoutes = new RoutesForExtract(); extrRoutes.setReactionForceRoute = rout.workingDirectory + @"\RF3Stamp.csv"; var extrRF = new ExtractRF(); extrRF.Extract(extrRoutes, model); var reprRF = new ReactionForceReport(); reprRF.ReportReactionForce(model, genReport, file, extrRF); filesForVolume.stampNodeDisplacementRoute = rout.workingDirectory + @"\" + filesForVolume.stampNodeDisplacementName; filesForVolume.blankNodeDisplacementRoute = rout.workingDirectory + @"\" + filesForVolume.blankNodeDisplacementName; filesForVolume.blankCoordinatesRoute = rout.workingDirectory + @"\" + filesForVolume.blankCoordinatesName; filesForVolume.elementCoordinatesRoute = rout.workingDirectory + @"\" + filesForVolume.elementCoordinatesName; filesForVolume.stampNodesRoute = rout.workingDirectory + @"\" + filesForVolume.stampNodesName; filesForVolume.elementVolumeRoute = rout.workingDirectory + @"\" + filesForVolume.elementVolumeName; var extrVolume = new ExtractVolume(); //extrVolume.GetStampNodesDisplacement(filesForVolume); extrVolume.GetBlankNodesDisplacement(filesForVolume); //extrVolume.GetBlanksNodeCoordinates(filesForVolume); //extrVolume.GetElementCoordinates(filesForVolume, model); extrVolume.Volume(model); var reprVolume = new VolumeReport(); reprVolume.ReportVolume(model, genReport, file, extrVolume); } catch (Exception e) { Console.WriteLine(e.Message); } }
public void GetBlankNodesDisplacement(FilesForVolume filesForVolume) { BlanksNodeDisplacementDic = File.ReadLines(filesForVolume.blankNodeDisplacementRoute) .Select(line => line.Split(';')) .Where(split => split[0] != "Node") .ToDictionary(split => double.Parse(split[0]), split => new BlanksNodeCoordinates(double.Parse(split[1]), double.Parse(split[2]), double.Parse(split[3]))); #region Проверка, путём записис в файл, что в словаре имеются правильные узлы с координатами String NodeInStampCSV = String.Join( Environment.NewLine, BlanksNodeDisplacementDic.Select(d => d.Key + ";" + d.Value.X + ";" + d.Value.Y + ";" + d.Value.Z + ";")); File.WriteAllText("BlanksNodeDisplacementDic.csv", NodeInStampCSV); #endregion }
public void Volume(FilesForVolume filesForVolume, GeometryOptions model) { //Верменная переменная для подсчёта объёма Dictionary <double, double> array = new Dictionary <double, double>(); ElementVolume = File.ReadLines(filesForVolume.elementVolumeRoute).Select(line => line.Split(';')).ToDictionary(data => Convert.ToInt32(data[0]), data => Convert.ToDouble(data[1])); ElementVolume = ElementVolume .Where(f => f.Value != 0) .ToDictionary(x => x.Key, x => x.Value); ElementVolume = ElementVolume.Keys.Intersect(ElementNumber.Keys).ToDictionary(t => t, t => ElementVolume[t]); double sum = ElementVolume.Sum(y => y.Value); array.Add(model.blankRadius, sum); String csv = String.Join( Environment.NewLine, array.Select(d => d.Key + ";" + d.Value)); File.AppendAllText("TempVolume.csv", csv + Environment.NewLine); }
public void GetBlanksNodeCoordinates(FilesForVolume filesForVolume) { //правильный вариант текущих координат заготовки BlankCoordinatesDic = BlanksNodeDisplacementDic.ToDictionary(k => k.Key, v => v.Value); //new double min = BlankCoordinatesDic.Min(v => v.Value.Z); min = Math.Abs(min); NodeDisplacement += min; //new BlankCoordinatesDic = BlankCoordinatesDic.ToDictionary(k => k.Key, v => new BlanksNodeCoordinates(v.Value.X, v.Value.Y, v.Value.Z + min)); #region Проверка, путём записис в файл, что в словаре имеются правильные узлы с координатами String BlankCoordDic = String.Join( Environment.NewLine, BlankCoordinatesDic.Select(d => d.Key + ";" + d.Value.X + ";" + d.Value.Y + ";" + d.Value.Z + ";")); File.WriteAllText("BlankCoordinatesDic.csv", BlankCoordDic); #endregion }
public void GetElementCoordinates(FilesForVolume filesForVolume, GeometryOptions model) { try { // Новый список координат узлов заготовки, координаты которых меньше координаты перемещения штампа из списка координат узлов выше ^ Dictionary <double, NodesInStamp> NodesInStampDic = new Dictionary <double, NodesInStamp>(); Dictionary <int, double> radius = new Dictionary <int, double>(); Dictionary <int, double> StampNodes = new Dictionary <int, double>(); //double radius; ElementCoordinates = File.ReadLines(filesForVolume.elementCoordinatesRoute) .Skip(1) .Select(line => line.Split(';')) .ToDictionary(split => int.Parse(split[0]), split => new ElementNodes(int.Parse(split[1]), int.Parse(split[2]), int.Parse(split[3]), int.Parse(split[4]), int.Parse(split[5]), int.Parse(split[6]), int.Parse(split[7]), int.Parse(split[8]))); //пишем знак меньше, так как координаты увеличиваются к основанию заготовки (от меньшего к большему) //следовательно, для подсчёта объема в матрице, нам нужно то, что не больше перемещения матрицы NodesInStampDic = BlankCoordinatesDic.Where(f => f.Value.Z <= NodeDisplacement).ToDictionary(k => k.Key, v => new NodesInStamp(v.Value.X, v.Value.Y, v.Value.Z)); //Новый отбор точек. //Отбираются точки заготовки, которые меньше радиуса, после скругления //Т.к. подсчёт объёма идёт от пуансона до конца матрицы и мы прсото заносим в этот словарь //ведь он используется дальше и чтобы не менять структуру проги NodesInStampDic = BlankCoordinatesDic.ToDictionary(k => k.Key, v => new NodesInStamp(v.Value.X, v.Value.Y, v.Value.Z)); #region Проверка, путём записис в файл, что в словаре имеются правильные узлы, находящиеся в матрице, с координатами String NodeInStampCSV = String.Join( Environment.NewLine, NodesInStampDic.Select(d => d.Key + ";" + d.Value.X + ";" + d.Value.Y + ";" + d.Value.Z + ";")); File.WriteAllText("NodesInStamp.csv", NodeInStampCSV); #endregion StampNodes = File.ReadLines(filesForVolume.stampNodesRoute) .Select(line => line.Split(';')) .ToDictionary(key => Convert.ToInt32(key[0]), value => Math.Abs(Convert.ToDouble(value[3]))); #region Проверка, путём записис в файл, что в словаре имеются правильные соотнешения узла и его координаты Z (считается радиусом матрицы) String StampNodesCSV = String.Join( Environment.NewLine, StampNodes.Select(d => d.Key + ";" + d.Value + ";")); File.WriteAllText("StampNodes.csv", StampNodesCSV); #endregion double stampRadius = model.dieRadius; radius = NodesInStampDic.ToDictionary(k => Convert.ToInt32(k.Key), v => Math.Sqrt(Math.Pow(v.Value.X, 2) + Math.Pow(v.Value.Y, 2))); //добавить сраненние радиусов //Dictionary<double, double> stampDeltaRadius = new Dictionary<double, double>(); //stampDeltaRadius = NodesInStampDic.ToDictionary(k =>k.Key, v=> model.dieRadius - ((v.Value.Z/60) * (model.dieRadius - 10))); //radius = radius.Where(v => stampDeltaRadius[v.Key] <= v.Value).ToDictionary(k => k.Key, v => v.Value); //старый вариант отбора радиусов //radius = radius.Where(v => v.Value <= stampRadius).ToDictionary(k => k.Key, v => v.Value); //test radius = radius.Where(v => v.Value <= model.lowerFilletRadius).ToDictionary(k => k.Key, v => v.Value); String csvradius = String.Join( Environment.NewLine, radius.Select(d => d.Key + ";" + d.Value + ";")); File.WriteAllText("Radius.csv", csvradius); double minNodeNumber = radius.Min(x => x.Key); File.WriteAllText("minNodeNumber.txt", Convert.ToString(minNodeNumber)); ElementNumber = ElementCoordinates .Where(v => radius.Keys.Contains(v.Value.Node1) && radius.Keys.Contains(v.Value.Node2) && radius.Keys.Contains(v.Value.Node3) && radius.Keys.Contains(v.Value.Node4) && radius.Keys.Contains(v.Value.Node5) && radius.Keys.Contains(v.Value.Node6) && radius.Keys.Contains(v.Value.Node7) && radius.Keys.Contains(v.Value.Node8)) .ToDictionary(keyValue => keyValue.Key, keyValue => keyValue.Value.Node1); String csv = String.Join( Environment.NewLine, ElementNumber.Select(d => d.Key + ";" + d.Value + ";")); File.WriteAllText("ElementNumbers.csv", csv); } catch (Exception e) { MessageBox.Show("Get Elemnt Coordinates: " + e); } //string test = ElementCoord.FirstOrDefault(x=>x.Key == 1).Value; }