if (line->intersectWith(pEntity, AcDb::kOnBothOperands, arrPoint) == Acad::eOk && arrPoint.length() > 0)
{
AcDbVoidPtrArray segments;
AcGeDoubleArray pointsDist{ 0 };
AcDbCurve* curve = AcDbCurve::cast(pEntity);
for (auto& point : arrPoint)
{
AcGePoint3d p;
curve->getClosestPointTo(point, p);
double dist{ 0 };
curve->getParamAtPoint(p, dist);
pointsDist.append(dist);
acutPrintf(_T("point dist %lf\n"), dist);
}
std::sort(pointsDist.begin(), pointsDist.end());
if (curve->getSplitCurves(pointsDist, segments) == Acad::eOk)
{
acutPrintf(_T("len segments %d\n"), segments.length());
for (int i{0}; i < segments.length(); i++)
{
AcDbEntity* seg = AcDbEntity::cast(static_cast<AcDbObject*>(segments[i]));
pBlockTableRecord->appendAcDbEntity(seg);
seg->close();
}
}
}