diff --git a/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs b/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs index a1043d0cbc6006942d90d9296041434f93dc29e4..4d7915ac56d698af5b3e1d7c7e17e63c76686979 100644 --- a/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs +++ b/src/CAD/IFox.CAD.Shared/ExtensionMethod/EditorEx.cs @@ -534,7 +534,7 @@ public static void DrawVectors(this Editor editor, IEnumerable pnts, sh var rlst = new LispList { { LispDataType.Int16, colorIndex } }; rlst.AddRange(GetLines(pnts, isClosed)); - editor.DrawVectors(rlst, editor.CurrentUserCoordinateSystem); + editor.DrawVectors(new(rlst.ToArray()), Matrix3d.Identity); } /// @@ -577,7 +577,7 @@ public static void DrawCircles(this Editor editor, IEnumerable pnts, sh rlst.AddRange(GetLines(tpnts, true)); } - editor.DrawVectors(rlst, editor.CurrentUserCoordinateSystem); + editor.DrawVectors(new(rlst.ToArray()), editor.CurrentUserCoordinateSystem); } /// @@ -602,7 +602,49 @@ public static void DrawCircle(this Editor editor, Point2d pnt, short colorIndex, editor.DrawVectors(pnts, colorIndex, true); } - + /// + /// 根据点表绘制矢量线段(每两点为一条线段的起始点和终止点) + /// + /// 用户交互对象 + /// 点表 + /// CAD颜色索引;默认:1为红色 + /// 是否高亮显示;为高亮显示,默认:为不高亮显示 + public static void DrawLineVectors(this Editor editor, IEnumerable points, int colorIndex = 1, + bool drawHighlighted = false) + { + Point3d endPoint1, endPoint2; + var itor = points.GetEnumerator(); + while (itor.MoveNext()) + { + endPoint1 = itor.Current; + if (!itor.MoveNext()) return; + endPoint2 = itor.Current; + editor.DrawVector(endPoint1, endPoint2, colorIndex, drawHighlighted); + } + } + /// + /// 根据点表绘制首尾相连的矢量 + /// + /// 用户交互对象 + /// 点表 + /// CAD颜色索引;默认:1为红色 + /// 是否闭合; 为闭合,默认: 为不闭合 + /// 是否高亮显示;为高亮显示,默认:为不高亮显示 + public static void DrawEndToEndVectors(this Editor editor, IEnumerable points, int colorIndex = 1, + bool isclose = false, bool drawHighlighted = false) + { + var itor = points.GetEnumerator(); + if (points.Count() < 1 || !itor.MoveNext()) return; + Point3d endPoint1 = itor.Current, endPoint2 = new(), firstEndPoint = endPoint1; + while (itor.MoveNext()) + { + endPoint2 = itor.Current; + editor.DrawVector(endPoint1, endPoint2, colorIndex, drawHighlighted); + endPoint1 = endPoint2; + } + if (isclose) + editor.DrawVector(endPoint2, firstEndPoint, colorIndex, drawHighlighted); + } #endregion #region 矩阵