|
AcDbObjectPointer <CCivilDbPipeNode > pPipeNode( aryRes[i] , AcDb :: kForRead);
if ( pPipeNode.openStatus() != Acad ::eOk )
{
continue;
}
AcGePoint3d ptCenter = pPipeNode->Position();
AcDbBlockTableRecord* pBlockTableRecord = new AcDbBlockTableRecord;
AcDbObjectId blockId;
Acad::ErrorStatus ret = AcDbUtils::CreateAnonymousBlock(pBlockTableRecord, blockId, acdbCurDwg());
if (ret == Acad::eOk)
{
AcDbLine* lineX = new AcDbLine;
lineX->setStartPoint(ptCenter);
AcGeVector3d vec = AcGeVector3d::kXAxis;
vec.rotateBy(MathUtils::kRad45, AcGeVector3d::kZAxis);
AcGePoint3d ptEnd = ptCenter + vec* dRadius*1.5;
lineX->setEndPoint(ptEnd);
pBlockTableRecord->appendAcDbEntity(lineX);
lineX->close();
CString strText;
strText.Format(_T("最大洪流量%.2f立方米"), aryValueMax[i]);
AcDbText* textVol = new AcDbText;
textVol->setTextString(strText);
textVol->setPosition(AcGePoint3d(ptEnd.x, ptEnd.y+0.5, ptEnd.z));
pBlockTableRecord->appendAcDbEntity(textVol);
textVol->close();
AcDbExtents extentText;
textVol->getGeomExtents(extentText);
AcDbLine* lineY = new AcDbLine;
lineY->setStartPoint(ptEnd);
lineY->setEndPoint( AcGePoint3d( extentText.maxPoint().x, ptEnd.y, ptEnd.z) );
pBlockTableRecord->appendAcDbEntity(lineY);
lineY->close();
AcDbCircle* circle = new AcDbCircle(ptCenter, AcGeVector3d::kZAxis, dRadius);
circle->setColorIndex(nColorIndex);
circle->setLineWeight(nLineWeight);
pBlockTableRecord->appendAcDbEntity(circle);
circle->close();
pBlockTableRecord->setOrigin(ptCenter);
pBlockTableRecord->close();
}
if (blockId.isValid())
{
AcDbBlockReference *pBlkRef = new AcDbBlockReference;
if( pBlkRef )
{
CAppXdata xData2(_T("HYSWMMTAG"), pBlkRef->database());
xData2.SetValue(1070, 0, 0);
xData2.SetXdata(pBlkRef);
}
pBlkRef->setBlockTableRecord(blockId);
pBlkRef->setPosition(ptCenter);
AcDbUtils::AddToCurrentSpaceAndClose(pBlkRef);
}
// 从图面查找,并删除
filter = acutBuildList(RTDXF0,_T(""INSERT"") , -3, 1001, _T("HYSWMMTAG"), 0);
CAcadSelSet selEnt;
if (selEnt.AllSelect(filter) != CAcad
SelSet::kSelected)
return;
AcDbObjectIdArray idsBlkEnt;
selEnt.AsArray(idsBlkEnt);
AcDbUtils::EraseEntitys(idsBlkEnt); |
|