找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 846|回复: 2

[求助]:如何填充由一大一小两个同心圆组成的圆环?

[复制链接]
发表于 2005-1-9 17:49:29 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
如题,我想把圆环部分填充起来,但Arx里的AcDbHatch好像只能填充有相交的两实体组成的闭合区域,求该填充的实现方法.最好能贴个代码上来!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2005-1-9 23:12:30 | 显示全部楼层
源自帮助



The following example shows how to acquire an associative hatch entity on the WCS XY plane. The hatch boundary consists of an external rectangular loop with an internal circular hole. The hatch pattern is the ANSI31 predefined type with current AutoCAD default color. The newly created hatch is associative, in which you can change the source boundary geometry to update the hatch pattern.

Acad::ErrorStatus acqHatch2()
{
    AcDbHatch* pHatch = new AcDbHatch();

    // Set hatch plane
    //
    AcGeVector3d normal(0.0, 0.0, 1.0);
    pHatch->setNormal(normal);
    pHatch->setElevation(0.0);

    // Set hatch pattern to ANSI31 predefined type
    //
    pHatch->setHatchPattern(AcDbHatch::kPreDefined, "ANSI31");

    // Set Associativity
    //
    pHatch->setAssociative(Adesk::kTrue);

    // Construct database AcDbLines
    //
    AcGePoint2d vertexPts[4];
    AcDbObjectId lineId, cirId, hatchId;
    AcDbObjectIdArray dbObjIds;
    AcDbLine *line;

    vertexPts[0].set(2.0, 2.0, 0.0);
    vertexPts[1].set(8.0, 2.0, 0.0);
    vertexPts[2].set(8.0, 8.0, 0.0);
    vertexPts[3].set(2.0, 8.0, 0.0);

    for (int i = 0; i < 4; i++) {
        line =  new AcDbLine();
        line->setStartPoint(vertexPts)
        line->setEndPoint(vertexPts[(i == 3) ? 0 : i+1])
        line->postToDb(line, lineId);
        dbObjIds.append(lineId);
    }

    // Append an external rectangular loop to hatch boundary
    //
    pHatch->appendLoop(AcDbHatch::kExternal, dbObjIds);

    // Create a AcDbCircle and post it to database
    //
    AcGePoint2d cenPt(5.0, 5.0, 0.0);
    AcGeVector3d normal(0.0, 0.0, 1.0);
    AcDbCircle *circle = new AcDbCircle();
    circle->setNormal(normal);
    circle->setCenter(cenPt);
    circle->setRadius(1.0);
    circle->postToDb(circle, cirId);
    dbObjIds.setLogicalLength(0);
    dbObjIds.append(cirId);  

    // Append an internal loop (circle) to hatch boundary
    //
    pHatch->appendLoop(AcDbHatch::kDefault, dbObjIds);

    // Elaborate hatch lines
    //
    pHatch->evaluateHatch();

    // Get all associative source boundary object Ids for later use.
    //
    dbObjIds.setLogicalLength(0);
    pHatch->getAssocObjIds(dbObjIds);

    // Post hatch entity to database
    //
    pHatch->postToDb(pHatch, hatchId);

    // Attach hatchId to all source boundary objects for notification.
    //
    AcDbEntity *pEnt;
    int numObjs = dbObjIds.length();
    Acad::ErrorStatus es;
    for (i = 0; i < numObjs; i++) {
        es = acdbOpenAcDbEntity(pEnt, dbObjIds, AcDb::kForWrite);
        if (es == Acad::eOk) {
            pEnt->addPersistentReactor(hatchId);
            pEnt->close();
        }
    }
    return eOk;
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-1-10 10:13:34 | 显示全部楼层
谢谢 binbin ,问题已解决
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-22 07:32 , Processed in 0.174692 second(s), 34 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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