明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1557|回复: 0

[讨论]讨论代码!急!

[复制链接]
发表于 2002-12-21 16:46 | 显示全部楼层 |阅读模式
下面一段代码为什么不能显示填充图案???
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;
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-3 02:40 , Processed in 0.197303 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表