And this Polyline Object is non-database-resistent,It was splited by another polyline.
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];
}