984 lines
23 KiB
C++
984 lines
23 KiB
C++
//-------------------------------------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TArchCmdReactor 类
|
|
// = Version : ver2.0
|
|
// = Author : wlw
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: TArchCmdReactor 定义
|
|
// = Maintainers:
|
|
//
|
|
//-------------------------------------------------------------------------------------------------------+
|
|
#include "StdAfx.h"
|
|
#include "TArchCmdReactor.h"
|
|
#include "TPushMemVar.h"
|
|
#include "dbconfig.h"
|
|
#include "DbCamera.h"
|
|
#include "TEntityBase.h"
|
|
#include "TAcDbObjectPtr.h"
|
|
#include "winuser.h"
|
|
#include "symdef.h"
|
|
#include "DbSpace.h"
|
|
#include "TDbSectionPathSign.h"
|
|
|
|
TArchCmdReactor * TArchCmdReactor::g_pCmdReactor = NULL;
|
|
BOOL TArchCmdReactor::s_bLayerChanged = FALSE;
|
|
BOOL TArchCmdReactor::s_bUpdateMaterial = FALSE;
|
|
extern void InitBlockInsertIds(BOOL bCmdEnd);
|
|
|
|
// sg add 100126,增加楼层框图层
|
|
AcDbObjectId TArchCmdReactor::g_idFloorRectLayer = AcDbObjectId::kNull;
|
|
|
|
TArchCmdReactor::TArchCmdReactor()
|
|
{
|
|
assert(g_pCmdReactor == NULL);
|
|
g_pCmdReactor = this;
|
|
s_bLayerChanged = FALSE;
|
|
}
|
|
|
|
TArchCmdReactor::~TArchCmdReactor()
|
|
{
|
|
}
|
|
|
|
// 建立墙体命令的监测
|
|
void TArchCmdReactor::Attach()
|
|
{
|
|
if (!g_pCmdReactor)
|
|
{
|
|
acedEditor->addReactor(new TArchCmdReactor());
|
|
}
|
|
}
|
|
|
|
// 除去墙体命令的监测
|
|
void TArchCmdReactor::Detach()
|
|
{
|
|
if (g_pCmdReactor)
|
|
{
|
|
acedEditor->removeReactor(g_pCmdReactor);
|
|
delete g_pCmdReactor;
|
|
g_pCmdReactor = NULL;
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::UpdateCorners(){}
|
|
void TArchCmdReactor::UpdateOpenings(){}
|
|
void TArchCmdReactor::UpdateWalls(){}
|
|
void TArchCmdReactor::UpdateClip(){}
|
|
void TArchCmdReactor::UpdateRegion(){}
|
|
void TArchCmdReactor::UpdateAssocGraphic(){}
|
|
void TArchCmdReactor::ResetAll(){}
|
|
void TArchCmdReactor::AddModifiedClip(const AcDbObjectId &id){}
|
|
|
|
void TArchCmdReactor::beginDoubleClick(const AcGePoint3d & clickPoint)
|
|
{
|
|
PickSet ss(SS_FREE);
|
|
RBList mask(RTDXF0,_T("ATS_*"),NULL);
|
|
ss.Get(_T("I"),NULL,NULL,mask);
|
|
BOOL bFlag = FALSE;
|
|
AecObjectEditMethod func(NULL);
|
|
if(ss.Length()==1)
|
|
{
|
|
OPENOBJ_BEGIN(ss[0L], AcDb::kForRead, TDbEntity, pEnt);
|
|
if(pEnt)
|
|
func = pEnt->GetEditMethod();
|
|
OPENOBJ_END();
|
|
|
|
OPENOBJ_BEGIN(ss[0L], AcDb::kForRead, TDbCurveEntity, pEnt);
|
|
if(pEnt)
|
|
func = pEnt->GetEditMethod();
|
|
OPENOBJ_END();
|
|
|
|
if(func)
|
|
{
|
|
AcDbObjectId id;
|
|
if (acdbGetObjectId(id, (TLong_ptr*)ss[0L]) == Acad::eOk)
|
|
{
|
|
TDocLock lock;
|
|
func(id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
// 登记发生变化的墙角
|
|
void TArchCmdReactor::AddWallCorners(TDbWall *pWall)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->AddWallCorners(pWall);
|
|
}
|
|
}
|
|
|
|
// 登记发生变化的柱子
|
|
void TArchCmdReactor::AddChangedColumn(TDbColumn *pColumn)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->AddChangedColumn(pColumn);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::AddModifiedOpening(const AcDbObjectId &id)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->AddModifiedOpening(id);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::AddModifiedWall(const AcDbObjectId &id)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->AddModifiedWall(id);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::AddModifiedClip(const AcDbObjectId &id)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->AddModifiedClip(id);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::AddModifiedClipped(const AcDbObjectId &id)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->AddModifiedClipped(id);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::AddModifiedRegion(const AcDbObjectId &id)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->AddModifiedRegion(id);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::ResetAll()
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->ResetDocCmdGlobals();
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::lispWillStart(const TCHAR * firstLine)
|
|
{
|
|
DocSetIsAcadIdle(FALSE);
|
|
if (firstLine && _tcslen(firstLine) >= 3)
|
|
{
|
|
TCString sLispExpr;
|
|
sLispExpr = firstLine;
|
|
_tcsupr(sLispExpr);
|
|
if (sLispExpr[1] == _T('C') && sLispExpr[2] == _T(':'))
|
|
{
|
|
TCHAR &cLast = sLispExpr[sLispExpr.Length()-1]; // remove right _T(')')
|
|
cLast = EOS;
|
|
BeginUserCommand(&sLispExpr[3], FALSE);
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
pData->m_bLispCommand = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 忽略改变比例的命令
|
|
void TArchCmdReactor::lispEnded()
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
ASSERT(pData);
|
|
if (pData)
|
|
{
|
|
TCString sCmdNames;
|
|
VERIFY(TGGetVar(_T("CMDNAMES"), sCmdNames) == RTNORM);
|
|
if (!sCmdNames)
|
|
{
|
|
if (pData->m_bLispCommand)
|
|
{
|
|
if (_tcsicmp(g_szLastCommand, _T("TCHSCALE")) != 0)
|
|
{
|
|
EndUserCommand(g_szLastCommand, FALSE);
|
|
}
|
|
}
|
|
pData->m_bLispCommand = FALSE;
|
|
DocSetIsAcadIdle(TRUE);
|
|
ClearKeyboardBuffer();
|
|
}
|
|
else
|
|
{
|
|
pData->m_bLispCommand = FALSE;
|
|
}
|
|
|
|
pData->UpdateExtend(false);
|
|
}
|
|
}
|
|
void TArchCmdReactor::lispCancelled()
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
if (pData != NULL)
|
|
{
|
|
pData->UpdateExtend(false);
|
|
}
|
|
}
|
|
|
|
// 命令开始时初始化
|
|
// to do: 如何判断一个用户命令的真正开始
|
|
void TArchCmdReactor::commandWillStart(const TCHAR * cmdStr)
|
|
{
|
|
int nCmdActive = 0;
|
|
TGGetVar(_T("CMDACTIVE"), &nCmdActive);
|
|
if (nCmdActive == 1)
|
|
{
|
|
#ifdef TASD
|
|
//清空消息容器
|
|
RemoveAllMsg();
|
|
#endif
|
|
DocSetIsAcadIdle(FALSE);
|
|
BeginUserCommand(cmdStr, TRUE);
|
|
}
|
|
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
if (pData != NULL)
|
|
{
|
|
pData->m_sCurCommand = cmdStr;
|
|
}
|
|
|
|
ClearKeyboardBuffer();
|
|
}
|
|
|
|
void TArchCmdReactor::commandCancelled(const TCHAR * cmdStr)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
|
|
int nCmdActive = 0;
|
|
TGGetVar(_T("CMDACTIVE"), &nCmdActive);
|
|
|
|
if (nCmdActive == 1)
|
|
{
|
|
//add by xlc on 110304 解决弧墙上的门窗移动复制时飞线问题
|
|
CString sTemp(cmdStr);
|
|
sTemp.MakeUpper();
|
|
bool bMove = sTemp.Find(_T("MOVE")) >= 0;
|
|
bool bCopy = sTemp.Find(_T("COPY")) >= 0;
|
|
if (bMove || bCopy)
|
|
{
|
|
EndUserCommand(cmdStr, TRUE);
|
|
}
|
|
|
|
g_ssPickFirst.Free();
|
|
DocSetIsAcadIdle(TRUE);
|
|
}
|
|
ClearKeyboardBuffer();
|
|
if (pData != NULL)
|
|
{
|
|
pData->m_sCurCommand[0] = 0;
|
|
}
|
|
if (cmdStr && _tcsicmp(cmdStr, _T("PLOT")) == 0 || _tcsicmp(cmdStr, _T("PREVIEW")) == 0)
|
|
{
|
|
PostPlot();
|
|
}
|
|
|
|
if (pData != NULL)
|
|
{
|
|
bool bRefreshAll = _tcsicmp(cmdStr,_T("BCLOSE")) == 0 || _tcsicmp(cmdStr,_T("BEDIT")) == 0;
|
|
pData->UpdateExtend(bRefreshAll);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::commandFailed(const TCHAR * cmdStr)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
|
|
int nCmdActive = 0;
|
|
TGGetVar(_T("CMDACTIVE"), &nCmdActive);
|
|
if (nCmdActive == 1)
|
|
{
|
|
g_ssPickFirst.Free();
|
|
DocSetIsAcadIdle(TRUE);
|
|
}
|
|
|
|
#if ADS>16
|
|
if (_tcsicmp(cmdStr,_T("GRIP_STRETCH")) == 0)
|
|
EndUserCommand(cmdStr,TRUE);
|
|
#endif
|
|
|
|
ClearKeyboardBuffer();
|
|
|
|
if (pData != NULL)
|
|
{
|
|
pData->m_sCurCommand[0] = 0;
|
|
|
|
bool bRefreshAll = _tcsicmp(cmdStr,_T("BCLOSE")) == 0 || _tcsicmp(cmdStr,_T("BEDIT")) == 0;
|
|
pData->UpdateExtend(bRefreshAll);
|
|
}
|
|
}
|
|
// 命令结束时,更新墙角
|
|
// ACAD Bug: 当命令结束时还有没有close的实体, 因此可能需要强制close
|
|
// to do: 如何判断一个用户命令的真正结束
|
|
void TArchCmdReactor::commandEnded(const TCHAR *cmdStr)
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
|
|
int nCmdActive;
|
|
TGGetVar(_T("CMDACTIVE"), &nCmdActive);
|
|
if (nCmdActive == 1)
|
|
{
|
|
if (_tcsicmp(cmdStr, _T("QUIT")) == 0 || _tcsicmp(cmdStr, _T("END")) == 0 ||
|
|
_tcsicmp(cmdStr, _T("OPEN")) == 0 || _tcsicmp(cmdStr, _T("NEW")) == 0 ||
|
|
_tcsicmp(cmdStr, _T("SHADE")) == 0 || _tcsicmp(cmdStr, _T("RENDER")) == 0 ||
|
|
_tcsicmp(cmdStr, _T("REDRAW")) == 0 ||
|
|
_tcsstr(cmdStr, _T("TCHSCALE"))|| _tcsstr(cmdStr, _T("UpdateAllLinkage")) ||
|
|
_tcsicmp(cmdStr, _T("UNDO")) == 0 || _tcsicmp(cmdStr, _T("REDO")) == 0 ||
|
|
_tcsicmp(cmdStr, _T("U")) == 0 ||
|
|
_tcsicmp(cmdStr, _T("CHPROPERTIES")) == 0 || _tcsicmp(cmdStr, _T("INSERT")) == 0 ||
|
|
_tcsicmp(cmdStr, _T("AUDIT")) == 0
|
|
)
|
|
{
|
|
if (_tcsicmp(cmdStr, _T("UNDO")) == 0 || _tcsicmp(cmdStr, _T("REDO")) == 0
|
|
|| _tcsicmp(cmdStr, _T("U")) == 0 )
|
|
{
|
|
}
|
|
}
|
|
else
|
|
{
|
|
EndUserCommand(cmdStr, TRUE);
|
|
}
|
|
|
|
DocSetIsAcadIdle(TRUE);
|
|
ClearKeyboardBuffer();
|
|
}
|
|
if (pData != NULL)
|
|
{
|
|
pData->m_sCurCommand[0] = 0;
|
|
|
|
bool bRefreshAll = _tcsicmp(cmdStr,_T("BCLOSE")) == 0 || _tcsicmp(cmdStr,_T("BEDIT")) == 0;
|
|
pData->UpdateExtend(bRefreshAll);
|
|
}
|
|
}
|
|
|
|
void TArchCmdReactor::sysVarChanged(const TCHAR * varName, Adesk::Boolean success)
|
|
{
|
|
if (_tcsicmp(varName, _T("CVPORT")) == 0 && success)
|
|
{
|
|
int tilemode = 0;
|
|
TGGetVar(_T("TILEMODE"), &tilemode);
|
|
if (tilemode == 0)
|
|
{
|
|
int cvport = 1;
|
|
TGGetVar(_T("CVPORT"), &cvport);
|
|
if (cvport>1)
|
|
{
|
|
double s = GetViewportPScale(cvport);
|
|
if (s>1.0E-3)
|
|
{
|
|
DocSetPScale(s);
|
|
}
|
|
}
|
|
DocStatus();
|
|
}
|
|
}
|
|
}
|
|
|
|
// 开始用户的命令, 包括ARX和ADS
|
|
void TArchCmdReactor::BeginUserCommand(const TCHAR *pszCmd, BOOL bIsArxCommand)
|
|
{
|
|
s_bLayerChanged = FALSE;
|
|
s_bUpdateMaterial = FALSE;
|
|
extern bool g_bIsWBlock;
|
|
if (pszCmd && _tcsicmp(pszCmd, _T("WBLOCK")) == 0)
|
|
{
|
|
g_bIsWBlock = true;
|
|
}
|
|
|
|
DocSetIsUpdateDisp(FALSE);
|
|
if (pszCmd)
|
|
{
|
|
//_tcscpy(g_szLastCommand, pszCmd);
|
|
if ( g_szLastCommand != NULL)
|
|
{
|
|
_tcscpy(g_szLastCommand, pszCmd);
|
|
}
|
|
}
|
|
|
|
ResetAll();
|
|
|
|
// 把当前选择集放入全局变量
|
|
if (pszCmd && _tcsicmp(pszCmd, _T("EDITCOMP")) == 0)
|
|
{
|
|
return; //部件编辑不处理预先选择集
|
|
}
|
|
|
|
g_ssPickFirst.Free();
|
|
resbuf *gset = NULL, *pset = NULL;
|
|
if (ads_ssgetfirst(&gset, &pset) == RTNORM)
|
|
{
|
|
if (gset)
|
|
{
|
|
if (gset->restype == RTPICKS)
|
|
{
|
|
TPickEntSet ss0(0);
|
|
ss0 = gset->resval.rlname;
|
|
g_ssPickFirst += ss0;
|
|
ss0.Free();
|
|
}
|
|
ads_relrb(gset);
|
|
}
|
|
if (pset)
|
|
{
|
|
if (pset->restype == RTPICKS)
|
|
{
|
|
TPickEntSet ss0(0);
|
|
ss0 = pset->resval.rlname;
|
|
g_ssPickFirst += ss0;
|
|
ss0.Free();
|
|
}
|
|
ads_relrb(pset);
|
|
}
|
|
}
|
|
if (!g_ssPickFirst || g_ssPickFirst.Length()<1)
|
|
{
|
|
if (!!g_entMouseOn)
|
|
{
|
|
g_ssPickFirst += g_entMouseOn;
|
|
}
|
|
}
|
|
if (!!g_entMouseOn)
|
|
{
|
|
acedRedraw(g_entMouseOn,4);
|
|
g_entMouseOn = TEntitySet();
|
|
}
|
|
|
|
TDbCamera::BegUserCommand(pszCmd, bIsArxCommand);
|
|
InitBlockInsertIds(FALSE);
|
|
|
|
if (pszCmd && _tcsicmp(pszCmd, _T("PLOT")) == 0 || _tcsicmp(pszCmd, _T("PREVIEW")) == 0)
|
|
{
|
|
|
|
PrePlot();
|
|
}
|
|
}
|
|
|
|
// 结束用户的命令, 包括ARX和ADS
|
|
void TArchCmdReactor::EndUserCommand(const TCHAR *szCmd, BOOL bIsArxCommand)
|
|
{
|
|
extern bool g_bIsWBlock;
|
|
extern int g_nEndCmdFlag;
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
|
|
TPushMemVar<BOOL> vMonitor(g_bMonitorDbAction, FALSE);
|
|
g_bIsWBlock = false;
|
|
g_ssPickFirst.Free();
|
|
TCString sCmdNames(256);
|
|
if (szCmd)
|
|
{
|
|
sCmdNames = szCmd;
|
|
|
|
if (pData != NULL)
|
|
{
|
|
pData->m_sCurCommand = szCmd;
|
|
}
|
|
}
|
|
|
|
//add by w on 060110
|
|
CString sTemp(sCmdNames);
|
|
sTemp.MakeUpper();
|
|
bool bPaste = sTemp.Find(_T("PASTECLIP")) >= 0;
|
|
bool bCopy = sTemp.Find(_T("COPY")) >= 0;
|
|
if (bPaste)
|
|
{
|
|
extern void UpdateFrom6();
|
|
UpdateFrom6();
|
|
}
|
|
|
|
if (_tcsicmp(sCmdNames, _T("INSERT")) != 0 &&
|
|
_tcsicmp(sCmdNames, _T("QSAVE")) != 0 &&
|
|
_tcsicmp(sCmdNames, _T("SAVE")) != 0 &&
|
|
_tcsicmp(sCmdNames, _T("SAVEAS")) != 0 &&
|
|
_tcsicmp(sCmdNames, _T("PLOT")) != 0 &&
|
|
_tcsicmp(sCmdNames, _T("PREVIEW")) != 0 &&
|
|
_tcsicmp(sCmdNames, _T("WBLOCK")) != 0 &&
|
|
g_bDwgBegin&&pData != NULL)
|
|
{ //制止对INSERT命令进行处理
|
|
BOOL bSpeedUp = FALSE;
|
|
|
|
if (pData->IsTooManyChanged())
|
|
{
|
|
bool bTotalChange = _tcsicmp(sCmdNames, _T("MOVE")) == 0 || _tcsicmp(sCmdNames, _T("ROTATE")) == 0;
|
|
if (!bTotalChange)
|
|
{
|
|
bTotalChange = bPaste || bCopy;
|
|
}
|
|
|
|
if (bTotalChange)
|
|
{
|
|
bSpeedUp = TRUE;
|
|
}
|
|
}
|
|
|
|
BeginModelRecordZone(); //add by xlc on 100531 提速优化
|
|
if (!bSpeedUp)
|
|
{
|
|
pData->UpdateCorners();
|
|
}
|
|
else
|
|
{
|
|
pData->UpdateCorners(true); //add by xlc on 100531 提速优化
|
|
|
|
AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
|
|
if (pDb != NULL)
|
|
{
|
|
AcDbBlockTable *pBlockTable = NULL;
|
|
pDb->getSymbolTable(pBlockTable, AcDb::kForRead);
|
|
if (pBlockTable != NULL)
|
|
{
|
|
AcDbBlockTableRecord*pBlock = NULL;
|
|
int cvport = 0;
|
|
int tilemode;
|
|
TGGetVar(_T("TILEMODE"), &tilemode);
|
|
TGGetVar(_T("CVPORT"), &cvport);
|
|
if ((tilemode == 0 && cvport == 1))
|
|
{
|
|
pBlockTable->getAt(ACDB_PAPER_SPACE,pBlock,AcDb::kForRead);
|
|
}
|
|
else
|
|
{
|
|
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlock,AcDb::kForRead);
|
|
}
|
|
//add by xlc on 100531 提速优化
|
|
AcDbExtents ext;
|
|
bool bHasExt = false;
|
|
typedef CMap<long,long,AcDbExtents,AcDbExtents> CMapLongToExtents;
|
|
if (pData->m_mapIdToCorner.Lookup(pBlock->objectId().asOldId(),ext))
|
|
{
|
|
bHasExt = true;
|
|
}
|
|
|
|
if (pBlock != NULL)
|
|
{
|
|
AcDbBlockTableRecordIterator *pEntIter = NULL;
|
|
pBlock->newIterator(pEntIter);
|
|
if (pEntIter != NULL)
|
|
{
|
|
bool bGetGeomExt = false;
|
|
int nFoundAt = 0;
|
|
AcDbExtents ext2;
|
|
TADSGePoint3d ptExtMin,ptExtMax;
|
|
for (pEntIter->start();!pEntIter->done();pEntIter->step())
|
|
{
|
|
AcDbEntity *pEnt = NULL;
|
|
pEntIter->getEntity(pEnt,AcDb::kForRead);
|
|
if (pEnt != NULL)
|
|
{
|
|
//add by xlc on 100531 提速优化
|
|
TEntityBase* pEntBase = TEntityBase::Cast(pEnt);
|
|
if (pEntBase == NULL)
|
|
{
|
|
pEnt->close();
|
|
continue;
|
|
}
|
|
|
|
//如果已经修改的实体,则不用重复更新图形 lfy 2010-6-9
|
|
if (pData->ObjModifiedIn(pEnt->objectId()))
|
|
{
|
|
if (pEnt->upgradeOpen() == Acad::eOk)
|
|
{
|
|
pEnt->assertWriteEnabled();
|
|
pEnt->recordGraphicsModified();
|
|
}
|
|
pEnt->close();
|
|
continue;
|
|
}
|
|
|
|
bGetGeomExt = false;
|
|
if ( GetGeomExtentsInRecordZone(pEnt->objectId(),ext2))
|
|
{
|
|
bGetGeomExt = true;
|
|
}
|
|
else
|
|
{
|
|
bGetGeomExt = pEnt->getGeomExtents(ext2) == Acad::eOk ? true : false;
|
|
}
|
|
|
|
//if (pEnt->getGeomExtents(ext2) == Acad::eOk)
|
|
if (bGetGeomExt)
|
|
{
|
|
ptExtMin = ext2.minPoint(); ptExtMax = ext2.maxPoint();
|
|
ptExtMin.z = ptExtMax.z = 0;
|
|
if (ext.maxPoint().x<ptExtMin.x || ext.maxPoint().y<ptExtMin.y ||
|
|
ext.minPoint().x>ptExtMax.x || ext.minPoint().y>ptExtMax.y)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
if (bHasExt)
|
|
{
|
|
if (pEnt->upgradeOpen() == Acad::eOk)
|
|
{
|
|
pEnt->assertWriteEnabled();
|
|
pEnt->recordGraphicsModified();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pEnt->close();
|
|
}
|
|
}
|
|
|
|
delete pEntIter;
|
|
}
|
|
|
|
pBlock->close();
|
|
}
|
|
|
|
pBlockTable->close();
|
|
}
|
|
}
|
|
}
|
|
|
|
pData->UpdateWalls();
|
|
pData->UpdateOpenings();
|
|
pData->UpdateRegion();
|
|
|
|
if (!bSpeedUp)
|
|
{
|
|
pData->UpdateClip();
|
|
}
|
|
EndModelRecordZone();
|
|
}
|
|
|
|
#ifdef TASD
|
|
//处理结构对象
|
|
EndUserCommandStru(szCmd, bIsArxCommand);
|
|
#endif
|
|
|
|
ResetAll();
|
|
|
|
if (szCmd && _tcsstr(szCmd, _T("TEDITOBJ")))
|
|
{
|
|
;//对象编辑不释放, 留给构件件编辑
|
|
}
|
|
else
|
|
{
|
|
g_ssPickFirst.Free();
|
|
}
|
|
|
|
if (!!g_idViewportLayer)
|
|
{
|
|
OPENOBJ_BEGIN(g_idViewportLayer, AcDb::kForWrite, AcDbLayerTableRecord, pLayer);
|
|
if (pLayer && pLayer->isPlottable())
|
|
{
|
|
pLayer->setIsPlottable(false);
|
|
}
|
|
OPENOBJ_END();
|
|
g_idViewportLayer = AcDbObjectId::kNull;
|
|
}
|
|
|
|
// sg add 100126,增加楼层框图层
|
|
if (!!g_idFloorRectLayer)
|
|
{
|
|
OPENOBJ_BEGIN(g_idFloorRectLayer, AcDb::kForWrite, AcDbLayerTableRecord, pLayer);
|
|
if (pLayer && pLayer->isPlottable())
|
|
{
|
|
pLayer->setIsPlottable(false);
|
|
}
|
|
OPENOBJ_END();
|
|
g_idFloorRectLayer = AcDbObjectId::kNull;
|
|
}
|
|
|
|
DocSetIsUpdateDisp(FALSE);
|
|
TDbCamera::EndUserCommand(szCmd, bIsArxCommand);
|
|
InitBlockInsertIds(TRUE);
|
|
if (szCmd && _tcsicmp(szCmd, _T("PLOT")) == 0 || _tcsicmp(szCmd, _T("PREVIEW")) == 0)
|
|
{
|
|
PostPlot();
|
|
}
|
|
|
|
if (g_nEndCmdFlag == 1)
|
|
{
|
|
TchGeLib::adsout << _T("\n学习版处理规模有限,请购买正式版!");
|
|
}
|
|
else if (g_nEndCmdFlag == 2)
|
|
{
|
|
TchGeLib::adsout << _T("\n您的授权版本,日照程序规模受限制!");
|
|
}
|
|
else if (g_nEndCmdFlag == 3)
|
|
{
|
|
TchGeLib::adsout << _T("\n学习版,功能不可用!");
|
|
}
|
|
g_nEndCmdFlag = 0;
|
|
|
|
if (s_bLayerChanged)
|
|
{
|
|
::PostMessage(NULL, WM_TCH_LAYER_CHANGED, 0, 0);
|
|
}
|
|
if (s_bUpdateMaterial)
|
|
{
|
|
::PostMessage(NULL, WM_TCH_UPDATE_MATERIAL, 0, 0);
|
|
}
|
|
s_bLayerChanged = FALSE;
|
|
s_bUpdateMaterial = FALSE;
|
|
}
|
|
|
|
void TArchCmdReactor::pickfirstModified()
|
|
{
|
|
if (IsPaperSpace())
|
|
{
|
|
return;
|
|
}
|
|
//ASSERT(acDocManager->isApplicationContext()); why assert fails?
|
|
TCString sCmdName;
|
|
int nCmdActive = 0;
|
|
TGGetVar(_T("CMDNAMES"), sCmdName);
|
|
TGGetVar(_T("CMDACTIVE"), &nCmdActive);
|
|
if ( _tcsicmp(sCmdName, _T("ARRAY")) == 0 ||
|
|
_tcsicmp(sCmdName, _T("TARRAY-ARRAY")) == 0) //这个命令受影响,取消检测
|
|
{
|
|
return;
|
|
}
|
|
|
|
TPickEntSet &ssGrip = DocGetPickGrip();
|
|
TPickEntSet ssTemp(SS_FREE);
|
|
ssTemp += ssGrip;
|
|
|
|
// add "ATS_SECTIONPATHSIGN" by gjm
|
|
TRBList mask(RTDXF0, _T("ATS_SPACE,ATS_SECTIONPATHSIGN,ATS_STRU_FLOORSLAB,ATS_DRAWINGNAME"), NULL);
|
|
|
|
ssTemp.BaseFilter(mask); //上次加亮的房间
|
|
|
|
ssGrip.Free(); //加亮纪录复位
|
|
TPickEntSet ss(SS_FREE); //本次加亮的全部对象
|
|
if (ss.Get(_T("I")) == RTNORM)
|
|
{
|
|
ssGrip += ss; //保存加亮纪录
|
|
ss.BaseFilter(mask); //只留下本次加亮房间
|
|
TPickEntSet ssInc(SS_FREE), ssDec(SS_FREE);
|
|
ssInc += ss;
|
|
ssInc -= ssTemp; //获得新增加加亮的房间
|
|
ssDec += ssTemp;
|
|
ssDec -= ss; //获得取消加亮的房间
|
|
|
|
TDocAutoLock vLock;
|
|
long lCount = ssInc.Length();
|
|
for (long i = 0L; i< lCount; i++)
|
|
{
|
|
TEntitySet ent = ssInc[i];
|
|
// add by gjm for entity of the section_path
|
|
if (1 == lCount)
|
|
{
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbSectionPathSign, pEnt);
|
|
if (pEnt)
|
|
pEnt->SetShowSide(true);
|
|
OPENOBJ_END();
|
|
}
|
|
// end
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbSpace, pEnt);
|
|
if (pEnt)
|
|
{
|
|
pEnt->SetHighlight(TRUE);
|
|
}
|
|
OPENOBJ_END();
|
|
// add by hh 2013-10-15 选中时高亮图名标注的区域
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbDrawingName, pDraw);
|
|
if (pDraw)
|
|
{
|
|
pDraw->SetShowRegion(TRUE);
|
|
}
|
|
OPENOBJ_END();
|
|
// add end
|
|
}
|
|
|
|
lCount = ssDec.Length();
|
|
for (i = 0L; i < lCount; i++)
|
|
{
|
|
TEntitySet ent = ssDec[i];
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbSpace, pEnt);
|
|
if (pEnt)
|
|
{
|
|
pEnt->SetHighlight(FALSE);
|
|
}
|
|
OPENOBJ_END();
|
|
// add by hh 2013-10-15 选中时高亮图名标注的区域
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbDrawingName, pDraw);
|
|
if (pDraw)
|
|
{
|
|
pDraw->SetShowRegion(FALSE);
|
|
}
|
|
OPENOBJ_END();
|
|
// add end
|
|
}
|
|
}
|
|
else
|
|
{ //房间全部消除加亮,不需要加锁
|
|
TDocAutoLock vLock;
|
|
long lCount = ssTemp.Length();
|
|
for (long i = 0L; i < lCount; i++)
|
|
{
|
|
TEntitySet ent = ssTemp[i];
|
|
// add by gjm for entity of the section_path
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbSectionPathSign, pEnt);
|
|
if (pEnt)
|
|
pEnt->SetShowSide(false);
|
|
OPENOBJ_END();
|
|
// end
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbSpace, pEnt);
|
|
if (pEnt)
|
|
{
|
|
pEnt->SetHighlight(FALSE);
|
|
}
|
|
OPENOBJ_END();
|
|
// add by hh 2013-10-15 选中时高亮图名标注的区域
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbDrawingName, pDraw);
|
|
if (pDraw)
|
|
{
|
|
pDraw->SetShowRegion(FALSE);
|
|
}
|
|
OPENOBJ_END();
|
|
// add end
|
|
}
|
|
}
|
|
DocStatus();
|
|
}
|
|
|
|
extern AcDbObjectId WblockCloneObjects(AcDbObjectId idOldBlock,AcDbDatabase *pDb);
|
|
void TArchCmdReactor::endWblock( AcDbDatabase* pTo )
|
|
{
|
|
AcEditorReactor::endWblock(pTo);
|
|
// 执行wblock命令时无法自动将TDbPsConfig存在新数据库中
|
|
// 通过以下函数实现此操作,以保证线宽填充等设置有效在新数据
|
|
// 库中仍然有效 wlw 2014.12.11 add
|
|
TDbConfig *pCloneConfig = NULL;
|
|
Acad::ErrorStatus es;
|
|
AcDbDictionary* pRootDict = NULL;
|
|
es = pTo->getNamedObjectsDictionary(pRootDict,AcDb::kForRead);
|
|
if (es != Acad::eOk)
|
|
{
|
|
return;
|
|
}
|
|
|
|
AcDbObjectId idExist;
|
|
AcDbObject* pObj = NULL;
|
|
es = pRootDict->getAt(_T("ATS_DBCONFIG"), pObj, AcDb::kForRead);
|
|
|
|
if (es == Acad::eOk)
|
|
{
|
|
pObj->close();
|
|
pRootDict->close();
|
|
return;
|
|
}
|
|
else //当前数据库未初始化全局变量
|
|
{
|
|
if (pRootDict->upgradeOpen() == Acad::eOk)
|
|
{
|
|
pRootDict->assertWriteEnabled();
|
|
|
|
TDbConfig *pConfig = GetDwgGlobal(AcDb::kForRead);
|
|
if (pConfig != NULL)
|
|
{
|
|
//将当前文档的dbconfig clone到wblock新dwg中
|
|
pCloneConfig = (TDbConfig*)pConfig->clone();
|
|
pConfig->close();
|
|
|
|
|
|
pCloneConfig->SetHatchDividerId(AcDbObjectId::kNull);
|
|
pCloneConfig->SetHatchFillId(AcDbObjectId::kNull);
|
|
pCloneConfig->SetHatchFill1Id(AcDbObjectId::kNull);
|
|
pCloneConfig->SetHatchFill2Id(AcDbObjectId::kNull);
|
|
|
|
//add by xlc on 091102 解决线图案填充不导出的问题
|
|
if(pConfig->IsDividerLineHatch())
|
|
{
|
|
pCloneConfig->SetHatchDividerId(WblockCloneObjects(pConfig->GetHatchDividerId(),pTo));
|
|
}
|
|
if(pConfig->IsFillLineHatch())
|
|
{
|
|
pCloneConfig->SetHatchFillId(WblockCloneObjects(pConfig->GetHatchFillId(),pTo));
|
|
}
|
|
if(pConfig->IsFill1LineHatch())
|
|
{
|
|
pCloneConfig->SetHatchFill1Id(WblockCloneObjects(pConfig->GetHatchFill1Id(),pTo));
|
|
}
|
|
if(pConfig->IsFill2LineHatch())
|
|
{
|
|
pCloneConfig->SetHatchFill2Id(WblockCloneObjects(pConfig->GetHatchFill2Id(),pTo));
|
|
}
|
|
|
|
pCloneConfig->SetHatchBrickId(AcDbObjectId::kNull);
|
|
pCloneConfig->SetHatchRocketId(AcDbObjectId::kNull);
|
|
pCloneConfig->SetHatchConcreteId(AcDbObjectId::kNull);
|
|
pCloneConfig->SetHatchSteelId(AcDbObjectId::kNull);
|
|
pCloneConfig->SetLinetypeDote(GetLinetypeIdFromString(_T("DOTE"),pTo));
|
|
pCloneConfig->SetLinetypeDash(GetLinetypeIdFromString(_T("DASH"),pTo));
|
|
|
|
AcDbObjectId idConfig;
|
|
es = pRootDict->setAt(_T("ATS_DBCONFIG"),pCloneConfig,idConfig);
|
|
if (es == Acad::eOk)
|
|
{
|
|
pCloneConfig->close();
|
|
}
|
|
else
|
|
{
|
|
delete pCloneConfig;
|
|
}
|
|
}
|
|
pRootDict->downgradeOpen();
|
|
pRootDict->close();
|
|
}
|
|
}
|
|
}
|
|
|
|
// 修墙角
|
|
void TArchCmdReactor::UpdateCorners()
|
|
{
|
|
TArchPerDocData *pData = GetCurDocData();
|
|
|
|
TPushMemVar<BOOL> vMonitor(g_bMonitorDbAction, FALSE);
|
|
|
|
pData->UpdateCorners();
|
|
pData->UpdateClip();
|
|
}
|
|
|
|
// 确定门窗的配属关系(对刚刚被修改的门窗)
|
|
void TArchCmdReactor::UpdateOpenings()
|
|
{
|
|
TPushMemVar<BOOL> vMonitor(g_bMonitorDbAction, FALSE);
|
|
GetCurDocData()->UpdateOpenings();
|
|
}
|
|
// 确定门窗的配属关系(对刚刚被修改的墙体)
|
|
void TArchCmdReactor::UpdateWalls()
|
|
{
|
|
TPushMemVar<BOOL> vMonitor(g_bMonitorDbAction, FALSE);
|
|
GetCurDocData()->UpdateWalls();
|
|
}
|
|
void TArchCmdReactor::UpdateClip()
|
|
{
|
|
TPushMemVar<BOOL> vMonitor(g_bMonitorDbAction, FALSE);
|
|
GetCurDocData()->UpdateClip();
|
|
}
|
|
void TArchCmdReactor::UpdateRegion()
|
|
{
|
|
TPushMemVar<BOOL> vMonitor(g_bMonitorDbAction, FALSE);
|
|
GetCurDocData()->UpdateRegion();
|
|
}*/ |