|
void cmdTestSpline() {
ads采用point pt;
ads采用name ent;
AcDbObjectId objId;
if (acedEntSel(L"\nSelect Spline", ent, pt) != RTNORM)
return;
if (acdbGetObjectId(objId, ent) != Acad::eOk)
return;
AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
Acad::ErrorStatus es;
AcDbSpline *spline;
if ((es = acdbOpenObject(spline, objId, AcDb::kForRead)) == Acad::eOk) {
int i, count = spline->numControlPoints();
AcGePoint3d controlPoint, ptOnCurve;
for (i=0; i<count; ++i) {
es = spline->getControlPointAt(i, controlPoint);
if (!es) {
es = spline->getClosestPointTo(controlPoint, ptOnCurve);
if (!es) {
AcDbLine *line = new AcDbLine(controlPoint, ptOnCurve);
line->setDatabaseDefaults();
postToDb(pDb, line);
}
}
}
spline->close();
}
} |
|