using DevExpress.XtraEditors;
|
using System;
|
using System.Collections.Generic;
|
using System.Windows.Forms;
|
using GCOCC;
|
using System.IO;
|
using System.Text;
|
|
namespace HydrCAD.WinFrmUI.Impeller
|
{
|
public partial class MainViewPage : TabbedMdiXtraForm
|
{
|
GCOCC_Point3d ShroundLine1Start;
|
GCOCC_Point3d ShroundLine1End;
|
GCOCC_Point3d ShroundLine2Control;
|
GCOCC_Point3d ShroundLine2End;
|
GCOCC_Point3d ShroundLine3End;
|
GCOCC_Point3d OutletLineEnd;
|
GCOCC_Point3d InletLineStart;
|
GCOCC_Point3d HubLine1End;
|
GCOCC_Point3d HubLine2Control;
|
GCOCC_Point3d HubLine2End;
|
|
GCOCC.LineData ShroundLine1;
|
GCOCC.LineData ShroundLine2;
|
GCOCC.LineData ShroundLine3;
|
|
GCOCC.LineData OutletLine;
|
GCOCC.LineData InletLine;
|
|
GCOCC.LineData HubLine1;
|
GCOCC.LineData HubLine2;
|
GCOCC.LineData HubLine3;
|
|
List<GCOCC.LineData> lines = new List<GCOCC.LineData>();
|
|
|
|
|
|
//GCDemo data;
|
private void InitOcctDemo()
|
{
|
//data = new GCDemo();
|
ShroundLine1Start = new GCOCC_Point3d(0, 50, 0);
|
ShroundLine1End = new GCOCC_Point3d(6.43625613, 50, 0);
|
ShroundLine2Control = new GCOCC_Point3d(15.43528266, 53.2753778, 0);
|
ShroundLine2End = new GCOCC_Point3d(20.22356467, 61.56892551, 0);
|
ShroundLine3End = new GCOCC_Point3d(27, 100, 0);
|
OutletLineEnd = new GCOCC_Point3d(45, 100, 0);
|
InletLineStart = new GCOCC_Point3d(0, 15, 0);
|
HubLine1End = new GCOCC_Point3d(12.57235685, 15, 0);
|
HubLine2Control = new GCOCC_Point3d(37.96045984, 25.90758985, 0);
|
HubLine2End = new GCOCC_Point3d(47.52439057, 51.83175847, 0);
|
|
ShroundLine1 = new GCOCC.LineData(LineType.Straight, new GCOCC_Point3d[] { ShroundLine1Start, ShroundLine1End });
|
ShroundLine2 = new GCOCC.LineData(LineType.Arc, new GCOCC_Point3d[] { ShroundLine1End, ShroundLine2Control, ShroundLine2End });
|
ShroundLine3 = new GCOCC.LineData(LineType.Straight, new GCOCC_Point3d[] { ShroundLine2End, ShroundLine3End });
|
|
OutletLine = new GCOCC.LineData(LineType.Straight, new GCOCC_Point3d[] { ShroundLine3End, OutletLineEnd });
|
InletLine = new GCOCC.LineData(LineType.Straight, new GCOCC_Point3d[] { InletLineStart, ShroundLine1Start });
|
|
HubLine1 = new GCOCC.LineData(LineType.Straight, new GCOCC_Point3d[] { InletLineStart, HubLine1End });
|
HubLine2 = new GCOCC.LineData(LineType.Arc, new GCOCC_Point3d[] { HubLine1End, HubLine2Control, HubLine2End });
|
HubLine3 = new GCOCC.LineData(LineType.Straight, new GCOCC_Point3d[] { HubLine2End, OutletLineEnd });
|
|
|
//Read(System.IO.Path.Combine(@"D:\WorkData\Pump3D\DPumpHdrV1.0\out", "GridPints.txt"));
|
|
|
_occViewer2d = new HydrCAD.WinFrmUI.Viewer.OccBaseViewer();
|
_occViewer2d.Dock = DockStyle.Fill;
|
_occViewer2d.Name = "OCCViewer2d1";
|
this.Controls.Add(_occViewer2d);
|
}
|
|
/// <summary>
|
/// 轴面投影图
|
/// </summary>
|
public void CreateAxialProjectionDiagram()
|
{
|
lines.Add(ShroundLine1);
|
lines.Add(ShroundLine2);
|
lines.Add(ShroundLine3);
|
lines.Add(OutletLine);
|
lines.Add(InletLine);
|
lines.Add(HubLine1);
|
lines.Add(HubLine2);
|
lines.Add(HubLine3);
|
_occViewer2d.View.Draw2dLines(lines.ToArray(), 1);
|
}
|
List<GCOCC.LineData> _passLines = null;
|
/// <summary>
|
/// 过流断面
|
/// </summary>
|
public void CreatCrossSection()
|
{
|
int flow_num = 10;
|
|
_passLines = new List<GCOCC.LineData>();
|
List<GCOCC.LineData> shroundLines = new List<GCOCC.LineData> { ShroundLine1, ShroundLine2, ShroundLine3 };
|
List<GCOCC.LineData> hubLines = new List<GCOCC.LineData> { HubLine1, HubLine2, HubLine3 };
|
var circles = GCOCC_MathMethord.GetMidArcBetweenTwoGroupLinesTest(shroundLines.ToArray(), hubLines.ToArray(), flow_num);
|
List<GCOCC.GCOCC_Point2d> starts = new List<GCOCC_Point2d>();
|
List<GCOCC.GCOCC_Point2d> mids = new List<GCOCC_Point2d>();
|
List<GCOCC.GCOCC_Point2d> ends = new List<GCOCC_Point2d>();
|
//var circles = GCOCC_MathMethord.GetMidArcBetweenTwoGroupLines(shroundLines.ToArray(), hubLines.ToArray(), Convert.ToInt32(Numbers.Text));
|
foreach (var c in circles)
|
{
|
GCOCC_Point3d start = new GCOCC_Point3d(c._start.X, c._start.Y, 0);
|
GCOCC_Point3d end = new GCOCC_Point3d(c._end.X, c._end.Y, 0);
|
GCOCC_Point3d mid = new GCOCC_Point3d(c._mid.X, c._mid.Y, 0);
|
starts.Add(new GCOCC_Point2d(c._start.X, c._start.Y));
|
mids.Add(new GCOCC_Point2d(c._mid.X, c._mid.Y));
|
ends.Add(new GCOCC_Point2d(c._end.X, c._end.Y));
|
var isLine = GCOCC_MathMethord.CheckIf3PointsOnALine(start, end, mid);
|
GCOCC.LineData l = null;
|
if (isLine)
|
{
|
l = new GCOCC.LineData(LineType.Straight, new GCOCC_Point3d[] { start, end });
|
}
|
else
|
{
|
l = new GCOCC.LineData(LineType.Arc, new GCOCC_Point3d[] { start, mid, end });
|
}
|
_passLines.Add(l);
|
}
|
//View.DrawPoints(starts,"Ps");
|
//View.DrawPoints(mids,"Pc");
|
//View.DrawPoints(ends,"Ph");
|
//View.DrawLines(_passLines, 1);
|
_occViewer2d.View.Draw2dLines(_passLines.ToArray(), 1);
|
}
|
List<GCOCC.LineData> _midFlowCurve = new List<GCOCC.LineData>();
|
/// <summary>
|
/// 中间流线
|
/// </summary>
|
public void CreateMiddleFlowCurve()
|
{
|
if (_passLines == null || _passLines.Count < 3)
|
return;
|
|
var pts = GCOCC.GCOCC_MathMethord.GetMidPointsFromPassLines(_passLines.ToArray());
|
ShroundLine3End = new GCOCC_Point3d(27, 100, 0);
|
OutletLineEnd = new GCOCC_Point3d(45, 100, 0);
|
pts.Add(new GCOCC_Point2d((ShroundLine3End.X + OutletLineEnd.X) / 2, (ShroundLine3End.Y + OutletLineEnd.Y) / 2));
|
List<GCOCC_Point3d> pt3ds = new List<GCOCC_Point3d>();
|
foreach (var item in pts)
|
{
|
GCOCC_Point3d p3d = item.ConvertToPoint3d();
|
pt3ds.Add(p3d);
|
}
|
var midLine = new GCOCC.LineData(LineType.BSpline, pt3ds.ToArray());
|
_midFlowCurve.Add(midLine);
|
//View.DrawPoints(pts);
|
_occViewer2d.View.Draw2dLines(_midFlowCurve.ToArray(), 1);
|
}
|
|
List<DividedPointData> shroundPoints = new List<DividedPointData>();
|
List<DividedPointData> midPoints = new List<DividedPointData>();
|
List<DividedPointData> hubPoints = new List<DividedPointData>();
|
/// <summary>
|
/// 流线分点
|
/// </summary>
|
public void CreateStreamlineDividingPoint()
|
{
|
if (_midFlowCurve == null || _midFlowCurve.Count == 0)
|
return;
|
double Angles = 2.5;
|
List<GCOCC.LineData> shroundLines = new List<GCOCC.LineData> { ShroundLine1, ShroundLine2, ShroundLine3 };
|
shroundPoints = GCOCC_MathMethord.GetPointsFromStreamLine(shroundLines.ToArray(), Angles);
|
shroundPoints.Insert(0, new DividedPointData(new GCOCC_Point2d(ShroundLine3End.X, ShroundLine3End.Y), 0, 0, true, 0, 0));
|
List<GCOCC_Point2d> pts = new List<GCOCC_Point2d>();
|
shroundPoints.ForEach(x => pts.Add(x.Point));
|
_occViewer2d.View.Draw2dPointsWithIndex(pts.ToArray(), null);
|
|
List<GCOCC.LineData> hubLines = new List<GCOCC.LineData> { HubLine1, HubLine2, HubLine3 };
|
hubPoints = GCOCC_MathMethord.GetPointsFromStreamLine(hubLines.ToArray(), Angles);
|
hubPoints.Insert(0, new DividedPointData(new GCOCC_Point2d(OutletLineEnd.X, OutletLineEnd.Y), 0, 0, true, 0, 0));
|
List<GCOCC_Point2d> pts2 = new List<GCOCC_Point2d>();
|
hubPoints.ForEach(x => pts2.Add(x.Point));
|
_occViewer2d.View.Draw2dPointsWithIndex(pts2.ToArray(), null);
|
|
midPoints = GCOCC_MathMethord.GetPointsFromStreamLine(_midFlowCurve.ToArray(), Angles);
|
midPoints.Insert(0, new DividedPointData(new GCOCC_Point2d(OutletLineEnd.X, OutletLineEnd.Y), 0, 0, true, 0, 0));
|
List<GCOCC_Point2d> pts3 = new List<GCOCC_Point2d>();
|
midPoints.ForEach(x => pts3.Add(x.Point));
|
|
_occViewer2d.View.Draw2dPointsWithIndex(pts3.ToArray(), null);
|
}
|
|
List<HydrCAD.Model.GridPoint> shroundGridPoints = new List<HydrCAD.Model.GridPoint>();//方格网前盖板流线点集合, 分点坐标 和旋转角度
|
List<HydrCAD.Model.GridPoint> hubGridPoints = new List<HydrCAD.Model.GridPoint>();//后盖板
|
List<HydrCAD.Model.GridPoint> midGridPoints = new List<HydrCAD.Model.GridPoint>();//中间流线
|
List<PointRotateData> shroundRotateDatas = new List<PointRotateData>();//前盖板流线 轴面图坐标 和旋转角度
|
List<PointRotateData> hubRotateDatas = new List<PointRotateData>();//后盖板
|
List<PointRotateData> midRotateDatas = new List<PointRotateData>();//中间流线
|
/// <summary>
|
/// 映射方格网
|
/// </summary>
|
public void CreateMappingGrid()
|
{
|
if (shroundGridPoints == null || shroundGridPoints.Count == 0)
|
return;
|
|
List<GCOCC.LineData> shroundLines = new List<GCOCC.LineData> { ShroundLine1, ShroundLine2, ShroundLine3 };
|
List<double> shroundGridY = new List<double>();
|
shroundGridPoints.ForEach(x => shroundGridY.Add(x.Y));
|
var shroundMapPoints = GCOCC_MathMethord.MapGridPointsToStreamLinePoints(shroundLines.ToArray(), shroundPoints, shroundGridY);
|
for (int i = 0; i < shroundMapPoints.Count; i++)
|
{
|
GCOCC_Point3d pt = new GCOCC_Point3d()
|
{
|
X = shroundMapPoints[i].X,
|
Y = shroundMapPoints[i].Y,
|
Z = 0
|
};
|
PointRotateData data = new PointRotateData(pt, 2.5 * i);
|
shroundRotateDatas.Add(data);
|
}
|
|
List<GCOCC.LineData> hubLines = new List<GCOCC.LineData> { HubLine1, HubLine2, HubLine3 };
|
List<double> hubGridY = new List<double>();
|
hubGridPoints.ForEach(x => hubGridY.Add(x.Y));
|
var hubMapPoints = GCOCC_MathMethord.MapGridPointsToStreamLinePoints(hubLines.ToArray(), hubPoints, hubGridY);
|
for (int i = 0; i < hubMapPoints.Count; i++)
|
{
|
GCOCC_Point3d pt = new GCOCC_Point3d()
|
{
|
X = hubMapPoints[i].X,
|
Y = hubMapPoints[i].Y,
|
Z = 0
|
};
|
PointRotateData data = new PointRotateData(pt, 2.5 * i);
|
hubRotateDatas.Add(data);
|
}
|
|
List<double> midGridY = new List<double>();
|
midGridPoints.ForEach(x => midGridY.Add(x.Y));
|
var midMapPoints = GCOCC_MathMethord.MapGridPointsToStreamLinePoints(_midFlowCurve.ToArray(), midPoints, midGridY);
|
for (int i = 0; i < midMapPoints.Count; i++)
|
{
|
GCOCC_Point3d pt = new GCOCC_Point3d()
|
{
|
X = midMapPoints[i].X,
|
Y = midMapPoints[i].Y,
|
Z = 0
|
};
|
PointRotateData data = new PointRotateData(pt, 2.5 * i);
|
midRotateDatas.Add(data);
|
}
|
}
|
|
|
List<GCOCC_Point3d> shroundRotatedPoints;
|
List<GCOCC_Point3d> hubRotatedPoints;
|
List<GCOCC_Point3d> midRotatedPoints;
|
/// <summary>
|
/// 叶片设计面造型
|
/// </summary>
|
public void CreateWorkSheet()
|
{
|
if (shroundRotateDatas == null || shroundRotateDatas.Count == 0)
|
return;
|
|
shroundRotatedPoints = GCOCC_MathMethord.RotatePoint(shroundRotateDatas);
|
_occViewer2d.View.Draw3dPoints(shroundRotatedPoints.ToArray());
|
|
hubRotatedPoints = GCOCC_MathMethord.RotatePoint(hubRotateDatas);
|
_occViewer2d.View.Draw3dPoints(hubRotatedPoints.ToArray());
|
|
midRotatedPoints = GCOCC_MathMethord.RotatePoint(midRotateDatas);
|
_occViewer2d.View.Draw3dPoints(midRotatedPoints.ToArray());
|
|
GCOCC.LineData sline = new GCOCC.LineData(LineType.BSpline, shroundRotatedPoints.ToArray());
|
GCOCC.LineData hline = new GCOCC.LineData(LineType.BSpline, hubRotatedPoints.ToArray());
|
GCOCC.LineData mline = new GCOCC.LineData(LineType.BSpline, midRotatedPoints.ToArray());
|
|
//_occViewer2d.View.MakeSurfaceAcrossSplines2(new List<GCOCC.LineData>() { sline, mline, hline }.ToArray());
|
}
|
|
|
|
|
|
}
|
}
|