1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- /* ==============================================================================
- * 功能描述: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
- {
- /// <summary>
- /// ExportUtils
- /// </summary>
- 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<XYZ> list=new List<XYZ>();
- if (points is IEnumerable iEnumerable)
- {
- for (int i = 0; i < iEnumerable.GetCount()-1; i=i+2)
- {
- double[] array = {iEnumerable.GetByIndexT<double>(i), iEnumerable.GetByIndexT<double>(i + 1), 0};
- XYZ xyz = Point2XYZ(array);
- list.Add(xyz);
- }
- }
- return new PolyLine(list);
- }
- }
- }
|