admin 发表于 2024-5-2 22:41:18

ARX 多段线的合并

合成多段线
static void AppendPLinePoint(const AcDbObjectId& id,const bool& gotoNext,AcDbPolyline* pLine,int& plIndex)
{
AcDbEntity* pEnt = NULL;
Acad::ErrorStatus es = acdbOpenObject(pEnt,id,AcDb::OpenMode::kForRead);
if(es != Acad::eOk)
{
acutPrintf(采用T("open object failed in combine pline"));
return;
}
if(!pEnt->isKindOf(AcDbPolyline::desc()))
{
pEnt->close();
return;
}

AcDbPolyline* pPoly = NULL;
pPoly = (AcDbPolyline*)pEnt;
AcGePoint2dArray ptArr;
int count = pPoly->numVerts();
AcGePoint2d pt ;
double bulge = 0.0;
if(gotoNext)
{
for(int i = 0;i < count ; i++)
{
pPoly->getPointAt(i,pt);
pPoly->getBulgeAt(i,bulge);
pLine->addVertexAt(plIndex,pt,bulge);
plIndex++;
}
}
else
{
for(int i = count - 1;i > 0; i--)
{
pPoly->getPointAt(i,pt);
if(i > 0)
{
pPoly->getBulgeAt(i - 1,bulge);
}
else
{
pPoly->getBulgeAt(0,bulge);
}
pLine->addVertexAt(plIndex,pt,-bulge);
plIndex++;
}
}

pEnt->close();
}
页: [1]
查看完整版本: ARX 多段线的合并