using System;
|
using System.Collections.Generic;
|
using System.Windows.Forms;
|
using HydrEngineCSharp;
|
|
namespace DPumpHydr.WinFrmUI.Volute
|
{
|
public partial class OccDesignCtrl : System.Windows.Forms.UserControl
|
{
|
|
private HydrEngineCSharp.CDisplayView pDisplayView;
|
private int m_nCreateCurve = 0;
|
private int m_nNum = 0;
|
private int m_nSectionNum = 0;
|
private int m_nVoluteNum = 0;
|
public OccDesignCtrl()
|
{
|
InitializeComponent();
|
|
// ´´½¨Ê±µÄ´úÂë
|
pDisplayView = new HydrEngineCSharp.CDisplayView();
|
|
pDisplayView.InitOCCDraw();
|
|
this.MouseDown += OnMouseDown;
|
this.MouseMove += OnMouseMove;
|
this.MouseUp += OnMouseUp;
|
this.MouseWheel += OnMouseWheel;
|
|
IntPtr hwnd = this.Handle;
|
//IntPtr hwnd = splitContainer1.Handle;
|
// ³õʼ»¯¸üдúÂë
|
pDisplayView.InitialUpdateOCC((uint)hwnd, true);
|
|
//string strTurbopumpTopoShapeName = "ÎÏ¿ÇÉè¼Æ" + (m_nNum++).ToString();
|
//bool bSucc = pDisplayView.addTurbopumpTopoShape(strTurbopumpTopoShapeName);
|
//if (bSucc)
|
//{
|
// m_nCreateCurve = 1;
|
// //MessageBox.Show("¿ªÊ¼ÎÏ¿ÇÉè¼Æ");
|
//}
|
|
|
|
}
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
{
|
// »æÖÆ´úÂë
|
pDisplayView.OCCDraw();
|
}
|
|
protected override void OnResize(EventArgs e)
|
{
|
base.OnResize(e);
|
// ³ß´ç¸Ä±äʱµÄ´úÂë
|
if (pDisplayView != null)
|
{
|
pDisplayView.OCCResize();
|
}
|
}
|
|
|
|
|
|
private void OnMouseDown(object sender, MouseEventArgs e)
|
{
|
if (e.Button == MouseButtons.Left)
|
{
|
// Êó±ê×ó¼ü°´ÏµIJÙ×÷
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.LButtonDown(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Middle)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MButtonDown(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Right)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.RButtonDown(nF, pLT_PtInt2D);
|
}
|
}
|
|
private void OnMouseUp(object sender, MouseEventArgs e)
|
{
|
if (e.Button == MouseButtons.Left)
|
{
|
// Êó±ê×ó¼ü°´ÏµIJÙ×÷
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.LButtonUp(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Middle)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MButtonUp(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Right)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.RButtonUp(nF, pLT_PtInt2D);
|
}
|
}
|
// Êó±ê¹öÂֵIJÙ×÷
|
private void OnMouseWheel(object sender, MouseEventArgs e)
|
{
|
// e.Delta ·µ»Ø¹öÂֵĹö¶¯Öµ
|
// Èç¹û e.Delta > 0 Ôò±íʾ¹öÂÖÏòÉÏ
|
// Èç¹û e.Delta < 0 Ôò±íʾ¹öÂÖÏòÏÂ
|
|
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MouseWheel(nF, (short)e.Delta, pLT_PtInt2D);
|
}
|
// Êó±êµÄ²Ù×÷
|
private void OnMouseMove(object sender, MouseEventArgs e)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MouseMove(nF, pLT_PtInt2D);
|
}
|
|
|
public void SetViewDirect(DPumpHydr.Model.eViewDirect vd)
|
{
|
if(vd == Model.eViewDirect.TOP)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.TOPVIEW);
|
|
if (vd == Model.eViewDirect.FRONT)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.FRONTVIEW);
|
|
if (vd == Model.eViewDirect.BACK)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.BACKVIEW);
|
|
if (vd == Model.eViewDirect.INI)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.INITVIEW);
|
|
if (vd == Model.eViewDirect.LEFT)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.LEFTVIEW);
|
|
if (vd == Model.eViewDirect.RIGHT)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.RIGHTVIEW);
|
}
|
|
string strTurbopumpTopoShapeName = "ÎÏ¿ÇÉè¼Æ1" ;
|
public void Initial( )
|
{
|
bool bSucc = pDisplayView.addTurbopumpTopoShape(strTurbopumpTopoShapeName);
|
if (bSucc)
|
{
|
m_nCreateCurve = 1;
|
}
|
}
|
/// <summary>
|
/// ¸üÐÂ1-8¶ËÃæ²ÎÊý
|
/// </summary>
|
public void UpdateSectParas18(List<DPumpHydr.OccModel.SectionParam> listSectionParam)
|
{
|
string wstrName = "¶ÏÃæ";
|
double dStartAngle = -HydrDisplayEngineBridge.PI_4;
|
int nNum = listSectionParam.Count;
|
double dDetAngle = 2 * HydrDisplayEngineBridge.PI / nNum;
|
for (int i = 0; i < nNum; i++)
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = listSectionParam[i];
|
|
double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius;
|
dGama_Left = theSectionParam.Gama_Left;
|
dGama_Right = theSectionParam.Gama_Right;
|
dH = theSectionParam.H;
|
dR_out = theSectionParam.R_out;
|
dR_Left = theSectionParam.m_dR_Left;
|
dR_Right = theSectionParam.R_Right;
|
dBaseWidth = theSectionParam.BaseWidth;
|
dBaseCircleRadius = theSectionParam.BaseCircleRadius;
|
int nIndex = theSectionParam.Index;
|
string wstrShapeNameI = wstrName + nIndex.ToString() + "(" + (m_nSectionNum++).ToString() + ")";
|
|
HydrGeomSection pHydrGeomCurve = new HydrGeomSection();
|
HydrProperties theHydrProperties = new HydrProperties();
|
theHydrProperties.SetShapeName(wstrShapeNameI);
|
pHydrGeomCurve.SetHydrProperties(theHydrProperties);
|
pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius);
|
double dAngle = i * dDetAngle + dStartAngle;
|
BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0);
|
BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0);
|
theMatrix.postMult(theMatrix1);
|
pHydrGeomCurve.SetMatrix(theMatrix);
|
pDisplayView.addVoluteCurve(i, pHydrGeomCurve);
|
}
|
Invalidate(true);
|
pDisplayView.FitAll3DViews(true);
|
m_nCreateCurve = 2;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void OnSectiondesignbutton(object sender, EventArgs e)
|
{
|
if (m_nCreateCurve != 1)
|
{
|
MessageBox.Show("ÇëÏÈ´´½¨ÎÏ¿ÇÉè¼Æ", "Ìáʾ");
|
return;
|
}
|
List<DPumpHydr.OccModel.SectionParam> listSectionParam = new List<DPumpHydr.OccModel.SectionParam>();
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 8;
|
theSectionParam.Gama_Left = 15.0;
|
theSectionParam.Gama_Right = 15.0;
|
theSectionParam.H = 79.9267;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 29.0;
|
theSectionParam.R_Right = 29.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 7;
|
theSectionParam.Gama_Left = 14.0;
|
theSectionParam.Gama_Right = 14.0;
|
theSectionParam.H = 72.5712;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 27.0;
|
theSectionParam.R_Right = 27.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 6;
|
theSectionParam.Gama_Left = 13.0;
|
theSectionParam.Gama_Right = 13.0;
|
theSectionParam.H = 64.6095;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 25.0;
|
theSectionParam.R_Right = 25.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 5;
|
theSectionParam.Gama_Left = 12.0;
|
theSectionParam.Gama_Right = 12.0;
|
theSectionParam.H = 55.9824;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 23.0;
|
theSectionParam.R_Right = 23.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 4;
|
theSectionParam.Gama_Left = 11.0;
|
theSectionParam.Gama_Right = 11.0;
|
theSectionParam.H = 46.6348;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 21.0;
|
theSectionParam.R_Right = 21.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 3;
|
theSectionParam.Gama_Left = 10.0;
|
theSectionParam.Gama_Right = 10.0;
|
theSectionParam.H = 36.5229;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 19.0;
|
theSectionParam.R_Right = 19.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 2;
|
theSectionParam.Gama_Left = 9.0;
|
theSectionParam.Gama_Right = 9.0;
|
theSectionParam.H = 25.6253;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 17.0;
|
theSectionParam.R_Right = 17.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = new DPumpHydr.OccModel.SectionParam();
|
theSectionParam.Index = 1;
|
theSectionParam.Gama_Left = 8.0;
|
theSectionParam.Gama_Right = 8.0;
|
theSectionParam.H = 13.9584;
|
theSectionParam.R_out = 1000;
|
theSectionParam.m_dR_Left = 10.0;
|
theSectionParam.R_Right = 10.0;
|
theSectionParam.BaseWidth = 60;
|
theSectionParam.BaseCircleRadius = 263.5;
|
listSectionParam.Add(theSectionParam);
|
}
|
string wstrName = "¶ÏÃæ";
|
double dStartAngle = -HydrDisplayEngineBridge.PI_4;
|
int nNum = listSectionParam.Count;
|
double dDetAngle = 2 * HydrDisplayEngineBridge.PI / nNum;
|
for (int i = 0; i < nNum; i++)
|
{
|
DPumpHydr.OccModel.SectionParam theSectionParam = listSectionParam[i];
|
|
double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius;
|
dGama_Left = theSectionParam.Gama_Left;
|
dGama_Right = theSectionParam.Gama_Right;
|
dH = theSectionParam.H;
|
dR_out = theSectionParam.R_out;
|
dR_Left = theSectionParam.m_dR_Left;
|
dR_Right = theSectionParam.R_Right;
|
dBaseWidth = theSectionParam.BaseWidth;
|
dBaseCircleRadius = theSectionParam.BaseCircleRadius;
|
int nIndex = theSectionParam.Index;
|
string wstrShapeNameI = wstrName + nIndex.ToString() + "(" + (m_nSectionNum++).ToString() + ")";
|
|
HydrGeomSection pHydrGeomCurve = new HydrGeomSection();
|
HydrProperties theHydrProperties = new HydrProperties();
|
theHydrProperties.SetShapeName(wstrShapeNameI);
|
pHydrGeomCurve.SetHydrProperties(theHydrProperties);
|
pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius);
|
double dAngle = i * dDetAngle + dStartAngle;
|
BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0);
|
BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0);
|
theMatrix.postMult(theMatrix1);
|
pHydrGeomCurve.SetMatrix(theMatrix);
|
pDisplayView.addVoluteCurve(i, pHydrGeomCurve);
|
}
|
Invalidate(true);
|
pDisplayView.FitAll3DViews(true);
|
m_nCreateCurve = 2;
|
|
}
|
|
//
|
private void OnBuildsolidbutton(object sender, EventArgs e)
|
{
|
if (m_nCreateCurve != 2)
|
{
|
MessageBox.Show("ÇëÏÈÍê³É¶ÏÃæÉè¼Æ", "Ìáʾ");
|
return;
|
}
|
//
|
string wstrVoluteName = "±ÃÌå" + (m_nVoluteNum++).ToString();
|
bool bSucc = pDisplayView.buildVoluteShape(wstrVoluteName);
|
if (bSucc)
|
{
|
Invalidate(true);
|
pDisplayView.FitAll3DViews(true);
|
m_nCreateCurve = 3;
|
}
|
}
|
|
|
}
|
}
|