/* ============================================================================== * 功能描述:ExportUtils * 创 建 者:Garrett * 创建日期:2019/12/17 17:20:14 * ==============================================================================*/ using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SAGA.DotNetUtils; using SAGA.DotNetUtils.Extend; using TestCad.Model; namespace TestCad { /// /// ExportUtils /// public class ExportUtils { public static TestCad.Model.XYZ Point2XYZ(object point) { string str = ""; XYZ xyz = null; if (point is double[] array) { if (array.Length == 3) { xyz=new XYZ(){X = array[0],Y= array[1], Z= array[2] }; } } return xyz; } public static TestCad.Model.PolyLine Coordinates2PloyLine(object points) { string str = ""; List list=new List(); if (points is IEnumerable iEnumerable) { for (int i = 0; i < iEnumerable.GetCount()-1; i=i+2) { double[] array = {iEnumerable.GetByIndexT(i), iEnumerable.GetByIndexT(i + 1), 0}; XYZ xyz = Point2XYZ(array); list.Add(xyz); } } return new PolyLine(list); } } }