Hide all model sketches before saving to dxf.
This commit is contained in:
4
ExportDXF/Forms/MainForm.Designer.cs
generated
4
ExportDXF/Forms/MainForm.Designer.cs
generated
@@ -122,8 +122,7 @@
|
|||||||
//
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(618, 391);
|
this.ClientSize = new System.Drawing.Size(618, 391);
|
||||||
this.Controls.Add(this.comboBox1);
|
this.Controls.Add(this.comboBox1);
|
||||||
this.Controls.Add(this.label3);
|
this.Controls.Add(this.label3);
|
||||||
@@ -137,6 +136,7 @@
|
|||||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.Name = "MainForm";
|
this.Name = "MainForm";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "ExportDXF";
|
this.Text = "ExportDXF";
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|||||||
@@ -319,7 +319,10 @@ namespace ExportDXF.Forms
|
|||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
if (worker.CancellationPending)
|
if (worker.CancellationPending)
|
||||||
break;
|
{
|
||||||
|
Print("Canceled by user.\n", Color.Red);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var fileName = GetFileName(item);
|
var fileName = GetFileName(item);
|
||||||
var savepath = Path.Combine(savePath, fileName + ".dxf");
|
var savepath = Path.Combine(savePath, fileName + ".dxf");
|
||||||
@@ -434,6 +437,17 @@ namespace ExportDXF.Forms
|
|||||||
|
|
||||||
var drawingModel = templateDrawing as ModelDoc2;
|
var drawingModel = templateDrawing as ModelDoc2;
|
||||||
drawingModel.ViewZoomtofit2();
|
drawingModel.ViewZoomtofit2();
|
||||||
|
|
||||||
|
if (HideModelSketches(view))
|
||||||
|
{
|
||||||
|
// delete the current view that has sketches shown
|
||||||
|
drawingModel.SelectByName(0, view.Name);
|
||||||
|
drawingModel.DeleteSelection(false);
|
||||||
|
|
||||||
|
// recreate the flat pattern view
|
||||||
|
view = templateDrawing.CreateFlatPatternViewFromModelView3(partModel.GetPathName(), partConfiguration, 0, 0, 0, false, false);
|
||||||
|
view.ShowSheetMetalBendNotes = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (ShouldFlipView(view))
|
if (ShouldFlipView(view))
|
||||||
{
|
{
|
||||||
@@ -458,6 +472,34 @@ namespace ExportDXF.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HideModelSketches(IView view)
|
||||||
|
{
|
||||||
|
var model = view.ReferencedDocument;
|
||||||
|
var activeConfig = ((Configuration)model.GetActiveConfiguration()).Name;
|
||||||
|
|
||||||
|
var modelChanged = false;
|
||||||
|
var refConfig = view.ReferencedConfiguration;
|
||||||
|
model.ShowConfiguration(refConfig);
|
||||||
|
|
||||||
|
var sketches = model.GetAllFeaturesByTypeName("ProfileFeature");
|
||||||
|
|
||||||
|
foreach (var sketch in sketches)
|
||||||
|
{
|
||||||
|
var visible = (swVisibilityState_e)sketch.Visible;
|
||||||
|
|
||||||
|
if (visible == swVisibilityState_e.swVisibilityStateShown)
|
||||||
|
{
|
||||||
|
sketch.Select2(true, -1);
|
||||||
|
model.BlankSketch();
|
||||||
|
modelChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model.ShowConfiguration(activeConfig);
|
||||||
|
|
||||||
|
return modelChanged;
|
||||||
|
}
|
||||||
|
|
||||||
private void CreateBOMExcelFile(string filepath, IList<Item> items)
|
private void CreateBOMExcelFile(string filepath, IList<Item> items)
|
||||||
{
|
{
|
||||||
var templatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "BomTemplate.xlsx");
|
var templatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Templates", "BomTemplate.xlsx");
|
||||||
|
|||||||
Reference in New Issue
Block a user