Moved HideModelSketches to ViewHelper class.

This commit is contained in:
AJ
2021-03-21 22:19:58 -04:00
parent 016e32c2e3
commit e9a7b51d24
2 changed files with 30 additions and 28 deletions

View File

@@ -1,4 +1,5 @@
using ExportDXF.ItemExtractors; using ExportDXF.ItemExtractors;
using ExportDXF.ViewFlipDeciders;
using OfficeOpenXml; using OfficeOpenXml;
using SolidWorks.Interop.sldworks; using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst; using SolidWorks.Interop.swconst;
@@ -571,34 +572,6 @@ namespace ExportDXF.Forms
return false; return false;
} }
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 string UserSelectFolder() private string UserSelectFolder()
{ {
string path = null; string path = null;

View File

@@ -1,4 +1,5 @@
using SolidWorks.Interop.sldworks; using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -269,5 +270,33 @@ namespace ExportDXF
{ {
return Math.Round(angleInRadians * 180.0 / Math.PI, 8); return Math.Round(angleInRadians * 180.0 / Math.PI, 8);
} }
public static 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;
}
} }
} }