You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
5.2 KiB
C#
164 lines
5.2 KiB
C#
using Rs.Framework;
|
|
using Rs.MotionPlat.Commom;
|
|
using Rs.MotionPlat.Flow.SafePosFlow;
|
|
using Rs.MotionPlat.Flow.SubFlow;
|
|
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 static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
|
|
|
namespace Rs.MotionPlat.SysConfig
|
|
{
|
|
public partial class FixtureConfig : BaseForm
|
|
{
|
|
public FixtureConfig()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Nozzle2Fixture_Click(object sender, EventArgs e)
|
|
{
|
|
TargetPosition targetPosition = new TargetPosition();
|
|
Button btn = (Button)sender;
|
|
if (int.TryParse(btn.Tag.ToString(), out int fixtureIndex))
|
|
{
|
|
if (int.TryParse(btn.Text, out int nozzleIndex))
|
|
{
|
|
targetPosition = NozzleManager.GetNozzleToFixturePos(fixtureIndex, nozzleIndex);
|
|
EButtonType btnType = Msgbox.ShowDialog(EButtonType.Ok | EButtonType.Cancel, $"Are you sure to move loadx:{targetPosition.X},loady1:{targetPosition.Y1},loady2:{targetPosition.Y2}");
|
|
GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void ReadOut()
|
|
{
|
|
foreach (Control ctol in groupBox15.Controls)
|
|
{
|
|
if (ctol.Tag == null || ctol.Tag.ToString() != "nocheck")
|
|
{
|
|
string ioname = string.Format(ctol.Tag.ToString(), ctol.Text);
|
|
if (Ops.IsOutOn(ioname))
|
|
{
|
|
ctol.BackColor = Color.Lime;
|
|
}
|
|
else
|
|
{
|
|
ctol.BackColor = Color.FromArgb(56, 56, 56);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void txtSysParam_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
UpdateSysParam((TextBox)sender);
|
|
}
|
|
}
|
|
|
|
private void Teach_Click(object sender, EventArgs e)
|
|
{
|
|
PositionHelper.Teach(this, sender);
|
|
}
|
|
|
|
private void FixtureConfig_Load(object sender, EventArgs e)
|
|
{
|
|
CheckPermission();
|
|
PositionHelper.BindPosition(groupBox1,"int");
|
|
PositionHelper.BindPosition(groupBox23);
|
|
PositionHelper.BindPosition(groupBox24);
|
|
PositionHelper.BindPosition(groupBox25);
|
|
PositionHelper.BindPosition(groupBox26);
|
|
PositionHelper.BindPosition(groupBox27);
|
|
PositionHelper.BindPosition(groupBox28);
|
|
timer1.Enabled = true;
|
|
}
|
|
|
|
private void Move_Click(object sender, EventArgs e)
|
|
{
|
|
PositionHelper.Move2This(this, sender, "", GlobalVar.WholeSpeed);
|
|
}
|
|
|
|
protected void btnIoOut_Click(object sender, EventArgs e)
|
|
{
|
|
Button btn = (Button)sender;
|
|
if (btn.Tag == null || btn.Tag.ToString() != "nocheck")
|
|
{
|
|
if (btn.BackColor == Color.Lime)
|
|
{
|
|
Ops.Off(string.Format(btn.Tag.ToString(), btn.Text));
|
|
}
|
|
else
|
|
{
|
|
Ops.On(string.Format(btn.Tag.ToString(), btn.Text));
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button25_Click(object sender, EventArgs e)
|
|
{
|
|
for(int i=1;i<=6;i++)
|
|
{
|
|
Ops.On($"治具夹{i}");
|
|
}
|
|
}
|
|
|
|
private void button26_Click(object sender, EventArgs e)
|
|
{
|
|
for (int i = 1; i <= 6; i++)
|
|
{
|
|
Ops.Off($"治具夹{i}");
|
|
}
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
ReadOut();
|
|
}
|
|
|
|
|
|
protected void btnTake_Click(object sender, EventArgs e)
|
|
{
|
|
int nozzleIndex = 1;
|
|
if (rbtnNozzle1.Checked)
|
|
nozzleIndex = 1;
|
|
if (rbtnNozzle2.Checked)
|
|
nozzleIndex = 2;
|
|
if (rbtnNozzle3.Checked)
|
|
nozzleIndex =3;
|
|
if (rbtnNozzle4.Checked)
|
|
nozzleIndex = 4;
|
|
Task.Run(() => {
|
|
FixtureTakeFlow.Instance.Take(int.Parse(((Button)sender).Tag.ToString()), nozzleIndex,true);
|
|
DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
|
|
});
|
|
}
|
|
|
|
protected void btnPlace_Click(object sender, EventArgs e)
|
|
{
|
|
int nozzleIndex = 1;
|
|
if (rbtnNozzle1.Checked)
|
|
nozzleIndex = 1;
|
|
if (rbtnNozzle2.Checked)
|
|
nozzleIndex = 2;
|
|
if (rbtnNozzle3.Checked)
|
|
nozzleIndex = 3;
|
|
if (rbtnNozzle4.Checked)
|
|
nozzleIndex = 4;
|
|
Task.Run(() => {
|
|
FixturePlaceFlow.Instance.Place(int.Parse(((Button)sender).Tag.ToString()), nozzleIndex,true);
|
|
DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
|
|
});
|
|
}
|
|
}
|
|
}
|