Commit fdc8b6d2 LN

多PCB模式增加角度偏移功能。

1 个父辈 aa5e55a0
...@@ -81,9 +81,9 @@ namespace TSA_V.DeviceLibrary ...@@ -81,9 +81,9 @@ namespace TSA_V.DeviceLibrary
/// <summary> /// <summary>
/// 多pcb模式,每个PCB针对PCB1的偏移坐标。key=pcb索引号,value =偏移坐标 /// 多pcb模式,每个PCB针对PCB1的偏移坐标。key=pcb索引号,value =偏移坐标
/// </summary> /// </summary>
public Dictionary<int, Point> mPCbOffsetMap = new Dictionary<int, Point>(); public Dictionary<int, PcbOffsetInfo> mPCbOffsetMap = new Dictionary<int, PcbOffsetInfo>();
public Point GetPCBOffsetPoint(int pcbIndex) public PcbOffsetInfo GetPCBOffsetPoint(int pcbIndex)
{ {
if (mPCbOffsetMap.ContainsKey(pcbIndex)) if (mPCbOffsetMap.ContainsKey(pcbIndex))
{ {
...@@ -91,11 +91,11 @@ namespace TSA_V.DeviceLibrary ...@@ -91,11 +91,11 @@ namespace TSA_V.DeviceLibrary
} }
else else
{ {
return new Point(0, 0); return new PcbOffsetInfo(0, 0,0);
} }
} }
public void SetPCBOffset(int pcbIndex, Point value) public void SetPCBOffset(int pcbIndex, PcbOffsetInfo value)
{ {
mPCbOffsetMap[pcbIndex] = value; mPCbOffsetMap[pcbIndex] = value;
} }
...@@ -545,4 +545,24 @@ namespace TSA_V.DeviceLibrary ...@@ -545,4 +545,24 @@ namespace TSA_V.DeviceLibrary
/// </summary> /// </summary>
public long uTime; public long uTime;
} }
public class PcbOffsetInfo
{
public PcbOffsetInfo() { }
public PcbOffsetInfo(int x, int y, int a)
{
this.X = x;
this.Y = y;
this.A = a;
}
public int X { get; set; }
public int Y { get; set; }
public int A { get; set; }
}
} }
using System; using System;
using System.CodeDom; using System.CodeDom;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.SqlClient;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -261,7 +262,7 @@ namespace TSA_V.DeviceLibrary ...@@ -261,7 +262,7 @@ namespace TSA_V.DeviceLibrary
} }
/// <summary> /// <summary>
/// 多板拷贝点 /// 多板拷贝点,返回板子区域,每个板子返回四个点。
/// </summary> /// </summary>
/// <param name="board"></param> /// <param name="board"></param>
/// <param name="sMTPoint"></param> /// <param name="sMTPoint"></param>
...@@ -307,6 +308,7 @@ namespace TSA_V.DeviceLibrary ...@@ -307,6 +308,7 @@ namespace TSA_V.DeviceLibrary
// 默认按均匀间距计算 // 默认按均匀间距计算
int dx = (currC - 1) * pcbColValue; int dx = (currC - 1) * pcbColValue;
int dy = (currR - 1) * pcbRowValue; int dy = (currR - 1) * pcbRowValue;
int dA = 0;//默认角度都是0
// 若设置了某个PCB相对PCB1的偏移,则覆盖默认值 // 若设置了某个PCB相对PCB1的偏移,则覆盖默认值
try try
{ {
...@@ -315,20 +317,46 @@ namespace TSA_V.DeviceLibrary ...@@ -315,20 +317,46 @@ namespace TSA_V.DeviceLibrary
var pOffset = board.mPCbOffsetMap[index]; var pOffset = board.mPCbOffsetMap[index];
dx = pOffset.X; dx = pOffset.X;
dy = pOffset.Y; dy = pOffset.Y;
dA = pOffset.A;
} }
} }
catch { } catch { }
//返回四个角的坐标(左上角不偏移,以左上角为基准进行角度旋转)
Point leftPoint1 = new Point(dx, dy);
Point rightPoint2 = new Point(dx + board.boardWidth, dy);
Point leftPoint3 = new Point(dx, dy + board.boardLength);
Point rightPoint4 = new Point(dx + board.boardWidth, dy + board.boardLength);
if (dA > 0 && dA <= 360)
{
//(double, double) newPo1 = RotatePoint(leftPoint1.X, leftPoint1.Y, 0, 0, dA);
//leftPoint1.X = (int)newPo1.Item1;
//leftPoint1.Y = (int)newPo1.Item2;
(double, double) newPo2 = RotatePoint(rightPoint2.X, rightPoint2.Y, leftPoint1.X, leftPoint1.Y, dA);
rightPoint2.X = (int)newPo2.Item1;
rightPoint2.Y = (int)newPo2.Item2;
Point leftPoint = new Point(dx, dy); (double, double) newPo3 = RotatePoint(leftPoint3.X, leftPoint3.Y, leftPoint1.X, leftPoint1.Y, dA);
Point rightPoint = new Point(dx + board.boardWidth, dy + board.boardLength); leftPoint3.X = (int)newPo3.Item1;
leftPoint3.Y = (int)newPo3.Item2;
(double, double) newPo4 = RotatePoint(rightPoint4.X, rightPoint4.Y, leftPoint1.X, leftPoint1.Y, dA);
rightPoint4.X = (int)newPo4.Item1;
rightPoint4.Y = (int)newPo4.Item2;
}
if (checkOKList != null) if (checkOKList != null)
{ {
Point leftNodePoint = XYConvertManager.CalPCBAreaNodePosition(leftPoint, checkOKList, 1); Point leftNodePoint1 = XYConvertManager.CalPCBAreaNodePosition(leftPoint1, checkOKList, 1);
Point rightNodePoint = XYConvertManager.CalPCBAreaNodePosition(rightPoint, checkOKList, 2); Point rightNodePoint2 = XYConvertManager.CalPCBAreaNodePosition(rightPoint2, checkOKList, 2);
Point leftNodePoint3 = XYConvertManager.CalPCBAreaNodePosition(leftPoint3, checkOKList, 3);
Point rightNodePoint4 = XYConvertManager.CalPCBAreaNodePosition(rightPoint4, checkOKList, 4);
result.Add(new List<Point>() { leftNodePoint, rightNodePoint }); result.Add(new List<Point>() { leftNodePoint1, rightNodePoint2, rightNodePoint4, leftNodePoint3 });
} }
} }
} }
...@@ -421,6 +449,7 @@ namespace TSA_V.DeviceLibrary ...@@ -421,6 +449,7 @@ namespace TSA_V.DeviceLibrary
// 默认按均匀间距计算 // 默认按均匀间距计算
int dx = (currC - 1) * pcbColValue; int dx = (currC - 1) * pcbColValue;
int dy = (currR - 1) * pcbRowValue; int dy = (currR - 1) * pcbRowValue;
int dA = 0;
// 若设置了某个PCB相对PCB1的偏移,则覆盖默认值 // 若设置了某个PCB相对PCB1的偏移,则覆盖默认值
try try
{ {
...@@ -429,6 +458,7 @@ namespace TSA_V.DeviceLibrary ...@@ -429,6 +458,7 @@ namespace TSA_V.DeviceLibrary
var pOffset = board.mPCbOffsetMap[index]; var pOffset = board.mPCbOffsetMap[index];
dx = pOffset.X; dx = pOffset.X;
dy = pOffset.Y; dy = pOffset.Y;
dA = pOffset.A;
} }
} }
catch { } catch { }
...@@ -439,6 +469,15 @@ namespace TSA_V.DeviceLibrary ...@@ -439,6 +469,15 @@ namespace TSA_V.DeviceLibrary
newPoint.PointSizeX = point.PointSizeX; newPoint.PointSizeX = point.PointSizeX;
newPoint.CheckOK = false; newPoint.CheckOK = false;
if (dA > 0 && dA <= 360)
{
//以单块电路板的左上角为基准点进行旋转
(double, double) newPo = RotatePoint(newPoint.PositionX, newPoint.PositionY, dx, dy, dA);
newPoint.PositionX = newPo.Item1;
newPoint.PositionY = newPo.Item2;
}
if (checkOKList != null) if (checkOKList != null)
{ {
try { newPoint = XYConvertManager.CalPointNodePosition(newPoint, checkOKList); } catch { } try { newPoint = XYConvertManager.CalPointNodePosition(newPoint, checkOKList); } catch { }
...@@ -459,6 +498,26 @@ namespace TSA_V.DeviceLibrary ...@@ -459,6 +498,26 @@ namespace TSA_V.DeviceLibrary
} }
return pointList; return pointList;
} }
/// <summary>
/// xy绕过X2,Y2旋转angle后的坐标
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="x2">X2,Y2默认是板子左上角。</param>
/// <param name="y2"></param>
/// <param name="angleInDegrees"></param>
/// <returns></returns>
public static (double, double) RotatePoint(double x, double y, double x2, double y2, double angleInDegrees)
{
double angleInRadians = angleInDegrees * (Math.PI / 180.0);
double cosTheta = Math.Cos(angleInRadians);
double sinTheta = Math.Sin(angleInRadians);
double newX = cosTheta * (x - x2) - sinTheta * (y - y2) + x2;
double newY = sinTheta * (x - x2) + cosTheta * (y - y2) + y2;
return (Math.Round(newX, 2), Math.Round(newY, 2));
}
} }
public class ConBaseInfo public class ConBaseInfo
......
...@@ -2837,5 +2837,6 @@ ...@@ -2837,5 +2837,6 @@
<data name = "MPCBTips" xml:space = "preserve"> <value>Click the PCB block below to set its offset relative to PCB1 (Unit: mm). If not set, it will be arranged evenly according to the row/column spacing above.</value> </data> <data name = "MPCBTips" xml:space = "preserve"> <value>Click the PCB block below to set its offset relative to PCB1 (Unit: mm). If not set, it will be arranged evenly according to the row/column spacing above.</value> </data>
<data name = "Pcb1Fixed" xml:space = "preserve"> <value>PCB1 is used as the reference, and its offset is fixed at (0,0)</value> </data> <data name = "Pcb1Fixed" xml:space = "preserve"> <value>PCB1 is used as the reference, and its offset is fixed at (0,0)</value> </data>
<data name = "FrmBoardInfo_chbMPoint_Text" xml:space = "preserve"> <value>Multi-Points Projection </value> </data> <data name = "FrmBoardInfo_chbMPoint_Text" xml:space = "preserve"> <value>Multi-Points Projection </value> </data>
<data name = "FrmPCbOffsetConfig_label1_Text" xml:space = "preserve"> <value> angular offset: </value> </data>
</root> </root>
\ No newline at end of file \ No newline at end of file
...@@ -2815,4 +2815,5 @@ ...@@ -2815,4 +2815,5 @@
<data name = "MPCBTips" xml:space = "preserve"> <value> 点击下方PCB块可设置其相对PCB1的偏移(单位:mm)。未设置则按上方行/列间距均匀排布 </value> </data> <data name = "MPCBTips" xml:space = "preserve"> <value> 点击下方PCB块可设置其相对PCB1的偏移(单位:mm)。未设置则按上方行/列间距均匀排布 </value> </data>
<data name = "Pcb1Fixed" xml:space = "preserve"> <value> PCB1作为基准,偏移固定为(0,0) </value> </data> <data name = "Pcb1Fixed" xml:space = "preserve"> <value> PCB1作为基准,偏移固定为(0,0) </value> </data>
<data name = "FrmBoardInfo_chbMPoint_Text" xml:space = "preserve"> <value> 多点位投影功能 </value> </data> <data name = "FrmBoardInfo_chbMPoint_Text" xml:space = "preserve"> <value> 多点位投影功能 </value> </data>
<data name = "FrmPCbOffsetConfig_label1_Text" xml:space = "preserve"> <value> 角度偏移: </value> </data>
</root> </root>
\ No newline at end of file \ No newline at end of file
...@@ -3059,4 +3059,5 @@ ...@@ -3059,4 +3059,5 @@
<data name = "MPCBTips" xml:space = "preserve"> <value> 点击下方PCB块可设置其相对PCB1的偏移(单位:mm)。未设置则按上方行/列间距均匀排布 </value> </data> <data name = "MPCBTips" xml:space = "preserve"> <value> 点击下方PCB块可设置其相对PCB1的偏移(单位:mm)。未设置则按上方行/列间距均匀排布 </value> </data>
<data name = "Pcb1Fixed" xml:space = "preserve"> <value> PCB1作为基准,偏移固定为(0,0) </value> </data> <data name = "Pcb1Fixed" xml:space = "preserve"> <value> PCB1作为基准,偏移固定为(0,0) </value> </data>
<data name = "FrmBoardInfo_chbMPoint_Text" xml:space = "preserve"> <value> 多点位投影功能 </value> </data> <data name = "FrmBoardInfo_chbMPoint_Text" xml:space = "preserve"> <value> 多点位投影功能 </value> </data>
<data name = "FrmPCbOffsetConfig_label1_Text" xml:space = "preserve"> <value> 角度偏移: </value> </data>
</root> </root>
\ No newline at end of file \ No newline at end of file
...@@ -233,7 +233,7 @@ namespace TSA_V ...@@ -233,7 +233,7 @@ namespace TSA_V
} }
if (angle != 0) if (angle != 0)
{ {
var pointR = RotatePoint(point.PositionX, point.PositionY, 0, 0, angle); var pointR =XYConvertManager.RotatePoint(point.PositionX, point.PositionY, 0, 0, angle);
point.PositionX = pointR.Item1; point.PositionX = pointR.Item1;
point.PositionY = pointR.Item2; point.PositionY = pointR.Item2;
} }
...@@ -333,48 +333,7 @@ namespace TSA_V ...@@ -333,48 +333,7 @@ namespace TSA_V
Close(); Close();
} }
(double, double) RotatePoint(double x, double y,double x2,double y2, double angleInDegrees)
{
double angleInRadians = angleInDegrees * (Math.PI / 180.0);
double cosTheta = Math.Cos(angleInRadians);
double sinTheta = Math.Sin(angleInRadians);
double newX = cosTheta * (x - x2) - sinTheta * (y - y2) + x2;
double newY = sinTheta * (x - x2) + cosTheta * (y - y2) + y2;
return (Math.Round(newX,2), Math.Round(newY,2));
}
//private (double,double) xuanzhuan(double x, double y, int angle)
//{
// int cA = angle;
// if (angle <= 0)
// {
// cA = 360 - angle;
// }
// double orgX = x;
// double orgY = updateBoardInfo.boardLength - y;
// double newX = orgX * Math.Cos(-cA) + orgY * Math.Sin(-cA);
// double newY = (updateBoardInfo.boardLength - orgX * Math.Sin(-cA) + orgY * Math.Cos(-cA));
// LogUtil.info($"X={x},Y={y}, 偏移={angle},结果:X={newX},Y={newY}");
// // 将角度转换为弧度
// //double angleInRadians = angle * Math.PI / 180;
// //// 计算旋转后的新坐标
// ////double newX = x * Math.Cos(angleInRadians) - y * Math.Sin(angleInRadians);
// ////double newY = x * Math.Sin(angleInRadians) + y * Math.Cos(angleInRadians);
// //double newX = x * Math.Cos(angle) - y * Math.Sin(angle);
// //double newY = x * Math.Sin(angle) + y * Math.Cos(angle);
// return (newX,newY);
//}
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
Close(); Close();
......
...@@ -386,6 +386,7 @@ namespace TSA_V ...@@ -386,6 +386,7 @@ namespace TSA_V
int defDy = r0 * rowGap; int defDy = r0 * rowGap;
int currDx = defDx; int currDx = defDx;
int currDy = defDy; int currDy = defDy;
int currDA = 0;
try try
{ {
var p = currBoardInfo.GetPCBOffsetPoint(index); var p = currBoardInfo.GetPCBOffsetPoint(index);
...@@ -393,19 +394,21 @@ namespace TSA_V ...@@ -393,19 +394,21 @@ namespace TSA_V
{ {
currDx = p.X; currDx = p.X;
currDy = p.Y; currDy = p.Y;
currDA = p.A;
} }
} }
catch { } catch { }
using (var dlg = new TSA_V.frmBoard.FrmPCbOffsetConfig(index, currDx, currDy)) using (var dlg = new TSA_V.frmBoard.FrmPCbOffsetConfig(index, currDx, currDy,currDA))
{ {
if (dlg.ShowDialog(this) == DialogResult.OK) if (dlg.ShowDialog(this) == DialogResult.OK)
{ {
int x = dlg.OffsetX; int x = dlg.OffsetX;
int y = dlg.OffsetY; int y = dlg.OffsetY;
currBoardInfo.SetPCBOffset(index, new Point(x, y)); int a = dlg.OffsetA;
currBoardInfo.SetPCBOffset(index, new PcbOffsetInfo(x, y, a));
// 更新标签显示 // 更新标签显示
lbl.Text = $"PCB{index}({x},{y})"; lbl.Text = $"PCB{index}(A={x},Y={y},A={a})";
try try
{ {
if (FrmProjectorScreen.instance != null) if (FrmProjectorScreen.instance != null)
......
...@@ -32,8 +32,11 @@ namespace TSA_V.frmBoard ...@@ -32,8 +32,11 @@ namespace TSA_V.frmBoard
this.numY = new System.Windows.Forms.NumericUpDown(); this.numY = new System.Windows.Forms.NumericUpDown();
this.btnOK = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.numA = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numX)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numY)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numY)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numA)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// labelX // labelX
...@@ -96,7 +99,7 @@ namespace TSA_V.frmBoard ...@@ -96,7 +99,7 @@ namespace TSA_V.frmBoard
// //
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnOK.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.Location = new System.Drawing.Point(55, 110); this.btnOK.Location = new System.Drawing.Point(62, 159);
this.btnOK.Name = "btnOK"; this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(125, 39); this.btnOK.Size = new System.Drawing.Size(125, 39);
this.btnOK.TabIndex = 4; this.btnOK.TabIndex = 4;
...@@ -109,7 +112,7 @@ namespace TSA_V.frmBoard ...@@ -109,7 +112,7 @@ namespace TSA_V.frmBoard
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(186, 110); this.btnCancel.Location = new System.Drawing.Point(193, 159);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(125, 39); this.btnCancel.Size = new System.Drawing.Size(125, 39);
this.btnCancel.TabIndex = 5; this.btnCancel.TabIndex = 5;
...@@ -117,13 +120,43 @@ namespace TSA_V.frmBoard ...@@ -117,13 +120,43 @@ namespace TSA_V.frmBoard
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// //
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(52, 104);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 24);
this.label1.TabIndex = 6;
this.label1.Text = "角度偏移:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// numA
//
this.numA.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.numA.Location = new System.Drawing.Point(158, 104);
this.numA.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.numA.Minimum = new decimal(new int[] {
100000,
0,
0,
-2147483648});
this.numA.Name = "numA";
this.numA.Size = new System.Drawing.Size(160, 23);
this.numA.TabIndex = 7;
//
// FrmPCbOffsetConfig // FrmPCbOffsetConfig
// //
this.AcceptButton = this.btnOK; this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(371, 170); this.ClientSize = new System.Drawing.Size(371, 226);
this.Controls.Add(this.label1);
this.Controls.Add(this.numA);
this.Controls.Add(this.labelX); this.Controls.Add(this.labelX);
this.Controls.Add(this.numX); this.Controls.Add(this.numX);
this.Controls.Add(this.labelY); this.Controls.Add(this.labelY);
...@@ -137,8 +170,12 @@ namespace TSA_V.frmBoard ...@@ -137,8 +170,12 @@ namespace TSA_V.frmBoard
this.Shown += new System.EventHandler(this.FrmPCbOffsetConfig_Shown); this.Shown += new System.EventHandler(this.FrmPCbOffsetConfig_Shown);
((System.ComponentModel.ISupportInitialize)(this.numX)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numX)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numY)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numY)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numA)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
private Label label1;
private NumericUpDown numA;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -7,15 +7,19 @@ namespace TSA_V.frmBoard ...@@ -7,15 +7,19 @@ namespace TSA_V.frmBoard
{ {
public int OffsetX { get; private set; } public int OffsetX { get; private set; }
public int OffsetY { get; private set; } public int OffsetY { get; private set; }
public int OffsetA{get;private set; } //角度
private readonly int pcbIndex; private readonly int pcbIndex;
private readonly int defaultX; private readonly int defaultX;
private readonly int defaultY; private readonly int defaultY;
private readonly int defaultA;
public FrmPCbOffsetConfig(int pcbIndex, int defaultX, int defaultY) public FrmPCbOffsetConfig(int pcbIndex, int defaultX, int defaultY,int defaultA)
{ {
this.pcbIndex = pcbIndex; this.pcbIndex = pcbIndex;
this.defaultX = defaultX; this.defaultX = defaultX;
this.defaultY = defaultY; this.defaultY = defaultY;
this.defaultA=defaultA;
InitializeComponent(); InitializeComponent();
this.Text = ResourceControl.GetString("FrmPCbOffsetConfig_Text", "设置 PCB{0} 相对偏移(mm)", pcbIndex+""); this.Text = ResourceControl.GetString("FrmPCbOffsetConfig_Text", "设置 PCB{0} 相对偏移(mm)", pcbIndex+"");
// 初始化控件默认值 // 初始化控件默认值
...@@ -23,6 +27,8 @@ namespace TSA_V.frmBoard ...@@ -23,6 +27,8 @@ namespace TSA_V.frmBoard
{ {
numX.Value = defaultX; numX.Value = defaultX;
numY.Value = defaultY; numY.Value = defaultY;
numA.Value = defaultA;
} }
catch { } catch { }
} }
...@@ -31,6 +37,7 @@ namespace TSA_V.frmBoard ...@@ -31,6 +37,7 @@ namespace TSA_V.frmBoard
{ {
OffsetX = (int)numX.Value; OffsetX = (int)numX.Value;
OffsetY = (int)numY.Value; OffsetY = (int)numY.Value;
OffsetA = (int)numA.Value;
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();
} }
......
...@@ -1032,3 +1032,4 @@ PcbRowValueInvalid 行间距必须大于0 The line spacing must be greater than ...@@ -1032,3 +1032,4 @@ PcbRowValueInvalid 行间距必须大于0 The line spacing must be greater than
PcbColValueInvalid 列间距必须大于0 The column spacing must be greater than 0. 列间距必须大于0 PcbColValueInvalid 列间距必须大于0 The column spacing must be greater than 0. 列间距必须大于0
PcbRowColInvalid 行列数必须都大于等于1 Both the number of rows and columns must be greater than or equal to 1. 行列数必须都大于等于1 PcbRowColInvalid 行列数必须都大于等于1 Both the number of rows and columns must be greater than or equal to 1. 行列数必须都大于等于1
NoPoints 当前程序没有组装点,无法测试 The current program has no assembly points, so testing cannot be performed. 当前程序没有组装点,无法测试 NoPoints 当前程序没有组装点,无法测试 The current program has no assembly points, so testing cannot be performed. 当前程序没有组装点,无法测试
FrmPCbOffsetConfig_label1_Text 角度偏移: angular offset : 角度偏移:
\ No newline at end of file \ No newline at end of file
...@@ -598,15 +598,20 @@ namespace TSA_V ...@@ -598,15 +598,20 @@ namespace TSA_V
List<List<Point>> mpcbAreas=XYConvertManager.GetCopyArea(board); List<List<Point>> mpcbAreas=XYConvertManager.GetCopyArea(board);
if(mpcbAreas.Count>0) if(mpcbAreas.Count>0)
{ {
foreach(List<Point> area in mpcbAreas) Color boardColor = Color.LightGray;
int line = 1;
foreach (List<Point> area in mpcbAreas)
{ {
if (area.Count == 2) if (area.Count == 2)
{ {
Color boardColor = Color.LightGray;
Point point1 = area[0]; Point point1 = area[0];
Point point2 = area[1]; Point point2 = area[1];
int line = 1;
g.DrawRectangle(new Pen(boardColor, line), new Rectangle(point1.X, point1.Y, (point2.X - point1.X), (point2.Y - point1.Y))); g.DrawRectangle(new Pen(boardColor, line), new Rectangle(point1.X, point1.Y, (point2.X - point1.X), (point2.Y - point1.Y)));
}else if (area.Count == 4)
{
Point[] points =area.ToArray();
g.DrawPolygon(new Pen(boardColor, line), points);
} }
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!