private void button_GenerateTunnel_Click(object sender, EventArgs e) { var radius = textBoxNum_Radius.ValueNumber; var segmentNum = (ushort)textBoxNum_Segments.ValueNumber; if (radius > 0 && segmentNum > 0) { Material mat = _definitions.Materials.FirstOrDefault(); Profile prof = _definitions.Profiles.FirstOrDefault(); _tunnelStructure = Tunnel.Create(radius, segmentNum, defaultMat: mat, defaultProfile: prof); // RefreshUI_TunnelTable(_tunnelStructure); eZDataGridViewTunnel.Refresh(); // TunnelPointorChanged?.Invoke(_tunnelStructure); // } else { MessageBox.Show("请输入正确参数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 将模型中的圆形隧道或者材料、截面定义信息刷新到控件中 /// </summary> /// <param name="tunnel"></param> public void ImportTunnelOrDefinitions(Tunnel tunnel, DefinitionCollection definitions) { if (definitions != null) { _definitions = definitions; } if (tunnel != null) { _tunnelStructure = tunnel; TunnelPointorChanged?.Invoke(_tunnelStructure); // 半径与管片块数 textBoxNum_Radius.Text = tunnel.Radius.ToString(); textBoxNum_Segments.Text = tunnel.SegmentNum.ToString(); // RefreshUI_TunnelTable(tunnel); } }