mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-26 20:37:42 -05:00
feat(desktop): add Formed after cutting to Drawing Properties
The checkbox starts checked for a drawing with bend lines (brake bends or a rolled part's centerline bend). Unchecking it marks a bent drawing that ships flat; checking it marks a part whose bend lines were lost. A choice the bend lines already make is not stored, so later bend line edits keep deciding.
This commit is contained in:
1 parent
f298aa361d
commit
b3d89ee479
3 files changed
+75
-2
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using System.Windows.Forms;
|
||||
using OpenNest.Bending;
|
||||
using OpenNest.CNC;
|
||||
using OpenNest.Forms;
|
||||
using OpenNest.Geometry;
|
||||
|
||||
namespace OpenNest.WinForms.Tests.Forms;
|
||||
|
||||
public class FormedAfterCuttingFormTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
public void DrawingProperties_BendLinesCheckTheBoxAndUncheckingOverridesThem(bool hasBends) =>
|
||||
StaTestThread.Run(() =>
|
||||
{
|
||||
var drawing = new Drawing("part", new Program());
|
||||
if (hasBends)
|
||||
{
|
||||
drawing.Bends.Add(new Bend
|
||||
{
|
||||
StartPoint = new Vector(0, 5),
|
||||
EndPoint = new Vector(10, 5),
|
||||
});
|
||||
}
|
||||
using var form = new EditDrawingForm();
|
||||
|
||||
form.LoadDrawing(drawing);
|
||||
var box = Assert.IsType<CheckBox>(form.Controls.Find("formedBox", true).Single());
|
||||
Assert.Equal(hasBends, box.Checked);
|
||||
|
||||
form.SaveDrawing(drawing);
|
||||
Assert.Null(drawing.FormedOverride);
|
||||
|
||||
box.Checked = !hasBends;
|
||||
form.SaveDrawing(drawing);
|
||||
Assert.Equal(!hasBends, drawing.FormedOverride);
|
||||
Assert.Equal(!hasBends, drawing.IsFormed);
|
||||
}, TimeSpan.FromSeconds(15), "The STA test did not complete.");
|
||||
}
|
||||
+27
-2
@@ -63,6 +63,8 @@ namespace OpenNest.Forms
|
||||
label4 = new Label();
|
||||
priorityBox = new OpenNest.Controls.NumericUpDown();
|
||||
priorityHint = new Label();
|
||||
formedBox = new CheckBox();
|
||||
formedHint = new Label();
|
||||
cutFirstBox = new CheckBox();
|
||||
cutFirstHint = new Label();
|
||||
allowCommonLineBox = new CheckBox();
|
||||
@@ -299,9 +301,13 @@ namespace OpenNest.Forms
|
||||
drawingFields.Controls.Add(nameBox, 1, 0);
|
||||
drawingFields.Controls.Add(label3, 0, 1);
|
||||
drawingFields.Controls.Add(customerBox, 1, 1);
|
||||
drawingFields.Controls.Add(formedBox, 1, 2);
|
||||
drawingFields.Controls.Add(formedHint, 1, 3);
|
||||
drawingFields.Dock = DockStyle.Fill;
|
||||
drawingFields.Name = "drawingFields";
|
||||
drawingFields.RowCount = 2;
|
||||
drawingFields.RowCount = 4;
|
||||
drawingFields.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||
drawingFields.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||
drawingFields.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||
drawingFields.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||
drawingFields.TabIndex = 0;
|
||||
@@ -334,6 +340,23 @@ namespace OpenNest.Forms
|
||||
customerBox.Name = "customerBox";
|
||||
customerBox.TabIndex = 1;
|
||||
//
|
||||
// formedBox
|
||||
//
|
||||
formedBox.AutoSize = true;
|
||||
formedBox.Margin = new Padding(3, 6, 3, 0);
|
||||
formedBox.Name = "formedBox";
|
||||
formedBox.TabIndex = 2;
|
||||
formedBox.Text = "F&ormed after cutting";
|
||||
formedBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// formedHint
|
||||
//
|
||||
formedHint.AutoSize = true;
|
||||
formedHint.ForeColor = SystemColors.GrayText;
|
||||
formedHint.Margin = new Padding(20, 0, 3, 4);
|
||||
formedHint.Name = "formedHint";
|
||||
formedHint.Text = "Bent or rolled; marked F on the nest report";
|
||||
//
|
||||
// nestingGroup
|
||||
//
|
||||
nestingGroup.AutoSize = true;
|
||||
@@ -512,7 +535,7 @@ namespace OpenNest.Forms
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
CancelButton = cancelButton;
|
||||
ClientSize = new Size(640, 470);
|
||||
ClientSize = new Size(640, 520);
|
||||
Controls.Add(layout);
|
||||
Controls.Add(bottomPanel1);
|
||||
Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
@@ -581,6 +604,8 @@ namespace OpenNest.Forms
|
||||
private Label label4;
|
||||
private Controls.NumericUpDown priorityBox;
|
||||
private Label priorityHint;
|
||||
private CheckBox formedBox;
|
||||
private Label formedHint;
|
||||
private CheckBox cutFirstBox;
|
||||
private Label cutFirstHint;
|
||||
private CheckBox allowCommonLineBox;
|
||||
|
||||
@@ -48,6 +48,12 @@ namespace OpenNest.Forms
|
||||
set { cutFirstBox.Checked = value; }
|
||||
}
|
||||
|
||||
private bool Formed
|
||||
{
|
||||
get { return formedBox.Checked; }
|
||||
set { formedBox.Checked = value; }
|
||||
}
|
||||
|
||||
private bool AllowCommonLine
|
||||
{
|
||||
get { return allowCommonLineBox.Checked; }
|
||||
@@ -158,6 +164,7 @@ namespace OpenNest.Forms
|
||||
Priority = drawing.Priority;
|
||||
CutFirst = drawing.CutFirst;
|
||||
AllowCommonLine = drawing.AllowCommonLine;
|
||||
Formed = drawing.IsFormed;
|
||||
Text = string.IsNullOrEmpty(drawing.Name)
|
||||
? "Drawing Properties"
|
||||
: $"Drawing Properties - {drawing.Name}";
|
||||
@@ -174,6 +181,7 @@ namespace OpenNest.Forms
|
||||
drawing.Priority = Priority;
|
||||
drawing.CutFirst = CutFirst;
|
||||
drawing.AllowCommonLine = AllowCommonLine;
|
||||
drawing.SetFormed(Formed);
|
||||
if (IsAutomaticColorRequested)
|
||||
{
|
||||
if (!drawing.HasCustomColor)
|
||||
|
||||
Reference in new issue
Block a user