本文整理汇总了C++中AcDbObject类的典型用法代码示例。如果您正苦于以下问题:C++ AcDbObject类的具体用法?C++ AcDbObject怎么用?C++ AcDbObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AcDbObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
void
ArxDbgAppEditorReactor::searchOneDictionary(AcDbDictionary* dict, AcDbObjectIdArray& objIds)
{
// get an iterator over this dictionary
AcDbDictionaryIterator* dictIter = dict->newIterator();
ASSERT(dictIter != NULL);
// walk dictionary and just collect all the entries that are of the
// given type
AcDbObject* obj;
for (; !dictIter->done(); dictIter->next()) {
if (acdbOpenAcDbObject(obj, dictIter->objectId(), AcDb::kForRead) == Acad::eOk) {
if (obj->isKindOf(ArxDbgDbDictRecord::desc())) {
objIds.append(obj->objectId());
}
else if (obj->isKindOf(AcDbDictionary::desc())) {
searchOneDictionary(AcDbDictionary::cast(obj), objIds);
}
obj->close();
}
}
delete dictIter;
dict->close();
}
示例2: addXData
void addXData()
{
// Get an Entity.
ads_name mnEnt;
ads_point ptSel;
int nRet = acedEntSel(_T("\nSelect an Entity: "), mnEnt, ptSel);
if (nRet != RTNORM)
return;
AcDbObjectId oid;
Acad::ErrorStatus retStat;
retStat = acdbGetObjectId(oid, mnEnt);
if (retStat != Acad::eOk)
return;
AcDbObject* pObj = NULL;
if ((retStat = acdbOpenObject(pObj, oid, AcDb::kForRead)) != Acad::eOk)
{
return;
}
// Get new XData.
TCHAR appName[132] = {0};
TCHAR resString[200] = {0};
acedGetString(NULL, _T("\nEnter application name: "), appName);
acedGetString(NULL, _T("\nEnter string to be added: "), resString);
// XData
resbuf *pRb = NULL;
resbuf *pTemp = NULL;
pRb = pObj->xData(appName);
if (pRb != NULL)
{
for (pTemp = pRb; pTemp->rbnext != NULL; pTemp = pTemp->rbnext);
}
else
{
acdbRegApp(appName);
pRb = acutNewRb(AcDb::kDxfRegAppName);
pTemp = pRb;
pTemp->resval.rstring = (TCHAR*)malloc((_tcslen(appName) + 1) * sizeof(TCHAR));
_tcscpy(pTemp->resval.rstring, appName);
}
pTemp->rbnext = acutNewRb(AcDb::kDxfXdAsciiString);
pTemp = pTemp->rbnext;
pTemp->resval.rstring = (TCHAR*)malloc((_tcslen(resString) + 1) * sizeof(TCHAR));
_tcscpy(pTemp->resval.rstring, resString);
// Set XData.
pObj->upgradeOpen();
pObj->setXData(pRb);
pObj->close();
acutRelRb(pRb);
}
示例3: acdbHostApplicationServices
void ArxDictTool::RegDict( const CString& dictName )
{
// 初始化工作,建立存储词典
AcDbDictionary* pNamedobj;
acdbHostApplicationServices()->workingDatabase()->getNamedObjectsDictionary( pNamedobj, AcDb::kForWrite );
AcDbObject* pObj;
Acad::ErrorStatus es = pNamedobj->getAt( dictName, pObj, AcDb::kForRead );
if( Acad::eOk == es )
{
pObj->close();
}
else if( Acad::eKeyNotFound == es )
{
AcDbDictionary* pDict = new AcDbDictionary();
AcDbObjectId dictId;
if( Acad::eOk != pNamedobj->setAt( dictName, pDict, dictId ) )
{
delete pDict;
}
else
{
pDict->close();
}
}
pNamedobj->close();
}
示例4: acdbOpenAcDbObject
bool
ArxDbgUtils::isOnLockedLayer(AcDbEntity* ent, bool printMsg)
{
AcDbObject* obj;
AcDbLayerTableRecord* layer;
bool isLocked = false;
Acad::ErrorStatus es;
es = acdbOpenAcDbObject(obj, ent->layerId(), AcDb::kForRead);
if (es == Acad::eOk) {
layer = AcDbLayerTableRecord::cast(obj);
if (layer)
isLocked = layer->isLocked();
else {
ASSERT(0);
}
obj->close();
}
else {
ASSERT(0);
ArxDbgUtils::rxErrorMsg(es);
}
if (isLocked && printMsg) {
acutPrintf(_T("\nSelected entity is on a locked layer."));
}
return isLocked;
}
示例5: ASSERT
void
ArxDbgUiTdcObjects::displayCurrent(int index)
{
// remove any previous entries
m_fieldStrList.RemoveAll();
m_valueStrList.RemoveAll();
ASSERT((index >= 0) && (index < m_objList.length()));
if(m_objList.length()==0)
return;//done
m_currentObjId = m_objList[index];
CString str;
AcDbObject* obj = NULL;
Acad::ErrorStatus es = acdbOpenObject(obj, m_currentObjId, AcDb::kForRead, true); // might want to show erased
setExtensionButtons(obj);
if (es == Acad::eOk) {
display(obj);
// hide or show the erased entity message
if (obj->isErased())
m_txtErased.ShowWindow(SW_SHOW);
else
m_txtErased.ShowWindow(SW_HIDE);
obj->close();
}
drawPropsList(m_dataList);
}
示例6: if
void
ArxDbgUtils::collectVertices(const AcDbPolyFaceMesh* pface, AcDbObjectIdArray& vfaces, AcGePoint3dArray& pts)
{
AcDbObjectIterator* vertexIter = pface->vertexIterator();
if (vertexIter == NULL)
return;
AcDbFaceRecord* vface;
AcDbPolyFaceMeshVertex* pfaceVertex;
AcDbObject* obj;
// walk through and seperate vfaces and vertices into two
// seperate arrays
Acad::ErrorStatus es;
for (; !vertexIter->done(); vertexIter->step()) {
es = acdbOpenObject(obj, vertexIter->objectId(), AcDb::kForRead);
if (es == Acad::eOk) {
if ((vface = AcDbFaceRecord::cast(obj)) != NULL)
vfaces.append(obj->objectId());
else if ((pfaceVertex = AcDbPolyFaceMeshVertex::cast(obj)) != NULL)
pts.append(pfaceVertex->position());
else {
ASSERT(0);
}
obj->close();
}
else
ArxDbgUtils::rxErrorMsg(es);
}
delete vertexIter;
}
示例7: acdbOpenAcDbObject
BOOL
ArxDbgUiTdcObjects::OnInitDialog()
{
ArxDbgUiTdcDbObjectBase::OnInitDialog();
m_lbObjList.ResetContent();
AcDbObject* obj;
CString str;
Acad::ErrorStatus es;
int len = m_objList.length();
for (int i=0; i<len; i++) {
es = acdbOpenAcDbObject(obj, m_objList[i], AcDb::kForRead, true); // might have passed in erased ones
if (es == Acad::eOk) {
ArxDbgUtils::objToClassAndHandleStr(obj, str);
m_lbObjList.AddString(str);
obj->close();
}
}
m_lbObjList.SetCurSel(0);
buildColumns(m_dataList);
displayCurrent(0);
return TRUE;
}
示例8: removeEntryFromDict
void
removeEntryFromDict(const char* strDictKey, AcDbDictionary* pParent,
const char* strEmpKey)
{
AcDbObjectId idO;
//see if our dictionary is there
ARXOK(pParent->getAt(strDictKey,idO));
//get it for write
AcDbObject* pO;
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForWrite));
//check if someone has else has created an entry with our name
//that is not a dictionary. This should never happen as long as
//I use the registered developer ID.
AcDbDictionary* pEmployeeDict;
if ((pEmployeeDict=AcDbDictionary::cast(pO))==NULL)
throw Acad::eNotThatKindOfClass;
//check if a record with this key isthere
ARXOK(pEmployeeDict->getAt(strEmpKey,idO));
//get it for write
ARXOK(actrTransactionManager->getObject(pO,idO,AcDb::kForWrite));
//and erase it
ARXOK(pO->erase());
//erase dictionary if it has no more entries
if (pParent->numEntries()==0)
ARXOK(pParent->erase());
}
示例9: getAttachedEntities
void
ArxDbgUiTdcObjReactorsBase::displayEntList()
{
m_entsAttached.setLogicalLength(0);
m_lbEntList.ResetContent();
getAttachedEntities(m_entsAttached);
CString str;
Acad::ErrorStatus es;
AcDbObject* obj;
int len = m_entsAttached.length();
for (int i=0; i<len; i++) {
es = acdbOpenAcDbObject(obj, m_entsAttached[i], AcDb::kForRead, true);
if (es == Acad::eOk) {
ArxDbgUtils::objToClassAndHandleStr(obj, str);
if (obj->isErased())
str += _T(" (erased)");
m_lbEntList.AddString(str);
obj->close();
}
}
setButtonModes();
}
示例10: listXrecord
// The listxrecord() functions gets the xrecord associated with the
// key "ASDK_XREC1" and lists out its contents by passing the resbuf
// list to the function printList().
//
void
listXrecord()
{
AcDbObject *pObj;
AcDbXrecord *pXrec;
AcDbObjectId dictObjId;
AcDbDictionary *pDict;
pObj = selectObject(AcDb::kForRead);
if (pObj == NULL) {
return;
}
// Get the object ID of the object's extension dictionary.
//
dictObjId = pObj->extensionDictionary();
pObj->close();
// Open the extension dictionary and get the xrecord
// associated with the key ASDK_XREC1.
//
acdbOpenObject(pDict, dictObjId, AcDb::kForRead);
pDict->getAt("ASDK_XREC1", (AcDbObject*&)pXrec,
AcDb::kForRead);
pDict->close();
// Get the xrecord's data list and then close the xrecord.
//
struct resbuf *pRbList;
pXrec->rbChain(&pRbList);
pXrec->close();
printList(pRbList);
acutRelRb(pRbList);
}
示例11: mapIter
void
ArxDbgAppEditorReactor::verifyClonedReferences(AcDbIdMapping& idMap)
{
ArxDbgDbEntity* ent;
AcDbObject* obj;
Acad::ErrorStatus es;
int numErrorsFixed;
AcDbIdPair idPair;
AcDbIdMappingIter mapIter(idMap);
for (mapIter.start(); !mapIter.done(); mapIter.next()) {
if (mapIter.getMap(idPair)) {
es = acdbOpenObject(obj, idPair.value(), AcDb::kForWrite);
if (es == Acad::eOk) {
ent = ArxDbgDbEntity::cast(obj);
if (ent != NULL) {
es = ent->verifyReferences(numErrorsFixed, true);
if (es != Acad::eOk) {
ASSERT(0);
ArxDbgUtils::rxErrorMsg(es);
obj->erase(); // don't know what else to do but erase screwed up entity
}
}
obj->close();
}
else {
ASSERT(0);
ArxDbgUtils::rxErrorMsg(es);
}
}
else {
ASSERT(0);
}
}
}
示例12: listPline
// This is the main function of this app. It allows the
// user to select an entity. It then checks to see if the
// entity is a 2d-polyline. If so, then it calls iterate
// passing in the objectId of the pline.
//
void
listPline()
{
int rc;
ads_name en;
AcGePoint3d pt;
rc = acedEntSel(_T("\nSelect a polyline: "), en,
asDblArray(pt));
if (rc != RTNORM) {
acutPrintf(_T("\nError during object selection"));
return;
}
AcDbObjectId eId;
acdbGetObjectId(eId, en);
AcDbObject *pObj;
acdbOpenObject(pObj, eId, AcDb::kForRead);
if (pObj->isKindOf(AcDb2dPolyline::desc())) {
pObj->close();
iterate(eId);
} else {
pObj->close();
acutPrintf(_T("\nSelected entity is not an AcDb2dPolyline. \nMake sure the setvar PLINETYPE is set to 0 before createing a polyline"));
}
}
示例13: acdbCurDwg
Acad::ErrorStatus CTwArxDictionary::CreateSubDictionaryID( IN const AcDbObjectId& IdRoot, IN const CString& strKey, OUT AcDbObjectId& IdSubDic, IN AcRxClass* pRxObjType /*= AcDbDictionary::desc() */ ) const
{
if( pRxObjType == NULL ) return Acad::eNullObjectPointer;
Acad::ErrorStatus es = Acad::eOk;
AcDbDictionary* pDicRoot = NULL;
AcDbDatabase* pWdb = acdbCurDwg();
if( IdRoot.isNull() )
es = pWdb->getNamedObjectsDictionary( pDicRoot, AcDb::kForRead );
else
es = acdbOpenObject( pDicRoot, IdRoot, AcDb::kForRead );
if( es != Acad::eOk ) return es;
if( pDicRoot->has(strKey) )
{
pDicRoot->getAt( strKey, IdSubDic );
pDicRoot->close();
return es;
}
pDicRoot->upgradeOpen();
AcDbObject* pObj = (AcDbObject*)pRxObjType->create();
es = pDicRoot->setAt( strKey, pObj, IdSubDic );
pObj->close();
pDicRoot->close();
return es;
}
示例14:
void ArxEntityHelper::EraseObject2( const AcDbObjectId& objId, Adesk::Boolean erasing )
{
AcDbObject* pObj;
if( Acad::eOk == acdbOpenAcDbObject( pObj, objId, AcDb::kForWrite, !erasing ) )
{
pObj->erase( erasing );
pObj->close();
//acutPrintf(_T("\n使用Open/close机制删除对象成功"));
}
}
示例15: getLinkedGE
LinkedGE* VentCaculate::getLinkedGE(AcDbObjectId objId)
{
AcDbObject* pObj;
acdbOpenObject( pObj, objId, AcDb::kForRead );
LinkedGE* pEdge = LinkedGE::cast( pObj );
pObj->close();
return pEdge;
}