setfocus(string name) { PaletteSet p = _ps; for (int i = 0; i < p.Count; i++) { if (p[i].Name == name) { p.Activate(i); break; } } }
public static void ShowPalette(string setName, string paletteName, System.Drawing.Size size, UIElement wpfUI) { GetPaletteSet(setName, size); if (!IsPalette(paletteName)) { ElementHost host = new ElementHost() { AutoSize = true, Dock = System.Windows.Forms.DockStyle.Fill, Child = wpfUI }; Palette palette = _ps.Add(paletteName, host); } var index = GetPaletteIndex(paletteName); _ps.Activate(index); _ps.Visible = true; _ps.Size = size; }
public void showAttrsEditor() { if (attrPaletteSet == null) { attrPaletteSet = new PaletteSet("属性面板", new System.Guid("D61D0875-A507-4b73-8B5F-9221FF392200")); baseAttrEditor = new BaseAttrEditor(); attrPaletteSet.AddVisual("基础属性", baseAttrEditor); buildingAttrEditor = new BuildingAttrEditor(); attrPaletteSet.AddVisual("楼房属性", buildingAttrEditor); heatProducerAttrEditor = new HeatProducerAttrEditor(); attrPaletteSet.AddVisual("热源属性", heatProducerAttrEditor); substationAttrEditor = new SubstationAttrEditor(); attrPaletteSet.AddVisual("热力站属性", substationAttrEditor); attrPaletteSet.SetSize(new System.Drawing.Size(120, 350)); solutionAttrPanel = new SolutionAttrPanel(); attrPaletteSet.AddVisual("方案属性", solutionAttrPanel); solutionAttrComparePanel = new SolutionAttrComparePanel(); attrPaletteSet.AddVisual("方案对比", solutionAttrComparePanel); } attrPaletteSet.Visible = true; attrPaletteSet.Activate(0); attrPaletteSet.PaletteActivated += new PaletteActivatedEventHandler(paletteActive); }
public void showPalettes(bool vis, int index = 0) { bool autoSize = false; try { if (_ps == null) { try { _ps = new PaletteSet("TEI Engineering Tools", new Guid("{C30FE6B0-7A39-40DD-97E1-E31697DD26A3}")); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " Grading_Palette.cs: line: 75"); } _ps.DockEnabled = (DockSides)DockingBehavior.Never; _ps.Dock = (DockSides)DockStyle.None; _ps.WindowState = Window.State.Minimized; ElementHost host; host = new ElementHost(); host.AutoSize = autoSize; host.Dock = DockStyle.None; host.Child = pGradeFloor; _ps.Add("Grade Finish Floor", host); host = new ElementHost(); host.AutoSize = autoSize; host.Dock = DockStyle.None; host.Child = pGradeSlope; _ps.Add("Grade Slope", host); host = new ElementHost(); host.AutoSize = autoSize; host.Dock = DockStyle.None; host.Child = pGradePlane; _ps.Add("Grade Tilted Plane", host); host = new ElementHost(); host.AutoSize = autoSize; host.Dock = DockStyle.None; host.Child = pGrading; _ps.Add("Site Grading Tools", host); host = new ElementHost(); host.AutoSize = autoSize; host.Dock = DockStyle.None; host.Child = pUpdateCNTL; _ps.Add("Update CNTL", host); _ps.PaletteActivated += _ps_PaletteActivated; } _ps.InitializeFloatingPosition(new System.Windows.Rect(new System.Windows.Point(200, 200), new System.Windows.Size(400, 400))); _ps.FloatControl(new System.Windows.Point(200, 200)); _ps.KeepFocus = true; _ps.Visible = vis; _ps.Activate(index); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " Grading_Palette.cs: line: 128"); } }
public void ProgramGenerate() { ProgramLine.Reset(); ProgramList.Clear(); if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { AddGCommand(98); AddMCommand(97, 2, 1); AddGCommand(17, "XYCZ"); AddGCommand(28, "XYCZ"); AddMCommand(97, 6, ObjectList[0].ToolNo); } else { AddCommand("G54G17G90G642"); AddCommand("G0G90G153D0Z0"); AddCommand("T18"); AddCommand("M6"); AddCommand("D6"); AddCommand("TRAORI"); AddCommand("G54"); } VertexType vertex = VertexType.Start; //int ind = 0; int z = 0; double[] angle = new double[2]; int[] type = { 2, 3 }; foreach (ProcessObject obj in ObjectList) { if (obj.ToolpathCurve == null) { Application.ShowAlertDialog("Не указана сторона обработки объекта " + obj.ToString()); continue; } Point3d[] point = { obj.ToolpathCurve.StartPoint, obj.ToolpathCurve.EndPoint }; //int rest = (int)Math.Ceiling((double)obj.DepthAll / obj.Depth) % 2; bool hasRest = (int)Math.Ceiling((double)obj.DepthAll / obj.Depth) % 2 == 1; switch (obj.ObjectType) { case ObjectType.Line: //ind = (obj.ToolpathLine.Angle > 0 && obj.ToolpathLine.Angle <= Math.PI) ? 1 - rest : rest; var processObjectLine = obj as ProcessObjectLine; vertex = (processObjectLine.AngleRound > 0 && processObjectLine.AngleRound <= Math.PI) ^ hasRest ? VertexType.End : VertexType.Start; angle[0] = angle[1] = processObjectLine.ToolpathAngle; z = 0; break; case ObjectType.Arc: //ind = (obj.ToolpathArc.StartAngle >= Math.PI * 0.5 && obj.ToolpathArc.StartAngle < Math.PI * 1.5) ? 1 - rest : rest; bool isLeftArc = obj.ToolpathArc.StartAngle >= Math.PI * 0.5 && obj.ToolpathArc.StartAngle < Math.PI * 1.5; vertex = isLeftArc ^ hasRest ? VertexType.End : VertexType.Start; if (isLeftArc) { angle[VertexType.Start.Index()] = (Math.PI * 1.5 - obj.ToolpathArc.StartAngle) * 180 / Math.PI; angle[VertexType.End.Index()] = (Math.PI * 1.5 - obj.ToolpathArc.EndAngle) * 180 / Math.PI; } else { angle[VertexType.Start.Index()] = ((Math.PI * 2.5 - obj.ToolpathArc.StartAngle) % (2 * Math.PI)) * 180 / Math.PI; angle[VertexType.End.Index()] = ((Math.PI * 2.5 - obj.ToolpathArc.EndAngle) % (2 * Math.PI)) * 180 / Math.PI; } z = -obj.Depth; break; } if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { // ProgramList.Add(new ProgramLine(0, 0, "XYC", 0, point[vertex.Index()].X, point[vertex.Index()].Y, angle[vertex.Index()])); AddSetToolCommand("XYC", point[vertex.Index()].X, point[vertex.Index()].Y, angle[vertex.Index()], obj.ToString()); // ProgramList.Add(new ProgramLine(0, 0, "XYZ", 0, point[vertex.Index()].X, point[vertex.Index()].Y, 20)); AddSetToolCommand("XYZ", point[vertex.Index()].X, point[vertex.Index()].Y, ProcessOptions.ZSafety, obj.ToString()); } else { AddCommand("G0" + ToGCode("X", point[vertex.Index()].X) + ToGCode("Y", point[vertex.Index()].Y) + CToGCode(angle[vertex.Index()]) + " B-90"); AddCommand("G0" + ZToGCode(20)); } if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { if (obj == ObjectList.First()) { AddMCommand(97, 7); AddMCommand(97, 8); AddMCommand(97, 3, obj.Frequency); } // ProgramList.Add(new ProgramLine(28, 0, "XYCZ")); AddGCommand(28, "XYCZ"); } else { if (obj == ObjectList.First()) { AddCommand("M3" + "S" + ProcessOptions.Frequency.ToString()); AddCommand("M8"); AddCommand("M7"); } } do { z += obj.Depth; if (z > obj.DepthAll) { z = obj.DepthAll; } // ProgramList.Add(new ProgramLine(1, 0, "XYCZ", obj.SmallSpeed, point[vertex.Index()].X, point[vertex.Index()].Y, angle[vertex.Index()], -z)); if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { AddProcessCommand(1, obj.SmallSpeed, point[vertex.Index()].X, point[vertex.Index()].Y, angle[vertex.Index()], -z, obj.ToString()); } else { AddCommand("G1" + ToGCode("X", point[vertex.Index()].X) + ToGCode("Y", point[vertex.Index()].Y) + ZToGCode(-z) + CToGCode(angle[vertex.Index()]) + ToGCode("F", obj.SmallSpeed)); } double xOld = point[vertex.Index()].X; double yOld = point[vertex.Index()].Y; vertex = vertex.Opposite(); switch (obj.ObjectType) { case ObjectType.Line: // ProgramList.Add(new ProgramLine(1, 0, "XYCZ", obj.GreatSpeed, point[vertex.Index()].X, point[vertex.Index()].Y, angle[vertex.Index()], -z)); if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { AddProcessCommand(1, obj.GreatSpeed, point[vertex.Index()].X, point[vertex.Index()].Y, angle[vertex.Index()], -z, obj.ToString()); } else { AddCommand("G1" + ToGCode("X", point[vertex.Index()].X) + ToGCode("Y", point[vertex.Index()].Y) + ZToGCode(-z) + CToGCode(angle[vertex.Index()]) + ToGCode("F", obj.GreatSpeed)); } ; break; case ObjectType.Arc: // ProgramList.Add(new ProgramLine(type[vertex.Index()], 0, "XYCZ", obj.GreatSpeed, point[vertex.Index()].X, point[vertex.Index()].Y, obj.ToolpathArc.Center.X, obj.ToolpathArc.Center.Y)); if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { AddProcessCommand(type[vertex.Index()], obj.GreatSpeed, point[vertex.Index()].X, point[vertex.Index()].Y, obj.ToolpathArc.Center.X, obj.ToolpathArc.Center.Y, obj.ToString()); } else { AddCommand("G" + type[vertex.Index()].ToString() + ToGCode("X", point[vertex.Index()].X) + ToGCode("Y", point[vertex.Index()].Y) + ToGCode("I", obj.ToolpathArc.Center.X - xOld) + ToGCode("J", obj.ToolpathArc.Center.Y - yOld) + CToGCode(angle[vertex.Index()]) + ToGCode("F", obj.GreatSpeed)); } ; break; } }while (z < obj.DepthAll); // ProgramList.Add(new ProgramLine(0, 0, "XYZ", 0, point[vertex.Index()].X, point[vertex.Index()].Y, 20)); if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { AddSetToolCommand("XYZ", point[vertex.Index()].X, point[vertex.Index()].Y, ProcessOptions.ZSafety, obj.ToString()); } else { AddCommand("G0" + ToGCode("X", point[vertex.Index()].X) + ToGCode("Y", point[vertex.Index()].Y) + ZToGCode(20)); } } if (ProcessOptions.Machine == ProcessOptions.TTypeMachine.Denver) { AddMCommand(97, 9); AddMCommand(97, 10); AddMCommand(97, 5); AddMCommand(97, 30); } else { AddCommand("M5"); AddCommand("M9"); AddCommand("TRAFOOF"); AddCommand("G0G90G153D0Z0"); AddCommand("M30"); } ProgramForm.RefreshGrid(); PaletteSet.Activate(2); }
public void PaletteSetShow() { PaletteSet.Visible = true; PaletteSet.Activate(0); }
public void ProgramGenerateRavelli() { ProgramLine.Reset(); ProgramList.Clear(); AddCommand("%300"); AddCommand("RTCP=1"); AddCommand("G600 X0 Y-2500 Z-370 U3800 V0 W0 N0"); AddCommand("G601"); AddCommand("G0 G53 Z0.0"); AddCommand("G64"); AddCommand("G154O10"); AddCommand("T1"); AddCommand("M6"); AddCommand("G172 T1 H1 D1"); AddCommand("M300"); foreach (ProcessObject obj in ObjectList) { var line = obj as ProcessObjectLine; var arc = obj as ProcessObjectArc; //var angle = obj.TopEdge ^ obj.Side == SideType.Right ? (2 * Math.PI - line.ProcessLine.Angle) % (2 * Math.PI) : (3 * Math.PI - line.ProcessLine.Angle) % (2 * Math.PI); var point0 = obj.ProcessActions.First().Toolpath.StartPoint; //var r = obj.Diameter / 2; //var da = ProcessOptions.AxisDist + ProcessOptions.VertAxisDist; //var dz = da * Math.Sin(obj.VerticalAngle) - r * (1 - Math.Cos(obj.VerticalAngle)); //var dr = da * (1 - Math.Cos(obj.VerticalAngle)) + r * Math.Sin(obj.VerticalAngle); //var dc = ProcessOptions.VertAxisDist - dr; //var angle = !obj.TopEdge ^ obj.Side == SideType.Right ? (2 * Math.PI - line.ProcessLine.Angle) % (2 * Math.PI) : (3 * Math.PI - line.ProcessLine.Angle) % (2 * Math.PI); //var dx = dc * Math.Sin(angle); //var dy = - dc * (1 - Math.Cos(angle)); //AddCommand("' dx=" + Math.Round(dx, 2) + "; dy=" + Math.Round(dy, 2) + "; dz=" + Math.Round(dz, 2) + "; dc=" + Math.Round(dc, 2)); var angle = line != null ? line.ToolpathAngle : obj.ProcessActions.First().Angle; AddCommand("G0" + ToGCode("X", point0.X) + ToGCode("Y", point0.Y)); AddCommand("G0" + ToGCode("Z", point0.Z)); // ZToGCode(point0.Z)); AddCommand("G1" + ToGCode("C", angle) + " F2000"); AddCommand("G1" + ToGCode("A", obj.VerticalAngleDeg) + " F2000"); if (obj == ObjectList.First()) { AddCommand("M3" + "S" + ProcessOptions.Frequency.ToString()); AddCommand("M7"); } foreach (var action in obj.ProcessActions) { if (action.Toolpath is Line) { AddCommand("G1" + ToGCode("X", action.Point.X) + ToGCode("Y", action.Point.Y) + ToGCode("Z", action.Point.Z) // ZToGCode(action.Point.Z) + ((obj is ProcessObjectArc) ? ToGCode("C", action.Angle) : "") + ToGCode("F", (action.Command == "Рез" || action.Command == "Подъем" || action.Command == "Отвод") ? obj.GreatSpeed : obj.SmallSpeed), action.Toolpath, action.Command); } else { AddCommand("G" + (action.IsClockwise ? 2 : 3) + ToGCode("X", action.Point.X) + ToGCode("Y", action.Point.Y) + ToGCode("I", ((Arc)action.Toolpath).Center.X) + ToGCode("J", ((Arc)action.Toolpath).Center.Y) + ToGCode("C", action.Angle) + ToGCode("F", obj.GreatSpeed), action.Toolpath, action.Command); } } } AddCommand("M5"); AddCommand("M9"); AddCommand("G61"); AddCommand("G153"); AddCommand("G0 G53 Z0"); AddCommand(";END OF PROGRAM"); AddCommand("SETMSP=1"); AddCommand("G0 G53 Z0"); AddCommand("G0 G53 A0 C0"); AddCommand("G0 G53 X0 Y0"); AddCommand("M30"); ProgramForm.RefreshGrid(); PaletteSet.Activate(2); }