UpdatePrefix()
This commit is contained in:
@@ -165,18 +165,12 @@ namespace ExportDXF.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int SldWorks_ActiveModelDocChangeNotify()
|
private int SldWorks_ActiveModelDocChangeNotify()
|
||||||
{
|
|
||||||
if (InvokeRequired)
|
|
||||||
{
|
{
|
||||||
Invoke(new MethodInvoker(() =>
|
Invoke(new MethodInvoker(() =>
|
||||||
{
|
{
|
||||||
SetActiveDocName();
|
SetActiveDocName();
|
||||||
|
UpdatePrefix();
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetActiveDocName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -612,5 +606,31 @@ namespace ExportDXF.Forms
|
|||||||
prefixTextBox.Text = string.Empty;
|
prefixTextBox.Text = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdatePrefix()
|
||||||
|
{
|
||||||
|
var model = sldWorks.ActiveDoc as ModelDoc2;
|
||||||
|
|
||||||
|
if (model == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var isDrawing = model is DrawingDoc;
|
||||||
|
var title = model.GetTitle();
|
||||||
|
|
||||||
|
if (isDrawing)
|
||||||
|
{
|
||||||
|
var drawingInfo = DrawingInfo.Parse(title);
|
||||||
|
|
||||||
|
if (drawingInfo == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
prefixTextBox.Text = $"{drawingInfo.JobNo} {drawingInfo.DrawingNo} PT";
|
||||||
|
prefixTextBox.SelectionStart = prefixTextBox.Text.Length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prefixTextBox.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user