public EditMoveXyForm(Pattern pattern, MoveXyCmdLine moveXyCmdLine) : base(pattern.GetOriginPos()) { InitializeComponent(); this.pattern = pattern; this.origin = pattern.GetOriginPos(); if (moveXyCmdLine == null) { isCreating = true; this.moveXyCmdLine = new MoveXyCmdLine(0, 0); this.moveXyCmdLine.Position.X = Properties.Settings.Default.MoveX; this.moveXyCmdLine.Position.Y = Properties.Settings.Default.MoveY; } else { isCreating = false; this.moveXyCmdLine = moveXyCmdLine; } PointD p = this.pattern.MachineRel(this.moveXyCmdLine.Position); this.tbX.Text = p.X.ToString("0.000"); this.tbY.Text = p.Y.ToString("0.000"); if (this.moveXyCmdLine != null) { this.moveXyCmdLineBackUp = (MoveXyCmdLine)this.moveXyCmdLine.Clone(); } this.ReadLanguageResources(); }
public MoveXyCmd(RunnableModule runnableModule, MoveXyCmdLine moveXyCmdLine) : base(runnableModule, moveXyCmdLine) { //offset = new PointD(moveXyCmdLine.Offset.X, moveXyCmdLine.Offset.Y); var structure = runnableModule.CommandsModule.program.ModuleStructure; position = structure.ToMachine(runnableModule, moveXyCmdLine.Position); this.ToSafeZ = moveXyCmdLine.ToSafeZ; }
public EditMoveXyMetro(MoveXyCmdLine moveXyCmdLine) { InitializeComponent(); //this.ReadLanguageResources(); if (moveXyCmdLine == null) { isCreating = true; this.moveXyCmdLine = new MoveXyCmdLine(0, 0); } else { isCreating = false; this.moveXyCmdLine = moveXyCmdLine; } tbX.Text = this.moveXyCmdLine.Position.X.ToString("0.000"); tbY.Text = this.moveXyCmdLine.Position.Y.ToString("0.000"); if (this.moveXyCmdLine != null) { this.moveXyCmdLineBackUp = (MoveXyCmdLine)this.moveXyCmdLine.Clone(); } }
/// <summary> /// 创建pattern /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCreate_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.txtPatternName.Text.Trim())) { if (String.IsNullOrEmpty(this.currPath)) { return; } this.patternName = Path.GetFileName(currPath); } else { this.patternName = this.txtPatternName.Text.Trim(); } if (!this.isCalculated) { MessageBox.Show("请先计算pattern原点"); return; } if (FluidProgram.Current == null) { MessageBox.Show("当前程序为空,请先加载或新建程序"); this.btnOK.Enabled = false; return; } else if (FluidProgram.Current != null) { if (this.currPInfo == null) { return; } if (this.currPInfo.Trajectory.PointsModified.Count <= 0) { return; } //double x=this.patternNewOrg.X - FluidProgram.Current.Workpiece.GetOriginPos().ToSystem().X; //double y= this.patternNewOrg.Y - FluidProgram.Current.Workpiece.GetOriginPos().ToSystem().Y; PointD org = (this.patternNewOrg - FluidProgram.Current.Workpiece.GetOriginPos()).ToPoint().ToSystem(); pattern = new Pattern(FluidProgram.Current, this.patternName, org.X, org.Y); pattern.CmdLineList.Clear(); List <CmdLine> cmdLineList = new List <CmdLine>(); if (this.currPInfo.Trajectory.MarkPt1 == null || this.currPInfo.Trajectory.MarkPt2 == null) { //MessageBox.Show("mark1 and mark2 are null,please set mark1 and mark2"); MessageBox.Show("mark1点和mark2点没有设置,请设置mark1点和mark2点"); return; } if (this.currPInfo.Trajectory.MarkPt1 != null) { CADImportV1._0.Infrastructure.PointD pd1 = this.currPInfo.Trajectory.MarkPt1.Mid; MarkCmdLine mark = new MarkCmdLine(new PointD(pd1.X, pd1.Y)); mark.TrackNumber = this.currPInfo.Trajectory.MarkPt1.Desig; cmdLineList.Add(mark); } if (this.currPInfo.Trajectory.MarkPt2 != null) { CADImportV1._0.Infrastructure.PointD pd2 = this.currPInfo.Trajectory.MarkPt2.Mid; MarkCmdLine mark = new MarkCmdLine(new PointD(pd2.X, pd2.Y)); mark.TrackNumber = this.currPInfo.Trajectory.MarkPt2.Desig; cmdLineList.Add(mark); } foreach (TrajPoint p in this.currPInfo.Trajectory.PointsModified) { if (p.Desig.Contains("(Blank)")) { MoveXyCmdLine moveXyCmdLine = new MoveXyCmdLine(p.Mid.X, p.Mid.Y, false); moveXyCmdLine.TrackNumber = p.Desig; cmdLineList.Add(moveXyCmdLine); } else { DotCmdLine dotCmdLine = new DotCmdLine(); dotCmdLine.Position.X = p.Mid.X; dotCmdLine.Position.Y = p.Mid.Y; dotCmdLine.NumShots = p.NumShots; dotCmdLine.TrackNumber = p.Desig; dotCmdLine.Rotation = p.Rotation.ToString("0.00"); dotCmdLine.Comp = p.Comp; if (!p.IsWeight) { dotCmdLine.IsAssign = true; } dotCmdLine.DotStyle = DotStyle.TYPE_1; if (p.Weight <= 0) { dotCmdLine.IsWeightControl = false; } else { dotCmdLine.IsWeightControl = p.IsWeight; } dotCmdLine.Weight = p.Weight; cmdLineList.Add(dotCmdLine); } } cmdLineList.Add(new EndCmdLine()); pattern.InsertCmdLineRange(0, cmdLineList); //进行校正 PatternCorrector.Instance.correctPatternRecursive(pattern, this.patternOldOrg, this.patternNewOrg, this.coordinateTransformer); MsgCenter.Broadcast(Constants.MSG_ADD_PATTERN, this, pattern); } }