|
[code]//-----------------------------------------------------------------------------
//----- acrxEntryPoint.cpp
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"
//-----------------------------------------------------------------------------
#define szRDS _RXST("")
//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
class CGroupExplodeApp : public AcRxArxApp {
public:
CGroupExplodeApp() : AcRxArxApp() {}
virtual AcRx::AppRetCode On_kInitAppMsg(void* pkt) {
AcRx::AppRetCode retCode = AcRxArxApp::On_kInitAppMsg(pkt);
return (retCode);
}
virtual AcRx::AppRetCode On_kUnloadAppMsg(void* pkt) {
AcRx::AppRetCode retCode = AcRxArxApp::On_kUnloadAppMsg(pkt);
return (retCode);
}
virtual void RegisterServerComponents() { }
static void RivilisGroupExplode()
{
AcString groupName;
if (acedGetString(FALSE, _T("\nИмя группы для расчленения: "), groupName) != RTNORM)
return;
AcDbObjectId idGroupDict = acdbCurDwg()->groupDictionaryId();
AcDbDictionaryPointer pGroupDict(idGroupDict, AcDb::kForWrite);
if (pGroupDict.openStatus() == Acad::eOk)
{
AcDbObjectId idGroup;
if (pGroupDict->getAt(groupName, idGroup) == Acad::eOk)
{
AcDbObjectPointer<AcDbGroup> pGroup(idGroup, AcDb::kForWrite);
if (pGroup.openStatus() == Acad::eOk)
{
if (pGroup->numEntities() > 0) pGroup->clear();
pGroup->erase();
}
}
else
{
acutPrintf(_T("\nГруппа '%s' не найдена в этом файле"), groupName.kACharPtr());
}
}
}
};
//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(CGroupExplodeApp)
ACED_ARXCOMMAND_ENTRY_AUTO(CGroupExplodeApp, Rivilis, GroupExplode, GroupExplode, ACRX_CMD_MODAL, NULL)[/code] |
|