本文整理汇总了C++中AcDbEntity::close方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbEntity::close方法的具体用法?C++ AcDbEntity::close怎么用?C++ AcDbEntity::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbEntity
的用法示例。
在下文中一共展示了AcDbEntity::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _extract_vertices_from_lines
void frgExtractTopologicalEntsFromLinesAlgm::_extract_vertices_from_lines(std::vector<Vertex2dsOnSegment2d> &seg_pnts_pairs,
const AcDbObjectIdArray &ids)
{
AcDbEntity *entity = NULL;
acedSetStatusBarProgressMeter(_T("正在提取每根线段上的节点..."), 0, ids.length());
for (int i = 0; i < ids.length(); i++)
{
acdbOpenAcDbEntity(entity, ids[i], AcDb::kForRead);
if (entity == NULL)
continue;
if (entity->isA() != AcDbLine::desc())
{
entity->close();
continue;
}
AcDbLine *line = (AcDbLine *)entity;
Vertex2dsOnSegment2d stru;
stru.seg.set(AcGePoint2d(line->startPoint().x, line->startPoint().y),
AcGePoint2d(line->endPoint().x, line->endPoint().y));
entity->close();
_extract_from_seg(stru);
seg_pnts_pairs.push_back(stru);
acedSetStatusBarProgressMeterPos(i);
}
acedRestoreStatusBar();
}
示例2: addXdata
void Additional_Class::addXdata( AcDbObjectId entID, CString xdataStr, CString xdataNameStr )
{
AcDbEntity * pEnt;
struct resbuf * pRb;
if(Acad::eOk != acdbOpenAcDbEntity(pEnt, entID, AcDb::kForWrite))
{
pEnt->close();
return;
}
TCHAR * tempTchar = CString2TCHAR(xdataNameStr);
//TCHAR strAppName[] = tempTchar;
acdbRegApp(tempTchar);
TCHAR * typeName = CString2TCHAR(xdataStr);
struct resbuf * pTemp;
pTemp = pEnt->xData(tempTchar);
pRb = acutBuildList(AcDb::kDxfRegAppName, tempTchar,
AcDb::kDxfXdAsciiString, typeName,
RTNONE);
pEnt->setXData(pRb);
acutRelRb(pRb);
pEnt->close();
return;
}
示例3: _extract_from_seg
void frgExtractTopologicalEntsFromLinesAlgm::_extract_from_seg(Vertex2dsOnSegment2d &stru)
{
// - 获取相关的线段(相交、重合)
AcDbObjectIdArray ids;
_search_related_segs(ids, stru.seg);
// - 分为两类进行处理:相交和重叠
// -- 增加起点和终点
rlVertex2d *v = NULL;
stru.vertex2ds.insert(std::make_pair(0.0, v));
stru.vertex2ds.insert(std::make_pair(1.0, v));
// -- 处理每一个线段
AcDbEntity *entity = NULL;
for (int i = 0; i < ids.length(); i++)
{
acdbOpenAcDbEntity(entity, ids[i], AcDb::kForRead);
if (entity == NULL)
continue;
if (entity->isA() != AcDbLine::desc())
{
entity->close();
continue;
}
AcDbLine *_line = (AcDbLine *)entity;
AcGeLineSeg2d _seg(AcGePoint2d(_line->startPoint().x, _line->startPoint().y),
AcGePoint2d(_line->endPoint().x, _line->endPoint().y));
_line->close();
_extract_vertices(stru, _seg);
}
}
示例4: FindLinesByPoint
// 查找连接点junctionPt关联的分支图元(包含隐形的图元)
static void FindLinesByPoint( const AcGePoint3d& junctionPt, AcDbObjectIdArray& objIds )
{
AcDbBlockTable* pBlkTbl;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable( pBlkTbl, AcDb::kForRead );
AcDbBlockTableRecord* pBlkTblRcd;
pBlkTbl->getAt( ACDB_MODEL_SPACE, pBlkTblRcd, AcDb::kForRead );
pBlkTbl->close();
AcDbBlockTableRecordIterator* pBlkTblRcdItr;
pBlkTblRcd->newIterator( pBlkTblRcdItr );
for ( pBlkTblRcdItr->start(); !pBlkTblRcdItr->done(); pBlkTblRcdItr->step() )
{
// 不采用transaction的方法查找LinkedGE,
// 等价于排除当前正在以write状态编辑的LinkedGE
// 重要(***)
AcDbEntity* pEnt = 0;
if( Acad::eOk != pBlkTblRcdItr->getEntity( pEnt, AcDb::kForRead ) ) continue;
LinkedGE* pEdge = LinkedGE::cast( pEnt );
if( pEdge != 0 )
{
AcGePoint3d startPt, endPt;
pEdge->getSEPoint( startPt, endPt );
if( startPt == junctionPt || endPt == junctionPt )
{
objIds.append( pEdge->objectId() );
}
}
pEnt->close();
}
delete pBlkTblRcdItr;
pBlkTblRcd->close();
}
示例5: OnInitDialog
BOOL CDetailShow::OnInitDialog()
{
CAcUiDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
long len = m_objIds.length();
//取得选择集的长度
//遍历选择集中的实体,将其打开并修改其颜色为红色
for (int i =0;i<len;i++)
{
ads_name entres;
AcDbObjectId objId;
AcDbEntity *obj;
Acad::ErrorStatus es;
es = acdbOpenAcDbEntity(obj, m_objIds[i], AcDb::kForRead, true);
if (es == Acad::eOk) {
LPCTSTR str;
str = obj->isA()->name();
m_listBox.AddString(str);
obj->close();
}
}
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
示例6: acutPrintf
// This function has the user select an entity and then
// calls the reflectedEnergy() function in the protocol
// extension class attached to that entity's class.
//
void
energy()
{
AcDbEntity *pEnt;
AcDbObjectId pEntId;
ads_name en;
ads_point pt;
if (acedEntSel("\nSelect an Entity: ", en, pt)
!= RTNORM)
{
acutPrintf("Nothing Selected\n");
return;
}
acdbGetObjectId(pEntId, en);
acdbOpenObject(pEnt, pEntId, AcDb::kForRead);
// call the protocol extension class's method
//
double eTemp = ACRX_X_CALL(pEnt,
AsdkEntTemperature)->reflectedEnergy(pEnt);
acutPrintf("\nEnergy == %f\n", eTemp);
pEnt->close();
}
示例7: readDatabase
void readDatabase()
{
// Use kFalse to create an empty database.
AcDbDatabase *pDb = new AcDbDatabase(Adesk::kFalse);
// Use readDwgFile to load the DWG file.
acutPrintf(_T("\nRead file \"d:\\temp\\testfile.dwg\"."));
if(Acad::eOk != pDb->readDwgFile(_T("d:\\temp\\testfile.dwg")))
return;
// Get the BlockTable.
AcDbBlockTable *pBTable = NULL;
pDb->getSymbolTable(pBTable, AcDb::kForRead);
// Get the ModelSpace.
AcDbBlockTableRecord *pRecord = NULL;
pBTable->getAt(ACDB_MODEL_SPACE, pRecord, AcDb::kForRead);
pBTable->close();
// Get new iterator.
AcDbBlockTableRecordIterator *pItr = NULL;
pRecord->newIterator(pItr);
AcDbEntity *pEnt = NULL;
for (pItr->start(); !pItr->done(); pItr->step())
{
pItr->getEntity(pEnt, AcDb::kForRead);
acutPrintf(_T("\nclassname: %s"), (pEnt->isA())->name());
pEnt->close();
}
pRecord->close();
delete pItr;
delete pDb;
}
示例8: CopyBack
static void CopyBack( AcDbEntity* pSrcEnt, const AcDbObjectId& objId )
{
AcDbEntity* pEnt;
acdbOpenAcDbEntity( pEnt, objId, AcDb::kForWrite );
pEnt->copyFrom( pSrcEnt );
pEnt->close();
}
示例9:
// 使用常规的Open/Close机制
static void UpdateEntity2( const AcDbObjectId& objId )
{
AcDbEntity* pEnt;
if( Acad::eOk != acdbOpenObject( pEnt, objId, AcDb::kForWrite ) ) return;
pEnt->recordGraphicsModified( true ); // 标签图元状态已修改,需要更新图形
pEnt->close();
}
示例10: Get_Xdata
CString Additional_Class::Get_Xdata(AcDbObjectId EntID, CString Xdata_Ref )
{
AcDbEntity *pEnt;
acdbOpenAcDbEntity(pEnt, EntID, AcDb::kForRead);
struct resbuf *pRb;
pRb = pEnt->xData(Xdata_Ref);
if (pRb != NULL)
{
struct resbuf *pTemp;
pTemp = pRb;
pTemp = pTemp->rbnext;
pEnt->close();
return pTemp->resval.rstring;
}
acutRelRb(pRb);
pEnt->close();
return "";
}
示例11: AsdkSelectionFilterUI_SubentSel
// ----- AsdkSelectionFilterUI.SubentSel command (do not rename)
static void AsdkSelectionFilterUI_SubentSel(void)
{
// we have to allow duplicates; otherwise, the xref would be selectable
// only once (because the main entity is the one that counts).
setAllowDuplicateSelection(curDoc(), true);
ads_name sset, eName;
AcDbObjectId id;
// "_:n" gives us nested entities
//
if (RTNORM == acedSSGet("_:n", NULL, NULL, NULL, sset))
{
acutPrintf("\n");
long len = 0;
acedSSLength(sset, &len);
for (long i = 0; i < len; i++)// For each entity in sset
{
resbuf *rb = NULL;
// We use ssnamex() here, because the regular ssname()
// would give only the main entity (the xref)
//
if (RTNORM == acedSSNameX(&rb, sset, i))//Get the sub entity
{
resbuf *rbWalk = rb;
while (NULL != rbWalk)
{
if (RTENAME == rbWalk->restype)
{
eName[0] = rbWalk->resval.rlname[0];
eName[1] = rbWalk->resval.rlname[1];
if(Acad::eOk == acdbGetObjectId(id, eName))
{
acutPrintf("Entity %d: <%x>", i, id.asOldId());
AcDbEntity *pEnt;
if (Acad::eOk == acdbOpenObject(pEnt, id, AcDb::kForRead))
{
acutPrintf("(%s)\n", pEnt->isA()->name());
pEnt->close();
}
else
acutPrintf("\nCouldn't open object");
}
rbWalk = NULL; //force quit out of loop
}
else
rbWalk = rbWalk->rbnext;
}
acutRelRb(rb);
}
}
acedSSFree(sset);
}
setAllowDuplicateSelection(curDoc(), false);
}
示例12: acutPrintf
//-------------------------------------------------------------------------------------------
//
// 功能: 将从AcDbObject派生数据库对象保存到实体的扩展词典中
//
// 作者:Qin H.X.
//
// 日期:200709
//
// 历史:
// 2007.10.08 修改 by Qin H.X.
//
//----------------------------------------------------------------------------------------------
// - CSCH081.AddAttribute command (do not rename)
static void CSCH081AddAttribute(void)
{
AcDbObjectId dictObjId,eId, attId;
AcDbDictionary* pDict;
//选择管道(多义线)
ads_name en;
ads_point pt;
if ( acedEntSel(_T("\n选择管道(多义线): "), en, pt)!= RTNORM)
{
acutPrintf(_T("\n选择失败,退出: "));
return ;
}
// 打开对象
acdbGetObjectId(eId, en);
AcDbEntity * pEnt;
acdbOpenObject(pEnt, eId, AcDb::kForWrite);
if(!pEnt->isKindOf (AcDbPolyline::desc ()))
{
acutPrintf(_T("\n选择的不是管道(多义线),退出: " ));
return ;
}
// 判断实体的扩展词典是否创建,如果没有则创建
dictObjId = pEnt->extensionDictionary();
if( dictObjId == AcDbObjectId::kNull )
{
pEnt->createExtensionDictionary();
}
// 获取实体的扩展词典
dictObjId = pEnt->extensionDictionary();
pEnt->close();
// 判断词典中的属性是否创建
CPipeAttribute* pAttribute;
acdbOpenObject(pDict, dictObjId, AcDb::kForWrite);
pDict->getAt (_T("属性"),attId);
if(attId!= AcDbObjectId::kNull )//如果已经创建则输出数据
{
acdbOpenObject(pAttribute, attId, AcDb::kForRead);
acutPrintf(_T("\n管径:%4.2f " ),pAttribute->m_dRadius);
acutPrintf(_T("\n壁厚:%4.2f " ),pAttribute->m_dThickness );
acutPrintf(_T("\n埋深:%4.2f " ),pAttribute->m_dDeep );
acutPrintf(_T("\n材质:%s " ),pAttribute->m_cMaterial );
}
else
{
//没有则创建属性
pAttribute = new CPipeAttribute();
pDict->setAt(_T("属性"), pAttribute, attId);
}
//关闭对象
pDict->close();
pAttribute->close();
}
示例13:
CCadEntity * CCadEntityFactory::GetCadEntity(AcDbObjectId & idEntity)
{
AcDbEntity * entity = 0;
if (acdbOpenObject(entity, idEntity, AcDb::kForRead) != Acad::eOk) return 0;
CCadEntity * cadEntity = CCadEntityFactory::GetCadEntity(entity);
entity->close();
return cadEntity;
}
示例14: canBeSelected
bool MySSGetFilter::canBeSelected(AcDbObjectId id) const
{
bool ans = true;
AcDbEntity * pEnt;
if (acdbOpenAcDbEntity(pEnt, id, AcDb::kForRead) == Acad::eOk) {
ans = canBeSelected(pEnt);
pEnt->close();
}
return ans;
}
示例15: FilterDb
//0,不显示属性,1,显示属性,2,显示属性默认值
void CZhfPalette::FilterDb(AcDbDatabase* pDb, int iFilterMode)
{
if (iFilterMode==1)
{
return ;
}
Acad::ErrorStatus es ;
AcDbBlockTable* pBT = NULL ;
pDb->getBlockTable(pBT, AcDb::kForRead);
AcDbBlockTableRecord* pBTR = NULL;
es = pBT->getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForWrite);
pBT->close();
AcDbBlockTableRecordIterator* pIT;
es = pBTR->newIterator(pIT) ;
for (; !pIT->done(); pIT->step())
{
AcDbEntity* pEnt = NULL ;
if (Acad::eOk==pIT->getEntity(pEnt, AcDb::kForWrite))
{
if (pEnt->isKindOf(AcDbAttributeDefinition::desc()))
{
AcDbAttributeDefinition *pAttDef = AcDbAttributeDefinition::cast(pEnt);
if (iFilterMode==0)
{
pEnt->erase() ;
}
else if (iFilterMode>1)
{
if (pAttDef != NULL && !pAttDef->isConstant())
{
// We have a non-constant attribute definition,
// so build an attribute entity.
CString strShowVal ;
if (iFilterMode==2)
{
strShowVal = pAttDef->textString() ;
}
else if (iFilterMode==3)
{
strShowVal = pAttDef->prompt() ; //显示中文为乱码
}
pAttDef->setTag(strShowVal) ;
}
}
}
pEnt->close() ;
}
}
delete pIT;
pBTR->close();
}