singlewolf 发表于 2005-1-7 10:09:00

高手帮忙,由块名得到块中属性的值

给定一个块名,得到该块中所有属性的值,请大家帮忙啊。谢谢

singlewolf 发表于 2005-1-11 16:42:00

怎么没人帮我啊5555555555

singlewolf 发表于 2005-1-11 16:44:00

help me master

singlewolf 发表于 2005-1-13 09:47:00

快来帮帮我吧,急

王咣生 发表于 2005-1-13 16:30:00

使用AcDbBlockReferenceIterator
帮你找个例子,wait...

singlewolf 发表于 2005-1-21 16:28:00

To 王咣生
找到例子了吗?
谢谢

singlewolf 发表于 2005-1-25 10:26:00

怎么还没消息啊。我急啊

王咣生 发表于 2005-1-25 13:04:00


                       static void ExtractAttributes()
                       {
                                                       ads_name ename;
                                                       ads_point pt;
                                                       
                if(ads_entsel("\nSelect an block: ", ename, pt) != RTNORM)
                {
                        ads_printf("\nError selecting entity.");               
                        return;                       
                }
                                                                                                                                       
                AcDbObjectId eId;               
                acdbGetObjectId(eId, ename);
                AcDbEntity* pEnt = NULL;                if (acdbOpenObject(pEnt, eId , AcDb::kForRead) != Acad::eOk)
                {       
                        ads_printf("\nError opening entity.");
                        if(pEnt)
                                pEnt->close();
                        return;
                }
                                                                                                                                       
                if(pEnt->isA() != AcDbBlockReference::desc())
                                                       {
                        ads_printf("\nMust select a block insert.");
                        pEnt->close();
                        return;
                                                       }                AcDbBlockReference *pBlkRef = AcDbBlockReference::cast(pEnt);
                                                       AcDbAttribute *pAtt = NULL;
                                                       AcDbObjectIterator *pAttIter = pBlkRef->attributeIterator();                                                       _TCHAR tagName, strValue;                for (pAttIter->start(); !pAttIter->done(); pAttIter->step())
                                                       {
                        acdbOpenObject(pAtt, pAttIter->objectId(), AcDb::kForRead);
                        // get the tag string
                        _tcscpy(tagName, pAtt->tag());
                        ads_printf("\nBlock Insert Attribute tag is: %s", tagName);
                        _tcscpy(strValue, pAtt->textString());
                        ads_printf("\nBlock Insert Attribute string value is: %s",
                                                       
                                strValue);
                        pAtt->close();
                }
                delete pAttIter;
                pBlkRef->close();
        }
页: [1]
查看完整版本: 高手帮忙,由块名得到块中属性的值