分析模块重新调整
This commit is contained in:
@@ -755,12 +755,6 @@
|
||||
<Compile Include="Forms\92_Knowledge\FrmAnalysisResult.Designer.cs">
|
||||
<DependentUpon>FrmAnalysisResult.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\92_Knowledge\FrmAnalysisResultEx.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\92_Knowledge\FrmAnalysisResultEx.Designer.cs">
|
||||
<DependentUpon>FrmAnalysisResultEx.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\92_Knowledge\FrmEditProcessingJobs.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -816,8 +810,8 @@
|
||||
<Compile Include="Forms\92_Knowledge\FrmToolPositionViewer.Designer.cs">
|
||||
<DependentUpon>FrmToolPositionViewer.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\92_Knowledge\ViewJob.cs" />
|
||||
<Compile Include="Forms\92_Knowledge\ViewSteps.cs" />
|
||||
<Compile Include="Forms\92_Knowledge\ViewAnalysisJob.cs" />
|
||||
<Compile Include="Forms\92_Knowledge\ViewJobs.cs" />
|
||||
<Compile Include="Forms\IFormHighlightSymbol.cs" />
|
||||
<Compile Include="Forms\IFormHighlight.cs" />
|
||||
<Compile Include="Forms\IFormItemSetDataParent.cs" />
|
||||
@@ -1160,9 +1154,6 @@
|
||||
<EmbeddedResource Include="Forms\92_Knowledge\FrmAnalysisResult.resx">
|
||||
<DependentUpon>FrmAnalysisResult.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\92_Knowledge\FrmAnalysisResultEx.resx">
|
||||
<DependentUpon>FrmAnalysisResultEx.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\92_Knowledge\FrmEditProcessingJobs.resx">
|
||||
<DependentUpon>FrmEditProcessingJobs.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -86,8 +86,8 @@ namespace CPSO
|
||||
public List<ViewProcessingJob> ProcessingJobs => _processingJobs;
|
||||
|
||||
[NonSerialized]
|
||||
protected List<ViewJob> _completedJobs = new List<ViewJob> ();
|
||||
public List<ViewJob> CompletedJobs => _completedJobs;
|
||||
protected List<Forms._92_Knowledge.ViewAnalysisJob> _completedJobs = new List<Forms._92_Knowledge.ViewAnalysisJob>();
|
||||
public List<Forms._92_Knowledge.ViewAnalysisJob> CompletedJobs => _completedJobs;
|
||||
|
||||
|
||||
// Properties
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CaeGlobals;
|
||||
using CaeJob;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using CaeGlobals;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CPSO.Forms
|
||||
{
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CaeGlobals;
|
||||
using CaeGlobals;
|
||||
using CaeJob;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CPSO.Forms
|
||||
{
|
||||
|
||||
80
CPSO/Forms/92_Knowledge/FrmAnalysisEx.Designer.cs
generated
80
CPSO/Forms/92_Knowledge/FrmAnalysisEx.Designer.cs
generated
@@ -28,31 +28,10 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.btnRun = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Location = new System.Drawing.Point(12, 66);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowHeadersWidth = 51;
|
||||
this.dataGridView1.RowTemplate.Height = 27;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(776, 301);
|
||||
this.dataGridView1.TabIndex = 0;
|
||||
//
|
||||
// btnRun
|
||||
//
|
||||
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
@@ -68,88 +47,31 @@
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(439, 387);
|
||||
this.btnCancel.Location = new System.Drawing.Point(470, 387);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(144, 37);
|
||||
this.btnCancel.TabIndex = 2;
|
||||
this.btnCancel.Text = "取消";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(22, 25);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(112, 15);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.Text = "开始任务序号:";
|
||||
//
|
||||
// numericUpDown1
|
||||
//
|
||||
this.numericUpDown1.Location = new System.Drawing.Point(140, 23);
|
||||
this.numericUpDown1.Maximum = new decimal(new int[] {
|
||||
99999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDown1.Name = "numericUpDown1";
|
||||
this.numericUpDown1.Size = new System.Drawing.Size(120, 25);
|
||||
this.numericUpDown1.TabIndex = 5;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(306, 25);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(82, 15);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "任务数量:";
|
||||
//
|
||||
// numericUpDown2
|
||||
//
|
||||
this.numericUpDown2.Location = new System.Drawing.Point(426, 23);
|
||||
this.numericUpDown2.Maximum = new decimal(new int[] {
|
||||
99999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDown2.Name = "numericUpDown2";
|
||||
this.numericUpDown2.Size = new System.Drawing.Size(120, 25);
|
||||
this.numericUpDown2.TabIndex = 7;
|
||||
//
|
||||
// FrmAnalysisEx
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.numericUpDown2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.numericUpDown1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnRun);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.Name = "FrmAnalysisEx";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "FrmAnalysisEx";
|
||||
this.Load += new System.EventHandler(this.FrmAnalysisEx_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.Button btnRun;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDown1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDown2;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
using CaeGlobals;
|
||||
using CaeJob;
|
||||
using CaeKnowledge.View;
|
||||
using CaeMesh;
|
||||
using CaeModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
// ReSharper disable InlineTemporaryVariable
|
||||
@@ -23,159 +18,26 @@ namespace CPSO.Forms._92_Knowledge
|
||||
|
||||
Self = controller;
|
||||
|
||||
dataGridView1.DataSource = new BindingList<ViewJob>();
|
||||
|
||||
Text = @"切削力仿真";
|
||||
|
||||
// 计算任务数
|
||||
numericUpDown2.Value = 2;
|
||||
}
|
||||
|
||||
public void PrepareForm()
|
||||
{
|
||||
if (Self.CompletedJobs.Count > 0 && dataGridView1.DataSource is BindingList<ViewJob> jobs)
|
||||
{
|
||||
jobs.Clear();
|
||||
foreach (var vj in Self.CompletedJobs)
|
||||
{
|
||||
jobs.Add(vj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FrmAnalysisEx_Load(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.AllowUserToAddRows = false;
|
||||
dataGridView1.AllowUserToDeleteRows = false;
|
||||
dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
|
||||
|
||||
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView1.RowHeadersVisible = false;
|
||||
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
}
|
||||
|
||||
private async void btnRun_Click(object sender, EventArgs e)
|
||||
private void btnRun_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Self.ProcessingJobs.Count <= 0)
|
||||
return;
|
||||
|
||||
int BeginIndex = (int)numericUpDown1.Value;
|
||||
int EndIndex = BeginIndex + (int)numericUpDown2.Value;
|
||||
|
||||
if (BeginIndex >= EndIndex)
|
||||
throw new CaeException("开始索引小于结束索引!");
|
||||
|
||||
Self.Form.SetStateWorking(@"进行切削力分析...");
|
||||
|
||||
if (dataGridView1.DataSource is BindingList<ViewJob> jobs)
|
||||
{
|
||||
for (int i = BeginIndex; i < EndIndex; ++i)
|
||||
{
|
||||
// 作业基础信息
|
||||
var processingJob = Self.ProcessingJobs[i];
|
||||
|
||||
var jobName = AddTaskAndRun(processingJob, out var stepName, out var surfaceName);
|
||||
|
||||
var job = Self.GetJob(jobName);
|
||||
|
||||
if (job != null)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Self.PrepareAndRunJob(job.Name, false, false);
|
||||
});
|
||||
|
||||
jobs.Add(new ViewJob(job)
|
||||
{
|
||||
StepName = stepName,
|
||||
SurfaceName = surfaceName,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var job in jobs)
|
||||
{
|
||||
Self.CompletedJobs.Add(job);
|
||||
}
|
||||
}
|
||||
|
||||
Self.Form.SetStateReady(@"进行切削力分析...");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionTools.Show(this, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private string AddTaskAndRun(ViewProcessingJob processingJob, out string stepName, out string surfaceName)
|
||||
{
|
||||
// 1. 先把所有计算步反激活
|
||||
var stepList = Self.GetAllSteps().ToList();
|
||||
stepList.ForEach(x =>
|
||||
{
|
||||
Self.ActivateDeactivateStep(x.Name, false);
|
||||
});
|
||||
|
||||
// 2. 新建一个计算步并激活
|
||||
// 复制一分模板计算步
|
||||
var newStep = Self.GetStep(processingJob.StepName).DeepClone();
|
||||
|
||||
newStep.Name = NamedClass.GetNameWithoutLastValue(newStep.Name);
|
||||
newStep.Name = Self.GetStepNames().GetNextNumberedKey(newStep.Name);
|
||||
|
||||
Self.AddStep(newStep, false);
|
||||
|
||||
stepName = newStep.Name;
|
||||
|
||||
// 激活计算步
|
||||
Self.ActivateDeactivateStep(newStep.Name, true);
|
||||
|
||||
// 2.1 新建用于施加载荷的曲面Surface
|
||||
// 新建Surface
|
||||
var surface = new FeSurface(Self.Model.Mesh.Surfaces.GetNextNumberedKey("UserSurface"))
|
||||
{
|
||||
CreatedFrom = FeSurfaceCreatedFrom.Selection,
|
||||
// ToDo: 未来修改
|
||||
FaceIds = processingJob.Base.Faces.Select(x => x.Id).ToArray()
|
||||
};
|
||||
|
||||
surfaceName = surface.Name;
|
||||
|
||||
Self.AddSurface(surface);
|
||||
|
||||
// 2.2 定义载荷
|
||||
bool twoD = Self.Model.Properties.ModelSpace.IsTwoD();
|
||||
bool complex = newStep is SteadyStateDynamicsStep;
|
||||
|
||||
var loadName = newStep.Loads.GetNextNumberedKey("Load");
|
||||
|
||||
double area = surface.Area;
|
||||
|
||||
if(area <= 0)
|
||||
area = 1.0;
|
||||
|
||||
double fx = -1.0 * processingJob.Fx / area;
|
||||
double fy = -1.0 * processingJob.Fy / area;
|
||||
double fz = -1.0 * processingJob.Fz / area;
|
||||
|
||||
var stLoad = new STLoad(loadName, surface.Name, RegionTypeEnum.SurfaceName, fx, fy, fz, twoD, complex, 0);
|
||||
|
||||
Self.AddLoad(newStep.Name, stLoad);
|
||||
|
||||
// 3. 新建一个Analysis Job
|
||||
var name = Self.GetJobNames().GetNextNumberedKey("Analysis");
|
||||
|
||||
var executable = Self.Settings.Calculix.CalculixExe; // 可执行文件路径
|
||||
var argument = name; // 参数
|
||||
var workDirectory = Self.Settings.GetWorkDirectory(); // 工作目录
|
||||
|
||||
var job = new AnalysisJob(name, executable, argument, workDirectory);
|
||||
|
||||
Self.AddJob(job);
|
||||
|
||||
return job.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
|
||||
this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
|
||||
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
|
||||
this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.NodeId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -65,8 +63,6 @@
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripLabel1,
|
||||
this.toolStripComboBox1,
|
||||
this.toolStripLabel2,
|
||||
this.toolStripTextBox1,
|
||||
this.toolStripButton1});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
@@ -83,21 +79,7 @@
|
||||
// toolStripComboBox1
|
||||
//
|
||||
this.toolStripComboBox1.Name = "toolStripComboBox1";
|
||||
this.toolStripComboBox1.Size = new System.Drawing.Size(121, 28);
|
||||
this.toolStripComboBox1.SelectedIndexChanged += new System.EventHandler(this.toolStripComboBox1_SelectedIndexChanged);
|
||||
//
|
||||
// toolStripLabel2
|
||||
//
|
||||
this.toolStripLabel2.Name = "toolStripLabel2";
|
||||
this.toolStripLabel2.Size = new System.Drawing.Size(69, 25);
|
||||
this.toolStripLabel2.Text = "曲面集:";
|
||||
//
|
||||
// toolStripTextBox1
|
||||
//
|
||||
this.toolStripTextBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
|
||||
this.toolStripTextBox1.Name = "toolStripTextBox1";
|
||||
this.toolStripTextBox1.ReadOnly = true;
|
||||
this.toolStripTextBox1.Size = new System.Drawing.Size(100, 28);
|
||||
this.toolStripComboBox1.Size = new System.Drawing.Size(480, 28);
|
||||
//
|
||||
// toolStripButton1
|
||||
//
|
||||
@@ -219,7 +201,6 @@
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
|
||||
private System.Windows.Forms.ToolStripComboBox toolStripComboBox1;
|
||||
private System.Windows.Forms.ToolStripLabel toolStripLabel2;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn NodeId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn X;
|
||||
@@ -230,6 +211,5 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn W;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Starin;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Stress;
|
||||
private System.Windows.Forms.ToolStripTextBox toolStripTextBox1;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
using CaeGlobals;
|
||||
using CaeKnowledge;
|
||||
using CaeKnowledge.View;
|
||||
using CaeMesh;
|
||||
using CaeResults;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CPSO.Forms._92_Knowledge
|
||||
@@ -26,25 +30,28 @@ namespace CPSO.Forms._92_Knowledge
|
||||
|
||||
public Controller Self { get { return _self; } }
|
||||
|
||||
private Dictionary<string, string> _data = new Dictionary<string, string>();
|
||||
|
||||
public void PrepareForm(Controller self)
|
||||
{
|
||||
_data.Clear();
|
||||
|
||||
if (self != null)
|
||||
{
|
||||
_self = self;
|
||||
|
||||
toolStripComboBox1.Items.Clear();
|
||||
|
||||
// 分析结果
|
||||
foreach (var job in self.CompletedJobs)
|
||||
{
|
||||
toolStripComboBox1.Items.Add(job.JobName);
|
||||
toolStripComboBox1.Items.Add("None");
|
||||
|
||||
_data.Add(job.JobName, job.SurfaceName);
|
||||
// 分析结果
|
||||
foreach (string name in Self.AllResults.GetResultNames())
|
||||
{
|
||||
var result = Self.AllResults.GetResult(name);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
toolStripComboBox1.Items.Add(result.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
toolStripComboBox1.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,92 +61,100 @@ namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
list.Clear();
|
||||
|
||||
if (toolStripComboBox1.SelectedIndex >= 0)
|
||||
if (toolStripComboBox1.SelectedIndex >= 0
|
||||
&& toolStripComboBox1.SelectedItem is string resultName
|
||||
&& File.Exists(resultName))
|
||||
{
|
||||
var jobName = toolStripComboBox1.SelectedItem as string;
|
||||
var surfaceName = toolStripTextBox1.Text;
|
||||
|
||||
LoadJob(list, jobName, surfaceName);
|
||||
var results = LoadResult(resultName);
|
||||
|
||||
results.ForEach(x => list.Add(x));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"没有选择指定作业Job,将提取全部结果!",
|
||||
"消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
foreach (var job in Self.CompletedJobs)
|
||||
{
|
||||
LoadJob(list, job.JobName, job.SurfaceName);
|
||||
}
|
||||
MessageBox.Show($"没有指定已完成的分析结果,无法提取结果!",
|
||||
"消息", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadJob(BindingList<ViewFeLog> list, string jobName, string surfaceName)
|
||||
private List<ViewFeLog> LoadResult(string resultName)
|
||||
{
|
||||
var job = Self.GetJob(jobName);
|
||||
var surface = Self.GetSurface(surfaceName);
|
||||
|
||||
// 读取结果文件
|
||||
if (job != null && job.Active && surface != null && surface.Active)
|
||||
{
|
||||
var loadJobs = LoadResult(jobName, surfaceName);
|
||||
|
||||
loadJobs.ForEach(x => list.Add(x));
|
||||
}
|
||||
}
|
||||
|
||||
private List<ViewFeLog> LoadResult(string jobName, string surfaceName)
|
||||
{
|
||||
var job = Self.Jobs[jobName];
|
||||
|
||||
var resultName = job.ResultsFileName; // 分析结果文件名
|
||||
|
||||
if (resultName.IsNullOrEmptyOrWhiteSpace())
|
||||
return null;
|
||||
|
||||
var list = new List<ViewFeLog>();
|
||||
|
||||
// 1. 分析结果文件
|
||||
if(!_self.AllResults.ContainsResult(resultName))
|
||||
if (!_self.AllResults.ContainsResult(resultName))
|
||||
{
|
||||
FeResults results = FrdFileReader.Read(resultName);
|
||||
|
||||
_self.AllResults.Add(resultName, results);
|
||||
}
|
||||
// 2. 读取映射文件
|
||||
string filePath = Path.GetDirectoryName(resultName);
|
||||
string fileName = Path.GetFileNameWithoutExtension(resultName);
|
||||
string fullPath = Path.Combine(filePath, $"{fileName}.st2");
|
||||
|
||||
FeResults fr = _self.AllResults.GetResult(resultName);
|
||||
var lines = File.ReadAllLines(fullPath, System.Text.Encoding.UTF8).ToList();
|
||||
|
||||
// 2. 对应的曲面集
|
||||
FeSurface surface = Self.GetSurface(surfaceName);
|
||||
Dictionary<int, string> stepNames = new Dictionary<int, string>();
|
||||
Dictionary<int, string> surfaceNames = new Dictionary<int, string>();
|
||||
|
||||
var nodeSet = Self.GetNodeSet(surface.NodeSetName); // 该曲面集对应的内部节点集合
|
||||
// 3. 解析每一行数据
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(line)) continue; // 跳过空行
|
||||
|
||||
int[] labels = nodeSet.Labels; // 对应的节点
|
||||
var parts = line.Split(',');
|
||||
|
||||
// 校验列数是否匹配(防止文件格式错误)
|
||||
if (parts.Length != 3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int id = int.Parse(parts[0]);
|
||||
stepNames.Add(id, parts[1]);
|
||||
surfaceNames.Add(id, parts[2]);
|
||||
}
|
||||
|
||||
// 3. 物理场
|
||||
var allFieldData = fr.GetAllFieldData();
|
||||
FeResults fr = _self.AllResults.GetResult(resultName);
|
||||
|
||||
// 3.1 位移场
|
||||
Field disp = fr.GetField(allFieldData[0]);
|
||||
var allStepIds = fr.GetAllStepIds();
|
||||
|
||||
var allValues = disp.GetComponentValues("ALL");
|
||||
var uValues = disp.GetComponentValues("U1");
|
||||
var vValues = disp.GetComponentValues("U2");
|
||||
var wValues = disp.GetComponentValues("U3");
|
||||
|
||||
foreach (var id in labels)
|
||||
foreach (var stepId in allStepIds)
|
||||
{
|
||||
var node = Self.GetNode(id);
|
||||
int index = id - 1;
|
||||
// 3.1 对应的曲面集
|
||||
var stepName = stepNames[stepId];
|
||||
|
||||
list.Add(new ViewFeLog(
|
||||
jobName, // 作业名称
|
||||
id, node.X, node.Y, node.Z, // 节点Id, x, y, z
|
||||
allValues[index], // 位移All, u, v, w
|
||||
uValues[index],
|
||||
vValues[index],
|
||||
wValues[index])
|
||||
);
|
||||
var surfaceName = surfaceNames[stepId];
|
||||
FeSurface surface = Self.GetSurface(surfaceName);
|
||||
|
||||
var nodeSet = Self.GetNodeSet(surface.NodeSetName); // 该曲面集对应的内部节点集合
|
||||
|
||||
int[] labels = nodeSet.Labels; // 对应的节点
|
||||
|
||||
// 3.2 提取出的位移值
|
||||
var dispAll = fr.GetField(fr.GetFieldData("DISP", "ALL", stepId, 1)).GetComponentValues("ALL");
|
||||
var dispU = fr.GetField(fr.GetFieldData("DISP", "U1", stepId, 1)).GetComponentValues("U1");
|
||||
var dispV = fr.GetField(fr.GetFieldData("DISP", "U2", stepId, 1)).GetComponentValues("U2");
|
||||
var dispW = fr.GetField(fr.GetFieldData("DISP", "U3", stepId, 1)).GetComponentValues("U3");
|
||||
|
||||
foreach ( var label in labels)
|
||||
{
|
||||
int index = label - 1;
|
||||
|
||||
var node = Self.GetNode(label);
|
||||
|
||||
double all = dispAll[index];
|
||||
double u = dispU[index];
|
||||
double v = dispV[index];
|
||||
double w = dispW[index];
|
||||
|
||||
list.Add(new ViewFeLog(stepId, stepName, node.Id, node.X, node.Y, node.Z, all, u, v, w));
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -149,18 +164,8 @@ namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
dataGridView1.Columns.Clear();
|
||||
dataGridView1.DataSource = new BindingList<ViewFeLog>();
|
||||
}
|
||||
|
||||
private void toolStripComboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
if (toolStripComboBox1.SelectedIndex >= 0)
|
||||
{
|
||||
toolStripTextBox1.Text = _data[toolStripComboBox1.SelectedItem as string];
|
||||
}
|
||||
else
|
||||
{
|
||||
toolStripTextBox1.Text = null;
|
||||
}
|
||||
toolStripComboBox1.SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
106
CPSO/Forms/92_Knowledge/FrmAnalysisResultEx.Designer.cs
generated
106
CPSO/Forms/92_Knowledge/FrmAnalysisResultEx.Designer.cs
generated
@@ -1,106 +0,0 @@
|
||||
namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
partial class FrmAnalysisResultEx
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAnalysisResultEx));
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
|
||||
this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripLabel1,
|
||||
this.toolStripComboBox1,
|
||||
this.toolStripButton1});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(800, 31);
|
||||
this.toolStrip1.TabIndex = 0;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 428);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(800, 22);
|
||||
this.statusStrip1.TabIndex = 1;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// toolStripLabel1
|
||||
//
|
||||
this.toolStripLabel1.Name = "toolStripLabel1";
|
||||
this.toolStripLabel1.Size = new System.Drawing.Size(84, 28);
|
||||
this.toolStripLabel1.Text = "分析结果:";
|
||||
//
|
||||
// toolStripComboBox1
|
||||
//
|
||||
this.toolStripComboBox1.Name = "toolStripComboBox1";
|
||||
this.toolStripComboBox1.Size = new System.Drawing.Size(121, 31);
|
||||
//
|
||||
// toolStripButton1
|
||||
//
|
||||
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
|
||||
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton1.Name = "toolStripButton1";
|
||||
this.toolStripButton1.Size = new System.Drawing.Size(73, 28);
|
||||
this.toolStripButton1.Text = "全部提取";
|
||||
//
|
||||
// FrmAnalysisResultEx
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
this.Name = "FrmAnalysisResultEx";
|
||||
this.Text = "批量提取分析结果";
|
||||
this.toolStrip1.ResumeLayout(false);
|
||||
this.toolStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
|
||||
private System.Windows.Forms.ToolStripComboBox toolStripComboBox1;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
public partial class FrmAnalysisResultEx : Form
|
||||
{
|
||||
public FrmAnalysisResultEx()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
|
||||
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
|
||||
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
|
||||
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
|
||||
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
|
||||
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
|
||||
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
|
||||
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
|
||||
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
|
||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>151, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -33,7 +33,6 @@
|
||||
this.btnOK = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnClearAll = new System.Windows.Forms.Button();
|
||||
this.btnReorganize = new System.Windows.Forms.Button();
|
||||
this.tsmiFile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiOpen = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiSaveAs = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -108,17 +107,6 @@
|
||||
this.btnClearAll.UseVisualStyleBackColor = true;
|
||||
this.btnClearAll.Click += new System.EventHandler(this.btnClearAll_Click);
|
||||
//
|
||||
// btnReorganize
|
||||
//
|
||||
this.btnReorganize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnReorganize.Location = new System.Drawing.Point(15, 326);
|
||||
this.btnReorganize.Name = "btnReorganize";
|
||||
this.btnReorganize.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnReorganize.TabIndex = 17;
|
||||
this.btnReorganize.Text = "显示/隐藏";
|
||||
this.btnReorganize.UseVisualStyleBackColor = true;
|
||||
this.btnReorganize.Click += new System.EventHandler(this.btnReorganize_Click);
|
||||
//
|
||||
// tsmiFile
|
||||
//
|
||||
this.tsmiFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -127,14 +115,14 @@
|
||||
this.tsmiDividerFile1,
|
||||
this.tsmiClose});
|
||||
this.tsmiFile.Name = "tsmiFile";
|
||||
this.tsmiFile.Size = new System.Drawing.Size(48, 24);
|
||||
this.tsmiFile.Size = new System.Drawing.Size(48, 26);
|
||||
this.tsmiFile.Text = "File";
|
||||
//
|
||||
// tsmiOpen
|
||||
//
|
||||
this.tsmiOpen.Image = global::CPSO.Properties.Resources.Open;
|
||||
this.tsmiOpen.Name = "tsmiOpen";
|
||||
this.tsmiOpen.Size = new System.Drawing.Size(224, 26);
|
||||
this.tsmiOpen.Size = new System.Drawing.Size(148, 26);
|
||||
this.tsmiOpen.Text = "Open";
|
||||
this.tsmiOpen.Click += new System.EventHandler(this.tsmiOpen_Click);
|
||||
//
|
||||
@@ -142,19 +130,19 @@
|
||||
//
|
||||
this.tsmiSaveAs.Image = global::CPSO.Properties.Resources.Save;
|
||||
this.tsmiSaveAs.Name = "tsmiSaveAs";
|
||||
this.tsmiSaveAs.Size = new System.Drawing.Size(224, 26);
|
||||
this.tsmiSaveAs.Size = new System.Drawing.Size(148, 26);
|
||||
this.tsmiSaveAs.Text = "Save As";
|
||||
this.tsmiSaveAs.Click += new System.EventHandler(this.tsmiSaveAs_Click);
|
||||
//
|
||||
// tsmiDividerFile1
|
||||
//
|
||||
this.tsmiDividerFile1.Name = "tsmiDividerFile1";
|
||||
this.tsmiDividerFile1.Size = new System.Drawing.Size(221, 6);
|
||||
this.tsmiDividerFile1.Size = new System.Drawing.Size(145, 6);
|
||||
//
|
||||
// tsmiClose
|
||||
//
|
||||
this.tsmiClose.Name = "tsmiClose";
|
||||
this.tsmiClose.Size = new System.Drawing.Size(224, 26);
|
||||
this.tsmiClose.Size = new System.Drawing.Size(148, 26);
|
||||
this.tsmiClose.Text = "Close";
|
||||
this.tsmiClose.Click += new System.EventHandler(this.tsmiClose_Click);
|
||||
//
|
||||
@@ -165,7 +153,7 @@
|
||||
this.tsmiFile});
|
||||
this.msMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.msMain.Name = "msMain";
|
||||
this.msMain.Size = new System.Drawing.Size(784, 28);
|
||||
this.msMain.Size = new System.Drawing.Size(784, 30);
|
||||
this.msMain.TabIndex = 15;
|
||||
this.msMain.Text = "menuStrip1";
|
||||
//
|
||||
@@ -174,7 +162,6 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(784, 361);
|
||||
this.Controls.Add(this.btnReorganize);
|
||||
this.Controls.Add(this.btnClearAll);
|
||||
this.Controls.Add(this.btnOK);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
@@ -205,7 +192,6 @@
|
||||
private System.Windows.Forms.Button btnOK;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnClearAll;
|
||||
private System.Windows.Forms.Button btnReorganize;
|
||||
private System.Windows.Forms.DataGridView dgvCommands;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiFile;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiOpen;
|
||||
|
||||
@@ -11,18 +11,18 @@ namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
public partial class FrmEditProcessingJobs : Form
|
||||
{
|
||||
// Variables
|
||||
private readonly Controller _controller;
|
||||
private Controller Self { get; }
|
||||
private bool _modified;
|
||||
|
||||
// Constructors
|
||||
public FrmEditProcessingJobs(Controller controller)
|
||||
public FrmEditProcessingJobs(Controller self)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Text = @"分析模型查看";
|
||||
dgvCommands.DataBindingComplete += DataBindingComplete;
|
||||
|
||||
_controller = controller;
|
||||
Self = self;
|
||||
_modified = false;
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@ namespace CPSO.Forms._92_Knowledge
|
||||
dgvCommands.Rows[e.RowIndex].DefaultCellStyle.BackColor = green;
|
||||
}
|
||||
|
||||
private void btnReorganize_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void btnClearAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
dgvCommands.DataSource = null;
|
||||
@@ -63,10 +59,10 @@ namespace CPSO.Forms._92_Knowledge
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
if (_modified && dgvCommands.DataSource is BindingSource source
|
||||
&& source.DataSource is List<ViewToolPosition> list)
|
||||
&& source.DataSource is List<ViewProcessingJob> list)
|
||||
{
|
||||
_controller.ToolPositions.Clear();
|
||||
_controller.ToolPositions.AddRange(list);
|
||||
Self.ProcessingJobs.Clear();
|
||||
Self.ProcessingJobs.AddRange(list);
|
||||
_modified = false;
|
||||
}
|
||||
|
||||
@@ -85,9 +81,9 @@ namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
_viewProcessingJobs.Clear();
|
||||
|
||||
if (_controller.ProcessingJobs.Count > 0)
|
||||
if (Self.ProcessingJobs.Count > 0)
|
||||
{
|
||||
_viewProcessingJobs.AddRange(_controller.ProcessingJobs);
|
||||
_viewProcessingJobs.AddRange(Self.ProcessingJobs);
|
||||
}
|
||||
|
||||
SetBinding();
|
||||
@@ -95,8 +91,11 @@ namespace CPSO.Forms._92_Knowledge
|
||||
|
||||
private void SetBinding()
|
||||
{
|
||||
BindingSource binding = new BindingSource();
|
||||
binding.DataSource = _viewProcessingJobs;
|
||||
BindingSource binding = new BindingSource()
|
||||
{
|
||||
DataSource = _viewProcessingJobs
|
||||
};
|
||||
|
||||
dgvCommands.DataSource = binding;
|
||||
}
|
||||
|
||||
@@ -124,12 +123,62 @@ namespace CPSO.Forms._92_Knowledge
|
||||
|
||||
private void tsmiOpen_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (OpenFileDialog ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "计算任务列表 (*.wdb)|*.wdb|All Files (*.*)|*.*";
|
||||
ofd.FilterIndex = 1;
|
||||
ofd.RestoreDirectory = true;
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
// 1. 从数据读取
|
||||
var list = KnowledgeTools.LoadDatabase(ofd.FileName);
|
||||
|
||||
// 2. 保存到Controller
|
||||
Self.ProcessingJobs.Clear();
|
||||
list.ForEach(x =>
|
||||
{
|
||||
Self.ProcessingJobs.Add(new ViewProcessingJob(x));
|
||||
});
|
||||
|
||||
// 3. 现实到dgv
|
||||
PrepareForm();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionTools.Show(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void tsmiSaveAs_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||
{
|
||||
sfd.Filter = "计算任务列表 (*.wdb)|*.wdb|All Files (*.*)|*.*";
|
||||
sfd.FilterIndex = 1;
|
||||
sfd.RestoreDirectory = true;
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var fullPath = sfd.FileName;
|
||||
|
||||
var jobs = Self.ProcessingJobs.Select(x => x.Base).ToList();
|
||||
|
||||
// 保存到数据库
|
||||
KnowledgeTools.SaveDatabase(fullPath, jobs);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionTools.Show(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@ using CaeKnowledge.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using CaeKnowledge.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
@@ -22,6 +20,8 @@ namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Text = @"切削力查看";
|
||||
|
||||
// dgvCommands.EnableDragAndDropRows();
|
||||
dgvCommands.DataBindingComplete += DataBindingComplete;
|
||||
_controller = controller;
|
||||
|
||||
@@ -3,12 +3,12 @@ using CaeKnowledge;
|
||||
using CaeKnowledge.Data;
|
||||
using CaeKnowledge.View;
|
||||
using CaeMesh;
|
||||
using CaeModel;
|
||||
using Plankton;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CaeModel;
|
||||
|
||||
// ReSharper disable SuggestVarOrType_SimpleTypes
|
||||
// ReSharper disable SuggestVarOrType_BuiltInTypes
|
||||
@@ -25,90 +25,149 @@ namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
InitializeComponent();
|
||||
Self = self;
|
||||
|
||||
Text = @"分析模型定义";
|
||||
gbProperties.Text = @"定义";
|
||||
}
|
||||
|
||||
public void PrepareForm()
|
||||
{
|
||||
if (propertyGrid.SelectedObject is ViewSteps steps)
|
||||
if (propertyGrid.SelectedObject is ViewJobs jobs)
|
||||
{
|
||||
steps.PopulateDropDownList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void FrmAddLoad_Load(object sender, EventArgs e)
|
||||
{
|
||||
var view = new ViewSteps(Self);
|
||||
var jobs = new ViewJobs(Self);
|
||||
|
||||
view.ToolPositionList.Clear();
|
||||
// 初始化下拉菜单
|
||||
jobs.PopulateDropDownList();
|
||||
|
||||
// 初始化刀位文件列表
|
||||
jobs.ToolPositionList.Clear();
|
||||
|
||||
if (Self?.ToolPositions != null)
|
||||
{
|
||||
view.ToolPositionList.AddRange(Self.ToolPositions);
|
||||
jobs.ToolPositionList.AddRange(Self.ToolPositions);
|
||||
}
|
||||
|
||||
propertyGrid.SelectedObject = view;
|
||||
propertyGrid.SelectedObject = jobs;
|
||||
}
|
||||
|
||||
private readonly Dictionary<int, int> _nodeToVertexMapping = new Dictionary<int, int>();
|
||||
private readonly Dictionary<int, int> _vertexToNodeMapping = new Dictionary<int, int>();
|
||||
|
||||
private readonly Dictionary<int, FeFace> _cellToFaceMapping = new Dictionary<int, FeFace>();
|
||||
|
||||
protected override async void OnApply(bool onOkAddNew)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(propertyGrid.SelectedObject is ViewSteps steps)) return;
|
||||
if (!(propertyGrid.SelectedObject is ViewJobs viewSteps)) return;
|
||||
|
||||
_nodeToVertexMapping.Clear();
|
||||
_vertexToNodeMapping.Clear();
|
||||
_cellToFaceMapping.Clear();
|
||||
// 基础计算步
|
||||
Step baseStep = Self.GetStep(viewSteps.Step);
|
||||
// Todo: 检查基础计算步
|
||||
|
||||
Step step = Self.GetStep(steps.Step);
|
||||
if (step == null)
|
||||
throw new CaeException($"无法找到对应的计算步:{steps.Step}");
|
||||
if (baseStep == null)
|
||||
throw new CaeException($"无法找到对应的计算步:{viewSteps.Step}");
|
||||
|
||||
if (!Self.Model.Mesh.Surfaces.TryGetValue(steps.Surface, out var surface))
|
||||
throw new CaeException($"无法找到对应的曲面集:{steps.Surface}");
|
||||
if (!Self.Model.Mesh.Surfaces.TryGetValue(viewSteps.Surface, out var surface))
|
||||
throw new CaeException($"无法找到对应的曲面集:{viewSteps.Surface}");
|
||||
|
||||
Self.Form.SetStateWorking(@"构建切削力分析模型...");
|
||||
|
||||
// 先把所有计算步反激活
|
||||
var stepList = Self.GetAllSteps().ToList();
|
||||
stepList.ForEach(x =>
|
||||
{
|
||||
Self.ActivateDeactivateStep(x.Name, false);
|
||||
});
|
||||
|
||||
List<ProcessingJob> jobs = new List<ProcessingJob>();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// 加载网格
|
||||
var mesh = LoadMesh(surface);
|
||||
|
||||
Self.ToolPositions.ForEach(tp =>
|
||||
foreach (var tp in Self.ToolPositions)
|
||||
{
|
||||
int vertId = GetClosedVertex(mesh, tp.Base);
|
||||
// 1. 计算最接近的顶点
|
||||
int vertId = GetClosedVertex(mesh, tp.Base); // PlanktonMesh中存储的Id
|
||||
|
||||
if (vertId >= 0)
|
||||
if (vertId < 0)
|
||||
{
|
||||
// 1.最接近节点
|
||||
int nodeId = _vertexToNodeMapping[vertId];
|
||||
FeNode node = Self.Model.Mesh.Nodes[nodeId];
|
||||
|
||||
// 2.最近节点周围的面单元
|
||||
List<FeFace> faces = new List<FeFace>();
|
||||
foreach (var f in mesh.Vertices.GetVertexFaces(vertId))
|
||||
{
|
||||
if(_cellToFaceMapping.TryGetValue(f, out var face))
|
||||
faces.Add(face);
|
||||
}
|
||||
|
||||
jobs.Add(new ProcessingJob(step.Name, tp.Base, node, faces.ToArray())
|
||||
{
|
||||
NewStepName = steps.NewStep
|
||||
});
|
||||
continue;
|
||||
}
|
||||
});
|
||||
|
||||
Self.ProcessingJobs.Clear();
|
||||
jobs.ForEach(job =>
|
||||
{
|
||||
Self.ProcessingJobs.Add(new ViewProcessingJob(job));
|
||||
});
|
||||
// 2. 最接近节点
|
||||
int nodeId = _vertexToNodeMapping[vertId]; // 全局网格中的Id
|
||||
FeNode node = Self.Model.Mesh.Nodes[nodeId];
|
||||
|
||||
// 3. 最近节点周围的面单元
|
||||
List<FeFace> faces = new List<FeFace>();
|
||||
foreach (var f in mesh.Vertices.GetVertexFaces(vertId))
|
||||
{
|
||||
if (_cellToFaceMapping.TryGetValue(f, out var face))
|
||||
faces.Add(face);
|
||||
}
|
||||
|
||||
// 4. 复制一份基础计算步并激活
|
||||
var newStep = Self.GetStep(baseStep.Name).DeepClone();
|
||||
|
||||
var stepName = viewSteps.NewStepName;
|
||||
newStep.Name = Self.GetStepNames().GetNextNumberedKey(NamedClass.GetNameWithoutLastValue(stepName));
|
||||
|
||||
Self.AddStep(newStep, false, false);
|
||||
|
||||
// 激活计算步
|
||||
Self.ActivateDeactivateStep(newStep.Name, true);
|
||||
|
||||
// 5. 添加载荷
|
||||
// 5.1 新建用于施加载荷的曲面Surface
|
||||
// 新建User Surface
|
||||
var userSurface = new FeSurface(Self.Model.Mesh.Surfaces.GetNextNumberedKey("UserSurface"))
|
||||
{
|
||||
CreatedFrom = FeSurfaceCreatedFrom.Selection,
|
||||
FaceIds = faces.Select(x => x.Id).ToArray(),
|
||||
// ToDo: 未来修改
|
||||
Internal = false,
|
||||
};
|
||||
|
||||
Self.AddSurface(userSurface);
|
||||
|
||||
// 5.2 定义载荷
|
||||
bool twoD = Self.Model.Properties.ModelSpace.IsTwoD();
|
||||
bool complex = newStep is SteadyStateDynamicsStep;
|
||||
|
||||
var loadName = newStep.Loads.GetNextNumberedKey("Load");
|
||||
|
||||
double area = userSurface.Area;
|
||||
|
||||
if (area <= 0)
|
||||
area = 1.0;
|
||||
|
||||
double fx = -1.0 * tp.MaxFx / area;
|
||||
double fy = -1.0 * tp.MaxFx / area;
|
||||
double fz = -1.0 * tp.MaxFz / area;
|
||||
|
||||
var stLoad = new STLoad(loadName, userSurface.Name, RegionTypeEnum.SurfaceName, fx, fy, fz, twoD, complex, 0);
|
||||
|
||||
// 5.3 添加载荷
|
||||
Self.AddLoad(newStep.Name, stLoad);
|
||||
|
||||
// 5.4 添加到 List<ProcessingJob> jobs
|
||||
jobs.Add(new ProcessingJob(tp.Base)
|
||||
{
|
||||
StepName = newStep.Name,
|
||||
SurfaceName = userSurface.Name,
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Self.ProcessingJobs.Clear();
|
||||
jobs.ForEach(x =>
|
||||
{
|
||||
Self.ProcessingJobs.Add(new ViewProcessingJob(x));
|
||||
});
|
||||
|
||||
Self.Form.SetStateReady(@"构建切削力分析模型...");
|
||||
@@ -152,13 +211,17 @@ namespace CPSO.Forms._92_Knowledge
|
||||
return closedVertexIndex;
|
||||
}
|
||||
|
||||
private readonly Dictionary<int, int> _nodeToVertexMapping = new Dictionary<int, int>();
|
||||
private readonly Dictionary<int, int> _vertexToNodeMapping = new Dictionary<int, int>();
|
||||
private readonly Dictionary<int, FeFace> _cellToFaceMapping = new Dictionary<int, FeFace>();
|
||||
|
||||
private PlanktonMesh LoadMesh(FeSurface surface)
|
||||
{
|
||||
// 计算面列表
|
||||
var faceList = (from faceId in surface.FaceIds
|
||||
let element = Self.Model.Mesh.Elements[faceId / 10]
|
||||
let faceName = (FeFaceName)(faceId % 10 + 1)
|
||||
select new FeFace(element, faceName)).ToList();
|
||||
let element = Self.Model.Mesh.Elements[faceId / 10]
|
||||
let faceName = (FeFaceName)(faceId % 10 + 1)
|
||||
select new FeFace(element, faceName)).ToList();
|
||||
|
||||
// 节点列表
|
||||
var hashSet = new HashSet<int>();
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
using CaeJob;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
public class ViewJob: INotifyPropertyChanged
|
||||
{
|
||||
private AnalysisJob Job { get; }
|
||||
|
||||
public void UpdateProgress()
|
||||
{
|
||||
OnPropertyChanged(nameof(Status));
|
||||
}
|
||||
|
||||
public ViewJob(AnalysisJob job)
|
||||
{
|
||||
Job = job;
|
||||
}
|
||||
|
||||
[DisplayName("Job名称")]
|
||||
public string JobName => Job.Name;
|
||||
|
||||
private string _stepName;
|
||||
[DisplayName("Step名称")]
|
||||
public string StepName { get => _stepName; set => SetField(ref _stepName, value); }
|
||||
|
||||
private string _surfaceName;
|
||||
[DisplayName("Surface名称")]
|
||||
public string SurfaceName { get => _surfaceName; set => SetField(ref _surfaceName, value); }
|
||||
|
||||
[DisplayName("状态")]
|
||||
public JobStatus Status => Job.JobStatus;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
protected bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
||||
field = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
using CaeGlobals;
|
||||
using CaeKnowledge.View;
|
||||
using DynamicTypeDescriptor;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
using System.Linq;
|
||||
|
||||
namespace CPSO.Forms._92_Knowledge
|
||||
{
|
||||
public class ViewSteps
|
||||
{
|
||||
private readonly DynamicCustomTypeDescriptor _dctd;
|
||||
|
||||
private readonly Controller _controller;
|
||||
|
||||
[Category("1数据")]
|
||||
[OrderedDisplayName(0, 3, "计算步Step")]
|
||||
[Description("选择要继承的计算步")]
|
||||
public string Step { get; set; }
|
||||
|
||||
[Category("1数据")]
|
||||
[OrderedDisplayName(1, 3, "曲面集")]
|
||||
[Description("选择要载荷所在的曲面集")]
|
||||
public string Surface { get; set; }
|
||||
|
||||
[Category("1数据")]
|
||||
[OrderedDisplayName(2, 3, "切削力")]
|
||||
[Editor(typeof(MyCollectionEditor), typeof(UITypeEditor))]
|
||||
public List<ViewToolPosition> ToolPositionList { get; set; } = new List<ViewToolPosition>();
|
||||
|
||||
[Category("2分析")]
|
||||
[DisplayName("新计算步名称")]
|
||||
public string NewStep { get; set; } = "new_step";
|
||||
|
||||
public ViewSteps(Controller self)
|
||||
{
|
||||
_controller = self;
|
||||
|
||||
_dctd = ProviderInstaller.Install(this);
|
||||
|
||||
PopulateDropDownList();
|
||||
}
|
||||
|
||||
public void PopulateDropDownList()
|
||||
{
|
||||
// ReSharper disable once JoinDeclarationAndInitializer
|
||||
CustomPropertyDescriptor cpd;
|
||||
|
||||
// Steps
|
||||
cpd = _dctd.GetProperty(nameof(Step));
|
||||
cpd.StatandardValues.Clear();
|
||||
|
||||
_controller.Model.StepCollection.StepsList.ForEach(x =>
|
||||
{
|
||||
cpd.StatandardValues.Add(new StandardValueAttribute(x.Name));
|
||||
});
|
||||
|
||||
// Surface
|
||||
cpd = _dctd.GetProperty(nameof(Surface));
|
||||
cpd.StatandardValues.Clear();
|
||||
|
||||
foreach (var surfaceName in _controller.Model.Mesh.Surfaces.Values
|
||||
.Where(x => !x.Internal)
|
||||
.Select(x => x.Name))
|
||||
{
|
||||
cpd.StatandardValues.Add(new StandardValueAttribute(surfaceName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
54
CPSO/Forms/FrmMain.Designer.cs
generated
54
CPSO/Forms/FrmMain.Designer.cs
generated
@@ -594,7 +594,6 @@ namespace CPSO
|
||||
this.splitContainer2.SuspendLayout();
|
||||
this.toolStripContainer2.BottomToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer2.ContentPanel.SuspendLayout();
|
||||
this.toolStripContainer2.TopToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer2.SuspendLayout();
|
||||
this.toolStripContainer3.SuspendLayout();
|
||||
this.toolStripContainer4.ContentPanel.SuspendLayout();
|
||||
@@ -954,9 +953,9 @@ namespace CPSO
|
||||
this.tsSymbols.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tslSymbols,
|
||||
this.tscbSymbols});
|
||||
this.tsSymbols.Location = new System.Drawing.Point(4, 0);
|
||||
this.tsSymbols.Location = new System.Drawing.Point(768, 0);
|
||||
this.tsSymbols.Name = "tsSymbols";
|
||||
this.tsSymbols.Size = new System.Drawing.Size(197, 28);
|
||||
this.tsSymbols.Size = new System.Drawing.Size(236, 28);
|
||||
this.tsSymbols.TabIndex = 9;
|
||||
//
|
||||
// tslSymbols
|
||||
@@ -995,9 +994,9 @@ namespace CPSO
|
||||
this.tscbComplex,
|
||||
this.tslAngle,
|
||||
this.tstbAngle});
|
||||
this.tsResultDeformation.Location = new System.Drawing.Point(4, 0);
|
||||
this.tsResultDeformation.Location = new System.Drawing.Point(556, 0);
|
||||
this.tsResultDeformation.Name = "tsResultDeformation";
|
||||
this.tsResultDeformation.Size = new System.Drawing.Size(921, 28);
|
||||
this.tsResultDeformation.Size = new System.Drawing.Size(876, 29);
|
||||
this.tsResultDeformation.TabIndex = 8;
|
||||
//
|
||||
// tslResultName
|
||||
@@ -1086,14 +1085,14 @@ namespace CPSO
|
||||
// tslAngle
|
||||
//
|
||||
this.tslAngle.Name = "tslAngle";
|
||||
this.tslAngle.Size = new System.Drawing.Size(52, 25);
|
||||
this.tslAngle.Size = new System.Drawing.Size(52, 20);
|
||||
this.tslAngle.Text = "Angle";
|
||||
//
|
||||
// tstbAngle
|
||||
//
|
||||
this.tstbAngle.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.tstbAngle.Name = "tstbAngle";
|
||||
this.tstbAngle.Size = new System.Drawing.Size(45, 28);
|
||||
this.tstbAngle.Size = new System.Drawing.Size(45, 27);
|
||||
this.tstbAngle.Text = "0 °";
|
||||
this.tstbAngle.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.tstbAngle.UnitConverter = null;
|
||||
@@ -1122,7 +1121,7 @@ namespace CPSO
|
||||
this.tsbLastStepIncrement,
|
||||
this.tsbAnimate,
|
||||
this.toolStripSeparator2});
|
||||
this.tsResults.Location = new System.Drawing.Point(4, 28);
|
||||
this.tsResults.Location = new System.Drawing.Point(4, 0);
|
||||
this.tsResults.Name = "tsResults";
|
||||
this.tsResults.Size = new System.Drawing.Size(552, 28);
|
||||
this.tsResults.TabIndex = 7;
|
||||
@@ -4808,7 +4807,7 @@ namespace CPSO
|
||||
this.panelControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelControl.Name = "panelControl";
|
||||
this.panelControl.Size = new System.Drawing.Size(1159, 693);
|
||||
this.panelControl.Size = new System.Drawing.Size(1159, 747);
|
||||
this.panelControl.TabIndex = 1;
|
||||
//
|
||||
// aeAnnotationTextEditor
|
||||
@@ -4946,13 +4945,13 @@ namespace CPSO
|
||||
// toolStripContainer1.ContentPanel
|
||||
//
|
||||
this.toolStripContainer1.ContentPanel.Controls.Add(this.splitContainer1);
|
||||
this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(1432, 846);
|
||||
this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(1432, 900);
|
||||
this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer1.LeftToolStripPanelVisible = false;
|
||||
this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer1.Name = "toolStripContainer1";
|
||||
this.toolStripContainer1.RightToolStripPanelVisible = false;
|
||||
this.toolStripContainer1.Size = new System.Drawing.Size(1432, 871);
|
||||
this.toolStripContainer1.Size = new System.Drawing.Size(1432, 925);
|
||||
this.toolStripContainer1.TabIndex = 4;
|
||||
this.toolStripContainer1.Text = "toolStripContainer";
|
||||
//
|
||||
@@ -4968,7 +4967,7 @@ namespace CPSO
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||
this.splitContainer1.Panel2MinSize = 250;
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1432, 846);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1432, 900);
|
||||
this.splitContainer1.SplitterDistance = 269;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
@@ -4987,8 +4986,8 @@ namespace CPSO
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.tbOutput);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1159, 846);
|
||||
this.splitContainer2.SplitterDistance = 693;
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1159, 900);
|
||||
this.splitContainer2.SplitterDistance = 747;
|
||||
this.splitContainer2.TabIndex = 2;
|
||||
//
|
||||
// tbOutput
|
||||
@@ -5026,29 +5025,24 @@ namespace CPSO
|
||||
//
|
||||
this.toolStripContainer2.ContentPanel.AutoScroll = true;
|
||||
this.toolStripContainer2.ContentPanel.Controls.Add(this.toolStripContainer1);
|
||||
this.toolStripContainer2.ContentPanel.Size = new System.Drawing.Size(1432, 871);
|
||||
this.toolStripContainer2.ContentPanel.Size = new System.Drawing.Size(1432, 925);
|
||||
this.toolStripContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer2.Name = "toolStripContainer2";
|
||||
this.toolStripContainer2.Size = new System.Drawing.Size(1432, 955);
|
||||
this.toolStripContainer2.Size = new System.Drawing.Size(1432, 953);
|
||||
this.toolStripContainer2.TabIndex = 5;
|
||||
this.toolStripContainer2.Text = "toolStripContainer2";
|
||||
//
|
||||
// toolStripContainer2.TopToolStripPanel
|
||||
//
|
||||
this.toolStripContainer2.TopToolStripPanel.Controls.Add(this.tsSymbols);
|
||||
this.toolStripContainer2.TopToolStripPanel.Controls.Add(this.tsResults);
|
||||
//
|
||||
// toolStripContainer3
|
||||
//
|
||||
//
|
||||
// toolStripContainer3.ContentPanel
|
||||
//
|
||||
this.toolStripContainer3.ContentPanel.Size = new System.Drawing.Size(1432, 983);
|
||||
this.toolStripContainer3.ContentPanel.Size = new System.Drawing.Size(1432, 982);
|
||||
this.toolStripContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer3.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer3.Name = "toolStripContainer3";
|
||||
this.toolStripContainer3.Size = new System.Drawing.Size(1432, 1008);
|
||||
this.toolStripContainer3.Size = new System.Drawing.Size(1432, 1007);
|
||||
this.toolStripContainer3.TabIndex = 6;
|
||||
this.toolStripContainer3.Text = "toolStripContainer3";
|
||||
//
|
||||
@@ -5059,17 +5053,18 @@ namespace CPSO
|
||||
//
|
||||
this.toolStripContainer4.ContentPanel.AutoScroll = true;
|
||||
this.toolStripContainer4.ContentPanel.Controls.Add(this.toolStripContainer2);
|
||||
this.toolStripContainer4.ContentPanel.Size = new System.Drawing.Size(1432, 955);
|
||||
this.toolStripContainer4.ContentPanel.Size = new System.Drawing.Size(1432, 953);
|
||||
this.toolStripContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer4.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer4.Name = "toolStripContainer4";
|
||||
this.toolStripContainer4.Size = new System.Drawing.Size(1432, 983);
|
||||
this.toolStripContainer4.Size = new System.Drawing.Size(1432, 982);
|
||||
this.toolStripContainer4.TabIndex = 7;
|
||||
this.toolStripContainer4.Text = "toolStripContainer4";
|
||||
//
|
||||
// toolStripContainer4.TopToolStripPanel
|
||||
//
|
||||
this.toolStripContainer4.TopToolStripPanel.Controls.Add(this.tsResultDeformation);
|
||||
this.toolStripContainer4.TopToolStripPanel.Controls.Add(this.tsResults);
|
||||
//
|
||||
// toolStripContainer5
|
||||
//
|
||||
@@ -5078,11 +5073,11 @@ namespace CPSO
|
||||
//
|
||||
this.toolStripContainer5.ContentPanel.AutoScroll = true;
|
||||
this.toolStripContainer5.ContentPanel.Controls.Add(this.toolStripContainer4);
|
||||
this.toolStripContainer5.ContentPanel.Size = new System.Drawing.Size(1432, 983);
|
||||
this.toolStripContainer5.ContentPanel.Size = new System.Drawing.Size(1432, 982);
|
||||
this.toolStripContainer5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer5.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer5.Name = "toolStripContainer5";
|
||||
this.toolStripContainer5.Size = new System.Drawing.Size(1432, 1008);
|
||||
this.toolStripContainer5.Size = new System.Drawing.Size(1432, 1007);
|
||||
this.toolStripContainer5.TabIndex = 8;
|
||||
this.toolStripContainer5.Text = "toolStripContainer5";
|
||||
//
|
||||
@@ -5094,7 +5089,7 @@ namespace CPSO
|
||||
this.toolStripContainer6.ContentPanel.AutoScroll = true;
|
||||
this.toolStripContainer6.ContentPanel.Controls.Add(this.toolStripContainer5);
|
||||
this.toolStripContainer6.ContentPanel.Controls.Add(this.toolStripContainer3);
|
||||
this.toolStripContainer6.ContentPanel.Size = new System.Drawing.Size(1432, 1008);
|
||||
this.toolStripContainer6.ContentPanel.Size = new System.Drawing.Size(1432, 1007);
|
||||
this.toolStripContainer6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.toolStripContainer6.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripContainer6.Name = "toolStripContainer6";
|
||||
@@ -5104,6 +5099,7 @@ namespace CPSO
|
||||
//
|
||||
// toolStripContainer6.TopToolStripPanel
|
||||
//
|
||||
this.toolStripContainer6.TopToolStripPanel.Controls.Add(this.tsSymbols);
|
||||
this.toolStripContainer6.TopToolStripPanel.Controls.Add(this.tsFile);
|
||||
this.toolStripContainer6.TopToolStripPanel.Controls.Add(this.tsViews);
|
||||
//
|
||||
@@ -5172,8 +5168,6 @@ namespace CPSO
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
this.toolStripContainer2.BottomToolStripPanel.ResumeLayout(false);
|
||||
this.toolStripContainer2.ContentPanel.ResumeLayout(false);
|
||||
this.toolStripContainer2.TopToolStripPanel.ResumeLayout(false);
|
||||
this.toolStripContainer2.TopToolStripPanel.PerformLayout();
|
||||
this.toolStripContainer2.ResumeLayout(false);
|
||||
this.toolStripContainer2.PerformLayout();
|
||||
this.toolStripContainer3.ResumeLayout(false);
|
||||
|
||||
@@ -593,30 +593,9 @@ namespace CPSO
|
||||
|
||||
tsmiProcessingSim.DropDownItems.Add(tsmiAnalysisViewer);
|
||||
|
||||
// Add by Luke at 2025-11-22
|
||||
tsmiAnalysisEx = new ToolStripMenuItem(@"切削力仿真");
|
||||
|
||||
tsmiAnalysisEx.Click += (sender, argc) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_frmAnalysisEx.Visible)
|
||||
{
|
||||
_frmAnalysisEx.PrepareForm();
|
||||
_frmAnalysisEx.ShowDialog();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionTools.Show(this, ex);
|
||||
}
|
||||
};
|
||||
|
||||
tsmiProcessingSim.DropDownItems.Add(tsmiAnalysisEx);
|
||||
|
||||
// Add by Luke
|
||||
tsmiAnalysisChecker = new ToolStripMenuItem(@"分析结果提取");
|
||||
|
||||
|
||||
tsmiAnalysisChecker.Click += (sender, argc) =>
|
||||
{
|
||||
try
|
||||
@@ -630,7 +609,7 @@ namespace CPSO
|
||||
}
|
||||
};
|
||||
|
||||
tsmiProcessingResult.DropDownItems.Add(tsmiAnalysisChecker);
|
||||
tsmiProcessingSim.DropDownItems.Add(tsmiAnalysisChecker);
|
||||
|
||||
tsmiTest.Text = @"测试";
|
||||
tsmiTest.Click += TsmiTest_Click;
|
||||
@@ -646,9 +625,9 @@ namespace CPSO
|
||||
tsmiDividerTools2.Visible = false;
|
||||
|
||||
// 优化工具栏显示
|
||||
tsResultDeformation.Visible = false;
|
||||
tsResults.Visible = false;
|
||||
tsSymbols.Visible = false;
|
||||
tsResultDeformation.Visible = true;
|
||||
tsResults.Visible = true;
|
||||
tsSymbols.Visible = true;
|
||||
}
|
||||
|
||||
// By Luke 2025-11-22
|
||||
@@ -1028,7 +1007,7 @@ namespace CPSO
|
||||
AddFormToAllForms(_frmEditProcessingJobs);
|
||||
|
||||
_frmAnalysisResult = new FrmAnalysisResult();
|
||||
AddFormToAllForms( _frmAnalysisResult);
|
||||
AddFormToAllForms(_frmAnalysisResult);
|
||||
|
||||
// Deformation toolstrip
|
||||
InitializeDeformationComboBoxes();
|
||||
@@ -7939,28 +7918,73 @@ namespace CPSO
|
||||
{
|
||||
RunAnalysis(jobName, true);
|
||||
}
|
||||
|
||||
// 修改by Luke 2026-3-26
|
||||
private void RunAnalysis(string jobName, bool onlyCheckModel)
|
||||
{
|
||||
// Check validity
|
||||
if (CheckValidity())
|
||||
{
|
||||
// 检查工作目录是否存在
|
||||
string workDirectory = _controller.Settings.GetWorkDirectory();
|
||||
//
|
||||
if (workDirectory == null || !Directory.Exists(workDirectory))
|
||||
{
|
||||
throw new Exception("The work directory of the analysis does not exist.");
|
||||
//
|
||||
}
|
||||
|
||||
// 获取分析任务
|
||||
AnalysisJob job = _controller.GetJob(jobName);
|
||||
if (job.JobStatus != JobStatus.Running)
|
||||
{
|
||||
string inputFileName = _controller.GetCalculiXInpFileName(jobName);
|
||||
|
||||
if (File.Exists(inputFileName))
|
||||
{
|
||||
if (MessageBoxes.ShowWarningQuestionOKCancel("Overwrite existing analysis files?") != DialogResult.OK) return;
|
||||
if (MessageBoxes.ShowWarningQuestionOKCancel("Overwrite existing analysis files?") != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Add by Luke
|
||||
// 将全部活跃Step按照序号保存
|
||||
if (_controller.ProcessingJobs.Count > 0)
|
||||
{
|
||||
var dataLines = new List<string> { };
|
||||
|
||||
int id = 1;
|
||||
_controller.ProcessingJobs.ForEach(x =>
|
||||
{
|
||||
var step = _controller.GetStep(x.StepName);
|
||||
|
||||
var surface = _controller.GetSurface(x.SurfaceName);
|
||||
|
||||
if (step != null && step.Active && surface != null)
|
||||
{
|
||||
var line = $"{id},{step.Name},{surface.Name}";
|
||||
dataLines.Add(line);
|
||||
|
||||
id++;
|
||||
}
|
||||
});
|
||||
|
||||
// 3. 写入文件(UTF-8编码,避免中文/特殊字符乱码
|
||||
string filePath = Path.Combine(job.WorkDirectory, $"{job.Name}.st2");
|
||||
File.WriteAllLines(filePath, dataLines, System.Text.Encoding.UTF8);
|
||||
}
|
||||
// Add by Luke
|
||||
|
||||
// 执行命令
|
||||
if (_controller.PrepareAndRunJobCommand(jobName, onlyCheckModel))
|
||||
{
|
||||
// 打开监控界面
|
||||
MonitorAnalysis(jobName);
|
||||
}
|
||||
//
|
||||
if (_controller.PrepareAndRunJobCommand(jobName, onlyCheckModel)) MonitorAnalysis(jobName);
|
||||
}
|
||||
else MessageBoxes.ShowError("The analysis is already running or is in queue.");
|
||||
else
|
||||
{
|
||||
MessageBoxes.ShowError("The analysis is already running or is in queue.");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void MonitorAnalysis(string jobName)
|
||||
|
||||
@@ -291,9 +291,6 @@
|
||||
<metadata name="timerOutput.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1088, 17</value>
|
||||
</metadata>
|
||||
<metadata name="visualStudio2022LightTheme1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>684, 63</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>110</value>
|
||||
</metadata>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
19003a4e0e82520802967bdb6aadcca3703f27ee4e8b187ae42cd3a6db8beae2
|
||||
3bc573ccf27fb67219e68c2c21aa1b1e3c6d6acc2d2935f1eb7cc6af24b8c2a6
|
||||
|
||||
@@ -508,10 +508,8 @@ D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms.FrmRBFMorphNodeEditor.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmAddCutter.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmAnalysisEx.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmAnalysisResult.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmAnalysisResultEx.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmEditProcessingJobs.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmEditToolPositions.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmStepsManager.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms.FrmCutter.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmCuttingForceCalc.resources
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmProcessingParameter.resources
|
||||
@@ -528,3 +526,4 @@ D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.exe
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.pdb
|
||||
D:\wg_cpso\CPSO\bin\x64\Debug\ToolPathParser.dll
|
||||
D:\wg_cpso\CPSO\bin\x64\Debug\ToolPathParser.pdb
|
||||
D:\wg_cpso\CPSO\obj\x64\Debug\CPSO.Forms._92_Knowledge.FrmStepsManager.resources
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user