并且此折线对象不受数据库限制,它是由另一条折线拆分的。
- public static Curve ParticalCopy(this Curve cv, Point3d pt1, Point3d pt2)
- {
- pt1 = cv.GetClosestPointTo(pt1, false);
- pt2 = cv.GetClosestPointTo(pt2, false);
- if (cv.GetDistAtPoint(pt1) > cv.GetDistAtPoint(pt2))
- {
- Point3d pt = pt1;
- pt1 = pt2;
- pt2 = pt;
- }
- DoubleCollection dbs = new DoubleCollection();
- double param1 = cv.GetParameterAtPoint(pt1);
- dbs.Add(param1);
- double param2 = cv.GetParameterAtPoint(pt2);
- dbs.Add(param2);
- DBObjectCollection DBS = cv.GetSplitCurves(dbs);
- IEnumerator enumDbOc = DBS.GetEnumerator();
- ObjectId res = ObjectId.Null;
- Tolerance t = new Tolerance(0.01, 0.01);
- Curve[] cvs = new Curve[DBS.Count];
- int i = 0;
- while (enumDbOc.MoveNext())
- {
- Curve lineTemp = (Curve)enumDbOc.Current;
- cvs[i] = lineTemp;
- i++;
- }
- if (param1 == 0)
- return cvs[0];
- else if (cvs.Length >= 2)
- return cvs[1];
- else
- return cvs[0];
- }
|