zmyqhx 发表于 2002-12-21 16:46:00

[讨论]讨论代码!急!

下面一段代码为什么不能显示填充图案???
Adesk::Boolean zmyrectangle::worldDraw(AcGiWorldDraw* mode)
{
        assertReadEnabled();
        // TODO: implement this function.
        AcGePoint3d Pts;
        AcGePoint3d pt;
        AcDbObjectId lineId0;
        AcDbObjectId lineId1;
        AcDbObjectId lineId2;
        AcDbObjectId lineId3;
        AcDbObjectIdArray dbObjIds;
    AcDbLine *line0;
        AcDbLine *line1;
        AcDbLine *line2;
        AcDbLine *line3;
        point(pt);

        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        line0=new AcDbLine(Pts,Pts);
        line0->worldDraw(mode);
        //line->postToDb(line, lineId);
    dbObjIds.append(lineId0);
       
       
        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        line1=new AcDbLine(Pts,Pts);
        line1->worldDraw(mode);
        //line->postToDb(line, lineId);
    dbObjIds.append(lineId1);

        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        line2=new AcDbLine(Pts,Pts);
        line2->worldDraw(mode);
        //line->postToDb(line, lineId);
    dbObjIds.append(lineId2);

        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        Pts.x=pt.x;Pts.y=pt.y;Pts.z=0;
        line3=new AcDbLine(Pts,Pts);
        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;
}
页: [1]
查看完整版本: [讨论]讨论代码!急!