User selection of viewFlipDecider
This commit is contained in:
24
ExportDXF/AskViewFlipDecider.cs
Normal file
24
ExportDXF/AskViewFlipDecider.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ExportDXF
|
||||||
|
{
|
||||||
|
public class AskViewFlipDecider : IViewFlipDecider
|
||||||
|
{
|
||||||
|
public string Name => "Ask to flip";
|
||||||
|
|
||||||
|
public bool ShouldFlip(SolidWorks.Interop.sldworks.View view)
|
||||||
|
{
|
||||||
|
var bends = ViewHelper.GetBends(view);
|
||||||
|
|
||||||
|
if (bends.Count == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return MessageBox.Show("Flip view?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,6 +88,7 @@
|
|||||||
<Compile Include="BendOrientation.cs" />
|
<Compile Include="BendOrientation.cs" />
|
||||||
<Compile Include="Bounds.cs" />
|
<Compile Include="Bounds.cs" />
|
||||||
<Compile Include="DrawingInfo.cs" />
|
<Compile Include="DrawingInfo.cs" />
|
||||||
|
<Compile Include="AskViewFlipDecider.cs" />
|
||||||
<Compile Include="Item.cs" />
|
<Compile Include="Item.cs" />
|
||||||
<Compile Include="IViewFlipDecider.cs" />
|
<Compile Include="IViewFlipDecider.cs" />
|
||||||
<Compile Include="ViewFlipDecider.cs" />
|
<Compile Include="ViewFlipDecider.cs" />
|
||||||
|
|||||||
50
ExportDXF/Forms/MainForm.Designer.cs
generated
50
ExportDXF/Forms/MainForm.Designer.cs
generated
@@ -34,17 +34,19 @@
|
|||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.prefixTextBox = new System.Windows.Forms.TextBox();
|
this.prefixTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// textBox1
|
// activeDocTitleBox
|
||||||
//
|
//
|
||||||
this.activeDocTitleBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.activeDocTitleBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.activeDocTitleBox.BackColor = System.Drawing.Color.White;
|
this.activeDocTitleBox.BackColor = System.Drawing.Color.White;
|
||||||
this.activeDocTitleBox.Location = new System.Drawing.Point(130, 13);
|
this.activeDocTitleBox.Location = new System.Drawing.Point(130, 13);
|
||||||
this.activeDocTitleBox.Name = "textBox1";
|
this.activeDocTitleBox.Name = "activeDocTitleBox";
|
||||||
this.activeDocTitleBox.ReadOnly = true;
|
this.activeDocTitleBox.ReadOnly = true;
|
||||||
this.activeDocTitleBox.Size = new System.Drawing.Size(400, 25);
|
this.activeDocTitleBox.Size = new System.Drawing.Size(424, 25);
|
||||||
this.activeDocTitleBox.TabIndex = 2;
|
this.activeDocTitleBox.TabIndex = 2;
|
||||||
this.activeDocTitleBox.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
this.activeDocTitleBox.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||||
//
|
//
|
||||||
@@ -54,21 +56,21 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.richTextBox1.BackColor = System.Drawing.Color.White;
|
this.richTextBox1.BackColor = System.Drawing.Color.White;
|
||||||
this.richTextBox1.Location = new System.Drawing.Point(12, 76);
|
this.richTextBox1.Location = new System.Drawing.Point(12, 119);
|
||||||
this.richTextBox1.Name = "richTextBox1";
|
this.richTextBox1.Name = "richTextBox1";
|
||||||
this.richTextBox1.ReadOnly = true;
|
this.richTextBox1.ReadOnly = true;
|
||||||
this.richTextBox1.Size = new System.Drawing.Size(570, 266);
|
this.richTextBox1.Size = new System.Drawing.Size(594, 260);
|
||||||
this.richTextBox1.TabIndex = 3;
|
this.richTextBox1.TabIndex = 3;
|
||||||
this.richTextBox1.Text = "";
|
this.richTextBox1.Text = "";
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(12, 16);
|
this.label1.Location = new System.Drawing.Point(13, 16);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(112, 17);
|
this.label1.Size = new System.Drawing.Size(111, 17);
|
||||||
this.label1.TabIndex = 4;
|
this.label1.TabIndex = 4;
|
||||||
this.label1.Text = "Active Document :";
|
this.label1.Text = "Active document :";
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
@@ -79,20 +81,20 @@
|
|||||||
this.label2.TabIndex = 4;
|
this.label2.TabIndex = 4;
|
||||||
this.label2.Text = "Prefix files with :";
|
this.label2.Text = "Prefix files with :";
|
||||||
//
|
//
|
||||||
// textBox2
|
// prefixTextBox
|
||||||
//
|
//
|
||||||
this.prefixTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.prefixTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.prefixTextBox.Location = new System.Drawing.Point(130, 44);
|
this.prefixTextBox.Location = new System.Drawing.Point(130, 44);
|
||||||
this.prefixTextBox.Name = "textBox2";
|
this.prefixTextBox.Name = "prefixTextBox";
|
||||||
this.prefixTextBox.Size = new System.Drawing.Size(400, 25);
|
this.prefixTextBox.Size = new System.Drawing.Size(424, 25);
|
||||||
this.prefixTextBox.TabIndex = 2;
|
this.prefixTextBox.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
//
|
//
|
||||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.button1.Image = global::ExportDXF.Properties.Resources.play;
|
this.button1.Image = global::ExportDXF.Properties.Resources.play;
|
||||||
this.button1.Location = new System.Drawing.Point(536, 13);
|
this.button1.Location = new System.Drawing.Point(560, 13);
|
||||||
this.button1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.button1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.button1.Name = "button1";
|
this.button1.Name = "button1";
|
||||||
this.button1.Size = new System.Drawing.Size(46, 56);
|
this.button1.Size = new System.Drawing.Size(46, 56);
|
||||||
@@ -100,11 +102,31 @@
|
|||||||
this.button1.UseVisualStyleBackColor = true;
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||||
//
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(12, 78);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(112, 17);
|
||||||
|
this.label3.TabIndex = 4;
|
||||||
|
this.label3.Text = "View flip decider :";
|
||||||
|
//
|
||||||
|
// comboBox1
|
||||||
|
//
|
||||||
|
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBox1.FormattingEnabled = true;
|
||||||
|
this.comboBox1.Location = new System.Drawing.Point(130, 75);
|
||||||
|
this.comboBox1.Name = "comboBox1";
|
||||||
|
this.comboBox1.Size = new System.Drawing.Size(353, 25);
|
||||||
|
this.comboBox1.TabIndex = 5;
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(594, 354);
|
this.ClientSize = new System.Drawing.Size(618, 391);
|
||||||
|
this.Controls.Add(this.comboBox1);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.richTextBox1);
|
this.Controls.Add(this.richTextBox1);
|
||||||
@@ -129,6 +151,8 @@
|
|||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label label2;
|
||||||
private System.Windows.Forms.TextBox prefixTextBox;
|
private System.Windows.Forms.TextBox prefixTextBox;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.ComboBox comboBox1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,16 @@ namespace ExportDXF.Forms
|
|||||||
worker.DoWork += Worker_DoWork;
|
worker.DoWork += Worker_DoWork;
|
||||||
worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
|
worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
|
||||||
|
|
||||||
viewFlipDecider = new AskViewFlipDecider();
|
var type = typeof(IViewFlipDecider);
|
||||||
|
var types = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
.SelectMany(s => s.GetTypes())
|
||||||
|
.Where(p => type.IsAssignableFrom(p) && p.IsClass)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
comboBox1.DataSource = GetItems();
|
||||||
|
comboBox1.DisplayMember = "Name";
|
||||||
|
|
||||||
|
//viewFlipDecider = new AskViewFlipDecider();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
protected override void OnLoad(EventArgs e)
|
||||||
@@ -52,6 +61,29 @@ namespace ExportDXF.Forms
|
|||||||
task.Start();
|
task.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Item2> GetItems()
|
||||||
|
{
|
||||||
|
var types = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
.SelectMany(s => s.GetTypes())
|
||||||
|
.Where(p => typeof(IViewFlipDecider).IsAssignableFrom(p) && p.IsClass)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var items = new List<Item2>();
|
||||||
|
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
var obj = (IViewFlipDecider)Activator.CreateInstance(type);
|
||||||
|
|
||||||
|
items.Add(new Item2
|
||||||
|
{
|
||||||
|
Name = obj.Name,
|
||||||
|
ViewFlipDecider = obj
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
private void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (worker.IsBusy)
|
if (worker.IsBusy)
|
||||||
@@ -77,6 +109,9 @@ namespace ExportDXF.Forms
|
|||||||
|
|
||||||
Invoke(new MethodInvoker(() =>
|
Invoke(new MethodInvoker(() =>
|
||||||
{
|
{
|
||||||
|
var item = comboBox1.SelectedItem as Item2;
|
||||||
|
viewFlipDecider = item.ViewFlipDecider;
|
||||||
|
|
||||||
button1.Image = Properties.Resources.stop_alt;
|
button1.Image = Properties.Resources.stop_alt;
|
||||||
|
|
||||||
if (richTextBox1.TextLength != 0)
|
if (richTextBox1.TextLength != 0)
|
||||||
@@ -621,11 +656,15 @@ namespace ExportDXF.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AskViewFlipDecider : IViewFlipDecider
|
public class Item2
|
||||||
{
|
{
|
||||||
public bool ShouldFlip(SolidWorks.Interop.sldworks.View view)
|
public string Name { get; set; }
|
||||||
|
public IViewFlipDecider ViewFlipDecider { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Helpers
|
||||||
{
|
{
|
||||||
return MessageBox.Show("Flip view?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,7 @@
|
|||||||
public interface IViewFlipDecider
|
public interface IViewFlipDecider
|
||||||
{
|
{
|
||||||
bool ShouldFlip(SolidWorks.Interop.sldworks.View view);
|
bool ShouldFlip(SolidWorks.Interop.sldworks.View view);
|
||||||
|
|
||||||
|
string Name { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
using SolidWorks.Interop.sldworks;
|
using SolidWorks.Interop.sldworks;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace ExportDXF
|
namespace ExportDXF
|
||||||
{
|
{
|
||||||
|
[DisplayName("Automatic")]
|
||||||
public class ViewFlipDecider : IViewFlipDecider
|
public class ViewFlipDecider : IViewFlipDecider
|
||||||
{
|
{
|
||||||
|
public string Name => "Automatic";
|
||||||
|
|
||||||
public bool ShouldFlip(SolidWorks.Interop.sldworks.View view)
|
public bool ShouldFlip(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
var orientation = GetOrientation(view);
|
var orientation = ViewHelper.GetOrientation(view);
|
||||||
var bounds = GetBounds(view);
|
var bounds = ViewHelper.GetBounds(view);
|
||||||
var bends = GetBends(view);
|
var bends = ViewHelper.GetBends(view);
|
||||||
|
|
||||||
var up = bends.Where(b => b.Direction == BendDirection.Up).ToList();
|
var up = bends.Where(b => b.Direction == BendDirection.Up).ToList();
|
||||||
var down = bends.Where(b => b.Direction == BendDirection.Down).ToList();
|
var down = bends.Where(b => b.Direction == BendDirection.Down).ToList();
|
||||||
@@ -23,12 +27,17 @@ namespace ExportDXF
|
|||||||
if (up.Count == 0)
|
if (up.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var bend = ClosestToBounds(bounds, bends);
|
var bend = ViewHelper.ClosestToBounds(bounds, bends);
|
||||||
|
|
||||||
return bend.Direction == BendDirection.Down;
|
return bend.Direction == BendDirection.Down;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Bounds GetBounds(SolidWorks.Interop.sldworks.View view)
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class ViewHelper
|
||||||
|
{
|
||||||
|
public static Bounds GetBounds(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
var outline = view.GetOutline() as double[];
|
var outline = view.GetOutline() as double[];
|
||||||
|
|
||||||
@@ -49,7 +58,7 @@ namespace ExportDXF
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Bend ClosestToBounds(Bounds bounds, IList<Bend> bends)
|
public static Bend ClosestToBounds(Bounds bounds, IList<Bend> bends)
|
||||||
{
|
{
|
||||||
var hBends = bends.Where(b => GetAngleOrientation(b.ParallelBendAngle) == BendOrientation.Horizontal).ToList();
|
var hBends = bends.Where(b => GetAngleOrientation(b.ParallelBendAngle) == BendOrientation.Horizontal).ToList();
|
||||||
var vBends = bends.Where(b => GetAngleOrientation(b.ParallelBendAngle) == BendOrientation.Vertical).ToList();
|
var vBends = bends.Where(b => GetAngleOrientation(b.ParallelBendAngle) == BendOrientation.Vertical).ToList();
|
||||||
@@ -91,7 +100,7 @@ namespace ExportDXF
|
|||||||
return minHBendDist < minVBendDist ? minHBend : minVBend;
|
return minHBendDist < minVBendDist ? minHBend : minVBend;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Bend SmallestYCoordinate(IList<Bend> bends)
|
public static Bend SmallestYCoordinate(IList<Bend> bends)
|
||||||
{
|
{
|
||||||
double dist = double.MaxValue;
|
double dist = double.MaxValue;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@@ -110,7 +119,7 @@ namespace ExportDXF
|
|||||||
return index == -1 ? null : bends[index];
|
return index == -1 ? null : bends[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Bend SmallestXCoordinate(IList<Bend> bends)
|
public static Bend SmallestXCoordinate(IList<Bend> bends)
|
||||||
{
|
{
|
||||||
double dist = double.MaxValue;
|
double dist = double.MaxValue;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@@ -129,19 +138,19 @@ namespace ExportDXF
|
|||||||
return index == -1 ? null : bends[index];
|
return index == -1 ? null : bends[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BendDirection GetBendDirection(Note note)
|
public static BendDirection GetBendDirection(Note note)
|
||||||
{
|
{
|
||||||
var txt = note.GetText();
|
var txt = note.GetText();
|
||||||
|
|
||||||
return txt.ToUpper().Contains("UP") ? BendDirection.Up : BendDirection.Down;
|
return txt.ToUpper().Contains("UP") ? BendDirection.Up : BendDirection.Down;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<Note> GetBendNotes(SolidWorks.Interop.sldworks.View view)
|
public static IEnumerable<Note> GetBendNotes(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
return (view.GetNotes() as Array)?.Cast<Note>();
|
return (view.GetNotes() as Array)?.Cast<Note>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Note GetLeftMostNote(SolidWorks.Interop.sldworks.View view)
|
public static Note GetLeftMostNote(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
var notes = GetBendNotes(view);
|
var notes = GetBendNotes(view);
|
||||||
|
|
||||||
@@ -163,7 +172,7 @@ namespace ExportDXF
|
|||||||
return leftMostNote;
|
return leftMostNote;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Note GetBottomMostNote(SolidWorks.Interop.sldworks.View view)
|
public static Note GetBottomMostNote(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
var notes = GetBendNotes(view);
|
var notes = GetBendNotes(view);
|
||||||
|
|
||||||
@@ -185,7 +194,7 @@ namespace ExportDXF
|
|||||||
return btmMostNote;
|
return btmMostNote;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<double> GetBendAngles(SolidWorks.Interop.sldworks.View view)
|
public static IEnumerable<double> GetBendAngles(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
var angles = new List<double>();
|
var angles = new List<double>();
|
||||||
var notes = GetBendNotes(view);
|
var notes = GetBendNotes(view);
|
||||||
@@ -199,7 +208,7 @@ namespace ExportDXF
|
|||||||
return angles;
|
return angles;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Bend> GetBends(SolidWorks.Interop.sldworks.View view)
|
public static List<Bend> GetBends(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
var bends = new List<Bend>();
|
var bends = new List<Bend>();
|
||||||
var notes = GetBendNotes(view);
|
var notes = GetBendNotes(view);
|
||||||
@@ -237,7 +246,7 @@ namespace ExportDXF
|
|||||||
return bends;
|
return bends;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BendOrientation GetOrientation(SolidWorks.Interop.sldworks.View view)
|
public static BendOrientation GetOrientation(SolidWorks.Interop.sldworks.View view)
|
||||||
{
|
{
|
||||||
var angles = GetBendAngles(view);
|
var angles = GetBendAngles(view);
|
||||||
|
|
||||||
@@ -268,7 +277,7 @@ namespace ExportDXF
|
|||||||
return vertical > horizontal ? BendOrientation.Vertical : BendOrientation.Horizontal;
|
return vertical > horizontal ? BendOrientation.Vertical : BendOrientation.Horizontal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BendOrientation GetAngleOrientation(double angleInDegrees)
|
public static BendOrientation GetAngleOrientation(double angleInDegrees)
|
||||||
{
|
{
|
||||||
if (angleInDegrees < 10 || angleInDegrees > 350)
|
if (angleInDegrees < 10 || angleInDegrees > 350)
|
||||||
return BendOrientation.Horizontal;
|
return BendOrientation.Horizontal;
|
||||||
@@ -285,7 +294,7 @@ namespace ExportDXF
|
|||||||
return BendOrientation.Unknown;
|
return BendOrientation.Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double RadiansToDegrees(double angleInRadians)
|
public static double RadiansToDegrees(double angleInRadians)
|
||||||
{
|
{
|
||||||
return Math.Round(angleInRadians * 180.0 / Math.PI, 8);
|
return Math.Round(angleInRadians * 180.0 / Math.PI, 8);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user