Reset prefix if no drawing info is found.
This commit is contained in:
@@ -4,7 +4,7 @@ namespace ExportDXF
|
|||||||
{
|
{
|
||||||
public class DrawingInfo
|
public class DrawingInfo
|
||||||
{
|
{
|
||||||
private static Regex drawingFormatRegex = new Regex(@"(?<jobNo>[34]\d{3}(-\d+\w{1,2})?)\s?(?<dwgNo>[ABEP]\d+(-?(\d+|[A-Z]))?)", RegexOptions.IgnoreCase);
|
private static Regex drawingFormatRegex = new Regex(@"(?<jobNo>[34]\d{3}(-\d+\w{1,2})?)\s?(?<dwgNo>[ABEP]\d+(-?(\d+[A-Z]?))?)", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
public string JobNo { get; set; }
|
public string JobNo { get; set; }
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ namespace ExportDXF
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("{0} {1}", JobNo, DrawingNo);
|
return $"{JobNo} {DrawingNo}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
|
|||||||
@@ -597,16 +597,20 @@ namespace ExportDXF.Forms
|
|||||||
var model = sldWorks.ActiveDoc as ModelDoc2;
|
var model = sldWorks.ActiveDoc as ModelDoc2;
|
||||||
var isDrawing = model is DrawingDoc;
|
var isDrawing = model is DrawingDoc;
|
||||||
|
|
||||||
if (!isDrawing)
|
if (isDrawing)
|
||||||
return;
|
{
|
||||||
|
|
||||||
var drawingInfo = DrawingInfo.Parse(activeDocTitleBox.Text);
|
var drawingInfo = DrawingInfo.Parse(activeDocTitleBox.Text);
|
||||||
|
|
||||||
if (drawingInfo == null)
|
if (drawingInfo == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
prefixTextBox.Text = string.Format("{0} {1} PT", drawingInfo.JobNo, drawingInfo.DrawingNo);
|
prefixTextBox.Text = $"{drawingInfo.JobNo} {drawingInfo.DrawingNo} PT";
|
||||||
prefixTextBox.SelectionStart = prefixTextBox.Text.Length;
|
prefixTextBox.SelectionStart = prefixTextBox.Text.Length;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prefixTextBox.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user