|
|
|
|
@ -14,13 +14,9 @@ using SparkClient.Views.UserControl.ViewportData.Enum; |
|
|
|
|
using SparkClient.Views.UserControl.ViewportData.Entity; |
|
|
|
|
using Color = SharpDX.Color; |
|
|
|
|
using GeometryModel3D = HelixToolkit.Wpf.SharpDX.GeometryModel3D; |
|
|
|
|
using MeshGeometry3D = HelixToolkit.Wpf.SharpDX.MeshGeometry3D; |
|
|
|
|
using Point = System.Windows.Point; |
|
|
|
|
using PerspectiveCamera = HelixToolkit.Wpf.SharpDX.PerspectiveCamera; |
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
using HelixToolkit.Wpf; |
|
|
|
|
using MeshBuilder = HelixToolkit.Wpf.SharpDX.MeshBuilder; |
|
|
|
|
using OrthographicCamera = HelixToolkit.Wpf.SharpDX.OrthographicCamera; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
using SparkClient.Model.Attributes; |
|
|
|
|
using SparkClient.Model.Extension; |
|
|
|
|
@ -51,6 +47,7 @@ public class ViewportHelperPro |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="viewport"></param> |
|
|
|
|
/// <param name="entities"></param> |
|
|
|
|
/// <param name="color"></param> |
|
|
|
|
[Log] |
|
|
|
|
public static MeshGeometryModel3D GenerateModelByEntity(Viewport3DX viewport, List<Viewport3DTriangleEntity> entities, Color4? color = null) |
|
|
|
|
{ |
|
|
|
|
@ -112,7 +109,6 @@ public class ViewportHelperPro |
|
|
|
|
/// 通过三角形实体集合生成面模型(只生成不添加) |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="entities"></param> |
|
|
|
|
/// <param name="color"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[Log] |
|
|
|
|
public static List<MeshGeometryModel3D> GenerateModelByEntityGroupByType(List<Viewport3DTriangleEntity> entities) |
|
|
|
|
@ -185,7 +181,7 @@ public class ViewportHelperPro |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Log] |
|
|
|
|
public static async Task ExportModelsToVideo(Viewport3DX viewport, string filePath) |
|
|
|
|
public static async Task ExportModelsToVideo(Viewport3DX? viewport, string filePath) |
|
|
|
|
{ |
|
|
|
|
if (viewport == null) |
|
|
|
|
viewport = ViewportManager.GetViewport3D(); |
|
|
|
|
@ -203,7 +199,7 @@ public class ViewportHelperPro |
|
|
|
|
/// <param name="viewport"></param> |
|
|
|
|
/// <param name="filePath"></param> |
|
|
|
|
[Log] |
|
|
|
|
public static void ExportModelsToStl(Viewport3DX viewport, string filePath) |
|
|
|
|
public static void ExportModelsToStl(Viewport3DX? viewport, string filePath) |
|
|
|
|
{ |
|
|
|
|
if (viewport == null) |
|
|
|
|
viewport = ViewportManager.GetViewport3D(); |
|
|
|
|
@ -214,7 +210,7 @@ public class ViewportHelperPro |
|
|
|
|
foreach (var model in viewport.Items.OfType<MeshGeometryModel3D>()) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if (model.Geometry is HelixToolkit.Wpf.SharpDX.Geometry3D geometry) |
|
|
|
|
if (model.Geometry != null && model.Geometry is HelixToolkit.Wpf.SharpDX.Geometry3D geometry) |
|
|
|
|
{ |
|
|
|
|
var positions = geometry.Positions; |
|
|
|
|
var indices = geometry.Indices; |
|
|
|
|
@ -252,7 +248,6 @@ public class ViewportHelperPro |
|
|
|
|
/// <summary> |
|
|
|
|
/// 导出模型 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="viewport"></param> |
|
|
|
|
/// <param name="filePath"></param> |
|
|
|
|
[Log] |
|
|
|
|
public static async Task ExportModelsToStlASync(string filePath) |
|
|
|
|
@ -379,7 +374,7 @@ public class ViewportHelperPro |
|
|
|
|
{ culetLineZ, culetLineX }; |
|
|
|
|
|
|
|
|
|
result.Add(DisplayLineModel3D(centerLines, Color.Red, 0.8f)); |
|
|
|
|
result.Add(DisplayLineModel3D(tableLines, Color.Green, 1f)); |
|
|
|
|
result.Add(DisplayLineModel3D(tableLines, Color.Green)); |
|
|
|
|
result.Add(DisplayLineModel3D(culetLines, Color.Blue, 0.8f)); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
@ -389,6 +384,8 @@ public class ViewportHelperPro |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="viewport"></param> |
|
|
|
|
/// <param name="entities"></param> |
|
|
|
|
/// <param name="color"></param> |
|
|
|
|
/// <param name="thickness"></param> |
|
|
|
|
[Log] |
|
|
|
|
public static List<LineGeometryModel3D> GentrateLineByEntity(Viewport3DX viewport, List<Viewport3DTriangleEntity> entities, Color4? color = null, double thickness = 1.0) |
|
|
|
|
{ |
|
|
|
|
@ -599,11 +596,11 @@ public class ViewportHelperPro |
|
|
|
|
public static List<GeometryModel3D> GenerateLineTextModels(List<Viewport3DTriangleEntity> entities, string valKey = "") |
|
|
|
|
{ |
|
|
|
|
var result = new List<GeometryModel3D>(); |
|
|
|
|
string steps = ViewportManager.DiamondType.Split(" ").Last(); |
|
|
|
|
// string steps = ViewportManager.DiamondType.Split(" ").Last(); |
|
|
|
|
if (Common.RunMode == 0) |
|
|
|
|
{ |
|
|
|
|
Logger.Info("【面文本生成】开始生成面相关文本信息"); |
|
|
|
|
var selFacet = entities; |
|
|
|
|
// var selFacet = entities; |
|
|
|
|
var selFacetType = entities.First().PlaneType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -729,7 +726,7 @@ public class ViewportHelperPro |
|
|
|
|
var facetIndex = int.Parse(dic.Key.Split("_")[1]) - 1; |
|
|
|
|
if ("GIRDLE_VALLEY".Equals(gridleResult.Key)) |
|
|
|
|
{ |
|
|
|
|
var showLine =GetLeftOrRightLineSegment(facetPoints, facetIndex >= 25 && facetIndex <= 57 ? true : false);; |
|
|
|
|
var showLine =GetLeftOrRightLineSegment(facetPoints, facetIndex >= 25 && facetIndex <= 57 ); |
|
|
|
|
if (showLine == null) continue; |
|
|
|
|
result.Add(DisplayLineModel3D(new List<Tuple<Vector3, Vector3>>() { showLine }, new Color4(1f, 0, 0, 1f), 2f)); |
|
|
|
|
} |
|
|
|
|
@ -752,7 +749,7 @@ public class ViewportHelperPro |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), gridleResult.Key, false); |
|
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(), gridleResult.Key); |
|
|
|
|
result.Add(DisplayText3D($"{valueFloat}", facetTextPoint)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -796,7 +793,7 @@ public class ViewportHelperPro |
|
|
|
|
//高亮的线 |
|
|
|
|
// var showLine = GetLeftParallelLineSegment(facetPoints); |
|
|
|
|
var facetIndex = int.Parse(dic.Key.Split("_")[1]) - 1; |
|
|
|
|
var showLine =GetLeftOrRightLineSegment(facetPoints, facetIndex >= 25 && facetIndex <= 57 ? true : false);; |
|
|
|
|
var showLine =GetLeftOrRightLineSegment(facetPoints, facetIndex >= 25 && facetIndex <= 57);; |
|
|
|
|
if (showLine == null) continue; |
|
|
|
|
|
|
|
|
|
//文字显示位置 |
|
|
|
|
@ -2311,7 +2308,7 @@ public class ViewportHelperPro |
|
|
|
|
return resultSegment; // 返回符合条件的线段 |
|
|
|
|
} |
|
|
|
|
[Log] |
|
|
|
|
private static Tuple<Vector3, Vector3> GetLeftOrRightLineSegment(List<Vector3> facetPoints, |
|
|
|
|
private static Tuple<Vector3, Vector3>? GetLeftOrRightLineSegment(List<Vector3> facetPoints, |
|
|
|
|
bool isLeft = true) |
|
|
|
|
{ |
|
|
|
|
Tuple<Vector3, Vector3> resultSegment = null; |
|
|
|
|
|