CAD drawOrder
2008-06-05 14:31
sortens.cpp
#include "StdAfx.h"
#include "StdArx.h"
dundas#include "sorttab.h"
#include "Sortens.h"
AcDbSortentsTable* get_sortents_table_of(AcDbEntity *pEnt)
{
AcDbObjectId owner_id = pEnt->ownerId();
if (AcDbObjectId::kNull == owner_id)
return NULL;
AcDbBlockTableRecord *pRec;
if (Acad::eOk != acdbOpenObject( pRec, owner_id, AcDb::kForRead ))
return NULL;
AcDbObjectId ext_id = pRec->extensionDictionary();
if (AcDbObjectId::kNull == ext_id)
{
if (Acad::eOk != pRec->upgradeOpen())
{
pRec->clo();
return NULL;
}
pRec->createExtensionDictionary();
ext_id = pRec->extensionDictionary();
if (AcDbObjectId::kNull == ext_id)
{
pRec->clo();
沈阳新航道return NULL;
}
}
AcDbDictionary *pExt;
Acad::ErrorStatus es = acdbOpenObject( pExt, ext_id, AcDb::kForRead );
pRec->clo();
passacagliaif (Acad::eOk != es)
return NULL;
AcDbObject *pObj;
if (Acad::eOk != pExt->getAt( "ACAD_SORTENTS", pObj, AcDb::kForWrite ))
{
if (Acad::eOk != pExt->upgradeOpen())
{
pExt->clo();
honorific
return NULL;
}
AcDbSortentsTable *pSt = new AcDbSortentsTable;
if (NULL == pSt)
{
pExt->clo();
return NULL;
}
AcDbObjectId new_id;
if (Acad::eOk != pExt->tAt( "ACAD_SORTENTS", pSt, new_id ))
{
delete pSt;
pExt->clo();
return NULL;
}
pSt->tBlockId( owner_id );
pObj = pSt;
}
pExt->clo();
if (!pObj->isKindOf( AcDbSortentsTable::desc() ))
{
pObj->clo();
return NULL;
}
return (AcDbSortentsTable*)pObj;
}
void tSortentsBits( int bits )
{
resbuf rb;
acedSetVar( "SORTENTS", &rb );
暑假英语日记}
void configureSortents()
{
world peace
resbuf rb;
const int nSortentsMask = (1 | 2 | 4 | 8 | 16 | 32 | 64);
acedGetVar( "SORTENTS", &rb );
高考录取分数线2013if (nSortentsMask != (rb.resval.rint & nSortentsMask))
tSortentsBits( rb.resval.rint | nSortentsMask );
}dermes
void MSSendBack(AcDbObjectId ent_id)
{
configureSortents();
AcDbEntity *pEnt;
if (Acad::eOk != acdbOpenObject( pEnt, ent_id, AcDb::kForRead ))
return;
AcDbSortentsTable *pSt = get_sortents_table_of( pEnt );
pEnt->clo();
if (NULL == pSt)drugstore
return;
AcDbObjectIdArray entity_array;
entity_array.append( ent_id );
pSt->moveToBottom(entity_array);
pSt->clo();
}
sortens.h
/
//////////////////////// ////////////////////////////////////////////
/////////////////Sortens.h////// /////////////////////////////////////
#include "sorttab.h"
AcDbSortentsTable* get_sortents_table_of(AcDbEntity *pEnt);
void tSortentsBits( int bits );
void configureSortents();
void MSSendBack(AcDbObjectId ent_id);
how to u sample:
//lect all object on this layer
ads_name ssname1;
struct resbuf *eb1;
ads_name ename;
eb1 = acutBuildList(-4, "", -4, "", -4, "or>", 0);
//lect single objects
acedSSGet("X", NULL, NULL, eb1, ssname1);
//for acedSSGet
long ilast;
// Find the index of the last entity in st.
acedSSLength(ssname1, &ilast);
AcDbObjectId SolidId;
AcDbObjectId
stomachArray IdArray;
for( int i = 0; i < ilast; i++)
{
acedSSName(ssname1, 0, ename );
// Get the inrt's block table record and compare its name
// to make sure we've got the right block. If so, t the layer
if (acdbGetObjectId(SolidId, ename) == Acad::eOk)
MSSendBack(SolidId);
}