当前位置: 首页>>代码示例>>C#>>正文


C# Polyline.Explode方法代码示例

本文整理汇总了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;
        }
开发者ID:komelio,项目名称:Dimeng.LinkToMicrocad,代码行数:50,代码来源:MathHelper.cs


注:本文中的Polyline.Explode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。