|
static void ECDMyGroupEUnion() {
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[];
region->booleanOper(AcDb::BoolOperType::kBoolUnite, (AcDbRegion *)regions[]);
AcGePoint3dArray ptArr;
CRegionUtil::GetRegionPoints(region, ptArr);
for (int i = ; i < regions.length (); i++)
{
AcDbRegion *regionTemp = (AcDbRegion *)regions[i];
regionTemp->erase();
regionTemp->close();
}
region->close();
AcDbPolyline *plTemp1 = new AcDbPolyline();
for (int i = ; i <ptArr.length(); i++)
{
plTemp1->addVertexAt(plTemp1->numVerts(), CConvertUtil::ToPoint2d(ptArr.at(i)), , , );
}
plTemp1->setClosed(Adesk::kTrue);
plTemp1->setColorIndex();
CDwgDataBaseUtil::PostToModelSpace(plTemp1);
plTemp1->close();
}
pl1->close();
pl2->close();
}
} |
|