|
static voidECDMyGroupEUnion() {
DrawRecJig recJig=DrawRecJig();
ads_point pt;
AcDbPolyline*pl1 = NULL, *pl2 =NULL;if (acedGetPoint(NULL, L"\n请选择插入点:", pt) ==RTNORM) {
AcDbObjectId oId1, oId2;if(recJig.DoIt(asPnt3d(pt), oId1)) {
pl1=AcDbPolyline::cast(recJig.entity());
}if(recJig.DoIt(asPnt3d(pt), oId2)) {
pl2=AcDbPolyline::cast(recJig.entity());
}
AcDbVoidPtrArray curveSegments;
AcDbVoidPtrArray regions;
curveSegments.append(pl1);
curveSegments.append(pl2);if (AcDbRegion::createFromCurves(curveSegments, regions) ==Acad::eOk) {
AcDbRegion*region =(AcDbRegion *)regions[0];
region->booleanOper(AcDb::BoolOperType::kBoolUnite, (AcDbRegion *)regions[1]);
AcGePoint3dArray ptArr;
CRegionUtil::GetRegionPoints(region, ptArr);for (int i = 0; i < regions.length (); i++)
{
AcDbRegion*regionTemp = (AcDbRegion *)regions[i];
regionTemp->erase();
regionTemp->close();
}
region->close();
AcDbPolyline*plTemp1 = newAcDbPolyline();for (int i = 0; i
{
plTemp1->addVertexAt(plTemp1->numVerts(), CConvertUtil::ToPoint2d(ptArr.at(i)), 0, 0, 0);
}
plTemp1->setClosed(Adesk::kTrue);
plTemp1->setColorIndex(1);
CDwgDataBaseUtil::PostToModelSpace(plTemp1);
plTemp1->close();
}
pl1->close();
pl2->close();
}
}
|
|