ARX合并多线段(部分内容参考其他人)

2023-07-06 16:07:34 浏览数 (1)

代码语言:javascript复制
void CCommonModel::AppendPoly( const AcDbObjectIdArray& objArray,AcDbPolyline *pPolyNew )
{
	AcDbObjectIdArray objIdArray = objArray;
	std::multimap<AcGePoint3d,int> mapPoints;			// AcGePoint3d不能排序,要重载符号“<”;
	std::multimap<AcGePoint3d,int>::iterator ite1;
 
	std::multimap<AcGePoint3d,int>::iterator ite2;
	for (int i = 0; i < objIdArray.length(); i  )
	{
		AcDbObjectId objId;
		objId = objIdArray.at(i);
		AcGePoint3d ptStart;
		AcGePoint3d ptEnd;
		AcDbObjectPointer<AcDbPolyline> pPoly(objId,AcDb::kForRead);
		pPoly->getStartPoint(ptStart);
		pPoly->getEndPoint(ptEnd);
		if (i == 0)
		{
			mapPoints.insert(std::make_pair(ptStart,1));
			mapPoints.insert(std::make_pair(ptEnd,1));
		}
		else
		{
			ite1 = mapPoints.find(ptStart);
			ite2 = mapPoints.find(ptEnd);
			if (ite1 != mapPoints.end())
			{
				(ite1->second)  ;
			}
			else
			{
				mapPoints.insert(std::make_

0 人点赞