|
下面一段代码为什么不能显示填充图案???
Adesk::Boolean zmyrectangle::worldDraw(AcGiWorldDraw* mode)
{
assertReadEnabled();
// TODO: implement this function.
AcGePoint3d Pts[2];
AcGePoint3d pt[4];
AcDbObjectId lineId0;
AcDbObjectId lineId1;
AcDbObjectId lineId2;
AcDbObjectId lineId3;
AcDbObjectIdArray dbObjIds;
AcDbLine *line0;
AcDbLine *line1;
AcDbLine *line2;
AcDbLine *line3;
point(pt);
Pts[0].x=pt[0].xts[0].y=pt[0].yts[0].z=0;
Pts[1].x=pt[1].xts[1].y=pt[1].yts[1].z=0;
line0=new AcDbLine(Pts[0],Pts[1]);
line0->worldDraw(mode);
//line->postToDb(line, lineId);
dbObjIds.append(lineId0);
Pts[0].x=pt[1].xts[0].y=pt[1].yts[0].z=0;
Pts[1].x=pt[2].xts[1].y=pt[2].yts[1].z=0;
line1=new AcDbLine(Pts[0],Pts[1]);
line1->worldDraw(mode);
//line->postToDb(line, lineId);
dbObjIds.append(lineId1);
Pts[0].x=pt[2].xts[0].y=pt[2].yts[0].z=0;
Pts[1].x=pt[3].xts[1].y=pt[3].yts[1].z=0;
line2=new AcDbLine(Pts[0],Pts[1]);
line2->worldDraw(mode);
//line->postToDb(line, lineId);
dbObjIds.append(lineId2);
Pts[0].x=pt[3].xts[0].y=pt[3].yts[0].z=0;
Pts[1].x=pt[0].xts[1].y=pt[0].yts[1].z=0;
line3=new AcDbLine(Pts[0],Pts[1]);
line3->worldDraw(mode);
//line->postToDb(line, lineId);
dbObjIds.append(lineId3);
AcDbHatch *pHatch=new AcDbHatch();
AcGeVector3d normal(0.0, 1.0, 0.0);
pHatch->setNormal(normal);
//pHatch->setElevation(0.0);
// Set hatch pattern to ANSI31 predefined type
//
pHatch->setPattern(AcDbHatch::kPreDefined, "ANSI31");
// Set Associativity
//
// pHatch->setAssociative(Adesk::kTrue);
// Append an internal loop (circle) to hatch boundary
//
//pHatch->appendLoop(AcDbHatch::kDefault, dbObjIds);
pHatch->appendLoop(AcDbHatch::kExternal, dbObjIds);
pHatch->worldDraw(mode);
// Elaborate hatch lines
//
pHatch->evaluateHatch();
// Post hatch entity to database
//
//pHatch->postToDb(pHatch);
delete pHatch;
delete line0;
delete line1;
delete line2;
delete line3;
return Acad::eOk;
} |
|