找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 677|回复: 0

[ARX函数]:选择指定图层的pline线进行填充(源码-交流)

[复制链接]
发表于 2006-3-14 16:08:05 | 显示全部楼层 |阅读模式

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

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

×
程序编译通过,可CAD执行时出现错误,
请朋友门一起来看看,帮助一下
void Myfl()
{

        ads_name ents;
        long entNums;
        struct resbuf *rb1;

        rb1 = acutBuildList(RTDXF0,"pline",8,"0",6,"continuous",RTNONE);
        acedSSGet("X",NULL,NULL,rb1,ents);
        acutRelRb(rb1); //don't forget
        acedSSLength(ents,&entNums);

        AcDbObjectIdArray dbObjIds;

        if (entNums != 0)
                {
                        for (long a = 0; a < entNums ; a ++)
                        {
                                AcDbObjectId  objId;
                                ads_name      ent;
                                AcDbHatch* pHatch=new AcDbHatch();
                                acedSSName(ents,a,ent);
                                acdbGetObjectId(objId, ent);
                                dbObjIds.append(objId);
                                               
                        }
                }
                acedSSFree(ents);
                acutRelRb(rb1);
       

        AcDbHatch* pHatch = new AcDbHatch();
        AcDbObjectId hatchId;
    // 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->setPattern(AcDbHatch::kPreDefined, "ANSI31");

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


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


    // 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);
        long i=0;
        AcDbBlockTable * pDbBT;
        AcDbBlockTableRecord * pDbBTR;
        AcDbDatabase * pDbDatab = acdbHostApplicationServices()->workingDatabase();
        pDbDatab->getSymbolTable(pDbBT, AcDb::kForRead);
        pDbBT->getAt(ACDB_MODEL_SPACE, pDbBTR, AcDb::kForWrite);

    // 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){
                        pDbBTR->appendAcDbEntity(dbObjIds, pHatch);
                }         
    }
        pDbBT->close();
        pDbBTR->close();
        pHatch->close();
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-9-22 01:52 , Processed in 0.235853 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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