AutoCAD 二次开发 求线的交点
作者:互联网
[CommandMethod("GTest")] public static void GTest() { var p1 = new Point3d(0, 0, 0); var p2 = new Point3d(100, 0, 0); var p3 = new Point3d(100, 100, 0); var p4 = new Point3d(0, 100, 0); var line = new Line(p1, p2);//创建直线 var s1 = new Point3d(80, -40, 0); var s2 = new Point3d(20, 90, 0); var line2 = new Line(s1, s2); Point3dCollection pt3Coll = new Point3dCollection();//交点集合 line2.IntersectWith(line, Intersect.ExtendBoth, pt3Coll, IntPtr.Zero, IntPtr.Zero); if (pt3Coll.Count > 0)//交点集合 2个交点 { foreach (var jd in pt3Coll) { var t = jd; } } pt3Coll = new Point3dCollection();//交点集合 var circle = new Circle(new Point3d(50, 10, 0), new Vector3d(0, 0, 1), 50);//创建r=50的圆 circle.IntersectWith(line, Intersect.OnBothOperands, pt3Coll, IntPtr.Zero, IntPtr.Zero); if (pt3Coll.Count > 0)//交点集合 2个交点 { foreach (var jd in pt3Coll) { var t = jd; } } pt3Coll = new Point3dCollection();//交点集合 var arc = new Arc(new Point3d(50, 10, 0), new Vector3d(0, 0, 1), 50, 0, 1.5 * Math.PI);//创建r=50,3/4的圆弧, arc.IntersectWith(line, Intersect.OnBothOperands, pt3Coll, IntPtr.Zero, IntPtr.Zero); if (pt3Coll.Count > 0)//交点集合 1个交点 { foreach (var jd in pt3Coll) { var t = jd; } } }
标签:jd,AutoCAD,var,pt3Coll,交点,二次开发,new,求线,Point3d 来源: https://www.cnblogs.com/china-guoch/p/15908820.html