本文整理汇总了C#中Polyline.Explode方法的典型用法代码示例。如果您正苦于以下问题:C# Polyline.Explode方法的具体用法?C# Polyline.Explode怎么用?C# Polyline.Explode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyline
的用法示例。
在下文中一共展示了Polyline.Explode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindSelfIntersectPline
public static List<int> FindSelfIntersectPline(Polyline polyline)
{
List<int> resultPts = new List<int>();
DBObjectCollection entities = new DBObjectCollection();
polyline.Explode(entities);
for (int i = 0; i < entities.Count; ++i)
{
for (int j = i + 1; j < entities.Count; ++j)
{
Curve curve1 = entities[i] as Curve;
Curve curve2 = entities[j] as Curve;
Autodesk.AutoCAD.Geometry.Point3dCollection points = new Autodesk.AutoCAD.Geometry.Point3dCollection();
curve1.IntersectWith(
curve2,
Intersect.OnBothOperands,
points,
IntPtr.Zero,
IntPtr.Zero);
foreach (Point3d point in points)
{
// Make a check to skip the start/end points
// since they are connected vertices
if (point == curve1.StartPoint ||
point == curve1.EndPoint)
{
if (point == curve2.StartPoint ||
point == curve2.EndPoint)
{
// If two consecutive segments, then skip
if (j == i + 1)
{
continue;
}
}
}
resultPts.Add(j);
}
}
// Need to be disposed explicitely
// since entities are not DB resident
entities[i].Dispose();
}
return resultPts;
}