this should be a bug of Acdb2dPolyline.
First you select an AcdbPolyline of k2dCubicSplinePoly,
the code below shows where the crush happens.
AcDbObjectPointer<AcDbCurve> pCurve(idPL,AcDb::kForRead);
AcGePoint3d pt3dOncurve;
pCurve->getClosestPointTo(asPnt3d(pt),pt3dOncurve);
double dParam = -1;
Acad::ErrorStatus es = pCurve->getParamAtPoint(pt3dOncurve,dParam);
acutPrintf(_T("\n%d,%g,%g,%g"),es,dParam,pt3dOncurve.x,pt3dOncurve.y);
es = pCurve->getPointAtParam(dParam,pt3dOncurve); // here ,dParam usualy much bigger than the number of vertices.
acutPrintf(_T("\n%d,%g,%g,%g"),es,dParam,pt3dOncurve.x,pt3dOncurve.y);
AcGeDoubleArray dBulgeArr;
dBulgeArr.append(dParam);
AcDbVoidPtrArray curveSegments;
AcGePoint3dArray pt3dNodes;
pt3dNodes.append(pt3dOncurve);
//es = pCurve->getSplitCurves(dBulgeArr,curveSegments);
es = pCurve->getSplitCurves(pt3dNodes,curveSegments);// here crushes. but with a simple Acdb2dPolyline, the codes works very well.
{
int i=0;
for (;i<curveSegments.length();++i)
{
AcDbCurve* pNewCurve = (AcDbCurve*)curveSegments[i];
AcDbObjectId idNew;
if (Acad_Ent::AppendEntity(pNewCurve,idNew))
{
pNewCurve->close();
}
}
}
AutoCAD version? ObjectARX version? x86/x64?
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
sorry, I forgot that.
The CAD version is 2008, and OjbectARX is also 2008.
I guess this should be a bug, and autodesk would not like to fix it in Version such as 2008,2009. if so ,I have to change my code.